Repository navigation
[PR] feat(dsh): keepCommandCompact — opt-in overlay scope keeping the explicit /compact command under bili (#4872) - #4883
ranxianglei wants to merge 19 commits into
Conversation
…li (#4872) The #3354 load-time overlay disabled BOTH dsh compaction packages in web-profile presets. compaction-basic is bili's target (auto-compression whose on-disk checkpoints shadowed the fold substrate, #1729), but command-compact carries the EXPLICIT /compact command — the DSH-official bridge third-party plugins borrow via ctx.commands.find(agent, "compact") (e.g. dsh-switchman's /ctx-handover). Disabling it made those plugins degrade to undefined with nothing pointing at bili. Owner decision (#4872 floor): ship an opt-in switch this release; full unbinding of auto-compaction constraints waits for server-side compaction to fully take over next phase. - new knob dsh.keepCommandCompact (file) / BILI_DSH_KEEP_COMMAND_COMPACT (env), default OFF = today's behavior, zero drift; resolved once at bili-native activation, takes effect at the next host restart - verdict channel now carries {active, keepCommandCompact} (legacy "active" string tolerated for mixed-version mid-update windows); disableBasicCompaction/countCompactionRows take the scope flag so the rewrite and its telemetry count stay in lockstep - web settings UI row + boot-note wording follow the flag
…#4872) Config-surface seeds (website/config-reference/{server,env-only}.yaml), generated CONFIGURATION.md tables (en/zh via gen-config-docs), manual long-form env rows, and CLIENTS.md/.zh-CN.md web-profile paragraphs: the overlay's /compact re-enable is now scoped to the explicit command — auto-compaction still has no re-enable switch by design (#3651/#3666); /compact-triggered calls remain gated by the #1729 wire guard.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10939-pr.4883.cdbc16eThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4883.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 这是 #4872 的唯一实现 PR( 标签: dsh、scope/wiring、p3 —— 功能交付(opt-in 开关,默认 OFF 零漂移),非缺陷不打 bug;底层插件失效问题在 #4872 侧已按 p2 管理。 状态(初核完成):
|
…LE.md ledger (#4872) The lifecycle-ledger-guard CI job requires every BILI_* env var read from src/ to be registered in LIFECYCLE.md. The keepCommandCompact switch added by this PR was missing from the ledger, so the guard failed on the PR head. Added it under §1 (transition switches): it is an opt-in scope narrowing of the #3354 load-time overlay, and retires with the next-phase decision to unbind auto-compaction entirely (#4872).
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Merge-guard sync done: merged origin/master into the branch cleanly (no conflicts; 77c60b0 → 25eaa12), local typecheck passes, pushed to |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Resynced again (master moved twice in between): merged current master cleanly into the branch, no conflicts, local typecheck passes — pushed 337a658 → 995d1ed → 6f0ba1a. Verified via API: head= |
…ewest master (#4883 inherited-red resync)
Merge master (33104b1) into 2026-10-27_dsh-keep-command-compact to clear the upstream merge_conflict blocker for PR #4883. Conflicts (8 in 6 files) — all doc-layout reorg (#5920) + one code file: - src/agent/dsh-native.ts (2): kept master's #5686 boot-note latch structure verbatim; injected the PR's keepCommandCompact text into the web-app branch and the non-web trace branch (docs/configuration.md path). - CONFIGURATION.md / .zh-CN.md: root = master's redirect stub; ported the PR's 5 keepCommandCompact entries into docs/configuration(.zh-CN).md. - CLIENTS.md / .zh-CN.md: root = master's stub; ported the PR's keepCommandCompact dsh-section edits into docs/clients(.zh-CN).md. - LIFECYCLE.md: root = master's stub; ported the PR's BILI_DSH_KEEP_COMMAND_COMPACT ledger row into docs/lifecycle.md. Verified: npm run typecheck clean; node --import tsx --test tests/dsh-native.test.ts = 76/76 pass.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 七问 — PR #4883 conflict-resolution run (attempt 1/3)
八问(中文,供人工评审):
判定:冲突已清(0 behind master),merge 已推(d61d472,干净 push 无 force),等远程 CI 在新 head 上重跑;CI 红则本车道 attempt 2/3 继续。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Status (re-trigger, live-verified this run): This is a re-fire of the already-resolved conflict — no new work done, nothing re-pushed. Live state as of this run (fresh
No further action this run. If CI lands red, this lane re-triggers (attempt 2/3) and I'll triage the failure; if green, the PR is mergeable for the owner. The full 七问 of the conflict-resolution work is in my previous comment. |
[ework] auto-fix stalled: test (windows-latest, 22, 2) — stopping for human review |
(ai: vllm-qwen/qwen3.8-27b) 七问 — PR #4883 resync run (attempt 1/3, merge-conflict lane)
八问(中文,供人工评审):
判定:冲突/behind 已清(0 behind master),merge 已推( |
[ework] CI fix verified green ✓ |
(ai: vllm-qwen/qwen3.8-27b) Re-verified live this run (fresh mirror cache, sha The windows-latest 22/2 red was the known Nothing to fix this run. |
# Conflicts: # src/knobs.ts # website/config-reference/env-only.yaml # website/config-reference/server.yaml
(ai: vllm-qwen/qwen3.8-27b) What I did this run (merge-conflict resync): Re-verified live first: master had moved
Key catch: master's 53 commits added a hard Verification (targeted, local): 八问(中文,供人工 reviewer)
判定:冲突已全部消解,定向校验全绿,已干净 push(无 force),分支 0 behind / 14 ahead。等待 CI 在新 head |
(ai: vllm-qwen/qwen3.8-27b) The 5 red test shards on head b8821bf (run 43436453880, re-verified still Diagnosis:
This is tracked in #6547 (with a verified fix that hasn't been applied yet — the assigned agent got stuck: disk full, force-stopped, spawn refused). Per the CI-failure coordination policy (owner 2026-10-24), I'm not fixing this master-level failure in my PR branch; I've reported it to #6547 and will re-verify my PR's CI once the fix lands in ci-fixes/master. 八问:
判定: 本 PR 的 5 个红分片是继承的 master 回归(#6547),不是 keepCommandCompact 的回归。已报告 #6547,等待修复落地后重新验证 CI。 |
(ai: vllm-qwen/qwen3.8-27b) Run 6 (wake m00363): resync master — CI still red (inherited master regression, #6547 fix unapplied) This run re-fired the same CI-fail event (run 43436453880, head b8821bf, 5 test shards). Re-verified live and did a resync:
The CI is still red — the 5 failing shards are the inherited master regression from #6480 (notice-registry inherits the legacy storage pin from 八问
收工判定:PR 分支已 resync 到最新 master(0 behind / 15 ahead,head 148dbb3)。CI 仍红(继承 master 回归,#6547 修复未应用)。等 #6547 修复落地后重验 CI。 |
…registry pure-sqlite pin, c6369fb)
(ai: vllm-qwen/qwen3.8-27b) This run (auto-fix lane 1/3) — inherited red, converged via ci-fixes. Live re-verification first: the mirror check cache was stale (~99 min old, pre-dated the failing jobs), so I verified against live GitHub check-runs for head Root cause — inherited from master, not this PR's code:
Proof it's inherited: every failing test file + its deps is byte-identical between the branch and Fix already converged in ci-fixes: Action (inherited-red policy 2026-10-24): merged Expected after CI re-run: the 结构化八问
判定: 继承性红已按策略收敛(merge ci-fixes 推送,head |
(ai: vllm-qwen/qwen3.8-27b) This run (auto-fix lane 1/3) — re-verified; the remaining red is master-level Windows EBUSY flakiness, not this PR's code. No branch change this run. Live re-verification: head What's still failing (both Windows, all EBUSY):
Why it's master-level, not this PR:
Action taken: none on the branch. Per the inherited-red policy (2026-10-24), master-level fixes converge to Expected: the EBUSY is flaky — a fresh CI run may pass if the AV/indexer isn't mid-scan. If it keeps failing, it's a sentinel/ci-fixes item, not a PR-branch fix. 结构化八问
判定: 真实缺陷(visibleNotices)已由上一轮 ci-fixes merge 修复(ub22/ub24 转绿);剩余 2 个 Windows 分片为 master 级 EBUSY 抖动,非本 PR 代码,按策略不在分支修,已上报 #4599 待哨兵收敛。下轮 CI 若因抖动转绿则本 PR 可合;若持续红则属哨兵/ci-fixes 事项。 |
(ai: vllm-qwen/qwen3.8-27b) Re-verified live — state unchanged from my previous run; this is a re-trigger of the same event (same head Live check-runs for head No branch change this run (policy 2026-10-24: master-level fixes converge to ci-fixes via the sentinel, not re-fixed per-PR). The 2 failures are the same master-level Windows Path to green: the CI won't re-run without a new push (head unchanged). It goes green when either (a) the sentinel converges a ci-fixes fix for the EBUSY and it's re-merged here, or (b) a fresh run lands where the AV/indexer isn't mid-scan. Neither is actionable from this branch right now. 结构化八问
判定: 状态未变,结论同前一轮;本 PR 侧无可操作项,待哨兵在 ci-fixes 收敛 EBUSY 修复(或新一轮 CI 因抖动转绿)。 |
[ework] auto-fix stalled: test (windows-latest, 22, 4), test (windows-latest, 22, 2) — stopping for human review |
2 similar comments
[ework] auto-fix stalled: test (windows-latest, 22, 4), test (windows-latest, 22, 2) — stopping for human review |
[ework] auto-fix stalled: test (windows-latest, 22, 4), test (windows-latest, 22, 2) — stopping for human review |
…d down (#4872/#6814) Field evidence (#6814, duplicate of #4872): with the #3354 overlay disabling command-compact in a web profile, a typed /compact is demoted by dsh to a PLAIN model message (user/message with rpcId) — no command error, no visible signal, and the user never learns compaction is owned by bili. Register a visible /compact stub in bili-native when bili owns the lane, the overlay latched (gap===null), the profile is web, and dsh.keepCommandCompact is unset — exactly the case where the real command is stood down. The stub answers with kind:success and a message naming billion-context ownership, /acp for live state, and the knob to restore dsh's own /compact. Gating: knob ON re-arms the real command (stub would shadow it); non-web profiles keep the host-plane /compact armed (no stub); overlay gap means the real command may be armed (no stub). The bundles/gap probes are hoisted out of the once-guard (they are pure structural typeof checks — cheap, side-effect-free) so the registration site can reuse the same verdicts; the once-guard now only gates the durable boot note. Tests: tests/dsh-native.test.ts — stub registered + answers visibly (web, knob off); absent (knob on / non-web / overlay gap). Suite 77/77; gate batch issue4872/3354/3662/4147 25/25; typecheck clean.
…port conflict) Union of dsh-compaction-disable imports: master added compactionCoverageText, branch added dshCompactionGateTelemetry + dshCompactionKeepCommandCompact; all 5 symbols are used in dsh-native.ts and exported by the merged dsh-compaction-disable.ts. Verified locally: typecheck + build + targeted tests (dsh-native, issue4872-dsh-keep-command-compact, notice-registry) all green (88/88).
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Conflict resolved — PR #4883 is now mergeable. (conflict lane, attempt 1/6) What I did this run:
Note: the mirror check-cache was stale (fetched 2026-11-15, old head 八问
判定: 冲突已解决,PR 现可合并(mergeable=true);等待 CI 与人工 review。 |
(ai: vllm-qwen/qwen3.8-27b) Verdict: APPROVE — posted as a comment (not a formal review) because the awork bot posts as the Re-reviewed on the new head What the PR doesNew opt-in knob
Correctness
Tests (would they catch regressions?)Yes. Risks / behavior disclosure (旧值→新值)
House conventionsConfig Surface Discipline ✓ (new knob reported, mapped onto the existing CINew head 8问(中文,供人工评审)
判定:APPROVE。 干净、范围收敛、owner 已拍板(#4872)、无 kernel/ 改动、默认零漂移、测试有牙、文档同步。无需要顺手修的小问题。 |
[ework] CI fix verified green ✓ |
…mpaction-disable.ts) Two facets resolved: (1) header comment block — kept both the #4872 (branch) and #7190 (master) doc blocks; (2) semantic — master's #7190 runtime-preset code called countCompactionRows with the pre-#4872 1-arg signature, so added the keepCommandCompact arg (read via dshCompactionKeepCommandCompact(), mirroring the load-time overlay at line 355) so runtime-registered presets honor the same verdict scope. Verified locally: typecheck + build + targeted tests (dsh-compaction-guard, issue4872-keepCommandCompact, dsh-native, notice-registry, issue7190-runtime-preset) all green.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Conflict re-resolved — PR #4883 is mergeable again. (conflict lane) This run, master advanced 4 commits ( What I did:
八问
判定: 冲突已解决,PR 现可合并(mergeable=true);等待 CI 与人工 review。 |
(ai: vllm-qwen/qwen3.8-27b) Re-review on new head The new head is another master merge (
CINew head 8问(中文,供人工评审 — 较上一轮 head 的增量)
判定:APPROVE(不变)。 新 head 是干净的 master 合并,PR 特性完整、与 master #7190 运行时路径正确协同、typecheck 干净、145/145 定向测试通过、无 kernel/ 改动、默认零漂移。无需要顺手修的小问题。 |
[ework] CI fix verified green ✓ |
Closes #4872
What
The #3354 load-time overlay (
bili-compaction-gate) marks BOTH@deepseek-ai/dsh-compaction-basicAND@deepseek-ai/dsh-command-compactdisabled: truein dsh web-profile presets.compaction-basicis the right target (its auto-compression checkpoints shadowed the fold substrate, #1729), butcommand-compactcarries the EXPLICIT/compactcommand — the DSH-official bridge third-party plugins borrow viactx.commands.find(agent, "compact")(e.g. dsh-switchman's/ctx-handover). Disabling it made those plugins degrade toundefinedwith nothing pointing at bili.Owner decision (#4872 floor): ship an opt-in switch this release; full unbinding of the auto-compaction constraints waits for server-side compaction to fully take over next phase (see Follow-up below).
config surface
New keys (both default OFF = today's behavior):
dsh.keepCommandCompactbillion-context.json)falsecompaction-basic;command-compactrows pass through untouchedBILI_DSH_KEEP_COMMAND_COMPACTfalseWhy the existing surface could not express this: the overlay scope was a hardcoded two-package constant list (
src/agent/dsh-compaction-disable.ts, rule at :159-161) with no knob to narrow it. Alternatives considered: reusingdsh.authoredCompaction— rejected, that knob controls whether bili ANSWERS dsh compaction calls locally (#3733), not which rows get disabled; conflating them would let local-answering users still break /compact-dependent plugins. Per-package booleans — rejected as overkill; the real design axis is one flag: "auto vs explicit".Owner sign-off pre-implementation (#4872 floor): 「ework 可以给出配置开关 允许本issue发生,本期这样」.
Behavior change disclosure
command-compactrows are no longer disabled →/compactis reachable again in web-profile presets andctx.commands.findconsumers work. A/compact-triggered compaction call STILL passes the nudge 死锁无检测:同一 session 交替收到两种结构互斥的请求流(巨型单消息 ↔ 多轮)时不告警 #1729 wire guard: with active fold blocks it is answered locally by bili-authored client compaction: let the host's own compaction flow run, but bili writes the checkpoint #3733 authored compaction (zero egress); otherwise the terminal, diagnosable refusal fires. Keeping the explicit command does NOT re-introduce nudge 死锁无检测:同一 session 交替收到两种结构互斥的请求流(巨型单消息 ↔ 多轮)时不告警 #1729's silent checkpoint shadowing — that mechanism lives in the auto path (compaction-basic), which stays disabled.countCompactionRowstakes it), so covered-row counts can never drift from what the rewrite actually did."active"to{active: true, keepCommandCompact?}; the reader tolerates the legacy string so mixed-version mid-update windows degrade to today's behavior.Visible /compact stub (#6814 follow-up, owner request)
Field evidence from #6814 (duplicate of #4872, details merged in): with the overlay disabling
command-compactin a web profile, a typed/compactis NOT a "command not found" error — dsh demotes it to a PLAIN model message (user/messagewith rpcId) with no visible signal; the user never learns compaction is owned by bili.Owner request (#4872 floor): 「建议补一条:命令不可用时的可见提示(而非静默降级为消息)」.
Fix: bili-native registers a visible
/compactstub — a bili-equivalent command — in exactly the case where the real command is stood down:gap === null) AND the profile is web (@deepseek-ai/dsh-web-appin the started bundles) ANDdsh.keepCommandCompactis unset.kind: "success") with a message naming billion-context ownership, pointing at/acpfor live compression state, and at the knob to restore dsh's own/compact.command-compact(a stub would double-register and shadow it); non-web profiles keep the host-plane/compactarmed (no stub); an overlay gap means the real command may still be armed (no stub).ctx.commands.find(agent, "compact")consumers (e.g. dsh-switchman): the lookup now finds a definition with a handler, so pre-handover guards pass and the stub's visible message is what they receive — the handover path is answered, not silently forwarded to the model.Follow-up direction (recorded, NOT implemented here)
Per the owner decision, the next phase (等服务端压缩彻底转正) removes the auto-compaction constraints entirely, on the principle that the compression plugin depends only on incremental messages and can ignore stock history. That is separate work; this PR ships only the opt-in switch + the visible stub.
Tests
tests/issue4872-dsh-keep-command-compact.test.ts: pure-function scope (default pins both-disabled; keep=true passes compact rows through BY IDENTITY at top/group/deep nesting depths, input untouched), verdict channel (flag rides the declaration; legacy"active"string tolerated), transform e2e (telemetry count locked to the rewrite; compact-only tree returns the input object untouched), knob tiers (env > file > default viaBILI_CONFIG_FILE).tests/dsh-native.test.ts: declaration-flag assertions (default false; knob ON reaches the verdict at activation; kill-switch still silent) + new stub test (registered and answers visibly for web+knob-off; absent for knob-on / non-web / overlay-gap).npm run typecheckclean. Full suite = CI.