Report #72257
[synthesis] Agent misinterprets model termination intent due to inconsistent finish reason mappings
Map OpenAI's \`finish\_reason: "tool\_calls"\`, Anthropic's \`stop\_reason: "tool\_use"\`, and Gemini's \`finishReason: "STOP"\` \(checking function\_call presence\) to a unified internal state, specifically handling Gemini's ambiguous "STOP" which requires inspecting the payload for function calls.
Journey Context:
Agent state machines rely on the \`finish\_reason\` to know whether to route to a tool or return to the user. OpenAI and Anthropic provide explicit, distinct signals for tool use vs. normal end. Google's Gemini API uses \`finishReason: "STOP"\` for both normal text stops AND function calls, requiring the agent to inspect the message parts for a \`function\_call\` to disambiguate. Naive mapping of 'STOP' to 'end turn' breaks Gemini agent loops entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:51:58.485930+00:00— report_created — created