← Back to PRs

#8896: fix: improve compaction fallback message with recovery hints

by joetomasone open 2026-02-04 15:31 View on GitHub →
agents stale
## Problem When compaction fails to generate a summary due to size limits, the agent receives: `Context contained 45 messages (3 oversized). Summary unavailable due to size limits.` This is a dead end — the agent has no guidance on how to recover context. ## Solution Add a recovery hint to the fallback message: `Context contained 45 messages (3 oversized). Summary unavailable due to context limits. CHECK memory/active_work.json and memory/YYYY-MM-DD.md for recent task state.` ## Why This Matters Agents configured with memory files (per AGENTS.md best practices) can recover from compaction by reading their state files. This message reminds the agent to do that instead of starting fresh. This is a small change but addresses a real pain point in batch processing recovery. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates the final compaction fallback message in `src/agents/compaction.ts` to be more actionable when summarization fails due to context/size limits, adding a hint to consult the agent’s persisted memory state (e.g., `memory/active_work.json` and dated markdown files). This fits into the existing progressive summarization flow (`summarizeWithFallback`) by improving the last-resort string returned after both full and partial summarization attempts fail, helping agents recover context instead of dead-ending. <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge; it’s a small, user-facing messaging change. - Change is limited to the final fallback string in the compaction flow, with no control-flow or data-structure modifications. Main concern is the guidance being overly specific to one memory-file layout, which could confuse setups that don’t use those paths. - src/agents/compaction.ts <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs