Conversation
…che smoothing Narrow fix for the interaction between #362 (cache-aware routing noise protection) and #408 (deferred proactive compaction). The issue: when incremental evaluation returns 'no compaction needed' due to hot-cache budget-headroom or hot-cache-defer (routing-noise suppression), deferred Anthropic sessions were incorrectly terminating their maintenance debt instead of continuing to execute after the prompt-cache TTL had expired. The fix: check whether deferred Anthropic sessions should override the cache-aware 'no compaction' decision once the TTL-safe hold has elapsed. If so, allow leaf compaction to execute despite the routing-noise hysteresis. Inline and non-deferred paths keep existing behavior unchanged. - Adds shouldForceDeferredAnthropicLeafCompaction() to gate override - Routes deferred Anthropic leaf compaction through executeLeafCompactionCore when TTL is stale - Adds regression test: 'assemble() still executes deferred Anthropic leaf debt after TTL expiry when cache smoothing remains effectively hot' - No changes to routing-noise protection or incremental evaluation logic Fixes: #408 Related: #362
When deferred Anthropic leaf debt overrides hot-cache smoothing after the prompt-cache TTL expires, run the leaf compaction with the cold-cache catch-up envelope instead of the original hot-cache single-pass settings. This preserves the intended deferred recovery behavior and prevents the maintenance record from being cleared after a single underpowered pass.\n\nAdd a regression that proves the stale-TTL override enables catch-up execution rather than reusing the hot-cache defer envelope, and update the existing stale-TTL test to assert the new execution parameters.\n\nRegeneration-Prompt: |\n Address the review finding on PR #434 in lossless-claw. The stale-TTL deferred Anthropic compaction fix should not merely force one hot-cache-sized leaf compaction pass and then clear the maintenance debt. Keep the change narrow and additive inside the deferred-compaction path. When the Anthropic prompt-cache TTL has expired and deferred debt must override cache smoothing, execute with the same catch-up envelope that cold-cache recovery uses, especially the extra pass allowance and condensed-pass setting. Add regression coverage that would fail if the forced path still used maxPasses=1 or allowCondensedPasses=false, and update any stale expectations in the existing TTL-expiry test.
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.
What
This PR fixes an interaction between cache-aware routing-noise protection (#362) and deferred proactive compaction (#408). When incremental evaluation suppresses compaction due to hot-cache hysteresis, deferred Anthropic sessions were incorrectly terminating their maintenance debt instead of continuing after the prompt-cache TTL expired.
Why
The #362 fix introduced cache-aware hysteresis that suppresses unnecessary compaction when a cache is 'effectively hot' for routing purposes. However, this was also suppressing legitimate deferred leaf compaction in Anthropic sessions whose actual cache TTL had gone stale. The TTL-safety check in #408 said 'safe to compact,' but the routing-noise heuristic could override that decision.
Changes
shouldForceDeferredAnthropicLeafCompaction()to check whether deferred Anthropic leaf debt should override cache-aware 'no compaction' once TTL is staleexecuteLeafCompactionCoreinstead of terminating maintenance debt earlyTesting
test/engine.test.tssuite passingFixes: #408
Related to: #362