Repository navigation
[PR] fix(session): keep a conversation on its main lane when full-compaction destroys the byte evidence — sessionid+host-msgid last-resort identity (#5719) - #5759
Conversation
…of forking a zero-state lane A full dsh compaction (one checkpoint user message replacing the middle of the conversation) landing in the SAME TURN as a volatile-field rewrite of the static system prompt (the Web-GUI port digits, #5517) defeats every byte-level continuation rung in resolveSessionOrder simultaneously — the rungs need fragments/cells/chain continuity and the compound event deletes all of them. The resolver then FORKED `<raw>|sub:<fp>`: a lane with zero state under an UNCHANGED client session id (issue #5719), which re-stamped timestamps/refs/lineage from scratch on every restart window and left the UI showing two lanes for one conversation. Host-minted per-message ids survive BOTH destructive forces. dsh stamps a stable UUID on every canonical message and re-sends them verbatim after a restart or compaction (the #4491 biliMsgIds body field), so ANY overlap between the ids riding the incoming request and the msg_ids RECORDED under the key proves same-conversation with a random-collision probability near zero — no threshold tuning, unlike simhash or content fingerprints. Single source of identity evidence (owner ruling: the JSON recording surface is being deprecated; do not add to it): - recorded side = the UNIFIED STORE's messages.msg_id column, already pinned at ingest by #4491 (validateMsgIds/applyMsgIdPin). The lookup used is #5312's getStore().unifiedAllMessageIds(key) — the FULL historical id set of a key (live AND retired rows; retire-don't-delete, #4390), identity-only SELECT with no content hydration, and null on an unavailable store. No parallel id ledger anywhere: session-order skeletons stay byte-level only, order-persist.ts is untouched by this change. - inbound side = incomingMsgIdsOf(body) in src/msgid-pin.ts: the same degrade-over-mispair discipline as validateMsgIds (#4491: malformed array => treat the field as absent, never half-trust it). No length-equals-messages contract here — compressed resends have uneven windows, and any-overlap is the proof we need (strict pinning stays with validateMsgIds). Semantics — presence-gated, last resort, all lanes: - resolveSessionOrder / personaConversationOrder gain two trailing optional params (msgIds, readStoredMsgIds); every existing call site is source-compatible. Requests that carry no stamped ids take EXACTLY the pre-change path — nothing about claim/match/reanchor/fork precedence changes unless both sides are present. - readStoredMsgIds is LAZY by contract: invoked at most once, and only at a fork exit with non-empty inbound ids. null return (store latch-off, legacy epoch, #4407/#5536 auto-disable) degrades to the byte-evidence only path. The underlying read is `SELECT msg_id` — cheap on long sessions too. - at each of the three fork exits (persona lane, derived-task grown, derived-task short): non-empty intersection => record() back onto the raw id + return {action: "reanchor"} with a reason naming the hit count and first matched id. The existing five escape rungs are untouched (each carries historical bug endorsements #2241/#2601/#4778/#5686 — this rung sits strictly BELOW them). - handle.ts wires both params into all six persona-order lanes from the single shared lazy lookup over unifiedTailViewRows. Tests (tests/issue5719-msgid-lane-identity.test.ts, 8 pins): incident shape re-anchors with no fork; disjoint ids still fork; no ids / malformed ids => exactly the old path; stored rows outlive any wire projection AND the JSON skeletons carry no ids field (single-source pin); restart wipes resolver memory but the store survives so the FIRST post-restart request already rescues; personaConversationOrder forwards everything lazily (store queried at most once); store-unavailable (null) degrades to fork. Verified: tsc clean; issue5719 file 8/8; persona/lane battery green (issue2944 10, issue3397 4, dsh-persona-continuity 4, dsh-persona-fingerprint 11, issue2601 7, persona-fork-active-parent-guard 1, plugin-fork 56); e2e red family green (3450 2, completion-wall 2, fix-1001 7, 3645 4, empty-summary 9, hold 4).
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8276-pr.5759.157f14eThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5759.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) PR #5759 审核 — 可合(先 rebase,机械无冲突)。 已拉取分支 结构化八问
代码 / 测试质量:命名达意( 判定:可合。 唯一机械步骤 = 先 rebase 到最新 master(当前 behind 41 commit,但三文件上游零变更,rebase 无文本冲突)。需要的话我可以代做 rebase。
|
[bot] 🏷 进度汇报(上一轮进程卡住被重启,这里同步现状):本 PR 的完整审核判定已在上一条回复给出(结论:rebase 后可合并,无回归、cache 只增不降、无新增配置),并已打上 查重:同症状、不同机制,不重复,但并存关系需你拍板。 本 PR(GitHub #5759)与另一条在途修复都指向同一个 bug(#5719:全量压缩 ∩ 系统提示词易变字段漂移落在同一轮 → 误 fork 出零状态
两条用户可见症状相同(都是"字节证据被整段删掉又改了几个字节"导致误 fork),按 owner 2026-10-13「同症状 = 一个 issue」原则,它们本应归并到 #5719 这一个 issue 下统一管理;但作为在途 PR 各自独立、互不阻塞。我不关闭、不合并其中任何一条——是并存 / 择一 / 谁先合,由你在上一条 本 PR 自身核对结论:与 master 无冲突、CI 全绿、rebase 干净( |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1046-master.cc29523 # this exact build
npm install -g billion-context@master # always the newest merged build
|
这是什么问题
dsh 桌面端在「全量压缩(一条 checkpoint 消息顶掉中间几百轮)和系统提示词变化(Web-GUI 端口号等易变字段)落在同一轮」时,会击穿车道解析的全部字节级逃逸梯——head 对齐、模型头佐证、prefix-affinity 续接、#4778 run、#5686 短尾对齐都要求字节证据,而这一轮恰恰把证据整段删掉又改了几个字节。结果是必然 fork 出一条零状态
<id>|sub:副车道:refs/tsStamps/token 账本全丢、UI 里一个客户端会话裂成两条车道。会话 id 全程没变(#5719 已实证排除);仅 5 个端口数字就能决定走不走副车道。这个 PR 做什么
在三个「确定要 fork」的出口处加一道最后兜底的身份判断,不碰现有任何一层:
biliMsgIds(Plugin lanes: pin identity to client msgids, render outbound from the server-owned history | 插件车道服务端正史:消息身份钉在客户端 id 上,出站前缀由正史渲染 #4491 盖章管线,dsh 为每条消息铸的稳定 UUID,跨重启/跨压缩不变)时,拿它和统一存储里该会话 key 已记录的 msg_id 全集(getStore().unifiedAllMessageIds,billion-context instead of billion-context-pi for pi? #5312 视图:live+retired,纯SELECT msg_id)求交;改动文件 4 个(+412/-5,vs master
0aace2f):src/session-resolve.ts—msgIds/readStoredMsgIds两个尾部可选参数(源码兼容)+ 三处 fork 出口的 rescue 闭包src/msgid-pin.ts—incomingMsgIdsOf()(整体降级风格同 Plugin lanes: pin identity to client msgids, render outbound from the server-owned history | 插件车道服务端正史:消息身份钉在客户端 id 上,出站前缀由正史渲染 #4491)src/server/handle.ts— 六个 persona 车道接线(懒查询契约:至多一次、只在 fork 出口)tests/issue5719-msgid-lane-identity.test.ts— 8 个 pin(含事故形态复现、无 id/坏 id/无 store 全部退回老路径、重启后首请求即命中)验证
本地全绿(node v25.9.0):tsc clean;新测试 8/8;persona/lane 回归电池 103 pass/0 fail;7 个 e2e 红族文件全绿。统一存储零新增表、零写入路径变更(id 由 #4491 盖章时本来就钉在消息行上)。
与其他修复的关系
<bili-snapshot>自声明):与本 PR 互补而非互斥——E5 靠 bili 自产标记自救,本 PR 靠 host 盖章身份自救;两路任一命中都不会再 fork。请 owner 定先后或并存。