Repository navigation
[PR] fix: dsh compaction gate covers runtime-registered agentPresets (#7169) - #7179
ranxianglei wants to merge 4 commits into
Conversation
The #3354 load-time overlay only hooked internal/config, which fires for plugin entries resolved via waterfall. Presets registered at runtime via ctx.agentPresets.register(definition) (dsh 0.2.2-rc.3+) bypass the hook entirely, so their compaction rows stay armed — with an active bili block that means native compaction is answered 200 and silently wipes bili's folds. This commit adds an agentPresets.register() wrapper (via cordis inject) that applies the same disableBasicCompaction rewrite to the definition's plugins tree. The gate is an always-on entry loaded before any preset, so the wrapper is in place before any register() call. The wrapper is idempotent and preserves the async register() semantics. Also extends the gate telemetry with a runtimePresetHookInstalled flag and adds a no-preset-register-hook gap to detectCompactionOverlayGap. Fixes #7169 Related: #7062
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10862-pr.7179.6c7fa67This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7179.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 本 PR closes #7169(gate 漏掉运行时注册的 preset)。Related #7062(用户报 dsh-multitask 运行时 preset 的 标签: 已齐 — PR #7179: Verification (live, head
|
🔶 需要决策 CI state (live, mirror cache, head Root cause (traced, not guessed):
Why this is a decision, not a mechanical fix: Runtime-registered presets are a dsh 0.2.2-rc.3+ feature (per the PR's own Options:
Recommendation: B — the alarm is a false positive on exactly the builds that lack Nothing was pushed this run; the branch head is unchanged ( |
[ework] CI fix verified green ✓ |
# Conflicts: # src/agent/dsh-native.ts
[ework] CI fix verified green ✓ |
… overlay still latches The #7169 runtime-preset wrapper needs ctx.inject, but a host without it still latches the loader-path internal/config hook, so the no-preset-register-hook gap value made detectCompactionOverlayGap alarm "could not latch / likely ARMED" for hosts where the overlay actually did latch — a boot-time behavior change (passive note -> ARMED alarm) that the pinned #1772 bare-host test caught. Revert the gap detector to its two capability checks; the wrapper state stays observable through the runtimePresetHookInstalled telemetry flag and the coverage text. Hosts predating inject also predate the runtime agentPresets.register() surface; the #1729 wire guard remains their backstop.
…he replacement The register() wrapper set __biliCompactionDisableWrapped on the ORIGINAL register function before replacing it, so a re-fired inject callback (host re-provisioning the agentPresets service) saw no marker on the function now at registry.register and wrapped the wrapper — double telemetry notes and a redundant rewrite pass per register call. Marker now sits on the replacement itself; regression test pins the skip-on-re-entry behavior.
🔶 需要决策 New situation since the last escalation: master merged a parallel fix for the same problem — PR #7190 (merged as #7242, commit Master's #7190 fix (already merged):
This PR (#7179), branch head
The conflict is semantic, not textual. Both sides rewrite Options:
Recommendation: A — close this PR as superseded by #7190. Nothing was pushed this run; the branch head is unchanged ( |
[ework] CI fix verified green ✓ |
1 similar comment
[ework] CI fix verified green ✓ |
🔶 需要决策 State unchanged since floor 12 (re-verified live this run): branch head The full A/B/C analysis is in floor 12 — the short version: this PR is superseded by #7190 (already merged into master; a superset: per-entry Recommendation: A — close this PR as superseded by #7190. Default if undecided: A (close). Options B (revert master's #7190) and C (merge both → double-wrap) are not recommended — see floor 12. Nothing was pushed this run; the branch head is unchanged ( |
[ework] CI fix verified green ✓ |
🔶 需要决策 4th wake for the same blocker; state completely unchanged (re-verified live this run): branch head Recommendation (unchanged): close this PR as superseded by #7190 — already merged into master as a superset (per-entry Nothing was pushed; the branch head is unchanged ( |
[ework] CI fix verified green ✓ |
[ework] CI fix verified green ✓ |
🔶 需要决策 5th wake; state unchanged (re-verified live + against the actual code this run): branch head Re-confirmed against the source: master's #7190 fix ( Recommendation (unchanged): close this PR as superseded by #7190. Default: close. Full A/B/C: floor 12. Nothing pushed; branch head unchanged. The owner's close decision is the only unblocking action. |
[ework] CI fix verified green ✓ |
🔶 需要决策 6th and final auto-fix attempt (1/6); state unchanged (re-verified live this run): branch head Final recommendation: close this PR as superseded by #7190 — already merged into master as a superset (per-entry Nothing was pushed; the branch head is unchanged ( |
[ework] CI fix verified green ✓ |
Problem
The #3354 load-time overlay only hooked
internal/config, which fires for plugin entries resolved via waterfall. Presets registered at runtime viactx.agentPresets.register(definition)(dsh 0.2.2-rc.3+) bypass the hook entirely, so their compaction rows stay armed. Two failure modes:Root Cause
registerCompactionDisableinsrc/agent/dsh-compaction-disable.tsregisters a middleware oninternal/config. This hook fires only for plugin entries (bundles) resolved via cordis waterfall. Agent presets registered at runtime viactx.agentPresets.register(definition)do not go through this path — theirpluginstree is never seen by the gate. Standard presets (preset-standard/ptc/minimal/cordis) have been covered by the structural matcher since #4147; only runtime-registered presets slipped through.Fix
Extends the existing disable verdict to the single birth point of runtime presets: the gate wraps
agentPresets.register()(via cordisinject) and, when the verdict is active and the definition'spluginstree carries compaction rows, rewrites them in place todisabled: truebefore passing through. Reuses #4147'sdisableBasicCompactionpure function and the same telemetry channel (the coverage text gains a runtime dimension). The #1729 wire guard is kept as the backstop for older dsh versions.The wrapper is:
disableBasicCompactionis a no-op on already-disabled rows; the re-entry marker sits on the replacement function so a re-fired inject callback does not double-wrap (0204e41)register()injector theagentPresetsservice is absent; an absentinjectis deliberately NOT a boot-alarm gap, because the loader-path overlay still latches without it (717b88f)Changes
src/agent/dsh-compaction-disable.ts:AgentPresetRegistryLiketypeinjecttoCompactionDisableHosttyperuntimePresetHookInstalledfield toDshCompactionGateTelemetrynoteRuntimePresetHookInstalled()helperagentPresets.register()wrapper inregisterCompactionDisablecompactionCoverageText()reports the runtime hook state (shared by the durable profile note and the first-request log line, [Diagnosis] Compression coverage reading for #3962 is unavailable on device: profileContext.startedBundles not detected | [诊断] #3962 的压缩覆盖读数在设备上取不到数:profileContext.startedBundles 探测不到 #6770)tests/issue3354-dsh-compaction-disable.test.ts:injectis not a gapdocs/configuration.md+docs/configuration.zh-CN.md:Sticky
dshCompactionRefusedBytesstop-bleed (tracked separately, does not block this PR)The sticky
dshCompactionRefusedBytes(src/server/handle.ts:2667-2668) is write-only by design (#2490). The follow-up reset work is already tracked: PR #5364 (owner-approved — the ledger floor follows the authored snapshot instead of the envelope peak; open, in flight) plus related #6551. Not touched here. Note: "clear after successful bili fold" (the wording in #7190's out-of-scope list) is a mismatched trigger — bili folds never shrink dsh's raw ledger; the correct reset trigger is a landed checkpoint, which is exactly what #5364 implements.Test Plan
tests/issue3354-dsh-compaction-disable.test.ts,tests/issue6770-compaction-coverage-text.test.ts,tests/issue4147-dsh-overlay-structural.test.ts,tests/issue3662-dsh-gate-fallback.test.ts,tests/dsh-native.test.ts— 104/104 passCloses #7190, #7169, #7062, #7178