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] google_genai: MCP failures after connecting can log an unhandled task exception #572
When an MCP connection fails, keep its error available to callers and let later calls open a new connection.
Describe the bug
Each MCP connection has a task that keeps its session open.
If that task fails after the session is ready, _run() removes the connection from the cache and raises the error. Nobody may be waiting for that task, so asyncio logs:
Task exception was never retrieved
The connection record also forgets the failure. Calling session() on that record returns the old session instead of raising the error.
Hi @brianstrauch@campoy, I'd like to pick this up. Plan: in python/google_genai/src/temporalio/google_genai/_mcp.py, have _ConnectionRecord._run store a failure that happens after the session is ready instead of re-raising it, and have session() raise that stored error, following the shared pool in python/mcp. The pre-ready path from #531 and the cancellation and interpreter-exit propagation stay unchanged, and the record still drops itself from _CONNECTIONS so the next call reconnects. Tests driven by asyncio.Event, not timing: the old record raises the original error, a later call opens a fresh connection, and no 'Task exception was never retrieved' is logged. Could you assign it to me?
Activity
rahulsjha commentedon Nov 16, 2026
Hi @brianstrauch @campoy, I'd like to pick this up. Plan: in python/google_genai/src/temporalio/google_genai/_mcp.py, have _ConnectionRecord._run store a failure that happens after the session is ready instead of re-raising it, and have session() raise that stored error, following the shared pool in python/mcp. The pre-ready path from #531 and the cancellation and interpreter-exit propagation stay unchanged, and the record still drops itself from _CONNECTIONS so the next call reconnects. Tests driven by asyncio.Event, not timing: the old record raises the original error, a later call opens a fresh connection, and no 'Task exception was never retrieved' is logged. Could you assign it to me?
[python/google_genai] preserve MCP failure occurring after connection…