Repository navigation
[PR] kernel: lift the permanent exemption for FAILED compress exchanges (#4289) - #4293
Closed
ranxianglei wants to merge 1 commit into
Closed
ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
…4289) ALWAYS_PROTECTED_TOOLS exempted every compress call+result by tool name alone, so total-failure retries (9-21KB summary-draft args, zero ranges applied) stayed BLOCKED forever: never advertised, never folded, pinning the fold floor while the session starved on its own compression residue (~75% of one measured 227K session). Exemption is now outcome-aware: a compress exchange whose paired result carries a total-failure receipt ('[Compression FAILED', zero blocks created) loses its hard protection at all three judgment sites (assignRefs, unit-projection filterProtectedToolMessages, recommend buildCompressibleRanges) and folds like an ordinary message; success/partial receipts ('[Compressed ...') and result-less in-flight calls stay exempt, acp_rule is untouched, and host hooks (isMessageProtected) or protectedTools patterns still outrank the carve-out. Recognition goes through config.isCompressTool so MCP-dialect lanes (mcp__bili__compress) get identical treatment through their isToolProtected hook path. Existing sessions self-heal without migration: stale BLOCKED refs migrate to fresh numeric refs on the next assignRefs pass via the existing #2607 path (renderDeferredRefs deferral applies), which also makes the exchanges eligible for the #3769 orphan sweep once a real fold moves the breakpoint. Tests: kernel/tests/issue4289-failed-compress-foldable.test.ts (12 cases incl. negative controls: partial receipts, in-flight, acp_rule, host-override wins, unnamed-result pairing, self-heal migration, MCP dialect).
This was referenced Oct 22, 2026
Closed
Owner
Author
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 本条是 PR #4293 的镜像 issue(关闭 #4289);按失败签名「失败 compress 交换永久 BLOCKED、残渣不可回收」检索 open+closed issue 与 PR,无同机制的独立条目。与 #4252(解析器拒绝风暴)是上下游互补关系,非重复——#4252 治"为什么大量失败",本 PR 治"失败了不可回收"。 标签: bug + scope/kernel + p1(压缩残渣只增不减地撑大上下文,属缓存泄露类失控增长,按 10-19 规则定 p1;kernel 级修复,跨车道,不打客户端标)。 当前状态:PR head |
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
kernel-change: outcome-aware compress exemption. The hard exemption lives in-kernel (kernel/src/protected.ts ALWAYS_PROTECTED_TOOLS) and all three foldability judgment sites are kernel-side (assignRefs, unit-projection filterProtectedToolMessages, recommend buildCompressibleRanges) — the host cannot express "exempt by call OUTCOME", so this must be a kernel change.
Closes #4289
What & why
isMessageProtectedexempted everycompresstool exchange by tool NAME alone. The design comment ("compress calls carry the summaries that decompress/search rely on") only holds for SUCCESSFUL calls: a total-failure receipt means zero ranges were applied, so the call+result carry no summary carrier — decompress/search can never read them. Yet they enjoyed the same permanent exemption: BLOCKED refs, never advertised, never folded, pinning the fold floor while the session starved on its own compression residue (~75% of one measured 227K session was residue; 70 failed calls = 116KB of pinned summary drafts).The exemption is now outcome-aware:
[Compression FAILED, zero blocks created — distinct from partial-success receipts which start[Compressed …) loses its hard protection at ALL THREE judgment sites (KDD#12: assignRefs / unit-projection / recommend share one set built from each site's own array class) and folds like an ordinary message. The thinking text pinned behind the failure nail folds along once the nail is gone.acp_ruleuntouched; host hooks (config.isMessageProtected) andprotectedToolspatterns still outrank the carve-out (host intent wins).config.isCompressTool, so MCP-dialect lanes (mcp__bili__compress, protected via the hostisToolProtectedhook rather than the bare-name check) get identical treatment — the carve-out skips both the ALWAYS_PROTECTED hit AND the hook hit, only for failed exchanges.Existing sessions self-heal without any migration: stale BLOCKED refs migrate to fresh numeric refs on the next
assignRefspass via the existing #2607 path (both halves become unprotected simultaneously, so the #3945 sibling guard never blocks;renderDeferredRefsdeferral applies as usual). That also makes the exchanges eligible for the #3769 orphan sweep once a real fold moves the breakpoint — sweep TIMING is unchanged, only eligibility is restored, so the "failures stay observable between folds" policy (#3769/billion-context-pi#9) is preserved.Behavior change (old → new)
No config surface added (owner-gated area untouched). No wire/message-shape change: folding a previously-unfoldable range only removes already-visible messages into an ordinary block. Mode-agnostic: kernel-level, applies identically in plugin and proxy modes.
Complementary to #4252 (parser-reject storm = the SOURCE of mass failed calls): both must land to end the compression-loop starvation; this PR fixes the independent "failed calls are unreclaimable" defect.
Tests
kernel/tests/issue4289-failed-compress-foldable.test.ts— 12 cases incl. negative controls: partial receipts NOT treated as failed, in-flight stays BLOCKED, acp_rule stays BLOCKED, hostisMessageProtectedoverride still pins a failed exchange,protectedTools:["compress"]still pins, unnamed results unpinned via toolCallId pairing, stale-BLOCKED self-heal migration (+ renderDeferredRefs), MCP dialect via host hooks, ref-interval coverage invariant (advertised ranges address the failed exchange, never the successful one).Kernel version: 0.0.151 → 0.0.152.