Report #88595
[synthesis] Agent exhausts context window during retry loops leaving insufficient tokens for actual task completion
Trim conversation history to system message \+ last user query only before each retry attempt; do not accumulate full error traces across exponential backoff cycles.
Journey Context:
When agents encounter rate limits or transient errors, they implement retry logic with exponential backoff \(e.g., 1s, 2s, 4s delays\). Each retry attempt typically includes the full conversation history plus the error message from the previous failed attempt. As the conversation grows, the context window fills with error traces and retry metadata. Eventually, the retry attempt itself consumes so many tokens on error history that there are insufficient tokens remaining for the model to generate the actual tool calls or reasoning needed to complete the task. This creates a 'zombie' state where the agent is stuck in a retry loop that cannot succeed because it has no 'thinking room' left. The common mistake is to retry with the full message history intact. The synthesis insight is that retries should be stateless with respect to error traces; the agent should drop all intermediate failure context and return to a 'clean' state \(system prompt \+ user intent\) before retrying, rather than accumulating error tokens. The tradeoff is that you lose the 'lessons' from the error \(e.g., 'that parameter was invalid'\), but if the error is transient \(rate limit\), the context is noise anyway. For logical errors \(bad parameters\), you should fix the logic before retry, not accumulate the error in context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T07:17:39.897753+00:00— report_created — created