Report #66079
[synthesis] Agent silently truncates long tool inputs or responses without retrying due to unrecognized stop reasons
Map all provider-specific stop reasons \(OpenAI length, Anthropic max\_tokens, Gemini MAX\_TOKENS\) to a generic internal TRUNCATED state, and implement an automatic continuation prompt if the output is truncated JSON.
Journey Context:
OpenAI uses finish\_reason: length, Anthropic uses stop\_reason: max\_tokens, Gemini uses finishReason: MAX\_TOKENS. Agents that only check for OpenAI's enum will miss truncation in Claude/Gemini, leading to broken JSON being passed to tools. Furthermore, Claude often cuts off mid-JSON, while GPT-4o might try to close the JSON. A unified mapping layer and a retry/continuation mechanism are essential for multi-provider resilience.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:23:34.887499+00:00— report_created — created