Skip to content

fix(context): persist fallback compaction breaker - #63965

Merged
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/63018-fallback-compaction-breaker
Jul 13, 2026
Merged

kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/63018-fallback-compaction-breaker

Conversation

@kshitijk4poor

Copy link
Copy Markdown

Summary

Fallback-only compaction loops now trip a durable, boundary-scoped circuit breaker across normal turns, session rotation, gateway recreation, and usage-less responses.

The original PR correctly identified deterministic fallback compactions as degraded, but its shared usage counter was reset by ordinary fitting responses between compaction episodes. This salvage preserves @LeonSGP43's commit and adds the lifecycle-complete breaker as a separate maintainer follow-up.

Changes

  • count fallback quality when a completed compaction boundary commits, independently of provider usage
  • persist the fallback streak per session and carry it across rotation/in-place/fresh gateway agents
  • keep ordinary fitting responses from erasing fallback history; reset only on a healthy compaction, a real runtime switch, or a new session
  • prevent stale Hermes fallback state from tainting Codex-native compaction
  • gate every automatic built-in compression entrypoint while preserving forced /compress
  • add production-seam tests for usage-less turns, context regrowth, rotation, persistence, Codex, model switches, and schema reconciliation

Validation

Check Result
Canonical targeted suite 638 passed
Final focused suite 400 passed
Real SessionDB E2E fallback 1 → 1 → 2/block → reload/block → healthy/reset
Mutation disabling the fallback increment fails 2 regression tests
Ruff / ty diff no new diagnostics (excluding symmetric ty panic noise)
git diff --check clean

Closes #63008.

Credit: salvages #63018 by @LeonSGP43; contributor commit and authorship preserved.

@kshitijk4poor
kshitijk4poor enabled auto-merge (rebase) July 13, 2026 20:38
@kshitijk4poor
kshitijk4poor merged commit af7dcea into NousResearch:main Jul 13, 2026
59 of 61 checks passed
@kshitijk4poor
kshitijk4poor deleted the salvage/63018-fallback-compaction-breaker branch August 5, 2026 07:10
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.

Compaction-runaway: anti-thrash guard blind to fallback degradation (R1-R6)

2 participants