Repository navigation
[PR] dsh authored client compaction: answer the #1729 guard locally with the bili snapshot (#3733) - #3737
Conversation
…he bili snapshot (#3733) Post-#3644 the substrate concern behind the #1729 refusal is gone, but the refusal itself keeps dsh's context gauge growing and its session file ballooning unboundedly (#3723). When BILI_DSH_AUTHORED_COMPACTION=1 (env-only rollout, per-request) and the session holds an active fold block, the guard answers the compaction summarize call locally — zero egress, autoModeForge discipline — with the folded snapshot: identity header <bili-snapshot v1 conv/seq/blocks /> + kernel-rendered block summaries (byte-identical to what the model already reads upstream). dsh records it as its checkpoint; the file shrinks; display/context/server agree. Landing recognition is declarative (tag in the message text, #2621 carrier+novelty discipline) and flows the same #2432 rebase as a foreign checkpoint, recorded as dshAuthoredCheckpointLanded (info, not warn). Precedence: allowDshCompaction (forward native) wins; no active blocks falls through to the 422; passthrough-lane guard untouched. dshCompactionRefusedBytes high-water still recorded on authored answers (#2490 output-clamp regimes). Fixes #3733
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4567-pr.3737.f6d178aThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3737.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…N.md In-passing fix found while reviewing #3737: since the #3540 merge, master has carried two adjacent BILI_ALLOW_DSH_COMPACTION detail rows — one with the #3384/#2490 output-budget paragraph but a stale pre-#3354 scope note, one with the current #3354-overlay scope note (the overlay marks preset-nested rows at any depth, pinned by tests/issue3354-dsh-compaction-disable.test.ts). Merge them into one canonical row keeping both unique paragraphs; the new BILI_DSH_AUTHORED_COMPACTION row from #3733 now sits in a single place.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 按失败签名与主题检索了 open+closed issue/PR( 标签: dsh + scope/wiring + p2(env 开关后的功能,落在 dsh 客户端通道 × 服务端协议边界;对应 #3723 的 p2 增长环)。非缺陷报告,不打 bug。 审核进行中:分支已 checkout(74ba783,12 文件 +652/−12),完整 diff 已通读,CI 各 lane 运行中(截至现在无失败)。正式结论按结构化八问发第二条评论。 |
…up row; add DSH_AUTHORED_COMPACTION long-form entry) Review follow-up on #3737: commit 74ba783 merged the duplicated BILI_ALLOW_DSH_COMPACTION rows in CONFIGURATION.md but left the zh-CN copy with both rows still present (one carrying the #3384 output-budget sentence, the other the newer #3354 scope note). Merged them into one row mirroring the EN union, and added the missing long-form BILI_DSH_AUTHORED_COMPACTION paragraph so the zh file matches the EN coverage (summary-table row + full description).
Review follow-up on #3737: the module-header example rendered the identity tag with literal angle brackets, unlike every other bili-tag example in the codebase (tag-echo-filter.ts / chain-checkpoint.ts write \x3c/\x3e even inside comments) — tooling that strips well-formed tags would mangle the example. Comment-only, zero behavior change.
Reviewer follow-up on #3737: the landing->replay->rebase e2e covered only the openai wire, but dsh desktop's compaction actually rides /v1/responses (#2360) — an untested prepare-responses OR-branch wiring mistake (wrong knownIds space or message view) would pass CI silently. Add a self-contained responses harness (function_call SSE arm turn folding m00001..m00008) that pins: authored answer on the production wire (zero egress, identity header + kernel-format summary in the prompt-forge stream), and replay through x-bili-plugin: dsh recognized via response.output_text.done extraction -> dshAuthoredCheckpointLanded.
(ai: vllm-qwen/qwen3.8-27b) PR #3737 审核结论(八问)1. 是什么问题 2. 什么原因导致的 3. 影响范围与严重程度 4. 怎么修复的
5. 是否有回归问题
6. 是否破坏缓存 7. 是否改了设计方向 8. 是否引入了新的配置 审核中直接推上 PR 分支的三个 commit(均已随最终 head 过 CI)
测试有效性断言有牙:零出口用 mock upstream 计数器实证(非 mock 形状)、422 双向钉死(gate 纪律 #3617)、优先权双向断言、landing 解析真实 SSE 流帧而非重放 fixture;确定性达标( 备注
判定:可合。 默认 OFF 保证零现状变更,opt-in 路径双向钉死,生产线路(responses)落地识别已有回归兜底。等人工合并 https://github.com/ranxianglei/billion-context/pull/3737。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.627-master.39fb841 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Fixes #3733. Follow-up to the #3644 snapshot doctrine; closes the growth loop from #3723.
What
When
BILI_DSH_AUTHORED_COMPACTION=1(env-only rollout window, read per-request — no restart) and a dsh compaction summarize call hits the #1729 guard while the session holds an ACTIVE fold block, bili answers the call locally instead of refusing:<bili-snapshot v1 conv="…" seq="…" blocks="…" />plus every active block's summary in the kernel render format (renderForgedSummary) — byte-identical to what the model already reads upstream, so client display, model context and server state agree for the first time.Landing recognition
The identity tag rides in the message text (clients resend content verbatim), so replay recognition is declarative:
carriesBiliSnapshotCheckpointwith the #2621 carrier+novelty discipline (user plain-text carrier, fresh id only). The #2432 rebase handles the landing on all four wires exactly like a foreign checkpoint, but recordsmetadata.dshAuthoredCheckpointLandedand logs info instead of warn.Precedence & guards
allowDshCompaction(explicit)dshCompactionRefusedBytes(raw-ledger high-water) is recorded on authored answers too, so the #2490 output-clamp regimes keep planning against the raw scale. Originals stay recoverable via CCR / export / fork at all times.Tests
tests/dsh-authored-compaction.test.ts— 15 tests: checkpoint render (header + kernel format, inactive skipped), forge bodies for all three wires (JSON + SSE frame/event-order parsing), unknown protocol → null, carrier+novelty gates, and six e2e lanes through a real proxy + mock upstream: zero-egress authored answer (+ countersdshAuthoredCompactions, nodshCompactionRefusals), stream:false JSON, knob-off 422 pinned, no-active-blocks 422, allowDshCompaction precedence, and full landing→replay→rebase→dshAuthoredCheckpointLanded. Affected families re-run green: dsh-compaction-guard 19, issue2432 11, issue2028 4, issue2709 5, issue3354 6, codex-compact-e2e 20, fold-reconcile 66, lane-decisions-matrix 58, codex-local-compaction 5.Docs
CONFIGURATION.md: summary-table row + full description (both language copies). CHANGELOG entry.