Skip to content

fix(#2260): v0.1.186 review follow-ups — dsh spawn leak, inert resign keys named at config load, codex arg/TOML fixes, web pristine root, misc - #2263

Merged
ranxianglei merged 10 commits into
masterfrom
2026-10-06_2260-review-followups
Oct 6, 2026
Merged

ranxianglei merged 10 commits into
masterfrom
2026-10-06_2260-review-followups

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Scope

Working the consolidated tracker #2260 (merged review follow-ups #2252–#2257 of the v0.1.186 review of #2249). One commit per item, each labeled.

Closes #2260 — with one caveat: B-2 (shape-detection false-positive surface) is awaiting owner ruling on whether the widened detection surface is intentional; if yes it becomes a small docs-only follow-up, if no it needs a narrowing direction. Reopen or re-trigger for that remainder if needed.

Items

Commit Item Change
9cc1d79 C-2 package-lock.json: record kernel 0.0.104 (three kernel commits bumped without lock regen) and drop the stray ../kernel-review (acp-kernel 0.0.42) entry leaked from a sibling-checkout install
35fa165 A (#2187 regression) health-timeout in ensureProxyRunning now hard-kills the spawned child (SIGKILL group + process, win32 skips the group kill) BEFORE throwing, with a visible log line. Previously the child stayed alive: in the dsh plugin lane the parent never exits so the BILI_PARENT_PID self-watch never fires, and plan-time retries respawned ~every 70s → hung node children accumulate forever, each also laddering the lane sticky port +1
c927495 C-1 src/server.ts:902: middle segment of the [resign] startup banner used double quotes, printing ${displayHost}:${actualPort} literally — now interpolates like its neighbors
883ed06 D (#2197 regression) buildCodexArgs inserts the appended -c key=value transport rewrites BEFORE the first user -- separator instead of after it. With a non-leading -- (e.g. bili codex exec -- "-p") the rewrites used to become positionals → traffic silently bypassed the proxy + dirty prompt. No -- in user args: byte-identical argv as before
32111de E codexTomlProblem now parses the key side with a real TOML key pattern (bare / basic string w/ escapes / literal string, dotted mix) and tracks bracket depth across lines: quoted keys with spaces/non-ASCII ("my key" = 1, "ключ" = 2) and multi-line arrays/inline tables no longer trigger the fatal process.exit(2) on VALID profiles; genuinely unclosed structures are now detected (previously passed silently)
15fb12c B-1 (#2090 upgrade impact) config-load warning names dead keys: any resign["<non-builtin-scheme>"].passthrough=true whose guard cascade resolves enabled gets ONE [acp-config] warn per distinct dead-key set (signature-based dedup, #1815 style), stating the key is inert since the #2090 compress-or-refuse contract and pointing at the working alternatives (resign["<scheme>"].enabled=false, BILI_RESIGN=0). Log-only; no behavior change. Scans both the root resign map and every providers[*].resign map
1482e1b B docs CONFIGURATION.md en+zh: the jsonc example's non-builtin passthrough line is annotated (inert until bili ships its re-signer — named once at config load) and the inert-passthrough paragraph gains the v0.1.186 warning sentence. The shape-detection suffix rule itself was already documented (en :499 / zh :499)
6502206 B release notes release-notes/package.json: v0.1.186 entry, tier critical (user-actionable breaking change → CRITICAL UPDATE READY surfaces): unsigned pass-through is builtin-scheme-only since #2090, other signature schemes refused until bili ships its re-signer, inert keys named at config load; + the #2187 spawn-leak fix. ≤400 chars, bilingual, newest-first
cd2dc97 F-1 opencodeCacheCopyRoot spec-slot selection was lexicographic (@0.1.9 beat @0.1.186); now numeric-segment compare when both sides parse as dotted versions, string fallback otherwise (so latest keeps its prior relative position). Display/inspect-lane only
55e0fbc F-2 web sessions pristine-root check: a data root holding ONLY bili's own infra dirs (ca/, created by ensureRootCA() at every proxy start) — or none at all — is pristine, so a fresh install's first /__bili/sessions load returns empty data instead of HTTP 500. Foreign content under the data root stays loud (#1937 intent preserved)
b53c56e F-4 tests/issue2187-dsh-spawn-retry.test.ts: withEnv now seals BILI_PROVIDER_REWRITES / BILI_MITM_HOSTS / NODE_EXTRA_CA_CERTS — ambient leakage flipped planNativeDsh to mode "off" and made the suite's timeouts test nothing
ae239ee F-5 resolveClientCommand antigravity + mcode branches used process.platform directly despite the injectable platform param (codex branch already used it) — win32 layouts were unreachable from tests. Both now honor the param; real-host behavior identical (default = process.platform)
e4827d6 F-3 test pinning the documented PI_ACP_DELEGATE_* > pi.subagents > acp.json > default precedence through the REAL chain (bili file loader → adapter mapper → bundled billion-context-pi-subagents@0.1.1 resolveDelegate). Verification result: the docs are CORRECT — env is consulted first per-field inside the bundled resolver even when pi.subagents is set, so no doc change was needed; the reviewer's "env may be silently ignored" suspicion does not hold for @0.1.1, and this test makes sure it stays that way

Recorded-for-reference NITs deliberately NOT touched (separate mechanism families): fold-reconcile METADATA_DRIFT_ESCALATED ordering, rediscoverAfterChildExit spin on foreign squatters, pi session_start tool re-registration.

Behavior changes (old → new)

  • A: spawn health-timeout abandoned the child (live, untracked) → now SIGKILL'd before the throw + one stderr log line. Only the timeout path changed; error/exit paths untouched.
  • D: codex argv with a non-leading --: rewrites moved from AFTER -- (positionals, proxy bypass) to BEFORE -- (effective). Without --: unchanged.
  • E: valid TOML profiles with quoted keys / multi-line value structures: launch refused with exit 2 → launch proceeds. Newly fatal: unclosed array/inline table (was silently accepted).
  • F-2: fresh-install web first load: HTTP 500 until first persisted session → empty list immediately. Data roots with foreign content: still loud (unchanged).
  • B-1: new startup log line for dead passthrough keys (log-only).
  • C-1: banner shows the real URL instead of literal ${displayHost}:${actualPort}.
  • F-1 / F-5: display-order / testability only; no wire, persistence, or config-schema change anywhere in this PR.

Config surface

No new config fields, env vars, or CLI flags. B-1 warns about EXISTING keys (resign[<scheme>].passthrough, .enabled, BILI_RESIGN); the PI_ACP_DELEGATE_* test pins existing documented behavior. Nothing to migrate.

Testing

Targeted suites run green locally (full regression is CI's job): launcher (+win-cmd-argv) 305 pass/5 platform-skips incl. new buildCodexArgs placement + platform-param cases; issue2187-launcher-slow-start 5/5 (new kill-on-timeout assertion); codex-profile-effective 16/16 (quoted-key + multi-line corpus, unclosed-structure negatives); issue2260-inert-resign-passthrough + issue1815 8/8; plugin-update 8/8 (version-ordered slots); web-sessions 17/17 (ca/-only pristine + foreign-content-stays-loud); issue2187-dsh-spawn-retry 2/2; pi-subagents-wiring 16/16 (new precedence pin); npm run typecheck clean.

Pre-release note for #2249

C-1, C-2, B-1 (+its test) and the release-notes entry are the "before release" items from #2260: they should reach the 2026-10-06_release-v0.1.186 branch before #2249 merges (cherry-pick of c927495, 9cc1d79, 15fb12c, 6502206, optionally 1482e1b) — flagged here rather than pushed to the release branch unilaterally.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-06_2260-review-followups (8e6e31e)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2347-pr.2263.c77c332

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr2263.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review 完成(13 个原始 commit + 2 个 review 修复 commit,18 文件)。每项都对着实际 diff 逐条核对,本地跑了定向测试(tsc clean;launcher/codex-profile-effective/web-sessions/plugin-update/issue2260/issue2187×2/pi-subagents-wiring 共 345 pass / 0 fail)。review 中发现两个小问题,已按「小问题直接修」在分支上直接修掉(见第 4 问)。

结构化七问

  1. 是什么问题:本 PR 是 v0.1.186([v0.1.186 review] 汇总:#2187 子进程累积 / #2090 升级影响 / 发布小修 / codex×2 / 杂项(合并自 #2252–#2257) #2260)review 的 follow-up——dsh spawn 泄漏、失效 resign key 静默、codex argv/TOML 解析、web pristine-root 判定等 10 项。本次审查对象是这些修复本身是否成立、是否引入回归。

  2. 什么原因导致的(各项根因):

    • A:ensureProxyRunning 超时路径抛错前不 kill 自己 spawn 的 child → dsh plan 重试反复 respawn,node 子进程堆积、sticky port ladder 爬升;
    • D:-c transport rewrite 追加在用户非 leading -- 之后变成位置参数 → 绕过 proxy + prompt 污染;
    • E:TOML 键侧用裸标识符正则,带引号键("my key" = 1、非 ASCII)被误判为坏文件 fatal exit(2);反向地未闭合 array/inline table 反而静默放过;
    • B-1:resign 保护漏识别 dsh-our-free-model 的 x-ofm-signature,其 EAC 请求被改写后 401(建议:未知签名 scheme 默认直送) #2090 后非 builtin scheme 的 passthrough key 失效,但 config load 零信号 → 用户以为生效实际没有;
    • C-1:banner 中段误用双引号而非模板字符串,${...} 字面打印;C-2:package-lock kernel 版本记录漂移 + stray ../kernel-review 条目;F-1:版本槽位字典序比较(@0.1.9 > @0.1.186);F-2:ensureRootCA() 自建 ca/ 目录被当作用户数据 → 全新安装 web sessions 页 500;F-3/F-4/F-5:测试缺口(precedence 未走真链 pin / env 泄漏 / platform param 未透传)。
  3. 怎么修复的:A 在 throw 前 SIGKILL 进程组(win32 负 pid 不支持,改按 pid kill)+ 可见日志;D 把 rewrite 插到第一个 -- 之前(无 -- 时 argv 字节不变);E 键侧按真实 TOML 键文法解析(bare/basic/literal string、点号混合)+ 跨行括号深度跟踪,EOF 时新增报未闭合结构;B-1 config load 时对每个失效 key 集合输出一次性 [acp-config] warn(签名去重)指向替代写法;其余为单点修复。方案均打在根因上,无治标。

  4. 是否有回归问题:触碰路径的既有行为逐项清点过——

    • A:仅 timeout 路径变更;childError/childExit 路径 child 本就已死,行为不变;
    • D:用户无 -- 时 argv 与旧版字节一致;有 -- 时仅位置前移,last-wins 顺序([Bug][Codex 0.160] -p profile 供应商未参与路由发现,bili codex 正常回答但请求绕过代理 #2197)保持;
    • E:「有效 TOML 通过」契约首次真正成立;检测面严格扩大(未闭合结构从静默通过变为报告)——属已披露的新行为,且与 checker 契约一致(codex 对这类文件同样 hard-fail);残留 nit:a . b = 1(点号两侧空格,合法 TOML)仍被拒——修复前同样被拒,非回归,未动;
    • B-1/C-1/C-2/F-1/F-5:日志/展示/lockfile 级,无运行时行为变化;
    • F-2:pristine 判定从「无目录」扩为「仅含 bili 基建目录(ca/)」——全新安装 web 首载 500→空列表(已披露),foreign content 仍 loud(管理页面全量加载历史会话时触发堆 OOM:需要有界分页、摘要统计与详情懒加载 #1937 意图不变);数据目录写入面核实过是封闭集(sessions + ca,logs 在 stateDir)。
    • 未发现无意回归。
    • review 中顺手修掉的两个小问题(独立标注 commit):
      • 168a2747b:1482e1b73 把 CONFIGURATION.md en 的 jsonc 示例整体缩进漂了一格(与 zh 镜像不一致)→ 恢复原缩进,保留新注释行;
      • 1a9f7920b:ae239ee9f 新增的 F-5 测试里两条 default-platform 断言是 host-dependent 的——Windows runner 上 process.platform 即 win32,且 os.homedir() 读 USERPROFILE 而非测试设置的 HOME,antigravity/mcode 期望值双双落空。e4827d625 的 Windows CI(node 22+24)正是这唯一一条失败(4427 tests / 1 fail),ubuntu 全绿。改为显式 "win32"/"linux" platform 参数钉住两种布局 + 像兄弟测试一样 seal USERPROFILE,本地 launcher.test.ts 277 pass / 0 fail 验证过。
  5. 是否破坏缓存:不涉及。所有 diff 不触碰消息重建、session 持久化、prefix cache 或压缩状态。

  6. 是否改了设计方向:不涉及。无架构/边界/数据流变化。

  7. 是否引入了新的配置:无新字段/env/CLI flag。B-1 只对既有 key 发警告;F-3 的 PI_ACP_DELEGATE_* 是 pin 既有行为。config surface 零变化。

其余备注

结论:方向与实现均成立,无回归、无缓存影响、无新配置面。CI 转绿后可合(合并操作请你执行)。

ework-agent added 10 commits October 6, 2026 19:20
…abandoning it

A of #2260 (review follow-up to #2187): ensureProxyRunning's timeout path threw while the detached child was still alive; only the starting marker was cleared. In the dsh plugin lane the spawner is a long-lived desktop host, so BILI_PARENT_PID self-watch never fires and every failed bring-up leaked one node process; plan-time retries re-arm every 10s (dsh-native maybeRetry), turning one persistently slow host into ~1 zombie per ~70s, each also stranding the lane sticky-port ladder.

Fix at the producer: killAbandonedChild() SIGKILLs the group + child on every platform before the timeout throw (stopProxy is deliberately not reused — its win32 early-return assumes the spawner exits ≤2s later). The victim never became healthy, so it served no traffic and holds no sessions; stale instance records stay inert via the dead-pid checks. Regression test pins exactly one SIGKILL on the never-healthy path.
D of #2260 (#2197 regression): cli.ts only eats a LEADING -- right after the client name, so in e.g. `bili codex exec -- "-p"` a non-leading -- reaches buildCodexArgs inside extra. The rewrites were appended after it — past a -- everything is positional to codex's parser, so the -c pairs became prompt text and the traffic silently bypassed the proxy. Insert at the first -- instead; all user flag tokens still precede the rewrites, keeping #2197 last-wins intact. Two regression tests pin the placement and the cross--- last-wins invariant.
…ulti-line values

E of #2260: the key-side regex only accepted \w runs inside quotes, so valid quoted keys with spaces or non-ASCII ("my key" = 1, "ключ" = 2) false-positived as structurally broken and bili refused the whole launch (exit 2) where codex 0.147 parses the profile fine. Replace with TOML-correct key parts (bare / basic string with escapes / literal string, dotted in any mix) evaluated on the scanner-extracted key side.

Same mechanism, second facet found while fixing: bracket-opened values spanning lines (arrays, inline tables) also false-positived, violating the checker's own contract ('valid TOML must pass silently'). Add a quote/comment-aware line scanner tracking array depth so continuation bodies are treated as value context, and report an unclosed array/table at EOF.
…view nit)

The inert-passthrough annotation re-indented the whole resign example one
space deeper than its enclosing braces and than the zh mirror. Cosmetic
only — no content change.
…s CI)

The two default-platform assertions in the new test resolved through the
real host: on a Windows runner process.platform is win32, so
resolveClientCommand took the %LOCALAPPDATA% layout and os.homedir() read
USERPROFILE (not the HOME the test set), failing both antigravity and
(once reached) mcode expectations. Windows CI runs of e4827d6 show
exactly this single failure (4427 tests, 1 fail) on both node versions.

Pin both layouts with explicit platform args ("win32"/"linux") and seal
USERPROFILE like the sibling tests, so the test holds on every host.
@ranxianglei
ranxianglei force-pushed the 2026-10-06_2260-review-followups branch from 1a9f792 to 8e6e31e Compare October 6, 2026 11:21
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 冲突已解决,rebase 完成并推送。

发生了什么:master 前进到 5db1e105c——#2249(release v0.1.186)合并了。该 release 分支按 #2260 线程里的预发布计划 cherry-pick 了本 PR 的 5 个条目(C-1 banner、C-2 lockfile、B-1 inert-keys+测试、B docs、release-notes 条目)+ 版本号 bump,与本 PR 分支上的原始提交内容相同但 SHA 不同 → 重放时文本冲突。这是预发布流程的预期结果,不是代码错误。

七问(针对本次冲突处理):

  1. 是什么问题:PR 与 base 分支 dirty——release v0.1.186 #2249 合并后,同一批变更以两个 SHA 分别存在于 master 和本分支。
  2. 什么原因导致的:预发布 cherry-pick 计划落地([v0.1.186 review] 汇总:#2187 子进程累积 / #2090 升级影响 / 发布小修 / codex×2 / 杂项(合并自 #2252–#2257) #2260 线程明确标记过这 5 个条目要在 release v0.1.186 #2249 合并前进 release 分支),两侧各持一份同内容提交。
  3. 怎么修复的:git rebase origin/master。git 按 patch-id 自动识别出 5 个已应用提交并跳过(与 release 侧 cherry-pick 逐字节一致),其余 10 个提交(A/D/E/F-1~F-5 + 两个 review 修复)无冲突重放。零手工冲突解决。新 tip 8e6e31e2c,已 --force-with-lease 推送(feature 分支)。
  4. 是否有回归问题:纯 rebase,无语义变化。rebase 后头已验证:typecheck clean + 定向套件 341 pass / 0 fail / 1 skip。并逐项核对最终 diff vs 新 master:仅剩 12 个文件(A/D/E/F 系列源码+测试+CONFIGURATION.md 缩进修正),不含 package.json 版本行(保持 release 的 0.1.186)、不含 release-notes/(保持 release 侧含 ec292beaf 更新的正式条目)、不含 src/server.ts(C-1 已在 master)。无重复、无降级。
  5. 是否破坏缓存:不涉及——rebase 本身不触碰缓存/持久化/会话逻辑;保留 diff 的各路径缓存行为维持原 review 结论(均不受影响)。
  6. 是否改了设计方向:不涉及。附带效果:PR 范围相应收窄——原 13+2 提交中 5 个已随 v0.1.186 发布,预发布 cherry-pick 提醒对这 5 项作废;剩余工作即 A/D/E/F 全部。B-2(shape-detection 误报面)仍等 owner 裁决。
  7. 是否引入新的配置:不涉及。

CI 正在对新 head 8e6e31e2c 全量重跑(上一轮唯一红项 Windows test matrix 的失败已由最后一个提交修复)。绿了我再报最终结论。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 CI 全绿,冲突处理闭环。

  • 新 head 8e6e31e2c(rebase 到 5db1e105c = v0.1.186 发布后的 master):22/22 check-runs success,含上一轮唯一红项的 Windows test matrix(22/24,失败已由最后一个提交修复)。
  • PR 状态:mergeable=true,mergeable_state=clean,base 已对齐当前 master。
  • 本地复核(rebase 后头):typecheck clean + 定向套件 341 pass / 0 fail / 1 skip。

最终判定:可合并(合并由人执行)。完整 review 结论见上一条(逐提交审查 + 回归审计 + 七问);本次 rebase 本身零语义变化,保留 diff 即 A/D/E/F 全部工作。遗留事项仅 B-2(shape-detection 误报面)等 owner 裁决,不阻塞本 PR。

@ranxianglei
ranxianglei merged commit dcf6ec4 into master Oct 6, 2026
22 checks passed
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.77-master.dcf6ec4 (rolling master tag).

npm install -g billion-context@0.0.77-master.dcf6ec4  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

@ranxianglei
ranxianglei deleted the 2026-10-06_2260-review-followups branch October 15, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v0.1.186 review] 汇总:#2187 子进程累积 / #2090 升级影响 / 发布小修 / codex×2 / 杂项(合并自 #2252–#2257)

1 participant