Repository navigation
[PR] fix: keep the live conversation on its raw lane when a full compaction lands with a persona-text drift (#5719) - #5734
Conversation
…ual (#4599) 01fcc5d (#5656/#5584, merged via #5687) diverts tool-less dsh single-shot requests onto the verbatim side lane (kernel no-touch); the residual for main turn 1 is documented in the commit's own comment. Five pre-existing pins assumed turn 1 rides the full pipeline and went born-red at merge (master red since; every PR head inherits it). Test-only realignment codifying the documented behavior: - issue2419/2446/2447/2481 guard-stamp subtests: two turns; the BLOCKED ref is witnessed on the first FULL-PIPELINE turn (turn 2). No fold can happen before turn 2 (nothing compressible, no action surface), so protection against every possible fold is unchanged. - issue2817: stats.requests off by one (turn 1 uncounted); the persona-fold teeth are intact, assertions shifted -1. - issue5403 A/B golden: turn 0 rides the side lane in BOTH phases (the gate ignores the rollout env), so rb[0] is unstamped by design; stamps resume at turn 1. Byte equality holds at i=0 (both phases forward verbatim). No src/, kernel/, config, or version changes. Locally green: all six files + side-lane-invariants + issue5656-single-shot-sidecar + dsh-persona-fingerprint.
…l compaction erases all positional proofs (#5719) A full dsh compaction (#3733 authored checkpoint replacing the whole head) landing in the same turn as a persona-text drift made every positional re-anchor rung structurally unreachable: the recorded tail is gone by definition, the incoming is shorter than the recorded skeleton, and the first post-compaction model step carries zero assistant turns. The live conversation then forked onto <id>|sub:<fp16(new tag)> while the parent record froze (resume-inheritance miss, re-compression from zero). New E5 rung, first in the tagChanged branch: trust the self-declaration embedded in bili's own authored checkpoint — the identity header forged by src/server/dsh-authored-compaction.ts names the exact raw id it belongs to. Gate: first user message only, exact producer format (version-pinned), conv byte-equal to the raw id. External personas quoting checkpoints are unaffected: stamped review/title sidecars never reach the resolver (sideRequestLike gate), and a foreign or late marker fails the gate. Behavior change: this shape went from 'always forks' to 're-anchors on the raw lane when carrying the self-declaration'; every marker-less shape is byte-identical (tests pin each pre-existing rung's reason string). Tests: tests/issue5719-self-checkpoint-reanchor.test.ts (acceptance 1/2/3 + four wire shapes + foreign-quote boundaries); regression suites green locally: dsh-persona-continuity, issue2944-neutral-skeleton, issue3397-persona-restart-stability, side-lane-invariants, issue2601-model-drift-absorption, issue4778-dsh-goal-subfork, issue5686-tagchanged-shorter-tail-reanchor, dsh-persona-fingerprint, issue4438-dsh-review-lane-isolation, issue5095-subagent-lane-token, dsh-authored-compaction.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8248-pr.5734.8f84bd1This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5734.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 —— open [PR] 清单里针对 #5719 的只有本 PR(#5734)一个,无并列 PR;#5686(PR #5693)修的是同分支的姊妹形状(compaction 保留 verbatim tail),机制不同、互不覆盖,issue 正文已说明分工。 标签: bug / dsh / scope/wiring / p1(fork 继承丢失、压缩状态孤儿化、从零重压一类的会话恢复缺陷,按 owner 修订 2026-10-19 定 p1)。 当前状态(初报,随后补结构化八问):
|
(ai: vllm-qwen/qwen3.8-27b) 结论:代码审核通过;CI 红已处置(继承性失败,已 merge ci-fixes 进 PR 分支并推送,head 现为 结构化八问
CI 处置(按 #4599 协调规则):接手时 10/30 shard 红,失败签名全部落在 ci-fixes 哨兵提交 热文件提示:open PR #5729 也动 session-resolve.ts 的 tagChanged 区域——两者若先后合入,后合者需 rebase(均为增量 rung,未见语义冲突)。 合并判定:方向正确、根因命中核心、测试有牙(正负双向 + 四 wire 形状 + foreign-quote 边界)、diff 干净、CHANGELOG 已披露行为变更。src/session-resolve.ts 属 identity/session-binding 逻辑,按 §7.4 保留人工合并——CI 重跑转绿后请 owner 自行合并:#5734 |
(ai: vllm-qwen/qwen3.8-27b) 本 PR 代码零缺陷;CI 红是继承 master 的红风暴,已清除,剩一枚已知负载 flake 已触发重跑。 本轮无需 owner 决策(非设计取舍、非授权卡点)。 结构化结论
剩余项(非本 PR 自致): 重跑后 run 判定: 可合 —— 继承红已清、本 PR 代码经本地定向验证零回归;剩一枚已知负载 flake 重跑即可转绿,无需人工介入。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE @ 6939ad3e — reviewed end-to-end at the current head. Note: the branch moved past 30a8bc2d0 mid-review; the two added commits are the sanctioned ci-fixes convergence for inherited master red, covered below.
Independent review
Direction. #5719's root cause is structural: when the #3733 authored compaction replaces the whole history head with one checkpoint message, every positional evidence channel the tagChanged branch relies on dies in the same turn (recorded tail gone by definition; incoming shorter than recorded skeleton defeats the #4778 length gate and the #5686 verbatim-tail rung; zero assistant turns defeats all mainShaped gates). A fix can therefore only add an evidence channel that survives a full compaction — and the only such artifact is bili's own forged checkpoint header (conv= declaration). E5 trusts exactly that, pinned to the version-pinned producer format. That is fixing at the decision point, not masking a symptom: a looser similarity match or a blanket "shorter incoming ⇒ stay put" would have reopened the mis-attribution class the identity ladder exists to prevent.
Correctness. I verified the regex against the producer byte-for-byte (src/server/dsh-authored-compaction.ts — conv IS the first attribute of the header; [^>]* cannot cross an earlier >, so any producer format drift degrades to a safe MISS, never a false claim). Placement-first is safe because every other tagChanged rung calls the identical record(rawId, turns, tagHash, effectiveModel) + reanchor — E5 only changes which reason string wins, not what gets recorded. Scope checks: stamped dsh sidecars (the #4438 class whose blobs quote checkpoints inside FILTERED_HISTORY) are filtered by sideRequestLike at all four dsh sites in src/server/handle.ts before ever reaching the resolver; token'd dispatches hit the laneToken branch before the recorded lookup; non-dsh hosts never carry bili-authored checkpoints (single producer) ⇒ no cross-host surface. The local pin instead of a server import preserves the server-free direction of session-resolve.ts; hex-escape convention (KDD#2) followed; no config surface added, deliberately no rollout switch (gate maximally strict, sole producer = dsh-authored compaction) — documented in body + CHANGELOG.
Regression audit — existing behaviors in the touched path, itemized:
| Behavior | Conclusion |
|---|---|
| E1 head-align (#2241/#2250), E2 model-switch (#2601/#2817), chain rung, E4 continuation (#4778), fifth rung (#5686), fork default | Preserved — E5 fires only on the exact self-declared marker shape; acceptance-3 test pins every pre-existing reason string byte-stable without the marker; control test proves the same shape minus the marker still forks |
| External persona borrowing the id quoting a checkpoint (foreign conv / marker in later user message / marker in system message) | Preserved — forks onto its own ` |
| Tag-unchanged continue/claim paths, first-sight anchoring, laneToken lanes, stamped sidecars | Untouched / gated out (code path unmodified or filtered upstream) |
| Disclosed behavior change | full-compaction + drift same-turn shape: always-forks → re-anchor-on-self-declaration. Disclosed old→new in body + CHANGELOG; no other shape changes |
| Cache / retry / cursor / dedup strategies | Not affected (no persistence-format, throttle, or watermark interaction) |
Tests. Six hermetic tests drive the real resolveSessionOrder through claim → compaction → next-request cycles: acceptance 1 (re-anchor + no fork + parent keeps updating), acceptance 2/2b (fork boundaries), four wire shapes, acceptance 3 (rung reasons byte-stable). They have teeth both directions — remove E5 and acceptance-1 fails; over-fire E5 and 2/2b fail. I ran them locally at both heads (all green, plus the 11 cited regression suites + typecheck at the original head).
The two added ci-fixes commits (now part of this PR). 0470bec62 + merge: test-only realignment (+86/−49, 6 files) of five pins that went born-red when #5656's generic dsh single-shot sidecar gate landed on master (premise commit 01fcc5d68 confirmed ancestor of master). I checked each hunk for masking rather than trusting the label: the four guard-stamp tests move the BLOCKED-ref assertion to the first full-pipeline turn (turn 2) — teeth intact, a guard regression still yields a normal ref ⇒ still fails, and no fold can happen before turn 2; #2817's request counts shift −1 (turn 1 rides the uncounted side lane) with fork assertions untouched; the #5418 golden asserts rb[0] unstamped in BOTH phases (the gate predates the feature and ignores rollout env) with byte-equality preserved. Legitimate born-red convergence per the #4599 policy; no src/kernel/config changes.
CI. At the original head 30a8bc2d0, 10 test shards were red — I pulled the ubuntu-22-1 shard logs for both SHAs: the 4 failing subtests are byte-identical to master's own failures (exactly those five-pin set, shard pass 3359/fail 4) ⇒ 100% inherited red, zero PR-specific failures. The ci-fixes merge addresses exactly those; the re-run on 6939ad3e is now fully green (30/30) per the mirror cache.
结构化八问(中文结论)
- 是什么问题:全量压缩(checkpoint 整体替换历史头部)与 persona 文本漂移落在同一回合时,resolveSessionOrder 的全部位置学重锚证据同时失效,主会话被确定性分叉到
|sub:车道——父记录冻结、继承断裂、从零重压。 - 什么原因导致的:根因是结构性的——既有各条逃生梯都依赖"被压缩掉的旧尾仍留在重发历史里",而全量压缩按定义抹掉了它;缺一条能在整段重写后存活的证据通道。
- 影响范围与严重程度:dsh 插件车道、全量压缩与系统文本漂移同回合触发的会话——该会话的压缩/继承能力完全不可用(事故实例后续 3 次再压缩 + 1 次拒绝 + 2 次截断)。p1 级可用性缺陷面。
- 怎么修复的:在 tagChanged 分支最前加 E5 梯——只扫首条 user 消息,匹配 bili 自己铸造的版本钉死标记
<bili-snapshot v1 … conv="<raw id>"…/>,声明成立即原地重锚到原始车道。信任边界 = bili 自身产物;格式漂移只会退化为旧行为(MISS),永不误认领。 - 是否有回归问题:无。既有行为逐条清点见上表:所有无标记形状逐字节不变(测试钉住各梯 reason 字符串),外部 persona 借 id 引用 checkpoint 照旧分叉(三个专项测试),token'd 分发与 sidecar 在到达解析器前被门控排除。唯一行为变更已披露(always-forks → 自声明时重锚)。
- 是否破坏缓存:不涉及——不动持久化格式、水位、重试/去重策略。
- 是否改了设计方向:不涉及——沿用既有梯子机制与身份层级教义,只新增一条自证证据通道,不引入新架构。
- 是否引入了新的配置:不涉及——刻意不加开关(门控最严、单一铸造者),PR 正文与 CHANGELOG 均已说明。
判定:可合(APPROVE)。代码、测试、披露、diff 整洁度均达标;CI 继承红已由 ci-fixes 收敛,当前 head 全绿。
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) PR #5734 review 完成,判定:APPROVE @ 审查范围(分支审查中途移动,两个 head 都覆盖):
已执行动作:
|
|
—第一条 user 消息携带我方 \x3cbili-snapshot v1 …\x3e 身份头且 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 好问题——把「身份」拆开看:E5 校验的身份就是头里的 1. 正常运行:不变,可重复命中。 每次 full compaction 都会用当前 2. 会 miss 的场景 A——格式/版本漂移(唯一需要纪律约束的一种): 未来某版 bili 改了头的字节(属性改名/重排/v2),本地钉死的正则( 3. 场景 B——宿主真的轮换 session id: 旧头的 conv ≠ 新 raw id → 不命中。但这是正确的:轮换后的新 id 在账本里没有记录,走的是 first-sight anchoring,根本到不了 E5(E5 只在「raw id 下已有记录 + tag 变了」的分支里)。不会发生「拿旧身份认领新会话」。 4. 场景 C——第一条 user 消息不再带头: 某种非 authored-compaction 的历史改写把 checkpoint 消息删掉/替换了 → miss → fork。这是机制的诚实边界:E5 只信「头部还在场时的自声明」,不猜。 另外两点补充:
|
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1061-master.1f2efba # this exact build
npm install -g billion-context@master # always the newest merged build
|
… rung order (30a8bc2) Upstream 30a8bc2 (merged via #5734 on Nov 6) made an authored-checkpoint conv declaration re-anchor on the raw lane BEFORE the store-overlap rung, and even when the store view is null — its own commit message documents 'this shape went from forks to re-anchors'. It added tests/issue5719-self-checkpoint-reanchor.test.ts but did not realign T1/T8 of this older suite, leaving every old-base PR (and the main branch itself) red on exactly those two pins. T1 now pins the self-declaration reason string (same outcome asserts kept: key raw + action reanchor); T8 now expects reanchor on the raw key where it previously expected the byte-evidence degrade to derived-persona/sub-fork. Marker-less shapes untouched (their pins still pass unmodified).
… rung order (30a8bc2) Upstream 30a8bc2 (merged via #5734 on Nov 6) made an authored-checkpoint conv declaration re-anchor on the raw lane BEFORE the store-overlap rung, and even when the store view is null — its own commit message documents 'this shape went from forks to re-anchors'. It added tests/issue5719-self-checkpoint-reanchor.test.ts but did not realign T1/T8 of this older suite, leaving every old-base PR (and the main branch itself) red on exactly those two pins. T1 now pins the self-declaration reason string (same outcome asserts kept: key raw + action reanchor); T8 now expects reanchor on the raw key where it previously expected the byte-evidence degrade to derived-persona/sub-fork. Marker-less shapes untouched (their pins still pass unmodified).
… rung order (30a8bc2) Upstream 30a8bc2 (merged via #5734 on Nov 6) made an authored-checkpoint conv declaration re-anchor on the raw lane BEFORE the store-overlap rung, and even when the store view is null — its own commit message documents 'this shape went from forks to re-anchors'. It added tests/issue5719-self-checkpoint-reanchor.test.ts but did not realign T1/T8 of this older suite, leaving every old-base PR (and the main branch itself) red on exactly those two pins. T1 now pins the self-declaration reason string (same outcome asserts kept: key raw + action reanchor); T8 now expects reanchor on the raw key where it previously expected the byte-evidence degrade to derived-persona/sub-fork. Marker-less shapes untouched (their pins still pass unmodified).
ranxianglei#5719 pin realignment + the ranxianglei#5854 revert Upstream moved bebc239 -> 21c950e (14 files). Relevant to this lane: - 151efca test(ranxianglei#5719): realign two stale pins after ranxianglei#5734 changed the re-anchor rung order (30a8bc2). This is the fix for the red I reported on ranxianglei#5176: 30a8bc2 added the E5 self-checkpoint rung without updating T1/T8 of tests/issue5719-msgid-lane-identity.test.ts, so every branch (master included) was red on exactly those two pins. The suite is 8/0 on the merged tree. - 66aadbd + bebc239: the ranxianglei#5854 revert of the fastpath-v6 lane, adopted earlier in 42ece0f6a and still absent from this merge's diff (already present in the lane). - src/cache-keepalive.ts / cache-ledger.ts / served-markers.ts / src/server.ts / upstream-throttle.ts + their tests: no overlap. Overlap: src/server/relay.ts only, and the merge was automatic (my ranxianglei#5176 non-streaming egress at :2062 and the upstream hold path do not cross). Verification on the merged tree (kernel rebuilt, treeless farm): issue5175-drift-lane-leak 58/0, tag-echo 79/0, issue2190-degen-close 32/0, golden-storage-render 5/0, storage-engine-proofs 12/0, native-compact-terminal 1/0, issue4666-migration-dedup 2/0, issue5719-msgid-lane-identity 8/0 (was 6/2). tsc --noEmit 0; four gates 0; config docs fixed point 0.
What
A full dsh compaction (#3733 authored checkpoint — one user message replacing the entire history head) landing in the same turn as a persona-text drift (e.g. dsh restart reallocating its GUI port into the system prompt; dsh-side trigger tracked separately under #5517) makes every positional re-anchor rung in
resolveSessionOrder'stagChangedbranch structurally unreachable:mainShapedgate).Result: the live conversation deterministically forks onto
<id>|sub:<fp16(new tag)>while the parent record freezes — resume-inheritance miss, compression state orphaned, re-compression from zero (incident 2026-11-02: 3 more compactations + 1 REFUSED turn + 2 max-tokens truncations on the sub lane the same day). Counterfactual: the identical 14-cell history with an unchanged system text stays on the main lane — the outcome differs by five port digits.The self-declaration embedded in bili's own authored checkpoint (
<bili-snapshot v1 conv="<rawId>" …/>, forged bysrc/server/dsh-authored-compaction.ts) is the one continuation proof that survives a full compaction — the resolver never read it.Fix
New E5 rung, placed FIRST in the
tagChangedbranch (strongest evidence, cheapest check; all rungs call the samerecord(), so placement only changes which reason string wins):convbyte-equal to the raw id;reanchoronto the raw lane —record()moves the recorded tagHash to the new tag, so the next request is tag-unchanged and simply continues. The|sub:fork never happens and the parent lane unfreezes.If the marker bytes ever drift, the scan degrades to a MISS (pre-fix fork behavior) — never to a false claim (same version-pin doctrine as
dsh-compaction-guard.ts).Safety (why external personas cannot ride this)
sideRequestLikegate insrc/server/handle.ts) — even though [Bug][dsh] 0.1.204: auto-review side request collides with the main session → false native-compaction rebase → aux usage skips #453 clamp → permanent upstream 400 #4438 proved those blobs DO quote landed checkpoints inside FILTERED_HISTORY;conv≠ raw id, or the marker sits in a later user message (the scan stops at the first).Behavior change (old → new)
This exact shape went from always forks to re-anchors onto the raw lane when the first user message carries a self-authored checkpoint declaring that id. Every marker-less shape is byte-identical — the regression suite pins each pre-existing rung's reason string unchanged (E1 #2241/#2250, E2 #2601/#2817, E4 #4778, fifth rung #5686, fork default).
Config surface
None. No new env var / config key / CLI flag. A rollout switch was considered and deliberately not added: the gate is already maximally strict (self-forged marker format + exact conv equality + first-user-message-only; the sole producer is dsh-authored compaction).
Relationship to prior work
Tests
tests/issue5719-self-checkpoint-reanchor.test.ts— acceptance criteria 1/2/3 from the issue + four wire shapes + foreign-quote boundaries (foreign conv, late marker, marker-in-system).Closes #5719