Skip to content

feat(compaction): L5 auto-compact hardening — breaker + recovery (M4.… - #30

Merged
wusijian007 merged 1 commit into
mainfrom
feat/m4.5-l5-breaker-recovery
Jun 20, 2026
Merged

wusijian007 merged 1 commit into
mainfrom
feat/m4.5-l5-breaker-recovery

Conversation

@wusijian007

Copy link
Copy Markdown
Owner

…5 / v4)

The final layer and v4 closeout: two production guardrails around the semantic auto-compact (the irreversible last resort).

Circuit breaker — a summarizer failure no longer crashes the run: it is caught, counted, and falls back to deterministic compaction for that turn. After maxL5Failures consecutive failures (default 3) the L5 path is disabled for the rest of the run, so a flapping summarizer can never spin forever (the ~250K-calls-a-day class of incident). Marks query.l5_failure / query.l5_circuit_open.

Post-compact recovery — the semantic recap REPLACES the stale region, so the model can forget which files it just touched. After the auto_compact stage actually runs, the loop appends a recovery note (formatPostCompactRecovery) listing the recently touched files, tracked from Read/Edit/Write tool_uses. Append-only (cache-friendly). Marks query.post_compact_recovery. (L5 suppression by collapse already shipped in M4.4.)

Framing: myagent's deterministic reclaim is the always-on last resort; the LLM auto-compact stays opt-in but is now guarded — the faithful realization of CC's "auto-compact on by default" given that a default LLM call would break offline determinism.

  • core: QueryOptions.maxL5Failures; breaker-wrapped auto_compact stage; trackRecentFiles + exported formatPostCompactRecovery; recovery injection gated on ranStages including "auto_compact".
  • tests: recovery-note format unit; breaker integration (3 throws -> circuit open, run survives + completes); recovery integration (mark carries the latest file).
  • docs: CLAUDE.md query-loop step 7 + v4 roadmap M4.5 delivered; roadmap banner marks the whole v4 track complete.

241 tests pass (+3); all 10 eval tasks green, fingerprint unchanged.

…5 / v4)

The final layer and v4 closeout: two production guardrails around the semantic
auto-compact (the irreversible last resort).

Circuit breaker — a summarizer failure no longer crashes the run: it is caught,
counted, and falls back to deterministic compaction for that turn. After
maxL5Failures consecutive failures (default 3) the L5 path is disabled for the
rest of the run, so a flapping summarizer can never spin forever (the
~250K-calls-a-day class of incident). Marks query.l5_failure /
query.l5_circuit_open.

Post-compact recovery — the semantic recap REPLACES the stale region, so the
model can forget which files it just touched. After the auto_compact stage
actually runs, the loop appends a recovery note (formatPostCompactRecovery)
listing the recently touched files, tracked from Read/Edit/Write tool_uses.
Append-only (cache-friendly). Marks query.post_compact_recovery. (L5 suppression
by collapse already shipped in M4.4.)

Framing: myagent's deterministic reclaim is the always-on last resort; the LLM
auto-compact stays opt-in but is now guarded — the faithful realization of CC's
"auto-compact on by default" given that a default LLM call would break offline
determinism.

- core: QueryOptions.maxL5Failures; breaker-wrapped auto_compact stage;
  trackRecentFiles + exported formatPostCompactRecovery; recovery injection
  gated on ranStages including "auto_compact".
- tests: recovery-note format unit; breaker integration (3 throws -> circuit
  open, run survives + completes); recovery integration (mark carries the latest
  file).
- docs: CLAUDE.md query-loop step 7 + v4 roadmap M4.5 delivered; roadmap banner
  marks the whole v4 track complete.

241 tests pass (+3); all 10 eval tasks green, fingerprint unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wusijian007
wusijian007 merged commit 601ee13 into main Jun 20, 2026
3 checks passed
@wusijian007
wusijian007 deleted the feat/m4.5-l5-breaker-recovery branch June 20, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant