Skip to content

[PR] fix: keep the live conversation on its raw lane when a full compaction lands with a persona-text drift (#5719) - #5734

Merged
ranxianglei merged 3 commits into
masterfrom
2026-11-05_e5-self-checkpoint-reanchor
Nov 7, 2026
Merged

ranxianglei merged 3 commits into
masterfrom
2026-11-05_e5-self-checkpoint-reanchor

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

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's tagChanged branch structurally unreachable:

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 by src/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 tagChanged branch (strongest evidence, cheapest check; all rungs call the same record(), so placement only changes which reason string wins):

  • scan ONLY the first user message (content-blind extraction over all four wire shapes: string content / openai+anthropic parts / responses items / google parts);
  • match our own version-pinned identity-header format; require conv byte-equal to the raw id;
  • on match: reanchor onto 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)

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

  • New: 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).
  • Local targeted suites green (112 tests): 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. typecheck + build clean. Full-suite verdict: CI.

Closes #5719

ework-agent and others added 2 commits November 5, 2026 14:36
…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.
@ranxianglei ranxianglei changed the title fix: keep the live conversation on its raw lane when a full compaction lands with a persona-text drift (#5719) [PR] fix: keep the live conversation on its raw lane when a full compaction lands with a persona-text drift (#5719) Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-05_e5-self-checkpoint-reanchor (6939ad3)

Latest build — install this exact version

npm install -g billion-context@0.0.8248-pr.5734.8f84bd1

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
6939ad3 billion-context@0.0.8248-pr.5734.8f84bd1 build
30a8bc2 billion-context@0.0.8234-pr.5734.0b5057d build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

当前状态(初报,随后补结构化八问):

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

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

结论:代码审核通过;CI 红已处置(继承性失败,已 merge ci-fixes 进 PR 分支并推送,head 现为 6939ad3ed,等 CI 重跑)。CI 绿后请 owner 合并。

结构化八问

  1. 是什么问题:dsh 全量压缩(bili-authored client compaction: let the host's own compaction flow run, but bili writes the checkpoint #3733 authored checkpoint)和 persona 文本漂移(dsh 重启后 GUI 端口重分配写进 system prompt)落在同一轮时,活着的会话确定性地分叉到 <id>|sub: 副车道——父车道记录冻结、压缩状态孤儿化、从零再压缩。
  2. 什么原因导致的:tagChanged 分支的全部既有 re-anchor rung 都要求字节级续接证据(记录的尾部、长度门、assistant 形状),而全量压缩按定义把这些证据全部抹掉;唯一能存活压缩的自足证明——bili 自己铸造的 checkpoint 内嵌的 conv="<rawId>" 自声明——判定层从未读取。修的是根本原因(判定器缺一条证据维度),不是堵症状。
  3. 影响范围与严重程度:仅 dsh 插件车道「全量压缩 + 系统提示漂移同轮」这一形状。触发时会话仍可用但压缩状态整体丢失(resume-inheritance miss、重复全量再压缩、成本激增),属状态/缓存泄露类 p1。事故当天实测:同一会话又触发 3 次再压缩 + 1 次 REFUSED turn + 2 次 max-tokens 截断。
  4. 怎么修复的:tagChanged 分支最前新增 E5 级——第一条 user 消息携带我方 \x3cbili-snapshot v1 …\x3e 身份头且 conv 与当前 raw id 逐字相等 → 直接 re-anchor 回主车道(record() 同步更新 tagHash,下一轮即普通 continue)。标记格式本地版本钉死(producer 字节漂移 → 扫描降级为 MISS = 修复前分叉行为,永不假认领)。外部 persona 引用 checkpoint 不受影响,stamped sidecar 到不了判定层(sideRequestLike 门,[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),无标记辅助请求走非锚定路径,外来标记因 conv 不符或不在第一条 user 消息而失败——两条独立防线。
  5. 是否有回归问题:逐一审过既有行为——纯增量改动,既有 rung 全部逐字未动(E1 [[bug] dsh 0.1.185: main lane forks itself on a mid-session model switch, orphaning the persona anchor — every native compress is refused (9/9, not covered by #2157) #2241/codex 线 responses 身份仍走 instructions-hash subagentNamespace:同 id 下 instructions 中途变更会 fork 主 lane 丢压缩(#2241 同款暴露,未审计) #2250、E2 [Bug] dsh 会话反复 model/provider 切换时主对话迁移到 |sub:<fp> persona fork,宿主盖章的 compress/decompress/acp_status 仍解析在陈旧父 id —— ref 跨空间不可解析直至熔断 #2601/[Bug] dsh 车道切模型 fork 出的 _sub: 会话不继承父会话 fold 块:上游上下文从 ~83K 瞬间膨胀到 794K、命中归 0、节省转负(0.1.187/0.1.188) #2817、post-restart chain、E4 [bug][dsh] Goal auto-continuation forks the main conversation into an empty |sub: lane → ~6M-token preflight, session ne | [bug][dsh] Goal auto-continuation forks the main conversation into an empty |sub: lane → ~6M-token preflight, session never replies… #4778、第五级 dsh Long-Session Drift Comprehensive Remediation: Sealing the Last Leak Window for Native Compression Local Deployment + | dsh 长会话漂移综合治理:堵死原生压缩本地落地的最后漏窗 + 会话身份分叉可见化与自愈 #5686、fork 默认键格式),fork 键与旧阶梯字节兼容(持久化 fork 车道跨升级存活);tag-unchanged 路径、首见 claim、laneToken 短路均不触碰。回归测试钉住每条既有 rung 的 reason 文案 byte-stable(验收 3)+ 无标记对照例仍分叉(负向钉)。本地定向验证:typecheck clean + 18 文件/130 测试全绿(新测试 + persona 连续性族 + ci-fixes 重对齐的 6 个文件);全量判决以 CI 重跑为准。有意行为变更披露(旧→新+原因):该精确形状从「必然分叉」变为「带自声明时 re-anchor 回主车道」——即本 bug 修复本身;所有无标记形状逐字节不变。
  6. 是否破坏缓存:不涉及 wire 渲染或锚点字节,只改会话键归属决策;re-anchor 反而恢复了原车道压缩状态的连续性(修复的正是状态孤儿化导致的重复计费)。
  7. 是否改了设计方向:没有。在既有 tagChanged 阶梯内加一条证据 rung,沿用 record()/reason 既有模式;E6/E1′ 明确未实现(保持最小面)。
  8. 是否引入新配置:没有。考虑过 rollout 开关但刻意不加(门极严,唯一 producer 是 dsh-authored compaction)。

CI 处置(按 #4599 协调规则):接手时 10/30 shard 红,失败签名全部落在 ci-fixes 哨兵提交 0470bec62(五个 dsh pin 重对齐)覆盖的 6 个文件内 = 继承 master 红,非本 PR 引入 → 已 merge origin/ci-fixes 进 PR 分支推送(head 6939ad3ed),并在 #4599 留了一行状态。

热文件提示: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

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

本 PR 代码零缺陷;CI 红是继承 master 的红风暴,已清除,剩一枚已知负载 flake 已触发重跑。 本轮无需 owner 决策(非设计取舍、非授权卡点)。

结构化结论

  1. 是什么问题: 本 PR([PR] fix: keep the live conversation on its raw lane when a full compaction lands with a persona-text drift (#5719) #5734)自身没有引入任何 CI 失败。报上来的 10+ 个红 shard 全部是继承自 master 的确定性红风暴,与本 PR diff 无关。
  2. 什么原因导致的: master 自 01fcc5d68([PR] fix: unknown dsh one-shot sidecars steal the raw-key anchor and kill compression (context-explosion root cause) #5687 合入的 dsh generic single-shot sidecar gate)起,isDshSingleShotSidecar()(src/server/side-request.ts)把「无 tools + 非空 system + 恰好一条 user」的 dsh 首轮请求整体转入 verbatim side lane(kernel no-touch),导致三族回归钉确定性红——① issue2419/2446/2447/2481 的 BLOCKED-ref 断言、② #2817 crosswire persona fold、③ #5418 watermark fastpath A/B。本 PR 只改 src/session-resolve.ts(E5 self-checkpoint re-anchor rung)+ 一枚新测试 + CHANGELOG,与这三族的机制和文件零交集(E5 rung 在 tagChanged 分支,这三族测试均不触达)。
  3. 影响范围与严重程度: 仅 CI 合并门禁被阻塞(全体 PR 继承同红);无运行时行为影响(turn 1 之前无可压缩内容,保护语义不受损)。
  4. 怎么修复的: 按 CI 协调政策(owner 2026-10-24),继承红收敛到常驻分支 ci-fixes —— origin/ci-fixes(tip 0470bec62,test-only 五钉对齐)已由兄弟车道 merge 进本分支,当前 head = 6939ad3ed8。我本地独立做了同样的 merge 并验证:与远端分支树逐字节一致、零冲突,因此不重复 push(改写他人 merge commit 属无效 churn)。本地定向复跑三族文件 + 本 PR 回归测试 issue5719-self-checkpoint-reanchor = 12/12 全绿。
  5. 是否有回归问题: 无。ci-fixes 只动 6 个测试钉文件,与本 PR src 零交集;merge 后本地全绿。
  6. 是否破坏缓存: 不涉及(不触碰缓存/重试/游标/去重策略)。
  7. 是否改了设计方向: 不变。
  8. 是否引入新配置: 无。

剩余项(非本 PR 自致): 重跑后 run 42018550101 权威终态 25/27 绿,唯一红 test (windows-latest, 22, 5) = msgid-lane-flow settle-race 负载 flake(#4599 floor 903 家族,多处登记)。证据:本地该文件 6/6 全绿;同树其余 shard 均绿;失败签名(delta ids append,actual 短于 expected)与该 flake 历史一致;与本 PR 及 ci-fixes 无关。已触发 rerun-failed-jobs(HTTP 201),待 attempt 2 转绿。另注:镜像 upstream-checks 缓存本轮 fetched_at 停在 11:37Z 未刷新,完成判定走了一次权威直取(非轮询)。

判定: 可合 —— 继承红已清、本 PR 代码经本地定向验证零回归;剩一枚已知负载 flake 重跑即可转绿,无需人工介入。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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.

结构化八问(中文结论)

  1. 是什么问题:全量压缩(checkpoint 整体替换历史头部)与 persona 文本漂移落在同一回合时,resolveSessionOrder 的全部位置学重锚证据同时失效,主会话被确定性分叉到 |sub: 车道——父记录冻结、继承断裂、从零重压。
  2. 什么原因导致的:根因是结构性的——既有各条逃生梯都依赖"被压缩掉的旧尾仍留在重发历史里",而全量压缩按定义抹掉了它;缺一条能在整段重写后存活的证据通道。
  3. 影响范围与严重程度:dsh 插件车道、全量压缩与系统文本漂移同回合触发的会话——该会话的压缩/继承能力完全不可用(事故实例后续 3 次再压缩 + 1 次拒绝 + 2 次截断)。p1 级可用性缺陷面。
  4. 怎么修复的:在 tagChanged 分支最前加 E5 梯——只扫首条 user 消息,匹配 bili 自己铸造的版本钉死标记 <bili-snapshot v1 … conv="<raw id>"…/>,声明成立即原地重锚到原始车道。信任边界 = bili 自身产物;格式漂移只会退化为旧行为(MISS),永不误认领。
  5. 是否有回归问题:无。既有行为逐条清点见上表:所有无标记形状逐字节不变(测试钉住各梯 reason 字符串),外部 persona 借 id 引用 checkpoint 照旧分叉(三个专项测试),token'd 分发与 sidecar 在到达解析器前被门控排除。唯一行为变更已披露(always-forks → 自声明时重锚)。
  6. 是否破坏缓存:不涉及——不动持久化格式、水位、重试/去重策略。
  7. 是否改了设计方向:不涉及——沿用既有梯子机制与身份层级教义,只新增一条自证证据通道,不引入新架构。
  8. 是否引入了新的配置:不涉及——刻意不加开关(门控最严、单一铸造者),PR 正文与 CHANGELOG 均已说明。

判定:可合(APPROVE)。代码、测试、披露、diff 整洁度均达标;CI 继承红已由 ci-fixes 收敛,当前 head 全绿。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

PR #5734 review 完成,判定:APPROVE @ 6939ad3e。

审查范围(分支审查中途移动,两个 head 都覆盖):

已执行动作:

@ranxianglei

Copy link
Copy Markdown
Owner Author

—第一条 user 消息携带我方 \x3cbili-snapshot v1 …\x3e 身份头且
这个身份是否会变化导致miss

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

好问题——把「身份」拆开看:E5 校验的身份就是头里的 conv 属性,它是压缩那一刻由 bili 自己盖上去的 raw session id(src/server/dsh-authored-compaction.ts:46:conv="${session.id}"),E5 侧只要求它与当前 resolver 的 raw id 逐字节相等(src/session-resolve.ts:200)。会不会变、变了会怎样,分四种情况:

1. 正常运行:不变,可重复命中。 每次 full compaction 都会用当前 session.id 重新盖头(生产者跑在压缩时刻,不是缓存旧值);一次 reanchor 成功后 record() 已把记录的 tagHash 移到新 tag,后续请求走 tag-unchanged 路径根本不再进 E5;若之后再次漂移(又重启换端口),tagChanged 再触发 E5,而第一条 user 消息是最新那个 checkpoint(full compaction 每次替换整个头部),仍盖着同一个 conv → 照样命中。所以「同会话反复压缩 + 反复漂移」的循环是被覆盖的。

2. 会 miss 的场景 A——格式/版本漂移(唯一需要纪律约束的一种): 未来某版 bili 改了头的字节(属性改名/重排/v2),本地钉死的正则(src/session-resolve.ts:171)就匹配不上 → miss → 回退到修复前的 fork 行为。这是设计选择而非疏漏:代码注释里写明了 doctrine(L164-170)「producer 字节漂移 ⇒ MISS,绝不假认领」。代价是退化、不是事故。配套纪律:以后改 renderDshAuthoredCheckpoint 的头格式,必须同步这个钉死的正则(两处常量刻意不共享导入——本模块要保持 server-free + detector 常量本地化的既有教义)。

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 只信「头部还在场时的自声明」,不猜。

另外两点补充:

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1061-master.1f2efba (rolling master tag).

npm install -g billion-context@0.0.1061-master.1f2efba  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

ranxianglei added a commit that referenced this pull request Nov 7, 2026
… 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 added a commit that referenced this pull request Nov 7, 2026
… 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 added a commit that referenced this pull request Nov 7, 2026
… 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).
Louie0806 added a commit to Louie0806/billion-context that referenced this pull request Nov 7, 2026
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.
@github-actions github-actions Bot mentioned this pull request Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant