Skip to content

[PR] fix: follow the ref-holding lane when host-stamped calls land on a sidecar stub - #5590

Open
ranxianglei wants to merge 6 commits into
masterfrom
2026-11-03_lineage-follow-stub-parent
Open

ranxianglei wants to merge 6 commits into
masterfrom
2026-11-03_lineage-follow-stub-parent

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes #5582

Problem

Long dsh sessions could never compress: compress always failed with "Total compressible content too small" while acp_status reported 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)

  1. At session start a dsh sidecar (title-gen blob: one short user message, its own persona system, no tools) fires under the SAME conversation id as the main conversation. If the v0.1.212 recognition gates miss it (dsh version drift), the resolver's virgin-id rule lets that shallow tagged request CLAIM the raw-key anchor — creating a 1-message ghost session.
  2. The main conversation arrives under its own persona system; every reanchor rung fails (the claimant blob pollutes the depth-1 prefix-affinity chain forever, fragments are disjoint) → the resolver FORKS the whole conversation onto |sub:<fp> permanently. Nudges computed there cite refs that exist only in the fork.
  3. Host-stamped management calls (compress/acp_status/decompress via the dsh shim) resolve their id VERBATIM onto the raw key → they land on the ghost forever: "highest allocated ref m00001" + "too small", circuit breaker after a few tries. acp_cache on that session showing exactly 1 request / ~993 input tokens is the fingerprint of the claimant sidecar being its only resident request.
  4. The pre-existing [Bug] dsh 会话反复 model/provider 切换时主对话迁移到 |sub:<fp> persona fork,宿主盖章的 compress/decompress/acp_status 仍解析在陈旧父 id —— ref 跨空间不可解析直至熔断 #2601 lineage follow cannot fire: its 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 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):

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)

  1. Uncited management calls on a sidecar-stub parent: old = follow the newest-born fresh ref-holder (recency chase — picked a chatty aux lane over the owner conversation); new = follow the deepest main-shaped descendant (≥ 32 refs), else the sole strictly-deeper descendant, else stay put.
  2. Calls citing refs beyond the resolved parent's frontier: old = legacy frontier-fit chosen by recency; new = sharp byRef-membership tier first, ranked frontier-fit second.
  3. New diagnostic WARN (once per conversation id) on suspected sidecar anchor races — log-only, no behavior change.

Healthy sessions are untouched: a parent that serves its own refs stays authoritative in every case table row.

Config surface

None added.

Tests

  • New 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.
  • Re-baselined the Compression fails in long sessions while new sessions work fine | 压缩失败.新会话反而没事 #3397 F2 uncited-control pin (newest-born chase → deepest owner) with the old→new rationale documented in-test.
  • Targeted suites green locally: issue5582, persona-fork-active-parent-guard, issue2601-persona-fork-lineage, issue3397-persona-restart-stability, issue2948-aux-lane-lineage-guard, issue4982-fork-lineage-conflict, lineage-reconcile-boot, dsh-persona-{continuity,fingerprint}, issue2915-order-centric-reconcile; typecheck clean. Full-suite verdict = remote CI on this head.

No kernel/ changes; no version bump (content PR).

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-03_lineage-follow-stub-parent (468f5c2)

Latest build — install this exact version

npm install -g billion-context@0.0.9541-pr.5590.c076d70

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

Recent builds (commit → version)

commit version build
468f5c2 billion-context@0.0.9541-pr.5590.c076d70 build
1215146 billion-context@0.0.9194-pr.5590.79ce03a build
2b13411 billion-context@0.0.7974-pr.5590.b623cf4 build
8fa1b98 billion-context@0.0.7968-pr.5590.9c663d4 build
090dc0a billion-context@0.0.7966-pr.5590.1590b14 build
0ac75bc billion-context@0.0.7962-pr.5590.21d810f build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: follow the ref-holding lane when host-stamped calls land on a sidecar stub [PR] fix: follow the ref-holding lane when host-stamped calls land on a sidecar stub Nov 3, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(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 口径)。

验证进行中,先报状态:

  • 分支已核对:pr-5590 head 0ac75bca2,base master,与当前 master 无落后(origin/master 无分支缺失的提交),mergeable=true。
  • 改动面:src/plugin.ts(+175)、src/server/handle.ts、src/session-resolve.ts(仅 WARN 观测)、新增 tests/issue5582-lineage-follow-stub-parent.test.ts(+291)、re-baseline tests/issue3397-persona-restart-stability.test.ts,共 527+/40-。无 kernel/ 触碰、无 version 变更、无配置面变更(与 PR 描述一致)。
  • CI:test shards(ubuntu/windows × node22/24)运行中;已完成的 static-gates/kernel-guard/lane-guard/test-import-graph/mysql-contract 全绿。等 test lanes 出结果后给完整八问结论。

@ranxianglei ranxianglei added bug Something isn't working dsh p1 scope/wiring labels Nov 3, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复(本 PR 即 #5582 的修复项;检索 open/closed issue+PR 无同机制在途条目)。
标签:pr + bug + dsh + scope/wiring + p1 —— dsh 车道长会话「完全压不动」属核心能力整体停摆,按可用性规则定 p1。

WIP 进展(审核中,先报状态):

  1. 分支已核对:2026-11-03_lineage-follow-stub-parent 与 master 无落后(审核期间哨兵追加了 090dc0aec merge commit——只带 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 的 storage-render golden 收敛,4 个 JSON 文件,代码未动)。
  2. 代码审完(plugin.ts / handle.ts / session-resolve.ts / 两个测试文件):非证据形状路径逐字节不变、PR 披露的三处行为变更与代码一致、[Bug] dsh 会话反复 model/provider 切换时主对话迁移到 |sub:<fp> persona fork,宿主盖章的 compress/decompress/acp_status 仍解析在陈旧父 id —— ref 跨空间不可解析直至熔断 #2601/Compression fails in long sessions while new sessions work fine | 压缩失败.新会话反而没事 #3397 守卫保留。结论见后续八问回复。
  3. 发现并修掉一个测试断言缺陷(小问题直接修):新回归测试 tests/issue5582-lineage-follow-stub-parent.test.ts 第 204 行 !comp.text.includes("highest allocated ref") 子串过宽——良性内核 no-op 回执也含该短语(Session highest allocated ref is mNNNNN — target older ranges only),本地确定性失败(路由本身是对的,调用正确落进了 fork 车道)。已收窄为 fatal 签名 "is above this session",本地重跑 5/5 绿。已作为独立标注 commit 推到 PR 分支:8fa1b9895。
  4. CI 在新 head 上运行中,结果出来后按八问体例给最终结论。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

进度汇报(会话曾被看门狗重启,现恢复):

  • 代码审核已完成,测试修复 8fa1b9895 已推到 PR 分支并验证(本地该文件 5/5 绿、typecheck 干净)。
  • CI 当前状态(新 head 8fa1b9895):30 项 check,0 失败,13 项运行中——guard 类全绿(kernel-guard / lane-guard / lock-sync / docs-* / version-guard / test-import-graph / mysql-contract / pi-subagents-guard / config-surface-guard / lifecycle-ledger-guard),test 矩阵分片仍在跑。
  • 之前卡住的原因:我用了一个长时间阻塞的轮询循环等 CI,被强制重启。已改为短查方式继续盯,test 分片出结果后立刻按八问体例给最终结论。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

最终结论(八问)

1. 是什么问题:dsh 长会话完全压不动——compress/acp_status 永远落在一个只有 1 条消息的「幽灵会话」上(报 "too small"、"highest allocated ref m00001"),而真正 300K+ 字符的主对话被永久分叉到 |sub: 车道;重启不愈合。

2. 什么原因导致的:两层机制叠加。① 会话启动时 dsh 标题 sidecar 与主对话同 id,v0.212 识别门漏掉它(dsh 版本漂移)时,resolver 的 virgin-id 规则让这个 1 消息浅请求抢到 raw-key 锚点 → 幽灵会话;② 主对话随后以 persona system 到达,reanchor 逐级失败(抢占 blob 永久污染 depth-1 前缀亲和链)→ 整体分叉到 |sub:<fp>。宿主盖章的管理调用按 id 逐字解析,永远落在幽灵上;既有 #2601 lineage-follow 又因出生时序过滤(每个被识别 sidecar 都把幽灵 lastSeen 推过 fork 出生时刻)而被排除——进程生命周期内无出路。#3397 skeleton 持久化让重启也不清场。

3. 影响范围与严重程度:p1。触发条件 = sidecar 先于首个主回合到达且识别门漏判(dsh 版本漂移窗口);命中后该会话压缩核心能力整体停摆 + acp_status 报错误数据,跨重启持续。未命中竞态的车道不受影响。

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 8fa1b9895:16 success / 14 gated-skip / 0 failure),本地定向 lineage 套件全绿。审核中修掉一个测试断言缺陷并推到分支(8fa1b9895):新回归测试第 204 行子串 "highest allocated ref" 过宽,误伤良性内核 no-op 回执(良性文本也含该短语),本地确定性失败但路由本身正确;已收窄为 fatal 签名 "is above this session",独立标注 commit,本地 5/5 绿,上述 CI 即在此 head 上跑绿。残留诚实边界(非回归、pre-existing 类):无引用且 owner fork 空闲超 10 分钟 + 多个浅 fresh 后代并存时仍留在 stub(无硬证据不猜);引用 ≤ 幽灵 frontier 时幽灵自答(保守边界,保 #2601)。小覆盖缺口:witness 冲突分支的 rescue 胶水参数无直接测试(共享逻辑经无见证分支已覆盖)。

6. 是否破坏缓存:不涉及——前缀缓存/重试/去重键零改动;只改管理调用解析到哪个会话对象。

7. 是否改了设计方向:无转向——把既有 persona-fork lineage-follow(#2601/#3397 家族)的证据源从「witness 精确 (tool,args) 匹配」扩展到「ref 所有权证据」,fail-closed 哲学不变;anchorRace 为 resolver 结果上的附加可选字段。

8. 是否引入了新的配置:无(config surface: none,已核对代码无新 env/config 字段)。

备注:审核期间哨兵向分支合入了 090dc0aec(#4599 ci-fixes 收敛,仅 4 个 storage-render golden JSON,与本 PR 逻辑无关)。

判定:可合并(head 8fa1b9895,CI 全绿;合并动作归 owner)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Review verdict: APPROVE — reviewed at head 2b134113d (supersedes the task-snapshot 0ac75bca2; the branch moved during review via the ci-fixes convergence merge 090dc0aec, which contributed only regenerated storage-render goldens, and another lane's assertion-narrowing commit 8fa1b9895). No kernel/ touch, no kernel-change declaration → hard rule not triggered. All non-blocking findings fixed on spot below.

查重: 不重复(前序 worker 已做重复筛查并打标签)。
标签: bug / dsh / scope/wiring / p1(已由前序 worker 打好,理由:宿主车道 dsh 的插件接线缺陷,核心压缩能力整体停摆级)。

结构化八问(independent review)

  1. 是什么问题: dsh 长会话完全无法压缩——acp_status 里会话只剩 1 条消息/85 字符,而宿主实际带着 300K+/766 条消息;compress 反复死于「可压内容太小」+「起始 ref 超出本会话最高已分配 ref」,熔断器 3-5 次后锁死,重启不愈合(compress always fails: acp_status only sees 1 message (85 chars), while the actual context on the host side is 300K+ / 7 | compress 始终失败:acp_status 只看到 1 条消息(85 字符),宿主侧真实上下文 300K+/766 条 #5582)。
  2. 什么原因导致的(因果链分层): ①锚点竞争:未被识别的 dsh sidecar(标题生成类 blob:浅历史+persona 标签=按设计即 CLAIM)先于第一个主回合拿到原始 raw-key 锚点;首个主回合 persona 不符、所有 continuity rung 全败 → 整个会话永久 fork 到 |sub:<fp>。②消费端路由盲区:宿主盖章的管理调用(compress/acp_status/decompress,nativeCaller)按 raw id 逐字解析,永远落在幽灵 stub 上;既有 [Bug] dsh 会话反复 model/provider 切换时主对话迁移到 |sub:<fp> persona fork,宿主盖章的 compress/decompress/acp_status 仍解析在陈旧父 id —— ref 跨空间不可解析直至熔断 #2601 lineage-follow 的出生顺序过滤(fork.createdAt > parent.lastSeen)被已识别 sidecar 持续刷新 ghost lastSeen 而永久失效。③Compression fails in long sessions while new sessions work fine | 压缩失败.新会话反而没事 #3397 骨架持久化在重启时把认领重新水合 → 重启不愈合。
  3. 影响范围与严重程度: p1。触发条件:dsh 宿主在同一 conversation id 下 sidecar 先于首主回合发射(标题生成类场景);命中后会话聊天可用但上下文只增不减——成本/质量持续恶化且无任何自愈路径。
  4. 怎么修复的: 消费端证据路由——当解析出的 parent 可证明无法服务该调用时(cited max ref 超过 parent frontier,或 stub 形状),改路由到可证明持有被引 refs 的后代车道(sharp 档:被引 id ∈ candidate.byRef,id 铸造不可复用故为硬证据;fallback 档:frontier ≥ maxCited,覆盖 fix: archive blocks across omp native compaction instead of silently deactivating them (#395) #421 compaction-pruned 类);无引用调用对 stub 形状 parent 跟随唯一深层/main-shaped 后代。全程 fail-closed:无证据 = 现状行为逐字节不变。另加生产端可观测性(anchorRace 标志 + per-id 一次性 WARN)。
  5. 是否有回归问题: 逐项清点过 diff 触碰路径的既有行为:maxCitedRefNum 输出不变(同一正则,仅来源重构);branch A/B 非证据形状逐字节走旧路径(honor-caller warn 行保留、livePersonaDescendant 保留);witness single/arb/verbatim-fallback 分支未动;resolver 的 key/action/reason 不变(anchorRace 纯增量字段);handle.ts 四个 call site 包装输入输出等价;无缓存/重试/游标/去重影响;young-real veto(orderIsMainShaped)防止绕过真正年轻的真实会话;[Bug] dsh 会话反复 model/provider 切换时主对话迁移到 |sub:<fp> persona fork,宿主盖章的 compress/decompress/acp_status 仍解析在陈旧父 id —— ref 跨空间不可解析直至熔断 #2601 fusion-board 守卫保留(parent 能服务自己的 refs 时绝不被 bypass)。结论:无意回归未发现。(另有一处本地环境发现的 master 级测试失效,与本 PR 无关,见下。)
  6. 是否破坏缓存: 不涉及——前缀缓存水位/增量车道/pf-* 协议头均未触碰,去重键不变。
  7. 是否改了设计方向: 不涉及——在既有 lineage-follow 机制上加证据资格判定,无新数据流、无新持久化格式。
  8. 是否引入了新的配置: 无——常量全部模块私有(STUB_PARENT_MAX_REFS=8 / FOLLOW_MIN_DEPTH_REFS=32 / PERSONA_LINEAGE_FRESH_MS=10min / ANCHOR_RACE_WARN_CAP=4096),无 env/config/CLI 面。

行为变更披露(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 分支落地)

  • 已顺手修:anchorRaceWarned 是无界模块级 Set(每个受影响 conversation id 一条、长驻代理进程永不驱逐)→ 按 warnedNoModelRequests 既有模式加上限 4096 + clear-on-full(src/server/handle.ts)+ commit 1db2a464c
  • 已顺手修:branch-A(witness-conflict rescue)接线此前零测试覆盖(所有用例都走 branch B)→ 新增 witness-conflict rescue 用例(陈旧 witnessed lane 经 witness bonus 压过 fresh owner lane,断言折叠确实执行在被见证车道而非 fresh 车道);旗舰用例语料从 ~2K 扩到 ~13K 使 compress 真正越过内核保护区完成折叠(此前断言只钉住路由、没钉住恢复),并补 block-attribution 断言(tests/issue5582-lineage-follow-stub-parent.test.ts)+ commit 2b134113d
  • 旁证:另一 lane 的 8fa1b9895(ghost-error 断言收窄到 fatal 边界签名)与我本地独立 root-cause 的缺陷一致(原断言的子串会命中内核保护区 no-op receipt 的正常文案)——验证其修法正确、牙口保留。

非阻塞发现(master 级继承性问题,不在本 PR 范围内修)

tests/lineage-reconcile-boot.test.ts AC9–AC12 在我本地环境确定性失败(3/3 次复现,master worktree 与 PR head 同样失败):mock relay 按位置 ref 索引算出的折叠目标(m00001..m00003)在当前内核保护区语义下整体落入 protected zone → compress 返回良性 no-op receipt → parent must have folded a block (got 0)。已用 master 原始 worktree 对照证明与 PR 无关(PR 未触碰任何涉及路径——该用例是纯 proxy-mode 增长阶段,不走 plugin 路由)。性质:master 级测试脆弱性(折叠目标区间 vs 保护区边界的漂移),预期 CI 中承载该文件的 shard 会独立于本 PR 变红。按 CI 协调纪律应收敛到 ci-fixes 哨兵通道(上游 #4599)处理,本 PR 不动它以免污染 diff。失败签名:not ok - AC9..AC12 ... error: 'parent must have folded a block (got 0)',日志特征 [acp-proxy: compress no-op m00001–m00003 → 0 blocks] + lies entirely inside the protected zone。

测试有效性判定

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 通道处置。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[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):

  • Rebased 2026-11-03_lineage-follow-stub-parent (was 2b134113) onto master and resolved the src/server/handle.ts + src/session-resolve.ts conflict. Master had refactored the 4 dsh-lane call sites to the 9-arg personaConversationOrder (carrying onSessionResolveEvent + msgid-rescue), whereas the PR's older base wrapped those sites in a local 4-arg dshPersonaOrder helper. I folded the PR's anchor-race once-per-id observability into master's centralized observer and deleted the redundant dshPersonaOrder wrapper.
  • Net result: handle.ts call sites are byte-identical to master; the PR's diff is now purely additive — an anchorRace diagnostic flag on SessionOrderResolution (set after the key/action are decided), an orderIsMainShaped export used only by plugin.ts, and a once-per-id warn log in the observer.
  • Typecheck green; tests/issue3397-persona-restart-stability.test.ts passes.
  • Before pushing I verified no concurrent push (remote head was still 2b134113) and verified git merge-tree = clean into current master c26c31ac. Then force-pushed the rebased tip → 12151465d6. The dirty/conflict state is cleared.
  • Applied the needs-decision label.

Why I'm stopping (this is a design decision, not a mechanical fix):
3 of the PR's NEW tests in tests/issue5582-lineage-follow-stub-parent.test.ts fail — all at the same shared fixture (buildStubParentPathology), which asserts the first MAIN conversation (different persona, disjoint history) forks onto a |sub:<fp> key. On current master that main conversation instead rides the raw key (the anchor migrates/continues), so no |sub: fork forms and the stub-parent pathology the PR was written to fix no longer reproduces in the test's scenario.

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 session-resolve.ts branching, which I did not touch. It is a divergence between the PR's original assumptions and master's evolved session-routing (the anchor-migration / continuity / msgid-rescue family — #5686 / #5719 / #2250).

CI state (stated honestly): the mirror cache still reflects the pre-rebase head (2b134113, all test shards green) — it has not refreshed to my new head 12151465d6 yet, so I cannot assert the new head's green/red. I expect the 3 tests above to show red on the new head; the rest should be unaffected.

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.


八问(中文,供人工评审):

  1. 是什么问题:PR [PR] fix: follow the ref-holding lane when host-stamped calls land on a sidecar stub #5590 要修「宿主盖戳的管理类调用(acp_status/compress/decompress)落在 sidecar 存根父会话上、追不到真正持 ref 的车道」(compress always fails: acp_status only sees 1 message (85 chars), while the actual context on the host side is 300K+ / 7 | compress 始终失败:acp_status 只看到 1 条消息(85 字符),宿主侧真实上下文 300K+/766 条 #5582)。本次是 CI 自动修复车道,先处理它与 master 的合并冲突。
  2. 什么原因导致的:冲突本身——master 在 PR 基线之后把 4 个 dsh 车道调用点重构成了 9 参 personaConversationOrder(带 onSessionResolveEvent + msgid-rescue),而 PR 旧基线用本地 4 参包装器,同一区域被双方改写。更深层——PR 的 3 个新测试假设「首个 MAIN 会话会 fork 到 |sub: 键」,但当前 master 的 session-resolve 已演进为「锚点迁移/续接」,MAIN 会话直接落在 raw 键上、不再 fork,所以 stub 父病理在测试场景里不再复现。
  3. 影响范围与严重程度(按选项):
    • A(判为已被取代):若 master 锚点迁移已彻底消除 stub 父滞留,则影响面 = 该修复不再需要,关闭无副作用;若仍有残留触发路径,A 会误关一个仍有效的修复。
    • B(按当前 master 重做):影响面 = 保留 plugin.ts 跟随逻辑 + 重写 3 个测试,波及 PR 范围与测试夹具;若找不到仍会形成 stub 父的活场景,B 无从落地。
    • C(挂起):分支已可合并但暂不合,等待裁决;无行为变更,零风险。
  4. 怎么修复的:冲突侧(已做)——把 PR 的 anchor-race 一次性观测合并进 master 的集中式 onSessionResolveEvent 观察者,删掉冗余 dshPersonaOrder 包装器,handle.ts 调用点与 master 逐字节一致,净 diff 纯增量。测试侧(需你定夺)——取决于 A/B/C。
  5. 回归风险(按选项):
  6. 是否破坏缓存:不涉及。增量改动是诊断字段 + 日志,不改路由、缓存、重试、增量游标或去重键。
  7. 是否改了设计方向:冲突解决把「按车道包装器观测」改为「集中式观察者观测」,这是顺应 master 既有重构方向,非新方向;整个 PR 保留/重做/关闭取决于你的 A/B/C 裁决。
  8. 是否引入了新的配置:不涉及,无新 env/config/默认值。

收工判定:合并冲突已解决并推送(分支现为 12151465d6,对当前 master c26c31ac 干净可合并),needs-decision 标签已打。PR 是否仍有价值取决于「当前 master 上 stub 父是否还会形成」——请裁决 A/B/C(默认 C 挂起)。

ci-check added 6 commits November 13, 2026 10:37
…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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant