Uh oh!
There was an error while loading. Please reload this page.
feat(cli): reconcile externally replaced npm Runtime Hosts - #4069
feat(cli): reconcile externally replaced npm Runtime Hosts#4069me2seeks wants to merge 6 commits into
Conversation
me2seeks
commented
Aug 28, 2026
Post-implementation dual audit — GOFirst-principles correctness
Simplification / deletion proof
Validation at 中文审计结论结论:GO。实现仍只有一份 owner/handoff/lease authority。旧版本通过其自身 helper 兼容不同 epoch,新版本通过共享 activator 等待精确 Ready 后才提交;用户确认后的 Host 若已经换了 epoch,不会被误关闭。活跃工作会回滚,退休开始后的故障保留 handoff 供恢复。实现还删除了重新联网下载旧版本的路径,直接验证持久化的精确旧包;没有新增 scheduler、journal、lock 或第二份恢复状态。远程与托管 Host 仍由各自 operator 更新。 |
fdc4364 to
4b3368eCompareme2seeks
commented
Aug 28, 2026
Maintainer findings independently confirmed and fixed at
Regression coverage includes an injected authority read failure followed by exact committed ownership (release, never retire), readable uncommitted handoff retirement, uncertain coordinator commit settlement, and Desktop-to-CLI owner mismatch with no staging or Host observation. Validation: CLI build; focused 42/42; full CLI 617/617; release policy 15/15; scoped Biome and diff-check. 中文修复说明两条结论均确认属实并已修复。父进程不再发送 committed/abort 裁决,只触发结算;activator 统一读取 durable record 决定 release 或 retire,读取不确定时继续持有 barrier/lease。外部 npm reconciliation 明确只支持同一 durable npm-global owner;跨 owner 在任何 registry、stage、store 或 Host 操作前返回 typed 拒绝。 |
4b3368e to
e288ae4Compareme2seeks
commented
Aug 30, 2026
Maintainer P1 independently confirmed and fixed at The authority lease previously supervised Candidate lifetime only; it did not fence Runtime Host admission. A Ready target could therefore accept ordinary TUI/Desktop work before the durable owner commit, and a later finalization failure could retire that target underneath newly admitted work. The fix makes pre-commit admission part of the existing launch-owner guard:
This adds no protocol field or compatibility epoch and no second durable state. Remote and service Hosts are unaffected because the gate exists only on the inherited local launch-owner path. Real-process regressions now prove both sides of the boundary: a second ordinary Client is rejected during the finalization window and the Candidate exits safely when its launch owner is lost; after release, an ordinary Client connects and executes After rebasing onto current 中文修复说明已确认该 P1。旧实现只用 launch-owner lease 约束候选进程寿命,没有限制 Host 接入,所以 durable commit 前普通 TUI/Desktop 可能取得工作,随后 finalization 失败会把正在工作的 target 直接退休。 现在候选在 lease 持有期间只允许 activator 的一次性 Client 身份完成握手;其他本地、Desktop、WebSocket 或 peer Client 都得到 真实进程测试覆盖了 commit 前第二客户端被拒绝且 finalization 失败可安全关闭,以及 commit/release 后普通客户端能够连接并对精确 PID 执行诊断。rebase 后完整 Runtime Host、CLI、构建、Biome、diff 与 merge-tree 门禁均通过;双重审查结论 GO。 |
e288ae4 to
631a0bfCompareme2seeks
commented
Aug 30, 2026
CI failure independently diagnosed and repaired at The failed I rebased onto current
Exact-head validation: renderer architecture 62/62; Runtime Host 1434 pass / 12 skip; CLI 659/659; dependency-ordered builds; focused launcher-loss and updater-admission integrations 3/3; focused reconciliation set 34/34; scoped Biome, diff-check, and current-main merge tree all pass. Final simplification and first-principles audits remain GO. |
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for consolidating installed-update target release/retirement behind the durable owner record and the shared activator. I reviewed exact head 631a0bf4727d8aeb006c958f3fecdba9cb85bef5; the exact target, owner, epoch, active-work, and pre-commit admission guards are strong. I left one P1 recovery-path suggestion inline. The required test is green, while the installed-CLI Windows validation currently fails and should be rerun or resolved after revision. Please do push back if there is an external supervisor/deadline around this child that I missed.
中文摘要
谢谢把更新目标的 release/retire 决策收敛到 durable owner record。当前主要问题是 record 永久损坏或持续 I/O 失败时,activator 会无限重试,父更新流程、barrier 与 authority lease 都无法退出;建议区分永久/暂时错误并提供有界、可观察的恢复结果。若外层已有我未追到的 supervisor/deadline,欢迎 push back。
AI-assisted review disclosure: Codex ran an independent analysis lane; Astro-Han independently verified the exact head, production path, and severity, and owns this review.
Uh oh!
There was an error while loading. Please reload this page.
631a0bf to
f323d1dCompare
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for tightening the durable-owner recovery and distinguishing permanent record corruption from transient I/O. One part of the earlier bounded-recovery concern still remains at the in-flight read boundary. This is a suggestion from an outside review, so please feel free to push back if the authority reader has a stronger completion guarantee.
AI-assisted review disclosure: Codex ran independent runtime-owner and recovery/test analysis lanes; Astro-Han is the contributor of record for this review.
| let record: Awaited<ReturnType<typeof input.readRecord>>; | ||
| for (;;) { | ||
| try { | ||
| record = await input.readRecord(input.expectedRootId); |
There was a problem hiding this comment.
[P1] (category ② — reasonable recovery path)
Thanks for adding the 10-second settlement deadline. The deadline is only checked after readRecord() rejects, so a single authority read that hangs indefinitely never reaches the timeout branch. In the normal external npm replacement recovery path, the old Host is already retired and the candidate remains behind the launch barrier while the parent awaits the activator’s closed promise without its own bound, leaving the Runtime Host unavailable until the hidden process is terminated manually. Could the parent own a hard activator-settlement deadline and terminate/wait for the child so its lease and launch-owner guard converge? A regression with readRecord: () => new Promise(() => {}) would cover the remaining boundary; a child-only Promise.race may still leave an uncancelled fs request keeping the process alive. Please push back if every production authority read is itself guaranteed to settle within this deadline.
Summary
The installed npm slot is already changed in this flow, so this PR does not run npm, add an update scheduler, or introduce another owner, journal, or lock. Cross-owner transfer, remote Hosts, and managed service Hosts remain under their respective owner/operator paths.
Safety invariants
Validation
npm run build --prefix packages/cligit diff --checkRefs #3243
Refs #3231
中文说明
本 PR 处理同一 durable npm-global installation owner 已被用户通过 npm 外部替换、但旧 Runtime Host 仍在运行的情况。不同 owner 的转移不属于本切片,会在解析 registry、stage 或观察 Host 前 typed 拒绝。
新 CLI 不直接假装兼容旧 Host,而是从持久化部署中启动旧版本自己的 retirement helper;旧版本负责按自己的协议安全退休旧 Host,新版本再通过共享 activator 启动并验证精确目标。父 coordinator 的成功、失败或断线都不再决定 target 的关闭与保留;activator 统一读取 durable owner record 后裁决。读取不确定时保留 barrier 与 authority lease,读到 exact committed 才 release,否则才 retire。
不在本 PR 范围内:跨 owner transfer、远程 Host、systemd 等托管 Host、npx 临时运行语义、自动检查周期与 TUI 文案。