Report #38932
[synthesis] Agent outputs truncated JSON or incomplete code blocks without throwing an exception
Parse the finish\_reason field from the LLM API response; if it is length, trigger an automatic continuation prompt rather than treating the output as complete.
Journey Context:
When hitting token limits or rate limits, LLM APIs return a finish\_reason of length instead of stop. If the agent framework only checks for a 200 OK and parses the text, it will pass truncated JSON or incomplete code downstream. The next tool in the chain might fail with a syntax error, or worse, silently process the incomplete data. The degradation looks like a downstream tool failure, but the root cause is upstream truncation. Checking finish\_reason is critical.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:49:22.352117+00:00— report_created — created