Skip to content

[PR] feat: default autoRestartOnUpdate on for host-spawned lane proxies - #2597

Closed
ranxianglei wants to merge 6 commits into
masterfrom
2026-10-10_lane-autorestart-default
Closed

ranxianglei wants to merge 6 commits into
masterfrom
2026-10-10_lane-autorestart-default

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Closes #2507

What

Host-spawned resident proxies — every dsh/opencode/pi/omp/kimi/zcode/claude plugin lane and bili <client> launcher lane — now self-restart by default once an auto-update lands on disk. Manual bili start keeps the old opt-in default.

Why

Resident hosts never restart, so on-disk updates never activated: the proxy kept running the old code indefinitely (the only trace was a warn-once log line). The safety-gated self-restart machinery already existed (#811, #414 group-kill, #1724 pre-spawn flush, #2095 win32 spawn) but was OFF by default everywhere — a dead end for resident lanes.

Behavior change (disclosure)

  • Old: autoRestartOnUpdate default OFF everywhere when env and file are both unset.
  • New: env unset + no explicit file value → ON when BILI_LAUNCHER_LANE is set (every lane-spawned proxy child), OFF for manual bili start.
  • Explicit values always win, unchanged: "autoRestartOnUpdate": false / ACP_AUTO_RESTART_ON_UPDATE=0 disables anywhere; true / =1 enables anywhere including manual start.
  • Also covers critical-advisory installs: the same handler is wired into the advisory watcher (src/cli.ts:630), so those now activate on lanes too.
  • Residual limitation (documented in README): the host-side glue (dist/agent/*.js loaded into the host process memory) still needs a host restart; the kernel is bundled inline into the proxy bundle, so re-exec covers all compression/kernel code.

config surface

  • No new fields, env vars, or CLI flags. Only change: the conditional DEFAULT of the existing autoRestartOnUpdate knob when nothing is set explicitly.
  • Why the existing surface could not express this: the flag exists but its OFF default gave resident lanes no activation path at all; making the default lane-aware reuses BILI_LAUNCHER_LANE, which every lane spawn already stamps (src/launcher.ts:4078) — no new signal needed.
  • Considered alternatives: global default ON (broader blast radius on manual daemons — rejected); keep OFF + stronger nagging (does not solve activation).
  • Migration: none required. Users who want the old behavior on lanes set "autoRestartOnUpdate": false in config or ACP_AUTO_RESTART_ON_UPDATE=0.

How

  • New resolveAutoRestartOnUpdate(env, fileValue) in src/config.ts: explicit env > explicit file value > lane-aware default. Wired into loadOptions, the single resolution point used by both the update watcher and the advisory watcher.
  • Regression test tests/issue2507-lane-autorestart-default.test.ts: resolution matrix (lane/manual × env/file interactions), end-to-end through loadOptions, and config-file authority including garbage-value fallthrough to the lane default.
  • Docs synced en+zh: CONFIGURATION.md / CONFIGURATION.zh-CN.md (options table row, §autoRestartOnUpdate section, env map), README.md / README.zh-CN.md self-update paragraph.
  • Companion string fix (separate labeled commit): stale-notice tail (src/agent/shared.ts), web i18n sys.stale_manual (zh+en), CLI help line — all pointed at the CLI flag as the only way to enable; now reference the config key.

Verification

  • Rebased onto current master (8e7bb12); one union conflict in fetchStaleNotice (master's commit-suffix interpolation from fix(#2490): plan output budgets against the refused dsh raw ledger; fail fast doomed evidence probes #2577 + this PR's wording) resolved as union of intent.
  • npm run typecheck clean; targeted suites green on the rebased head: issue2507-lane-autorestart-default + auto-restart + fix-config-session = 37/37, opencode-acp-command = 10/10; ccr-plugin + issue1815 + issue1733 = 22/22 verified pre-rebase. Full suite left to CI.
  • Hermetic lane e2e added (tests/e2e/e2e-lane-autorestart.test.ts, gate ACP_TEST_REGISTRY=1, shares the test: 自带本地 npm registry 的 hermetic 测试基建——解锁自更新/钉版本/解析全链路 e2e #1153 fixture infra): real dist build against local verdaccio — lane proxy (BILI_LAUNCHER_LANE=dsh) defaults ON, update lands on disk and the process self-restarts onto the same port serving the new version with no stale state; manual start defaults OFF, update lands but the process keeps serving the old code (stale=true). Both scenarios green locally.
  • npm run build OK (dist-import-annotations OK).

Human merge required (§7.4: default-value change stays human-gated).

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-10_lane-autorestart-default (34d1ac9)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2806-pr.2597.02b656b

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-pr2597.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] 🏷 PR #2597 审查完成(结构化八问):

① 是什么问题:常驻宿主(dsh/opencode/pi/omp/kimi/zcode/claude 及各 bili <client> launcher lane)永不重启,自动更新把新版本装到磁盘后代理仍无限期跑旧代码——self-restart 机制本身存在(#811/#414/#1724/#2095),但默认全 OFF,常驻 lane 没有任何激活路径。

② 什么原因导致的:根因是默认值,不是缺机制。autoRestartOnUpdate 的 OFF 默认不区分「宿主拉起」与「手动 bili start」,于是常驻代理只能靠用户手工改配置才能激活更新——修在决策点(loadOptions 的默认值解析),不是症状层打补丁。

③ 影响范围与严重程度:变更前所有宿主拉起的 lane 代理更新后都不激活,需人工重启;属功能失效(自动更新实际止步于「装盘」),无数据丢失/安全风险。手动 bili start 用户不受影响(默认保持 OFF)。

④ 怎么修复的:默认值改为 lane-aware——新增 resolveAutoRestartOnUpdate(env, fileValue)(src/config.ts):显式 env > 显式 file > BILI_LAUNCHER_LANE 存在 ? ON : OFF,接入 loadOptions 单一决议点(update watcher 与 advisory watcher 共用)。复用每条 spawn 路径已盖章的 lane 标记(src/launcher.ts:3976),零新信号;显式值永远优先,config false / env =0 在任何位置都能退回旧行为(README 已注明逃生口)。

⑤ 是否有回归问题:逐项审过既有行为——优先级语义不变(env>file>default);手动启动默认仍 OFF;重启机制本体未动;空白 lane 值→OFF(nonEmpty trim);env "yes"/"" 与 #811 原语义一致(e !== "0");既有测试全部显式传值、不受默认变更影响。审查中发现并已在分支上修掉两处:(a) docs-sync CI 红——本 PR 手改了生成块而不是改种子文件 website/config-reference/updates.yaml,重新生成即漂移;已回写种子+重新生成(cbc8630c6,生成器幂等性用 checksum 双跑验证);(b) README.md:400 flag 注释 (default off) 过时且与 cli help 不一致(1d108bd40)。两个独立标注 commit 已 fast-forward push(f869791ec..1d108bd),新 head 上 docs-sync 已转绿。

⑥ 是否破坏缓存:不涉及——未触碰 session/prefix-cache/重试/游标逻辑。

⑦ 是否改了设计方向:无架构转向;仅既有 knob 的条件默认值变化(PR 描述已按规范披露旧值→新值+原因),方案 A 是 #2507 里 owner 预先拍板的。

⑧ 是否引入了新的配置:无新字段/env/flag;复用既有 autoRestartOnUpdate + ACP_AUTO_RESTART_ON_UPDATE + BILI_LAUNCHER_LANE。

本地验证:typecheck clean;定向四套件 47/47(issue2507-lane-autorestart-default + auto-restart + fix-config-session + opencode-acp-command);全量回归交给 CI。当前 CI:已完成的全部 job 绿(含全部 real-client e2e lane、kernel-guard、pi-subagents-guard、lane-guard、build-artifact、docs-sync、docs-coverage),test 矩阵与 registry e2e 仍在跑。

判定:审查发现的两处问题均已修复推送,待剩余 CI job 转绿即可合并。按 §7.4 默认值变更保持 human-gated —— 请 @ranxianglei CI 全绿后手动合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 跟进(分支新增内容审查完毕,CI 全绿):

并行会话向本 PR 分支追加了一个 commit:a4dd4b37f test: hermetic lane-aware auto-restart e2e over the real update chain (#2507) —— 新增 tests/e2e/e2e-lane-autorestart.test.ts(+241 行)。我按测试有效性标准审了并本地实跑:

发现并已修一处缺口(独立标注 commit 34d1ac901):.github/workflows/ci-registry.yml 的 E2E 命令只列了 e2e-registry + e2e-advisory-rollback,新测试没被 CI 执行(等于没有兜底),artifact 收集 glob 也漏了它的 tmp 目录。已把 tests/e2e/e2e-lane-autorestart.test.ts 加进命令、tmp/e2e-lane-autorestart-* 加进 artifact glob 并推送。

最终状态(head 34d1ac901):CI 25/25 全绿(含全部 real-client e2e lane、kernel-guard、pi-subagents-guard、lane-guard、docs-sync、docs-coverage、build-artifact、双平台 registry e2e),PR mergeable=true / mergeable_state=clean。分支现共 5 个 commit(原 2 + 文档种子修复 cbc8630 + README 小修 1d108bd + 并行会话 e2e a4dd4b3 + CI 接线 34d1ac9)。

判定:审查发现的问题全部修复且经 CI 验证,无回归项。可合并——按 §7.4 默认值变更保持 human-gated,请 @ranxianglei 手动合并 #2597 。

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

陈旧票清理(第三批动作①):目标 issue #2507 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。

@ranxianglei ranxianglei changed the title feat: default autoRestartOnUpdate on for host-spawned lane proxies [PR] feat: default autoRestartOnUpdate on for host-spawned lane proxies Oct 24, 2026
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.

支持常驻模式自动更新重启

1 participant