Report #71368
[synthesis] Agent claims task is complete but actually hit context window limit
Explicitly check the API response finish\_reason for length instead of relying on the agent's text output, and implement automatic context summarization or handoff.
Journey Context:
When an agent runs out of tokens, the API truncates the output. If the agent was in the middle of a JSON tool call or a final summary, the truncated output might still be valid JSON or text that looks like a successful completion, or the LLM just stops mid-thought and the framework interprets the lack of tool call as 'done'. Developers trust the framework's parser. The fix requires treating finish\_reason=length as a hard error that triggers a context compression routine, not a stop condition.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:22:20.214778+00:00— report_created — created