Skip to content

[PR] fix: route compress to stale persona fork that holds the cited refs (#7075) - #7202

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-11-19_persona-compress-recovery
Open

ranxianglei wants to merge 1 commit into
masterfrom
2026-11-19_persona-compress-recovery

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Problem

Pre-#6883 traffic minted refs in a |sub: fork (persona-order ladder). Post-#6883 compress forwards stamp the raw id and the purpose header routes them to the parent. The fork went stale (no model traffic for >10 min) so livePersonaDescendant's freshness filter excludes it, but its ref space still holds the refs the compress cites.

Result: every ref is unknown to this session — the compress is routed to the parent (which doesn't hold the refs) instead of the fork (which does).

Fix

stalePersonaWithRefs — no freshness gate, refs are the discriminator. When livePersonaDescendant returns undefined (fork not fresh), fall through to stalePersonaWithRefs which finds the fork whose minted ref space contains the cited refs.

This recovers already-broken sessions: the next compress call will be routed to the fork that holds the refs, and the compress will succeed.

Tests

5 unit tests for stalePersonaWithRefs:

  • Finds a stale fork that holds the cited refs
  • Returns undefined when no fork holds the refs
  • Ignores ref-less forks
  • Returns undefined for fork parents
  • Returns undefined when maxCited is 0

Closes #7075

…7075)

Pre-#6883 traffic minted refs in a |sub: fork (persona-order ladder).
Post-#6883 compress forwards stamp the raw id and the purpose header
routes them to the parent. The fork went stale (no model traffic for
>10 min) so livePersonaDescendant's freshness filter excludes it, but
its ref space still holds the refs the compress cites.

Fix: stalePersonaWithRefs — no freshness gate, refs are the
discriminator. When livePersonaDescendant returns undefined (fork
not fresh), fall through to stalePersonaWithRefs which finds the
fork whose minted ref space contains the cited refs.

Closes #7075
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-19_persona-compress-recovery (2ad4cd1)

Latest build — install this exact version

npm install -g billion-context@0.0.10855-pr.7202.9d2bad1

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
2ad4cd1 billion-context@0.0.10855-pr.7202.9d2bad1 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: route compress to stale persona fork that holds the cited refs (#7075) [PR] fix: route compress to stale persona fork that holds the cited refs (#7075) Nov 18, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Verdict: mergeable — fixes a real, session-breaking bug; one narrow regression to track (filed as #7210).

What I verified (evidence, not "should work"):

  • Pulled the PR head (2026-11-19_persona-compress-recovery, sha 2ad4cd1) and read the diff in context. PR base = current master tip (0 commits behind), so no stale-base risk.
  • Diff is clean and single-scope: src/plugin.ts (+33/-1) adds stalePersonaWithRefs + a fall-through in the no-witness nativeCaller routing branch; tests/issue7075-stale-persona-compress-recovery.test.ts (+115) adds 5 unit tests. No unrelated changes, no version bump, no kernel/ touch, no config surface.
  • Ran the PR's targeted suite locally: 5/5 pass.
  • Ran the related persona-lineage regression suites locally (issue2601-persona-fork-lineage, issue2948-aux-lane-lineage-guard, issue3397-persona-restart-stability, persona-fork-active-parent-guard): 14/14 pass — the PR does not break the existing active-parent guard, because that test's incident shape uses acp_cache (cites no refs), so the new fallback's maxCited > 0 gate never fires there.
  • CI (mirror cache, sha 2ad4cd1): 30 checks, 0 failed, 3 still queued (mysql-contract, lane-guard, test-import-graph); gate lanes green. No red.

The fix is correct for the reported shape. livePersonaDescendant excludes the stale fork on two independent gates (freshness >10 min, and the birth-order gate when the parent is live post-upgrade). stalePersonaWithRefs drops both and uses the refs as the discriminator (fork frontier ≥ max cited), which recovers the #7075 "every ref is unknown to this session" breaker. The 5 unit tests pin the function's basic behavior (finds the stale ref-holder; undefined when no fork holds the refs / ref-less fork / fork-parent / maxCited=0).

One regression to decide on (narrow, filed as #7210). The fallback drops the BIRTH-ORDER gate that keeps an active raw parent authoritative. In the parallel-persona shape (active parent P + parallel |sub: fork F, both minted refs past the fork point), a host-initiated ref-citing management call (dsh periodic compress) whose cited refs sit at/below F's frontier is re-routed to F and compresses F's messages. Because parent and fork share ref NUMBERS post-fork (same mNNNNN, different messages), that is the wrong content. Before this PR the same call stayed on P (correct). The existing active-parent test does not catch it (its incident shape cites no refs). Root limitation: the ref-frontier proxy is necessary but not sufficient once parent and fork both mint past the fork point — only a content-based discriminator is clean. Options + recommendation are in #7210 (A: accept as a narrow interim / B: parent-frontier guard, risks re-breaking #7075 once the parent catches up in numbering / C: content-based, the proper fix).

Recommendation: merge — the #7075 bug is common (every #6883 upgrade path) and session-breaking, while the regression is narrow and low-probability. Track the residual risk in #7210 for a content-based discriminator. Final call is yours.


八问(结构化结论)

  1. 是什么问题: [PR] dsh purpose: declare auxiliary requests instead of content-guessing (#6880) #6883 升级后,宿主发起的压缩转发盖 raw id 被路由到父会话,但被引用的 refs 铸在已 stale 的 |sub: fork 里 → "every ref is unknown to this session",会话卡死无法压缩。
  2. 什么原因导致的: 路由判别(livePersonaDescendant)只认新鲜度 + birth-order,不认 refs 归属;fork 超 10 分钟无流量被排除,但其 ref 空间仍持有被引用的 refs。
  3. 影响范围与严重程度: 走 [PR] dsh purpose: declare auxiliary requests instead of content-guessing (#6880) #6883 升级路径的 dsh 用户(主流量从 fork 迁到 raw key 后 fork 变 stale);严重——会话无法压缩,属可用性缺陷。
  4. 怎么修复的: 新增 stalePersonaWithRefs 回退,无新鲜度门、以 refs 为判别(fork frontier ≥ 被引用最大 ref),在 livePersonaDescendant 落空时接住。
  5. 是否有回归问题: 有,一处窄回归——回退丢掉 birth-order 门,并行 persona 形状下宿主带 refs 调用可能被误路由到 fork 压缩错误内容(父/fork 在 fork 点后同号不同消息,frontier 代理无法区分)。已立 [Drive-by] persona compress fallback can mis-route an active parent's ref-citing call into a parallel fork (wrong-content compression) #7210 跟踪,选项 A/B/C 见该 issue。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 无架构转向;在既有 persona-lineage 路由上加一个回退分支,但把 ref-frontier 代理的适用面从 fresh fork 扩到 stale fork(行为面变化)。
  8. 是否引入了新的配置: 不涉及。

判定:建议合并(修复真实且常见的会话卡死,净收益;窄回归已立 #7210 跟踪)。是否合并由 owner 拍板。

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

Development

Successfully merging this pull request may close these issues.

Upgrade error: dsh ref is unknown | 升级报错dsh ref is unknown

1 participant