Repository navigation
[PR] pi inline compression is enabled by default (bare pi runs the in-process engine directly; one-click revert available) | pi 内联压缩默认开启(裸 pi 直接跑进程内引擎,可一键退回) - #5491
Conversation
planNativePi used to fall through to 'spawn' — bare pi with the extension installed spawned its own proxy (dist/index.js start, ephemeral port, parent-pid watchdog). Inline was opt-in only since #4687 reverted the #4571 flip. This restores the #4571 posture with explicit escape hatches: kill-switch > /bili/ launch > explicit inline (BILI_PI_INLINE=1/ on/yes/TRUE or "pi":{"inline":true}) > ANNOUNCED attach target (launcher-set BILLION_CONTEXT_PROXY/ATTACH — bili pi keeps its launcher proxy) > inline DEFAULT > spawn (explicit opt-out only) Opt-out restores the old attach/spawn posture verbatim: BILI_PI_INLINE=0/false/no/off or "pi":{"inline":false}. Blank BILI_PI_INLINE="" folds to unset. opencode's lane stays opt-in. bili pi-inline stays (NOT deprecated): it scrubs inherited BILLION_CONTEXT_PROXY/BILI_MITM_HOSTS so a stale attach env can't hijack the child, and preflights extension availability — with no proxy there is no wire-mode fallback, so a missing extension would otherwise silently run uncompressed. Supersedes the #4687 owner decision for the pi lane.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8061-pr.5491.063d114This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5491.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Human surface for the inline default: nobody types BILI_PI_INLINE=0.
bili -i pi == bili pi-inline (forced inline: env scrub + extension
preflight + BILI_PI_INLINE=1 preset, no proxy spawned)
bili -s pi proxy posture pinned: child gets BILI_PI_INLINE=0 so an
inherited/ambient inline env can't flip it while the
launcher proxy runs
Flags must PRECEDE the client name (everything after the client token
is forwarded verbatim — bili pi -i stays pi's own flag). opencode maps
the same way (-i -> opencode-inline, -s -> BILI_OPENCODE_INLINE=0).
Misuse exits 2 with a pointed message: other lanes, -s on the inline
lane, -i+-s together, or a posture without a client.
config-surface-guard holds every CLI flag to the same rule as config keys: no literal --inline/--server in README/CONFIGURATION → red. The yaml seeds (and thus the generated CONFIGURATION tables) now spell the long forms out.
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复——本条即 PR #5491 的镜像(单提交 55c1b5e);检索 open/closed issue 与 PR 无同向「pi 内联默认」在途工作,#4571/#4687 为已关闭历史项(一键车道引入 / 默认翻转收回),正是本次翻转的背景。 状态:定位到上游 PR #5491(branch 2026-11-02_pi-inline-default @ 55c1b5e,单提交,9 文件 ±101 行)。全 diff 已通读:
两个发现:
验证进行中:本地定向测试(tests/pi-native.test.ts / tests/pi-inline-ws.test.ts)+ typecheck,CI 以远程结果为准。结构化结论随后跟进。 |
…view nit)
The regenerated BILI_PI_INLINE entries rendered the opt-out config as
"pi": {"inline": false"} — a stray closing quote inside the JSON
fragment. Fix the seed (env-only.yaml desc_en/desc_zh) and regenerate
CONFIGURATION.md / CONFIGURATION.zh-CN.md.
The misuse test asserted exit code 2 but its per-case message regexes were never matched against anything (assert.ok(re) is always true). Capture console.error and assert.match each case's actual message.
…review) parseArgs records the -s pin in overrides, but the launch path skips the generic env merge the start/update lanes use, so BILI_PI_INLINE=0 never reached the child: with an ambient BILI_PI_INLINE=1 (shell export, alias, or a nested bili session), 'bili -s pi' still flipped onto the inline lane and the launcher proxy idled — the exact case the flag documents defeating. applyPosturePins mirrors the env merge for the two posture keys in runLaunch/runTestPi; a regression test pins the parse-to-env delivery.
(ai: vllm-qwen/qwen3.8-27b) PR #5491 审核完成——分支上补了三个 commit(最新 head 25a5db7),本地定向验证全绿。 审核做了什么
合并前需要你拍板的两件事
结构化八问
判定:代码侧可合(本地定向验证全绿:cli-parseargs 11/11、pi-native 19/19、pi-inline-ws 4/4、launcher-pi-inline 2/2,typecheck 干净);全套件以远程 CI 为准,正在最新 head 上跑,结果出来我跟进一句。请先处理上面两件事。 |
Summary line still said spawn (DEFAULT); after the #5428 flip the default is inline and spawn only via explicit opt-out.
…review) End-to-end complement to the unit-level parse-to-env test: runLaunch with an ambient BILI_PI_INLINE=1 must deliver the -s pin (overrides BILI_PI_INLINE="0") into the ACTUAL child env through stripInheritedProxy/buildPiEnv; control case proves an unpinned launch still inherits the ambient value.
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE — 方向、实现、测试均通过;review 中发现 4 处问题已全部在分支上顺手修掉(见下)。
方向关:按 owner 决策 2026-11-02 把 pi 车道恢复为内联默认(复原 #4571/#4669 姿态,废止 #4687 的 opt-in 规则)。历史核对:#3278 引入 inline lane → #4571 曾默认开启 → #4687 按当时「不改默认值」规则回退 opt-in → 本次 owner 明确重新拍板。方向成立,这是产品姿态决策,不是症状级修补。
回归审查(既有行为清单):
bili pilauncher 姿态(launcher 经 BILLION_CONTEXT_PROXY 宣告 attach):保持 —— attach 仍压过新默认(决策梯顺序未动,既有测试钉住);- 显式开(
BILI_PI_INLINE=1/on/yes/TRUE 或 config"pi":{"inline":true}):保持; - 显式关(env 0/false/no/off 或 config false):保持,truth table 双向行齐全;
- kill switches(
BILLION_CONTEXT_PLUGIN=0/BILI_NATIVE_PI=0/BILI_PROVIDER_REWRITES):保持,仍是最高优先; - opencode 车道:
-i/-s可用但默认不变(仍 opt-in):保持; - 有意变更(披露,旧值→新值):无任何 env/file/announce 的裸 pi —— 旧:spawn 自己的代理进程 → 新:进程内 inline 引擎直接压缩;空/垃圾
BILLION_CONTEXT_PROXY的兜底从 spawn 改为 inline(yaml 描述与 CHANGELOG 均已写明)。回退路径三条(bili -s pi、BILI_PI_INLINE=0、config false)均有文档+测试。
Review 发现(全部已处置):
bili -s pi的 pin 到不了子进程 env(真缺陷):cli.ts 把 -s pin 记进 overrides,但 launch 路径跳过 start/update 用的通用 env merge,而stripInheritedProxy不碰BILI_PI_INLINE——用户若 export 了BILI_PI_INLINE=1,bili -s pi照样翻进 inline 车道、launcher 代理闲置(我用捕获子进程 env 的 harness 实测确认)。修复:applyPosturePins在 runLaunch/runTestPi 镜像该 env merge(commit25a5db739——另一位 reviewer 并发发现并先推上分支,我独立复现后核对其修法等价且覆盖面更广[含 runTestPi],采纳其版本);我另补了端到端回归测试钉死 parse→子进程 env 全链路(含对照组)。- misuse 测试的正则从未被断言(
assert.ok(re)恒真,等于没测消息)→ 捕获 console.error 逐条 assert.match(commit6065f3eee,并发发现,与我写的修法等价,已核对)。 - 文档 JSON 片段缺右引号
{"inline": false"}→ 修 yaml 源并重新生成两份 md(commit9dd6576ff,与我的修复字节一致)。 planNativePidocstring 优先级行陈旧(仍写spawn (DEFAULT),翻转后默认已是 inline)→ 改为inline (DEFAULT since #5428) > spawn。
已顺手修:planNativePi docstring 优先级行与翻转后语义不符 + commit 25f908d
已顺手补:-s pin 端到端回归测试(parse→stripInheritedProxy→buildPiEnv→真实子进程 env,含「无 -s 时继承值保留」对照组)+ commit 8cfb94f
测试有效性:planNativePi truth table 为新默认补齐双向行(显式关/env-off 压过 file-true/垃圾 attach 兜底等);misuse 用例现在真断言消息;launcher e2e 钉住 -s pin 投递。新行为两个方向都有牙,回归时抓得住。
结构化八问:
- 是什么问题:产品姿态调整——裸 pi 默认改走进程内 inline 压缩(不再自起代理进程),并给人类入口
-i/-s。 - 什么原因导致的:默认值历史反复(#4571 默认开 → #4687 回退 opt-in),本次 owner 明确重新拍板恢复默认开。
- 影响范围与严重程度:所有无配置裸跑 pi 的用户——模型流量路径从「pi→独立 bili 代理进程→上游」变为「pi 进程内引擎」;codex Responses WS 桥失败时该通道降级直连(打 warn),HTTP 压缩不受影响。无数据丢失面,回退路径完整且已测。
- 怎么修复的:在
planNativePi决策梯加一档「默认 inline」(仅当 env+file 均未设置时落到),配 CLI 姿态 flag 与文档同步;不动既有各档的顺序与语义。 - 是否有回归问题:无——逐项清点见上(attach/explicit-inline/off/kill-switch/opencode 全部保持);高危模式逐条过:无语义漂移(只新增一档,不挪既有档序)、无 fail-fast 变吞错、无阈值/时序/输出格式变化。
- 是否破坏缓存:否——前缀缓存/cache ref 逻辑零触碰;inline 车道的缓存行为与其此前默认开启期(#4571 时代)一致。
- 是否改了设计方向:无架构转向——inline 机制本身是既有的(#3278),只移动默认档位;单写者安装契约不受影响。
- 是否引入新配置:无新 env/config key——只是既有
BILI_PI_INLINE/pi.inline的 unset 语义从 spawn 变为 inline(显式值语义不变);-i/-s是 CLI flag,非配置项。
CI:前头 4d94ce6 全量套件绿;我追加的两个 commit 零 src 改动(docstring + 测试文件),本地定向套件 383/383 全绿 + typecheck 干净;8cfb94f8d 上静态门禁/guard 均已绿,其余分片在队列中排队(failed=0,无失败)。
结论:可合,待 CI 队列排空转全绿即可由人合并。
PR #5491 review 完成:判定可合(APPROVE,自审限制下以 review comment 提交,https://github.com/ranxianglei/billion-context/pull/5491#pullrequestreview-5729959597);发现 4 处问题全部在分支上修掉—— |
|
解决冲突 重新review |
…esolution) Conflicts resolved (both sides kept): - CHANGELOG.md: pi-inline default-on entry (#5428) + watermark fastpath GA entry (#5403/#5418) - tests/cli-parseargs.test.ts: #5428/#5491 posture-flag tests + #5606 informational-flag tests - CONFIGURATION.md / CONFIGURATION.zh-CN.md: regenerated from merged yaml seeds via tools/gen-config-docs.mjs (keeps BILI_PERSONA_SPLIT row + new pi.inline default row)
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决并推送,PR 恢复可合并。七问摘要: 1. 是什么问题:PR #5491(pi 内联压缩默认开启 + 2. 什么原因导致的:两侧在相同文件的相同区域独立新增内容(典型并行开发文本冲突),不是逻辑矛盾——#5606 管「信息旗标何时生效」,本 PR 管「-i/-s 姿态旗标」,互不否定。 3. 影响范围与严重程度:只有合并状态被卡(dirty 不可合并);两侧改动都是纯增量,无数据/语义损坏风险。 4. 怎么修复的:选 merge(不 rebase)——保留分支上 8 个原始提交的作者与历史,推送是普通前推、无需 force-push。4 个冲突文件全部按「两侧都保留」解:
忠实度证明: 5. 是否有回归问题:本地 6. 缓存/CI 现状:已推送 7. 剩余事项与待决策:① 全量 CI 结果等远程把关;② 关于「重新 review」:本次合并本身未改变 PR 的任何语义(第 4 点的 diff 一致性证明),master 162 个提交与本 PR 的交互面已由定向测试覆盖——正式八问 review 请按新 head |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1027-master.1b7a661 # this exact build
npm install -g billion-context@master # always the newest merged build
|
改什么
装了 bili 扩展的裸
pi(什么都不设)现在直接跑进程内引擎压缩,不再自己派生代理进程。恢复 #4571 的姿态,#4687 的「只许手动开启」规则对 pi lane 作废(主人 2026-11-02 拍板)。人类入口(短旗标,必须放在子命令名前面)
bili pi -i仍是 pi 自己的参数)bili -i opencode/bili -s opencode-s pi-inline(它本来就是内联)、-i+-s同给、旗标没跟客户端新优先级
关键设计:宣告的附着目标仍压过默认内联——
bili pi是先起 launcher 代理再拉起 pi 的,它必须继续用那个代理,这次翻转对bili pi完全无感;受影响的只有「裸 pi + 插件」这一种启动方式。不想用内联怎么退回(三选一)
bili -s pi(给人用的)BILI_PI_INLINE=0(或 false/no/off;给脚本用的)"pi": { "inline": false }BILLION_CONTEXT_PLUGIN=0/BILI_NATIVE_PI=0bili pi-inline保留但不再是一等入口bili -i pi就是它的旗标写法,两者完全等价。它还有三件默认翻转替代不了的活:清继承的BILLION_CONTEXT_PROXY(防止残留附着变量劫持子进程)、预检扩展(没有 wire 兜底时当场报错而不是静默裸跑)、给脚本/别名一个确定语义。测试与文档
-i pi→pi-inline 映射、-s pi→BILI_PI_INLINE=0 预置、六种误用全部退出 2;{}→ inline)、空白值折叠、垃圾附着值回落到内联、显式退出逐条钉死;