Repository navigation
[PR] fix: follow the ref-holding lane when host-stamped calls land on a sidecar stub - #5590
ranxianglei wants to merge 6 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9541-pr.5590.c076d70This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5590.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 检索 open/closed issue 与 PR(关键词: sidecar stub / lineage follow / host-stamped compress fails / "too small" ghost session),无同机制在途条目;本 PR 即 #5582 的修复本体。 标签: bug + dsh + scope/wiring + p1(长会话压缩能力整体不可用 = 可用性缺陷,按 p1 口径)。 验证进行中,先报状态:
|
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复(本 PR 即 #5582 的修复项;检索 open/closed issue+PR 无同机制在途条目)。 WIP 进展(审核中,先报状态):
|
(ai: vllm-qwen/qwen3.8-27b) 进度汇报(会话曾被看门狗重启,现恢复):
|
(ai: vllm-qwen/qwen3.8-27b) 最终结论(八问)1. 是什么问题:dsh 长会话完全压不动—— 2. 什么原因导致的:两层机制叠加。① 会话启动时 dsh 标题 sidecar 与主对话同 id,v0.212 识别门漏掉它(dsh 版本漂移)时,resolver 的 virgin-id 规则让这个 1 消息浅请求抢到 raw-key 锚点 → 幽灵会话;② 主对话随后以 persona system 到达,reanchor 逐级失败(抢占 blob 永久污染 depth-1 前缀亲和链)→ 整体分叉到 3. 影响范围与严重程度:p1。触发条件 = sidecar 先于首个主回合到达且识别门漏判(dsh 版本漂移窗口);命中后该会话压缩核心能力整体停摆 + 4. 怎么修复的:修在路由决策点而非症状面——宿主盖章调用改为「跟随持有 refs 的车道」。带引用:父车道证明服务不了所引 refs(frontier < maxCited)或是 sidecar stub(≤8 refs 且非主形)时,路由到可证持有的后代——锐层 = 全部引用 ref 都在候选 byRef 里(id 永不复用 = 所有权证明),回退层 = frontier 匹配,排序 witness > fresh > 主形 > 深度。无引用:仅 stub 父才跟随——唯一足够深(≥32 refs)的 fresh 后代,否则唯一严格更深者,否则原地不动(fail closed)。生产侧另加一次性 WARN 诊断(resolver 把主形会话从浅记录上分叉时),零路由影响。 5. 是否有回归问题:审过触碰路径的既有行为——非证据形状两集成点均逐字节不变;#2601 fusion-board 守卫保留(父车道能服务自身引用时永不被绕过);#3397 单 fork 近因回退保留为唯一后代路径。披露的行为变更恰为 PR 正文三项(stub 上无引用调用路由策略、越界引用分层、新增 WARN),无阈值/时序/输出格式漂移。CI 全矩阵绿(head 6. 是否破坏缓存:不涉及——前缀缓存/重试/去重键零改动;只改管理调用解析到哪个会话对象。 7. 是否改了设计方向:无转向——把既有 persona-fork lineage-follow(#2601/#3397 家族)的证据源从「witness 精确 (tool,args) 匹配」扩展到「ref 所有权证据」,fail-closed 哲学不变; 8. 是否引入了新的配置:无(config surface: none,已核对代码无新 env/config 字段)。 备注:审核期间哨兵向分支合入了 判定:可合并(head |
(ai: vllm-qwen/qwen3.8-27b) Review verdict: APPROVE — reviewed at head 查重: 不重复(前序 worker 已做重复筛查并打标签)。 结构化八问(independent review)
行为变更披露(PR body 已披露,审核确认 old→new 完整): ① stub parent 上的无引用管理调用: newest-born recency chase → 最深 main-shaped / 唯一更深层 / 原地不动;② 引用超出 parent frontier 的调用: legacy recency frontier-fit → sharp byRef 档优先(候选集在证据形状下去掉出生顺序过滤——这正是修复机制本身);③ 新增一条 WARN 日志(log-only)。 已顺手修(non-blocking,已在 PR 分支落地)
非阻塞发现(master 级继承性问题,不在本 PR 范围内修)
测试有效性判定hermetic e2e 走真实 server+resolver+kernel(非 mock 路由函数);断言有牙:message inventory 钉死「64 msgs」落在正确车道、fatal 签名缺席、前置断言钉死出生顺序死亡条件(fork.createdAt < stub.lastSeen + stubRefs ≤ 8);正负向 row 齐全(young-real veto / solo fail-closed / overlap 歧义降级);我补完后两条接线分支(branch A/B)均有覆盖。typecheck 通过;定向套件本地绿(CI 全局判定以推送 head 的 test lane 为准)。 合并判定: APPROVE。 无 kernel/ 触碰、无阻塞性发现、行为变更披露完整、回归清点干净。注意:PR 触碰 identity/session-binding 逻辑,按 auto-merge gate 属 human-only 合并。CI 侧唯一预期红项是上述 master 继承性测试失效,与本 PR 变更无因果关系。 协调报告: review 完成,APPROVE 已发,head 2b13411,顺手修 2 commit 已推(1db2a46 / 2b13411),1 处 master 继承红签名已记录待 #4599 通道处置。 |
2b13411 to
1215146
Compare
[bot] 🏷 🔶 需要决策 — merge conflict resolved & pushed, but the PR's 3 new regression tests fail against current master (design-level; needs your call) What I did this run (conflict resolution — DONE):
Why I'm stopping (this is a design decision, not a mechanical fix): This is not caused by my conflict resolution: my diff is purely additive and set after the key/action are decided; the fork-vs-continue routing is master's CI state (stated honestly): the mirror cache still reflects the pre-rebase head ( Options:
Recommendation: investigate A first — determine whether a stub parent can still form on current master. If it can't → close as superseded. If it can (via a different trigger) → do B. Default if undecided: C (hold) — the conflict is resolved and the branch is mergeable, so holding loses nothing while you decide whether the PR is still needed. 八问(中文,供人工评审):
收工判定:合并冲突已解决并推送(分支现为 |
…decar stub Fixes #5582 Host-stamped management calls (compress/acp_status/decompress) resolve their conversation id VERBATIM onto the raw-key session. When a dsh sidecar (title-gen / auto-review blob) claimed that virgin anchor before the main conversation arrived under its own persona system, the resolver forks the main conversation onto |sub:<fp> permanently (the claimant blob pollutes the depth-1 prefix-affinity chain, killing every reanchor rung) while every management call keeps landing on the 1-message ghost: "highest allocated ref m00001" + "Total compressible content too small", breaker after a few tries, restart does not heal (#3397 skeleton persistence rehydrates the claim). Family: #2156/#2160 (ghost routing), #2601 (lineage follow), #3397 (restart stability), #2948 (aux lanes), #150 (id-reuse isolation). The pre-existing #2601 follow could not fire here: the no-witness rule requires fork.createdAt > parent.lastSeen, but every RECOGNIZED sidecar riding the raw key stamps the ghost's lastSeen after the fork's birth, so the birth-order filter excludes the owner conversation forever; the witness rule only covers model-emitted calls whose exact (tool,args) settled outbound. Consumer-side evidence routing in handlePluginTool (src/plugin.ts): - citedRefSet(): collect every mNNNNN token a call cites (maxCitedRefNum now derives from it, behavior unchanged). - stubParentFollow(): when the resolved parent cannot serve the cited refs (frontier < maxCited) or is a sidecar stub (frontier <= 8 refs AND not main-shaped), follow the descendant that PROVABLY holds them: sharp tier = every cited ref present in the candidate's byRef (ids are mint-proof, never reused); fallback tier = frontier fit; ranking prefers witness match > fresh > main-shaped > frontier depth. Ref-less calls follow only a UNIQUE sufficiently deep (>= 32 refs) fresh descendant of a stub parent; a sole strictly-deeper descendant preserves the #3397 single-fork recency fallback. Ambiguity stays put (fail closed). - Wiring: the witness-conflict branch tries this rescue before honoring the native caller; the no-witness branch routes by EVIDENCE (stub shape or cited-past-frontier) instead of letting the birth-order rule chase the newest-born shallow aux lane. Every other shape keeps the pre-#5582 path byte-identical, including the #2601 fusion-board guard (an active main-shaped parent citing within its own frontier stays authoritative). Behavior changes (old -> new): 1. Uncited management calls on a sidecar-stub parent: follow the newest-born fresh ref-holder -> follow the deepest main-shaped descendant (>= 32 refs), else the sole strictly-deeper descendant, else stay put. The old recency chase selected a chatty aux lane over the owner conversation (reproduced in tests). 2. Calls citing refs beyond the resolved parent's frontier: legacy frontier-fit picked by recency -> sharp byRef-membership tier first, ranked frontier-fit second. No config surface added. No kernel/ changes. Tests: new tests/issue5582-lineage-follow-stub-parent.test.ts (pathology end-to-end incl. acp_status/acp_cache/compress routing, overlap ambiguity, young-real veto, fail-closed solo, resolver flag rows); re-baselined the #3397 F2 uncited-control pin (newest-born chase -> deepest owner) with the old->new rationale documented in-test. Targeted lineage suites green.
Companion to the #5582 consumer-side fix: producer-side observability for the race that strands management calls on a sidecar stub. When the resolver forks a MAIN-shaped conversation off a SHALLOW recording under a different persona tag, that is exactly the signature of an unrecognized sidecar having claimed the raw-key anchor first (the claimant blob is 1-2 messages; a real main conversation never looks like that at turn one). The fork itself stays the correct isolation decision (#150), so this commit changes no routing — it adds: - SessionOrderResolution.anchorRace?: boolean, set in the derived-persona branch when !mainShaped(recorded) && mainShaped(incoming); - resolveSessionOrder-based dshPersonaOrder wrapper in handle.ts used by the four dsh lanes (google/anthropic/openai/responses), logging ONE warn per conversation id naming the suspected race and pointing at sidecar shape drift (title/review recognition gates); - orderIsMainShaped(id) export consumed by the plugin-lane stub-parent tests and follow logic. The once-per-id warn gives field evidence of WHICH deployment hits the race without changing behavior. No config surface added.
…ignature (review fix)
The pathology e2e asserted !comp.text.includes("highest allocated ref"),
which also matches the BENIGN kernel no-op receipt ("Session highest
allocated ref is mNNNNN — target older ranges only", kernel/src/compress.ts).
The routed call lands in the fork correctly and returns a protected-zone
no-op, so the broad substring failed deterministically even though routing
worked. Assert the fatal shape only: "is above this session" (the prefix of
kernel/src/boundaries.ts' "is above this session's highest allocated ref").
anchorRaceWarned was an unbounded module-level Set (one entry per affected conversation id, never evicted) in a long-lived proxy process. Cap it at 4096 with clear-on-full, matching the warnedNoModelRequests pattern in src/plugin.ts. Log-only; no routing behavior change.
…n the flagship case Branch-A wiring (nativeCaller + witness conflict -> stubParentFollow rescue before honoring the caller) had zero coverage; every existing case exercised branch B. Add a witness-conflict rescue case: a second deep lane under the same base id whose own ref space also holds the cited refs (every session mints from m00001), aged past the 10-min lineage freshness window so personaLineageWitness refuses it, plus an outbound tool witness naming it - only the #5582 evidence rescue can route the call. Asserts the fold executes in the witnessed lane (one block minted there) and not in the fresh owner lane. Grow the flagship corpus (~8K -> ~52K chars) so the mid-history compress range clears the kernel's protected recent zone and actually folds; pin the recovery with a block-attribution assertion (state.blocks.length === 1 in the owning lane) instead of relying on error-text absence alone.
… gate The claim turn was a single-user blob, which the #5656 dsh single-shot sidecar gate (merged 2026-11-05, before this branch's base) now recognizes as a side lane — so it never claims the raw key and the fork never forms. Use the residual two-user aux shape instead: it misses the single-shot gate (exactly-one-user requirement) yet stays below mainShaped's 3-cell floor, so the raw-key claim is a sidecar stub, not a young real conversation. The test lane was SKIPPED on the PR head (never actually run on CI), which is why this never surfaced. All 6 tests pass on the rebased head.
1215146 to
468f5c2
Compare
Fixes #5582
Problem
Long dsh sessions could never compress:
compressalways failed with "Total compressible content too small" whileacp_statusreported the session as 1 message / 85 chars although the host carried 300K+ chars / 766 messages; restarting did not heal it.Root cause (split brain behind one conversation id)
|sub:<fp>permanently. Nudges computed there cite refs that exist only in the fork.acp_cacheon that session showing exactly 1 request / ~993 input tokens is the fingerprint of the claimant sidecar being its only resident request.fork.createdAt > parent.lastSeen, but every RECOGNIZED sidecar riding the raw key stamps the ghost's lastSeen after the fork's birth, so the birth-order filter excludes the owner conversation for the process lifetime; the witness rule only covers model-emitted calls with an exact settled (tool,args) match. Restart does not heal because Compression fails in long sessions while new sessions work fine | 压缩失败.新会话反而没事 #3397 skeleton persistence rehydrates the claim and the fork decision is deterministic per request shape.Family: #2156/#2160 (ghost routing), #2601 (lineage follow), #3397 (restart stability), #2948 (aux lanes), #150 (id-reuse isolation).
What changed
Consumer-side evidence routing (
src/plugin.ts,handlePluginTool):citedRefSet()collects everymNNNNNtoken a call cites (maxCitedRefNumnow derives from it; behavior unchanged).stubParentFollow(): when the resolved parent cannot serve the cited refs (its minted frontier < max cited) or IS a sidecar stub (frontier ≤ 8 refs AND not main-shaped), route to the descendant that PROVABLY holds them — sharp tier: every cited ref present in the candidate'sbyRef(message ids are mint-proof and never reused); fallback tier: frontier fit; ranking prefers witness match > fresh > main-shaped > frontier depth. Ref-less calls follow only a UNIQUE sufficiently deep (≥ 32 refs) fresh descendant of a stub parent; a sole strictly-deeper descendant preserves the Compression fails in long sessions while new sessions work fine | 压缩失败.新会话反而没事 #3397 single-fork recency fallback. Ambiguity stays put (fail closed).Producer-side observability (
src/session-resolve.ts,src/server/handle.ts): when the resolver forks a MAIN-shaped conversation off a SHALLOW recording under a different persona tag (exactly the unrecognized-sidecar signature), a once-per-conversation WARN names the suspected sidecar anchor race and points at sidecar shape drift. No routing change — the fork stays the correct isolation decision (#150).Behavior changes (old → new)
Healthy sessions are untouched: a parent that serves its own refs stays authoritative in every case table row.
Config surface
None added.
Tests
tests/issue5582-lineage-follow-stub-parent.test.ts: pathology end-to-end (claim → main fork → recognized sidecars keep the stub alive past fork birth; acp_status/acp_cache/compress all land in the owning lane), overlap ambiguity (two lanes both containing a cited ref → deepest wins), young-real veto (main-shaped parent ≤ 8 refs is NOT a stub → stays put), fail-closed solo (no descendants → stays put), resolver flag positive+negative rows.No kernel/ changes; no version bump (content PR).