Repository navigation
[PR] Plug the last gap in silent deployment of dsh native compression + session fork visibility/self-healing (#5686) | 堵住 dsh 原生压缩静默落地的最后漏窗 + 会话分叉可见化/自愈 (#5686) - #5692
Conversation
…ative-compaction leak window, generalize the overlay alarm, fork visibility, tagChanged shorter-tail reanchor P0-1 (native-intercept.ts): every degraded DIRECT send (no live proxy / respawn exhausted / gateless host process) now marker-probes the body at the single choke point directSendOrRefuse(); a MARKER-DECISIVE dsh native-compaction summarize call (final user message starts with COMPACTION_INSTRUCTION via isDshCompactionCall) is refused LOCALLY with a protocol-shaped 422 (x-bili-gate: dsh-compaction-refused) instead of being forwarded raw upstream where it would land a checkpoint that durably shadows the session's raw history (#1729 doctrine, #5517/#5656 cluster). Mention-only directive text, google/custom wires, and unreadable/stream bodies keep today's fail-open semantics; routed /bili/ dispatches are excluded (server guards handle them); synchronous origin test avoids adding the 15s readiness hold to every degraded send. P0-2 (dsh-native.ts): detectCompactionOverlayGap now runs for EVERY profile shape, not just @deepseek-ai/dsh-web-app bundles; a failed latch boots an alarm on any form (desktop app-in-bundle layouts used to arm silently). P1-1 (session-resolve.ts + handle.ts): personaConversationOrder gains an optional observer callback; the six production call sites pass a handler that durably logs state-changing outcomes ([session-resolve] reanchor/derived-*), silent on claim/continue — forks no longer vanish. P1-2 (session-resolve.ts): new rung 5 in the tagChanged branch — a SHORTER incoming that keeps the recorded conversation's fragment-verified tail reanchors instead of forking (checkpoint landing + per-turn system-prompt rotation no longer deterministically mints |sub:<hash> lanes). Tests: issue5686-compaction-direct-refusal (4 cases incl. origin-alive route regression), issue5686-tagchanged-shorter-tail-reanchor (4 cases incl. observer capture), dsh-native P0-2 non-web alarm case; native-intercept falls-open case rewritten to expect the local refusal.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8177-pr.5692.d777ca5This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5692.tgz
npm install -g packageInstall instructions are refreshed on each push. |
… profile shapes too (#5686 P0-2) The latch probe now runs for every profile shape at startup, including builds whose bundle list cannot be introspected at all (bundles === undefined): pre-change those booted silently when the #3354 disable middleware could not latch, same blind-spot class as the desktop app-in-bundle shapes. Absorbs the broader P0-2 coverage from parallel PR #5692 so its unique delta no longer needs a second PR. webProfileWarned latches once per process for all shapes (host capability is stable within a process); web/non-web wording byte-identical, new third wording for the unintrospectable shape. New regression pin: unintrospectable + hook-less host emits the ARMED alarm.
|
(ai: vllm-qwen/qwen3.8-27b) Duplicate of #5691 — opened 42 minutes later against the same base (c9ba485) with the identical four-part scope of #5686. Head-to-head comparison:
CI: #5691's full matrix (ubuntu/windows × node 22/24 × shards) is green; this PR's Recommendation: keep #5691, close this one. Closing is owner-only — no further work planned on this branch. |
[bot] 🏷 结论:可合(待全量 test-matrix 转绿)。 独立审完四个修复的代码路径 + 测试 + CI,无阻断性缺陷。按 §7.4 此 PR 触碰 wire( 查重: 不重复。本 PR 是 #5686 的实现,而 #5686 本身就是 #5517/#5656 报告簇(checkpoint 落地后身份分叉)的归并项;与在途其它 PR 无重叠改动面。 结构化八问:
行为变更披露(Deliverables #4,旧→新 + 原因):
测试有效性(④,都看了断言有没有牙):两个新套件都成立。
CI(镜像缓存 @ head d6b5f06):0 failed / 0 pending;常驻门全绿( 收工判定:可合。 代码正确、对称、fail-open 与 wire 保真完整、测试有牙、行为变更已披露。唯一前置:等全量 test-matrix 转绿(当前无红无 pending)。此 PR 属人工合并域(wire + 身份/会话绑定),不走自动合并。 |
[bot] 🏷 |
🔶 需要决策 一句话:本 PR 唯一的红(unused-exports 门禁)已修好并本地验证通过,但 PR 的 head 分支在上游被删除、PR head 冻结在 我做了什么:
选项:
默认(不决策时):我不再动这个 PR(本车道禁止关闭/替代他人 PR);修复提交留在同名分支 七问(覆盖本次 run 全部动作):
|
…h entry when no live proxy (#5686 P0-1) The #1884 byte-untouched opt-in short-circuits before the origin machinery, so the per-caller noLiveProxy flag was never judged there: a marker-decisive compaction call on a signed gateway with a dead proxy still landed upstream and durably shadowed the raw history. Mechanism B of #5686 enumerates this entry among the six directSendOrRefuse sites; parallel PR #5692 covered it via its internal origin test. Absorb that delta here (regression pin added; negative control verified).
|
(ai: vllm-qwen/qwen3.8-27b) 审核结论(无法以作者身份提交正式 review 事件,以此评论为审查交付):REQUEST_CHANGES —— 本 PR 与在途的 #5691 重复(同一 issue #5686、同一 base、四部分范围相同),建议 owner 保留 #5691、关闭本 PR。 本 PR 唯一的独有内容(签名透传入口的覆盖)已移植进 #5691(commit 3109980,带回归钉),关闭不丢任何东西。以下审核为独立重做:两 PR 全量 diff 逐段对读 + master/pr 分支源码核对,未沿用线程里已有的查重结论。 逐项对比(机制级):
回归审查(既有行为清点):PR 正文披露的四处行为变更(死代理决定性压缩直发→本地 422;非 web/不可内省形状静默启动→启动期 ARMED 告警;fork/reanchor 零日志→warn/info 行;tagChanged 短逐字尾确定性 |sub: 分叉→raw id reanchor)逐一与代码核对属实,web 形状告警文案字节不变,非决定性/不可读/stream body 保持 fail-open 原语义(有测试钉住)。未发现披露之外的语义漂移。两种压缩模式都过了一遍:P1-2 在共享 resolver 上(两模式共用),P0-1/P0-2 仅插件车道客户端侧。 测试有效性:断言有牙——零上游 fetch 断言、尾部变异仍分叉的护栏用例、对称性回归、live-origin 路由钉;native-intercept.test.ts 被改写的那个用例原先钉的就是 bug 行为(fall-open 直发),替换正确。 CI:镜像缓存显示本 PR 八问:
已顺手修:本 PR 的 unused-exports 红门(SessionResolveObserver 导出)+ commit 79d0d21;独有 P0-1 delta 吸收进 #5691 + commit 3109980(该线程已留言)。 判定:REQUEST_CHANGES —— 被 #5691 取代且独有内容已全部保全于 #5691,建议 owner 关闭本 PR(agent 不执行关闭)。此分支不再计划进一步工作。 |
(ai: vllm-qwen/qwen3.8-27b) Review 完成:GitHub #5692 已发审核结论 = REQUEST_CHANGES —— 独立逐行对比确认被 #5691 取代(同一 issue、同一 base、四部分范围相同;按先来后到建议 owner 保留 #5691、关闭 #5692)。对上面查重声明的一处更正:#5692 并非没有任何独有内容——它覆盖了签名内置透传入口(master src/agent/native-intercept.ts:1565,#1884 opt-in),该入口在 origin 解析前短路,#5691 的调用方标志方案到不了(issue 机制 B 明确列了这六个入口);已把该 delta 移植进 #5691 = commit 3109980(条件标志 + 回归钉,负向控制验证过),关闭 #5692 不丢任何东西。已顺手修:本 PR 的 unused-exports 红门(SessionResolveObserver 导出无人引用)+ commit 79d0d21(门禁本地验证转绿)。完整八问结论见 GitHub #5692 审核评论;#5691 线程已留移植说明。 |
(ai: vllm-qwen/qwen3.8-27b) 状态核对:
八问(本车道最终报告):
结论:CI 侧无遗留可修项。按审核判定(被 #5691 取代、独有 delta 已由 3109980 保全),关闭本 PR 是你的专属操作(agent 不执行关闭);needs-decision 标签保留至关闭时随线程归档。本车道收工。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1031-master.47df07f # this exact build
npm install -g billion-context@master # always the newest merged build
|
What this PR does
Part of the #5686 consolidation for the dsh session-drift cluster (#5571 / #5608 / #5614 / #5630 / #5653 / #5656 / #5671). Four changes, all self-contained in billion-context — no dsh-side cooperation required:
P0-1 · Close the last leak window: local refusal at the single direct-send choke point (
src/agent/native-intercept.ts)Every degraded model dispatch (no live proxy at that moment, respawn exhausted, gateless host process, signed-builtin passthrough) funnels through
directSendOrRefuse(). That one spot now marker-probes outgoing bodies: when a call is marker-decisive (final user message starts withCOMPACTION_INSTRUCTION, judged by the existingisDshCompactionCallprotocol check) it is refused LOCALLY with a protocol-shaped 422 (x-bili-gate: dsh-compaction-refused) instead of being forwarded raw upstream. Forwarding would let dsh frame the provider's reply into a checkpoint that durably shadows the session's raw history — irreversible compression-substrate loss (#1729 doctrine), after which the identity resolver deterministically forks the lane (|sub:<hash>) and DSH-side compression tools go stale. This is exactly the "silent drift" reported in the 0.1.211/0.1.212 cluster.Semantics preserved everywhere else: directive text merely mentioned mid-conversation, google/custom wires, non-JSON bodies, and unreadable/stream bodies all keep today's fail-open direct semantics; routed
/bili/...dispatches are excluded (they reach a bili instance whose server-side guards already handle the call with full session evidence). The origin test is synchronous on purpose — awaiting readiness here would hold every degraded send up to the 15 s timeout.Refusal is deliberate, not a dead end: dsh logs
step compaction failed …; continuing the turnand serves the turn uncompressed — the conversation survives, only one compaction attempt fails.P0-2 · Overlay alarm generalizes to every profile shape (
src/agent/dsh-native.ts)detectCompactionOverlayGap()previously ran only inside the@deepseek-ai/dsh-web-appbundle branch, so every other profile form — notably desktop layouts where no@deepseek-ai/*package sits under the profile and the core ships inside the app — booted silently when the #3354 compaction-disable overlay could not latch (native auto-compaction armed, wire refusal as the only backstop). The structural gap check is cheap and side-effect-free, so it now runs for all forms and a failed latch raises the boot-time alarm regardless of bundle list. Web-profile note wording is unchanged.P1-1 · Fork visibility: identity decisions stop vanishing (
src/session-resolve.ts+src/server/handle.ts)personaConversationOrder()threw away every outcome but the key, so production forks/migrations left no durable line — the whole drift cluster had to be reconstructed from user screenshots. The adapter now accepts an observer callback; the six production call sites inhandle.tspass one that durably logs state-changing outcomes ([session-resolve] reanchor|derived-*: <rawId> -> <key> (reason), derived lanes at warn level). Claim/continue stay silent (steady state).P1-2 · Self-heal rung: tagChanged + shorter fragment-verified tail reanchors (
src/session-resolve.ts)New rung 5 in the
tagChangedbranch: an incoming shorter history whose tail aligns positionally and matches the recorded conversation's content fragments (same 8-cell sha verification as the existing tag-invariant branch) now keeps the original id instead of minting|sub:<hash>. Targeted exactly at the A∩B composite incident: checkpoint landing shortened the history while the newer dsh releases rotate the system prompt every turn — the old code failed all four existing rungs deterministically and forked, making the new persona lane start with the checkpoint sentence. Content-fragment verification bounds false reanchoring to ~random-collision probability (cross-session same-tail is bounded bysha256(tag)fp16 only); longer-incoming and mismatched-tail cases keep their existing behavior.Tests
tests/issue5686-compaction-direct-refusal.test.ts(4): decisive POST refuses locally (422 + header, zero upstream traffic);/messagesshape refuses with anthropic error envelope; mention-only directive text passes through untouched; live-origin case still routes via/bili/….tests/issue5686-tagchanged-shorter-tail-reanchor.test.ts(4): main leg reanchors and keeps the raw id; guard leg (broken final fragment) still forks|sub:; symmetric tag-invariant regression; P1-1 observer captures claim + derived-persona events.tests/dsh-native.test.ts: degraded non-web profile now alarms too (previously silent).native-intercept.test.tscase ("marker hit but proxy not ready falls open to a direct send") — the fall-open behavior it asserted is precisely the bug this PR fixes; it now expects the local 422.Results (local, node 25):
tsc --noEmitclean; both new suites 8/8 green;tests/native-intercept.test.ts78/78 green; dsh-persona-continuity + issue4778-subfork + issue3354-disable suites 23/23 green.Known pre-existing noise (not introduced by this PR): parts of
tests/dsh-native.test.tsfail on this host even without the dsh-native.ts change (verified by stashing it and re-running — same failures, first at#3354/#3662 declares lane ownershipthen cascading watchdog timeouts from shared-register pollution across the parallel suite). All overlay/alarm cases introduced or touched by this PR pass within those runs; CI is the arbiter.Residuals documented in #5686 (out of scope here): Go Remote processes never install the client patch (cross-process), stream bodies remain fail-open by design, and the DSH-side refs-stale bug lives in the dsh repo's tools.
Fixes #5686 (P0-1/P0-2/P1-1/P1-2 slices). Related: #5517 #5656 #5613 #5624 #5684 #5614