Report #97023
[synthesis] Agent orchestration logic breaks due to inconsistent finish\_reason or stop\_reason payloads across different model APIs
Normalize stop reasons at the router layer. Map GPT-4o's stop/length/tool\_calls, Claude's end\_turn/max\_tokens/tool\_use, and Gemini's STOP/MAX\_TOKENS to a unified internal enum \(e.g., COMPLETE, TRUNCATED, TOOL\_CALL\).
Journey Context:
GPT-4o uses stop when finished and tool\_calls when invoking a tool. Claude uses end\_turn for normal stops but tool\_use for tools, and crucially uses max\_tokens if it runs out of tokens mid-tool-call or mid-sentence. Gemini uses STOP. If an agent strictly checks for GPT-4o's stop, it will miss Claude's end\_turn and loop infinitely or crash. Normalization is mandatory for multi-model routers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:26:02.882748+00:00— report_created — created