You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: session ends after MCP tool calls when using Anthropic-compatible gateways #11417
When using the Anthropic provider behind an Anthropic-compatible gateway/proxy, MCP tools can run successfully but the chat stops without producing the final assistant reply.
What happens
The model triggers one or more MCP tools
The tools complete successfully
The session loop exits right after the tool parts, so the model never gets a follow-up turn to read tool results and produce the final text response
What I expected
If the latest assistant message contains tool parts, the session should continue until the model outputs a final text reply.
Why this seems to happen
Some gateways/proxies may return finish_reason=stop even though the assistant message still contains tool parts (sometimes even text + tool in the same message). OpenCode treats this as “done” and exits early.
How to reproduce (high level)
Configure Anthropic provider via an Anthropic-compatible gateway/proxy
Enable any MCP server(s)
Ask the model to call two MCP tools (serial or parallel) and then output a single final line (e.g. “DONE”)
Observe: tools run, but the final line is never produced
Notes
OpenAI provider does not show this behavior in the same setup.
Activity
github-actions commentedon Jan 31, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
github-actions commentedon Apr 2, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.