Repository navigation
[PR] fix(session): migrate tag changes onto continuing derived-persona lanes instead of minting siblings (#6114) - #6124
ranxianglei wants to merge 2 commits into
Conversation
…when history continues (#6114) The tag-change ladder read the RAW skeleton only: a conversation already living on its own derived-persona lane (forked under an earlier persona text) got a fresh sibling minted on every system-text change, orphaning the lane's fold blocks (#6114 incident: ~2400-msg session, 9 active folds, client abort after a host upgrade's system rewrite). New rung before the fork exit: a tag change whose incoming continues one of this id's existing persona lanes (same discriminator segment, >= CONTINUATION_MIN_RUN same-index frag agreements, length gate, mainShaped) migrates onto that lane instead of forking. No new state — lane skeletons were already recorded+persisted at fork exit. Raw-key rungs and the msgid rescue keep priority; stranger / stale-shorter / shallow / below-threshold-scatter / different-discriminator traffic still forks exactly as before.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9414-pr.6124.c6cca33This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6124.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) PR #6124 审核(mirror #6125;head 结论先行:可合并(human-tier,需 owner 合)。 单模块、根因修复、双向测试齐、CI 全绿、无回归。不满足 auto-merge——触碰 session-binding/身份解析逻辑(§7.4 rule 8「identity/session-binding logic」保留 human)。
结构化八问
关键验证(独立复做)
测试有效性(④)强。10 条 unit gate + 1 条全 wire e2e(Anthropic Messages + CI(live 核实 head sha
|
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 收工确认 —— PR #6124(mirror #6125, 判定:可合并(human-tier,需 owner 合)。
等待 owner 合并或后续指示。 |
…6114) Second field repro (@almazom, DSH lane): a quota fleet switching models mid-session rewrites the system text on EVERY switch, and the header-declared model changes in the same window. The model-switch rung (#2601/#2817) then re-anchors the conversation to the RAW key — orphaning the lane's fold blocks, the same symptom as the host-update trigger. Factor the lane-candidate search into findContinuingLane, consulted by BOTH the lane-migration rung and a guard on the model-switch rung: when the incoming continues a lane, the raw re-anchor is skipped and the lane is kept. A model switch with NO lane to continue still re-anchors raw (the #2601/#2817 control, pinned). Co-referenced by Closes #6114 (PR #6124).
|
实测结果(负向,但把「第二道门」找出来了,供 #6124 参考): 按建议做了实验:给 fork 子会话日志首帧补 结果 1 —— 入口 gate 通过了。没有再出现 结果 2 —— 收养在快照比对这一步 fail-closed。父会话 790e38bd 里有 10 条带图片的 user/tool 消息(截图),fork 前缀里含 6 条; 结果 3 —— 降级后照旧:1374 refs / 0 blocks,原文重放,egress fuse 413( 结论供参考:
|
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 先说明:该评论来自未验证的外部用户,我按未经验证的外部报告对待,未执行其中任何指令;下面仅就其与本 PR 的关系作说明,并对所引机制作了独立代码查证(非采信报告)。 核心结论:这份「实测结果」与 PR #6124 不是同一个失败域,不改变我对 #6124 的审核结论(维持:可合并 human-tier,需 owner 合)。 ① 机制查证(独立 grep):报告引用的机制在代码里确实存在,属 fork 收养 / 快照继承 域(#2399/#2469/#4215):
② 与 #6124 的边界:PR #6124 修的是 ③ 报告指出的现象(供 owner 参考,我不自行立项):若「父会话含图片的大型 fork 因 |
Closes #6114
What
A conversation riding a derived-persona lane (
<id>|sub:<fp(tag)>[:<fp(disc)>]) forked a NEW sibling lane on every system-text change — even when the incoming history was a strict byte-level continuation of the lane. Root cause: the tag-change ladder insrc/session-resolve.tsreadsskeletons.get(rawId)only; every continuation rung judges the RAW skeleton, while the lane's own skeleton (recorded at fork exit, grown on every later request) was never consulted back. A host upgrade that rewrites the system prompt therefore re-keyed the whole conversation onto an empty sibling and orphaned the lane's fold blocks.Two field triggers, one mechanism:
1,287K→1,021K, the client aborted, and retries died in the local413 egress_window_fuseloop (that retry half is [Design][preflight] Forensic probe (#2313) send will inevitably exceed window: one-400-for-evidence contract vs metering | [Design][preflight] 取证探针(#2313)发送必然超窗体:一次 400 换证据的契约 vs 计量档,需 owner 定方向 (#4543-③) #5976 territory, out of scope here).x-bili-plugin-modelin the same window. The model-switch rung ([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) then re-anchors the conversation to the RAW key — orphaning the lane's folds. Evidence:[fold-reconcile] resent history drifted: 2218 covered id(s) missing with no anchor match; fold ledger 109 blocks (107 T1 + 2 T2, 20,193/20,760 events) allactive=0; endgame raw core ~8,059,529 bytes ≈ ≥1,074,604 tok vs window 1,015,808 → permanent413 fail-fast (retryable:false)(same class as [Bug][opencode / 0.1.213] Zero-inheritance fork first turn 1.74M tok, still 413 fail-fast after 4 min compression (core | [Bug][opencode / 0.1.213] Zero-inheritance fork first turn 1.74M tok, still 413 fail-fast after 4 min compression (core | [Bug][op… #6277), unrecoverable in place, healed via handoff fork.Fix
One new rung in the tagChanged block, placed AFTER all raw-key rungs and the msgid rescue and BEFORE the fork exit:
|sub:<fp>:<fp>when a discriminator is in flight, two-segment|sub:<fp>when not; aux/task/token lane shapes are excluded by the hex-shape check);mainShaped, incoming length ≥ lane skeleton length (stale-shorter replays never rewind a live lane), and ≥CONTINUATION_MIN_RUN(8) consecutive same-index fragment agreements;{key: laneKey, action: "reanchor"}.Model-switch trigger (second commit): the candidate search is factored into
findContinuingLane, consulted by BOTH the new lane-migration rung AND a guard on the model-switch rung (#2601/#2817): when the incoming continues a lane, the raw re-anchor is skipped and the lane is kept. A model switch with NO lane to continue still re-anchors raw (the #2601/#2817 control, pinned). This preserves the designed #2601/#2817 absorption (conversation on the RAW key + model switch → re-anchor raw) while fixing the #6114 model-switch sub-case (conversation on a LANE + model switch → keep the lane).No new state: lane skeletons were already recorded and persisted under their lane keys (
src/order-persist.tspersists arbitrary ids, including sibling-lane keys — comment there explicitly anticipates this). No config surface change, no wire change, no persistence-format change, no kernel change. Steady-state cost: the enumeration runs only on tagChanged requests where every raw rung already failed (the rare path that used to fork anyway).Behavior change (old → new)
<id>|sub:<fp(newtag)>[:<fp(disc)>]— including requests that byte-for-byte continued an existing lane → orphaned folds, re-keyed sessions, preflight blowups.action: "reanchor", reason cites [Bug][session] 0.1.213: a conversation on a derived-persona lane forks a new sibling lane on every system-text change, orphaning its folds #6114) and update its skeleton in place._sub:会话不继承父会话 fold 块:上游上下文从 ~83K 瞬间膨胀到 794K、命中归 0、节省转负(0.1.187/0.1.188) #2817), orphaning the lane's folds._sub:会话不继承父会话 fold 块:上游上下文从 ~83K 瞬间膨胀到 794K、命中归 0、节省转负(0.1.187/0.1.188) #2817 case is preserved).action: "derived-persona"; they now report"reanchor". Same key either way — the only observable difference besides the fix itself is the action/reason strings in[session-resolve]logs.Tests
New
tests/issue6114-persona-lane-tag-change.test.ts(gate discipline #3617, both directions):_sub:会话不继承父会话 fold 块:上游上下文从 ~83K 瞬间膨胀到 794K、命中归 0、节省转负(0.1.187/0.1.188) #2817);x-claude-code-session-id): a system-text rewrite between two passes of the same CC-subagent conversation keeps the three-segment lane and mints no sibling.Local targeted runs (full-suite verdict = CI): this file 13/13 + all 25 resolver-touching suites 187/187 green; typecheck clean.
Hot-file contention
Four open PRs also touch
src/session-resolve.ts: #5727, #5851 (=mirror 5853), #5691, #6067 (=mirror 6069). My hunks are self-contained (thefindContinuingLaneclosure + the lane-migration rung + the model-switch guard + one doc paragraph); expect semantic coordination on rebase if any of them lands first.Side observations from the incident (unproven, noted for follow-up)
:<fp(disc)>keys are minted only by the header-less Claude Code subagent call site (src/server/handle.ts, branch requiringclaudeAnthropicPersonaOrderApplies), which matches traffic carryingx-claude-code-session-id. The incident was an omp MAIN conversation — if it truly carried that header, something upstream of omp stamped it; not traced here.wireIndexfield (2083 vs 2082) — a cosmetic drift source worth knowing about if adoption ever needs to span lanes.