Repository navigation
[PR] fix: refuse session adoption while a live peer instance is writing it (#394) - #5717
ranxianglei wants to merge 10 commits into
Conversation
…#394) Two live bili instances sharing one sessions dir can end up writing the SAME session: an anonymous client whose history matches a pfa-* chain via prefix-affinity gets adopted by whichever instance receives the traffic, even when the original instance is still actively writing that chain. The sessions-row upsert is last-writer-wins and lane sessions are exempt from the completeLog sweep (#3248), so alternating writers accumulate each other's rows and diverge from every envelope — digest drift, drift latch, frozen envelope (#5624's five-then-refreeze loop on a 9-instance shared-dir fleet). served-markers.ts already detects exactly this state (#3923, split-brain contest alarm). This turns the same writer-marker evidence into refusals at the inference-driven adoption points, before any write happens: - prefix-affinity resolve() takes a refuseAdoption callback; a chain that PASSES a rung's match gates but is refused is skipped (remaining candidates compete; all-refused falls through to the fresh mint) and reported in refusedAdoption for the caller's log. - handle.ts wires the refuser from src/adoption-guard.ts (new) and logs the refusal naming the peer instance. - plugin.ts resolveForkConversation refuses disk adoption of a hot id (management calls write via withSessionLock) and the proxy-tool execution path answers 409 for a hot session — the last write-vector gate for sessions already resident in this process. Deliberate boundaries, pinned by tests: - Client-named ids (conversation headers) are NOT refused — interleaved turns on a client-chosen session across instances is the owner-ruled supported topology (multi-instance-live.test.ts); the contest alarm + freeze remain the containment there. - Liveness-scoped: after the peer exits (dispose-stamped marker, dead pid + stale file) its sessions are adoptable again — restart handoff (#4626) keeps working. - Unwired (no probe — inline engine carries no writer markers) reads as uncontested: adoption behaves exactly as before. - Residual, pinned by a test: a byte-identical replay re-mints the same deterministic pfa id, so refusal cannot rename that shape; the write path still lands on the contested session and the #3923 alarm stays the containment for it. Refs #5624
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9010-pr.5717.ed1d38aThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5717.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 检索了 open+closed 的 PR/issue(adoption / split-brain / writer-marker 相关):其余在途的 adoption 类 PR(#5126 / #5525 / #3024 / #4345 / #5511 等)全部是 fork adoption(分叉会话继承链)那条机制,与本 PR 的「前缀亲和接管被活实例写入的会话」不同机制、不同失败域;没有第二份把 #3923 写入者标记变成写前拒绝的在途工作。本 PR 是 #5716 的唯一实现(Fixes #5716)。 审核开工中:已取分支 |
(ai: vllm-qwen/qwen3.8-27b) CI 自动修复轮次 1/3:
|
(ai: vllm-qwen/qwen3.8-27b) 本轮处理:11 个红 test shard = 继承性 master 红,已并入 ci-fixes,等 CI 重跑。
|
Review follow-up on the fix for #5716: tests/hot-adoption-guard.test.ts pins the resolver-side refusal, but the two plugin-plane gates shipped alongside it had no direct coverage. Adds tests/hot-adoption-plugin-gates.test.ts: - proxy tool execution (read AND write tools) on a memory-resident session a live peer is writing answers 409 naming the peer; an uncontested session executes normally, - disk adoption in resolveForkConversation refuses a contested id with an honest 404 PARENT_NOT_FOUND while an uncontested disk id is adopted, - the deliberate asymmetry pinned: a memory-resident session stays snapshot-servable even while hot, because its writes are gated at the tool plane.
(ai: vllm-qwen/qwen3.8-27b) 🔶 需要决策 结论:上轮并入 ci-fixes 后 11 个 test shard 里 8 个转绿;剩余 3 红(ub22-3 / ub24-3 / win22-4)是本 PR 自身引入的回归——新的「热会话拒绝采纳」机制与钉死「重启交接必须可用」的既有回归钉冲突。修法触及 PR 核心机制语义,超出本车道「小机械修复」权限,未推送任何改动,已打 needs-decision 标签,停手等拍板。 决策项(选项 + 推荐 + 默认)
本轮七问
|
(ai: vllm-qwen/qwen3.8-27b) PR #5717 审核结论(独立审核,非复读 issue 结论) 方向关 ✅:修的是根因——匿名会话身份推断(prefix affinity)缺「对端是否还活着」这一维度。#3923 早已算出「谁在写哪条会话」的证据(writer markers),本 PR 把同一份证据从「事后告警」提升为「写前拒绝」,没有另造检测机制,没有新增配置面。机制选择正确:拒绝点放在三个真实写入向量上(affinity 接管、磁盘 fork 接管、工具执行),而不是在存储层做全局锁(那会误伤受支持的 client-named 多实例拓扑)。 回归审查 ✅(逐项过既有行为):
结构化八问
行为变更披露(强制项):旧行为——匿名请求命中活对端正在写的会话时静默接管并写入(损坏+drift+冻结循环);新行为——同条件下 warn 日志点名对端(id/pid/lane),匿名请求改铸新会话(无折叠继承,重发一轮),管理面得到显式 404/409。原因:把静默损坏变成响亮的可恢复分裂,代价(一轮重发)远小于损坏代价。client-named 会话、单实例、未接线引擎三类边界行为不变。确定性 id 残余(字节级重放重铸同一 id)已如实钉测试,落回 #3923 告警+冻结兜底。 测试有效性(④):PR 自带 12 例双向断言齐全、真 resolver+真 marker 文件(utimes 回溯)、去重断言锐利。发现一处覆盖缺口并当场补上:两个插件平面闸门(磁盘接管拒绝、工具执行 409)此前零直接测试——我补了 CI:推送头 判定:可合并(CI 绿后)。方向正确、机制扎实、边界钉死、审计未发现回归,唯一覆盖缺口已补齐。 |
…while a peer holds the session (#394) Independent review of this PR's head found two gaps in the plugin-plane refusal semantics: - handlePluginFork: an idempotent-retry POST landing here after the first attempt succeeded on a live peer fell through replay() (which finds no adopted session now that hot disk adoption is refused) into the create branch — re-creating the child and running recordPluginSession + flushSync(parent) over the peer's rows: the exact last-writer-wins damage the guard exists to stop. The create branch now refuses with 409 HELD_BY_PEER_INSTANCE naming the holder, checked AFTER replay(): replay is read-only-safe (the child's committed envelope), so retries keep succeeding while only the parent is hot. - handlePluginStatus: a refused hot adoption fell through to the fallback-latest branch and answered with a DIFFERENT session's state under the requested id (wrong-session misroute; red at tests/plugin-fork.test.ts:1001 on this PR's previous head). It now answers 409 HELD_BY_PEER_INSTANCE naming the holder. Liveness-scoped like every other refusal: graceful dispose or a crashed peer past the stale grace restores normal resolution.
…tes graceful predecessor exit tests/hot-adoption-guard.test.ts: - status GET while the peer holds the id answers 409 HELD_BY_PEER_INSTANCE naming the peer (not a fallback pick), and resolves this session again once the evidence is gone; - an idempotent replay of a completed fork succeeds while only the parent is peer-held (pins the gate placement: create-branch only). tests/plugin-fork.test.ts (cross-process restart, both storage modes): the predecessor process's writer marker still lists parent+child as actively served while it lives, so the stand-in's guard would refuse both ids as peer-held. The test now simulates the graceful SIGTERM handover (#4626): wait for the marker file to quiesce (a throttled flush <=5s can still land), stamp stoppedAt/disposedAt, then boot the stand-in. The lingering-predecessor refusals stay pinned in tests/hot-adoption-guard.test.ts instead.
…ose test seam (#394) The restart-handoff suites spawn a successor proxy while the predecessor process is still alive. Every session commit stamps the predecessor's writer marker, so without a graceful-stop record the #394 guard refuses the handoff as held by a live peer — red on CI at d472ed8: issue5140-cold-raw-tail-fork x3 plus plugin-fork cross-process x2. dispose() is the production graceful-stop primitive (clears the pending marker flush and writes the final stoppedAt/disposedAt marker), so the harnesses now call it through a new test-only export _disposeServedWriterForTest instead of sleeping for marker-file quiescence and hand-stamping files. Ordered after the final flush, mirroring finishShutdown. Test-only surface: zero behavior change on the production path.
…ate its 200 assertion requires (#394) A cold-adopted non-fork session serves its snapshot ONLY through the unified raw-tail reconstruction (#5140); legacy mode fail-closes with 409 SNAPSHOT_UNAVAILABLE by design (pinned in tests/issue5140-cold-raw-tail-fork.test.ts). The guard harness never set BILI_STORAGE_UNIFIED, so "uncontested disk adoption must still work" asserted a 200 from a substrate that cannot exist — red on every leg running the file since d472ed8. bootGuardHarness now takes the same explicit storage-mode parameter as the #5140 harness (env set before store construction, restored after close, same ordering). The disk-adoption subtest boots "shadow"; the resident-session subtests keep the legacy default unchanged.
(ai: vllm-qwen/qwen3.8-27b) CI 全绿:head d95d1fc,30/30 checks 通过(镜像缓存确认 sha=d95d1fc63edf…)。 本 lane 共两个 commit:
本轮诊断:失败断言在任何 peer marker 写入之前就挂了,与 guard 无关。机制链:非 fork 插件会话的 修法(仅测试,+9/-3): 八问:
判定:auto-fix lane 收工,PR 侧无剩余 CI blocker( |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
说明:本 PR 作者与审核凭据同属
ranxianglei账号,GitHub 禁止对本人 PR 提交正式 APPROVE 事件,故以 review-comment 形式承载结论——判定为可合(APPROVE)。
独立审核结论:APPROVE(可合)
对本 PR head d95d1fc63 做了独立复审(未照抄 issue 侧结论)。CI 全绿(读镜像缓存:30 checks = 14 success + 16 skipped,无失败;mergeable_state=blocked 仅因待审核)。不触碰 kernel/、无 kernel-change 声明、不动 version、不新增任何配置项——满足可批准边界。
结构化八问
- 是什么问题:多实例共用一个 sessions 目录时,第二个 bili 实例会把另一个还活着的实例正在写的同一条会话当自己的接管(匿名前缀亲和 / 插件管理面磁盘接管),sessions 行 upsert 是 last-writer-wins,两边交错写 → digest drift → 冻结循环。#3923 只检测告警不拒绝,本 PR 把同一份证据变成写前拒绝。
- 什么原因导致的:根因是「接管判定只看内容匹配、不问对端活性」——prefix-affinity 的三条 rung(prefix/append/simhash)与
resolveForkConversation的磁盘接管都无条件采纳匹配到的链/行。#3923 的 writer markers 本就能证明对端活性,但只接给了告警。 - 影响范围与严重程度:仅在「活对端 + 同一会话 + 10min contest 窗口内」触发;单实例、不同会话的多实例、客户端显式命名会话的模型流量交错(受支持拓扑)全部不受影响。窗口内阻断的是 p1 级双写覆盖损坏;窗口外零影响。
- 怎么修复的:复用
served-markers.findContestedWriters(活性作用域:pid 活或标记 30s 新鲜才算活;stoppedAt/disposedAt优雅退出直接排除;自身instanceId排除)做成一个可选 probe(src/adoption-guard.ts)。resolver 侧对每条通过匹配门槛的候选过一遍 refuser——被拒跳过、其余照常竞争、全拒落新铸;管理面在磁盘接管 / fork create / status / 工具执行四处加写前闸,命中回 404/409 并指名对端。未接线(inline 引擎无标记)一律读作无竞争,行为与从前逐字节一致。 - 是否有回归问题:逐项清点既有行为——
- 匿名前缀采纳:非竞争链照旧采纳(钉「uncontested adopts exactly as before」+「refuser declines changes nothing」双向)。保持
- 磁盘接管:非竞争照旧 200 采纳(钉死)。保持
- fork:非竞争照旧 201;幂等 replay 走只读路径不受影响(钉了 parent-held 时 replay 仍 200)。保持
- status fallback-latest:从「拿另一会话状态冒充请求 id」(错误路由)改为 409 指名对端——修 bug,非语义漂移。有意变更(已披露)
- 工具执行:非竞争照旧执行(钉死双向)。保持
- 客户端命名会话模型流量:不变(
multi-instance-live钉死,兜底仍是 #3923 告警+冻结)。保持 - 高危模式核查:无 fail-fast 变吞错(反而更 fail-closed);无新增阈值(
CONTEST_WINDOW_MS=10min /PEER_FILE_FRESH_MS=30s 均复用自 served-markers,非本 PR 引入);无既有响应形状变更(409HELD_BY_PEER_INSTANCE是新增分支);pf 水位快路径 / 增量车道不经过本 guard。无意回归:无。 - 诚实残余(已钉测试):纯字节级重放重铸出同一个确定性 pfa id,拒绝改不了名;该形态落回 #3923 告警+冻结,PR 日志明说。
- 是否破坏缓存:拒绝采纳会新铸会话(隔离对端状态),该会话在对端的前缀缓存不再共享——这是刻意的 split-brain 隔离而非缓存失效 bug;单实例/正常路由场景缓存路径逐字节不变。pf-* 握手头、增量信封均不经过本 guard。
- 是否改了设计方向:否。不引入新机制,把 #3923 已有的「检测」升级为「写前拒绝」,复用同一份 writer-marker 证据;设计哲学(检测→拒绝、活性作用域、未接线降级)与既有 #3923/#4626 一致。
- 是否引入了新的配置:否。diff 无任何 config/env 字段新增;退出开关即 server.ts 一处
setHotAdoptionProbe接线(未接线自动降级)。
代码审查要点
instanceId = randomUUID()(src/server.ts:534)每进程唯一 → 自身排除安全,两个实例不会互相误判为 self。resolve()四个返回路径(prefix/append/simhash/new-mint)全部携带refusedAdoptionspread,诊断不漏路径;refuser 在三条 rung 均在匹配门槛之后咨询(不碰无关候选),simhash 里被拒候选在passing++之前continue(不计入歧义计数)——正确。- 工具闸放在
if (!session)404-return 之后(src/plugin.ts:2238),session.id不会抛空。 - 内存驻留会话的刻意不对称(snapshot 可读 / tool 拒写)有测试钉死(
tests/hot-adoption-plugin-gates.test.ts)。
测试有效性
真测试、断言有牙:具体 status/code/error 文案(指名 peer)、每个闸双向(该拒拒/不该拒不拒)、活性三档(活对端 / 优雅退出 / 崩溃 30s 窗口)、去重、replay 放置位、fallback 误路由修复。#3617 双向 gate 纪律满足;CI 已跑绿。
diff 整洁度
核心改动收敛在 5 个源文件 + 2 个新测试文件;dsh 测试对齐(issue2419/2446/2447/2481/2817/5403)来自 ci-fixes 合并(commit 0470bec626a + merge 6c59f85a1ed,#4599 协调政策下的继承性修复),非本 PR 范围蔓延。无空白/生成物噪声。
非阻塞观察(不拦、不改)
- 工具执行 409 的 client-facing error 只指名第一个 writer(
hot[0]!),而 fork/status 两处指名全部去重后的 peer——多对端同时写同一会话的罕见情形下 client 只看到第一个(日志里是全量)。纯一致性偏好,实际影响近零。 handle.ts拒绝时打两条 warn(一条带上下文的详细行 + 一条 terse 汇总行)——粒度选择,可接受。
合并判定:可合(APPROVE)。 无阻塞项,无内核门禁,行为变更已全部披露。
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) PR #5717 审核完成:APPROVE(可合) 独立端到端复审 head
处置:verdict 已作为 review-comment 挂到 PR(作者与审核凭据同属 合并判定:可合。 无阻塞项。 |
…ts import conflict (union: processStartMs + adoption-guard) Only textual conflict: the served-markers/adoption-guard import block. Master added processStartMs to the served-markers import (#3923 same-PID generation skip); this branch adds the adoption-guard import (#394 hot-adoption guard). Union keeps both. No other conflicts; verified overlap regions semantically: forkSnapshot (#4266 signed-thinking relaxation) and handlePluginFork (#5608 timestamp carry) sit outside the guard's refusal branches; prefix-affinity.ts changes are disjoint (resolve() refusal param vs chain-file validation strictening).
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Conflict resolved and merged — pushed as What happened this run:
CI status at posting time (mirror cache, live): all fast lanes already green or gated-skipped on 八问:
判定:冲突已解除、分支可合并;待 11 个 test shard 跑完确认全绿后补一行终态结论。 |
… the fork/status hot-adoption gates (#394)
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Re-review of updated head
19015a4(previous reviewed headd95d1fc6). The branch was rebased onto current master (58a87962) via one merge commit that resolved ansrc/server.tsimport conflict; I independently re-verified the final delta rather than trusting the rebase.
(Posted as a review-comment because the PR author and the reviewer credential are the sameranxiangleiaccount — GitHub rejects a formal APPROVE event on one's own PR. The verdict below is an approval.)
Verdict: APPROVE(可合)
What changed since my last review: only the rebase + a mechanical import-union merge. The PR's real contribution vs its base is unchanged (9 files / 915+/7-). I re-read the entire final source delta against base 58a87962 and confirmed the hot-adoption logic is byte-consistent with what I approved before:
adoption-guard.ts(new probe module),prefix-affinity.ts(refuser consulted after match gates in all three rungs; all four return paths carryrefusedAdoption; simhash refusals excluded from the ambiguity counter),plugin.ts(all four gates),handle.ts(refuser wired underif (!clientProvided)) — identical.- Import-conflict site verified (
server.ts): line 103 keeps master'sserved-markersimport (incl.processStartMs) AND line 104 adds the PR'sadoption-guardimport — a clean union, no duplicate or dropped line;setHotAdoptionProbewiring +_disposeServedWriterForTestseam intact.
Spot-fix applied on this head: 已顺手修:the proxy-tool 409 body named only the first holding peer (hot[0]!) while its own log line and the sibling fork/status gates name ALL deduped peers — aligned the body to dedupe-and-name-all like its siblings → commit 19015a4. Pure error-message-text change; status/gate/logic untouched.
Regression surface: uncontested adoption/fork/tool/status all unchanged (both gate directions pinned); client-named multi-instance model traffic unchanged (multi-instance-live pinned); no new thresholds (reuses served-markers liveness); no wire-shape change; no config/env/version bump. All five behavior changes remain disclosed old→new in the PR body.
CI: re-running at new head 19015a4 after the spot-fix (no failures so far); the underlying code was green-reviewed at d95d1fc6 (30/30) and the imported master work is independently merged-green.
八问(审核结论,中文)
- 是什么问题:多实例共用 sessions 目录时,第二个活着的 bili 实例会把对端正在写的 pfa-* 会话链当自己的接管,造成会话行 last-writer-wins 双写覆盖、digest drift、冻结/解冻循环(#5624 机制链)。本 PR 把 #3923 已有的写入者标记证据从「只检测」升级为「写前拒绝」。
- 什么原因导致的:根因是会话行 upsert 为 last-writer-wins(src/storage/store.ts:958)且 lane 会话豁免清扫——两个活实例交替写同一行必然漂移;#3923 只告警不拒绝,第二个实例照样接管。表面现象是 digest drift/冻结,病因是双活写入。
- 影响范围与严重程度:触发条件 = 两活实例共用 sessions 目录 + 匿名客户端前缀吻合命中对端正在写的链。严重度 = 数据完整性级(会话行被对端覆盖、digest drift、冻结循环),未修前属 p1。客户端显式命名会话的多实例交错拓扑不受影响(受支持,兜底仍是 #3923 告警+冻结)。
- 怎么修复的:复用 served-markers.findContestedWriters 的活性作用域做成可选 probe,在四个推断驱动的采纳点写前拒绝——匿名前缀亲和跳过热链转新铸、磁盘接管回 404、fork create 分支回 409(放 replay() 之后保幂等重试)、status 回 409(防错会话路由)、代理工具执行回 409(最后一道写入闸)。活性作用域保证对端退出后即可接管(#4626 交接不受影响)。
- 是否有回归问题:审过的既有行为——非竞争采纳/fork/tool/status 全部照旧(双向钉死)、客户端命名多实例模型流量不变(multi-instance-live 钉死)、无新增阈值/wire 形状/配置变更。高危模式逐项过:无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式变化。本次 rebase 的 import 冲突合并已核验为干净 union(未丢行、未重复)。
- 是否破坏缓存:不涉及——纯采纳决策的前置拒绝,不改任何缓存/重试/增量游标/去重键失效策略。
- 是否改了设计方向:不转向。把既有检测证据升级为拒绝;边界(客户端命名不拒、活性作用域、确定性 id 残余落回 #3923 告警+冻结)均按原设计保留并测试钉死。
- 是否引入了新的配置:无新增 env/config/默认值;probe 未接线时行为与从前完全一致。
合并判定:可合。 无阻塞项。
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Re-reviewed PR #5717 end-to-end at its updated head One on-spot fix pushed to the PR branch: aligned the proxy-tool 409 body to name all holding peers like its sibling fork/status gates (was first-peer-only) → commit CI: re-running at new head Verdict: APPROVE(可合)— mergeable, no blocking items. Full re-review (English + 八问) on the PR: #5717 (review) |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 终态确认:CI 全绿 — head 补充两条本 run 的事实记录:
判定:冲突解除 + CI 全绿,PR 侧无剩余 blocker( |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Final status — PR #5717 review complete, no open items. CI now green at head
Verdict: APPROVE(可合)— mergeable. Re-review comment on the PR: #5717 (review) |
(ai: glm-5.2)
Fixes #5716 — Refs #5624
改了什么(一句话)
接管会话之前先问一句「这条会话是不是正被另一个还活着的 bili 实例写着」——是就不接管:匿名请求转而新铸自己的会话,管理面调用得到指名对端的报错。判定证据复用 #3923 已有的写入者标记(writer markers),不新增任何配置项。
为什么
#5624 的机制链:多实例共用 sessions 目录 + 匿名客户端前缀吻合 → 第二个实例把别的实例正在写的
pfa-*链当自己的接管 → 会话行整体覆盖 upsert(src/storage/store.ts:958)+ lane 会话豁免清扫(#3248)→ 两边消息行堆积 → digest drift → 冻结/解冻循环。#3923 只检测不拒绝,第二个实例照样接管。这个 PR 把同一份证据变成写前拒绝。四个落点
src/adoption-guard.ts(新)hotAdoptionRefuser()给 resolver,hotWritersOf()给管理面;未接线(inline 引擎无标记)一律视为无竞争,行为与从前完全一致src/prefix-affinity.tsresolve(input, refuseAdoption?):通过匹配门槛但被拒的候选跳过、其余候选照常竞争、全被拒落新铸;refusedAdoption仅作诊断src/server/handle.tssrc/plugin.tsresolveForkConversation两处磁盘接管拒绝;代理工具执行对热门会话回 409(本进程已驻留会话的最后一道写入闸)刻意保留的边界(测试钉死)
tests/multi-instance-live.test.ts全绿),那条路径兜底仍是 The same sessionId is served by two bili processes simultaneously: interleaved logs from global + pi-native dual instanc | 同一 sessionId 被两个 bili 进程同时服务:全局 + pi-native 双实例日志交织、重复 cold-load(split-brain) #3923 告警 + 冻结。dispose()盖戳)或崩溃(pid 死 + 标记文件过期)后立即恢复可接管,重启交接 [Bug][split-brain] Restart-handover notice persists forever after the peer pid is gone (stale storage.splitBrain) #4626 不受影响;崩溃后 30s 内的标记仍然拒(fail-closed 窗口)。Pre-flight
npm run typecheck✅tests/hot-adoption-guard.test.ts12/12 ✅(拒绝/不拒绝双向、三档 rung、去重、活性过期、优雅退出、接线与未接线、探针集成)affinity-neutral/prefix-affinity-simhash/affinity-persist/affinity-crosswire-fold35/35 ✅;served-markers/issue-split-brain-surface/multi-instance-persist24/24 ✅;multi-instance-live(受支持拓扑钉子)1/1 ✅;e2e-plugin-tool-routing/plugin-passthrough-tool-xml-warn8/8 ✅package.json版本号;单 commitfix:前缀独立审核补充(ai: vllm-qwen/qwen3.8-27b @ 069d956)
对本 PR head 做了独立复审,补上插件面拒绝语义的两个缺口(commits ae89b2e / 069d956):
recordPluginSession+flushSync(parent)覆盖对端行,正是本 guard 要防的 last-writer-wins 损坏。现在 create 分支回 409HELD_BY_PEER_INSTANCE指名持有者;闸放在 replay() 之后——replay 只读安全(child 的 committed envelope),仅 parent 被持有时重试照常成功,不饿死。HELD_BY_PEER_INSTANCE指名对端。行为变更清单(旧值 → 新值)
status?conversationId=X&fallback=latest且 X hot活性作用域细节:对端优雅退出(dispose 盖戳)→ 立即可接管;崩溃 → 标记新鲜窗口(30s)内仍拒(fail-closed),过期后可接管;contest 窗口 10min。未新增任何配置项。
补充后的验证
tests/hot-adoption-guard.test.ts15/15 +tests/hot-adoption-plugin-gates.test.ts6/6 ✅tests/plugin-fork.test.ts56/56 ✅(含跨进程重启两存储模式:测试现模拟优雅的前任退出——marker 文件静默期后盖 stoppedAt/disposedAt 再起 stand-in,[Bug][split-brain] Restart-handover notice persists forever after the peer pid is gone (stale storage.splitBrain) #4626 交接语义;lingering-predecessor 拒绝形态留在 hot-adoption-guard.test.ts 钉)(@ 7358422: restart-handoff evidence no longer relies on marker-file quiescence plus hand-stamping — the harnesses record the graceful predecessor stop through dispose(), the production graceful-stop primitive (clears the pending flush, writes the final disposedAt marker), via the test-only export _disposeServedWriterForTest; ordered after the final flush mirroring finishShutdown. Zero behavior change.)
(@ d95d1fc: last CI-red closed - the disk-adoption negative control asserted a snapshot 200 from a storage substrate that needs an explicit mode pin: a cold-adopted non-fork session serves its snapshot ONLY through the unified raw-tail reconstruction (#5140) and legacy mode fail-closes with 409 by design, so the subtest now boots "shadow" explicitly. Full matrix green: 30/30 checks at d95d1fc.)