#10220: feat: register compaction retry hook to prevent cascade overflow
agents
Cluster:
Compaction Hooks Enhancement
## Summary
Fixes #10613. Implements a compaction retry hook that prevents cascade overflow loops.
When auto-compaction fires during context overflow, the retry can immediately overflow again. This hook:
- Intercepts the retry before it fires
- Calculates a safe token budget
- Downgrades the prompt to a slim one-shot version if needed
- Cancels the retry if even the slim prompt won't fit
## Dependencies
Requires `setAutoCompactionRetryHook` from pi-coding-agent (PR badlogic/pi-mono#1318).
## Verification
- `pnpm tsgo` passes clean with local pi-mono build
- Tests included
Most Similar PRs
#16915: fix: await compaction hooks with timeout to prevent cross-session d...
by maximalmargin · 2026-02-15
64.9%
#3749: fix(plugins): invoke before_compaction and after_compaction hooks d...
by taronsung · 2026-01-29
64.6%
#13861: feat(hooks): add session:compaction hook event
by lailoo · 2026-02-11
64.1%
#16788: feat(hooks): emit compaction lifecycle hooks
by vincentkoc · 2026-02-15
62.4%
#21072: feat: add compaction retry config (maxAttempts, retryDelayMs)
by akramcodez · 2026-02-19
61.8%
#19764: fix(security): OC-65 fix compaction counter reset to prevent contex...
by aether-ai-agent · 2026-02-18
61.8%
#19593: feat(compaction): proactive handover before context overflow
by qualiobra · 2026-02-18
61.0%
#15239: fix(compact): add execution-time fallback + transient retry for /co...
by VintLin · 2026-02-13
60.9%
#20184: feat: memory plugin compaction control
by solstead · 2026-02-18
60.4%
#8244: feat(hooks): add session:before_compact and session:after_compact i...
by kephail · 2026-02-03
59.7%