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
MCP client re-sends a tool call after a connection drop #2734
withSession (internal/adapter/mcp/reconnect.go) runs every session call, including tools/call from a tool's Execute. If the call fails with a connection-drop error, it reconnects once and runs the call again. A drop can happen after the server received and ran the call, so a tool with side effects (create an issue, send a message, merge a PR) can run twice. The agent identity design treats that as an unknown outcome that must never be replayed automatically (credentials-and-lifecycle.md, "Pauses and restart").
This affects today's MCP paths that use mcpadapter (direct MCP servers and the MCP broker's current protected caller). #2536's new gateway client avoids it for gateway calls; this ticket fixes the shared client.
Requirements
Keep reconnect-and-retry for calls that are safe to repeat (tools/list, resources/read, prompts/get, and the session handshake).
For tools/call: if the drop happened before the request was written, retrying is safe; once it was written, do not re-send. Return an error that says the outcome is unknown, so the engine reports it as such.
Keep the single-dial behaviour for concurrent callers.
Done when
A test server that drops the connection after receiving a tools/call sees the call once, and the caller gets an unknown-outcome error; a drop during tools/list still reconnects and retries once; existing reconnect tests pass.
Cross-cutting
The unknown-outcome error is model-visible where today a retried call might have succeeded; include the wire API compatibility assessment.
Activity