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: cancelling one MCP caller also cancels other callers #571
Cancel one Activity without cancelling other Activities waiting for the same MCP connection.
Describe the bug
Activities share a connection attempt when they call the same MCP server at the same time. Each caller waits on the same _ready future.
If one caller is cancelled, asyncio also cancels that shared future. The other callers then receive CancelledError, even though nobody cancelled them.
How did you hit this issue?
Found during review of #531. We left this for a follow-up with its own concurrency tests.
Minimal Reproduction
The failure sequence is:
Start opening an MCP connection and pause before it is ready.
Let callers A and B wait for that connection.
Cancel A.
B also receives CancelledError.
B should keep waiting and receive the connection once it is ready.
Environment/Versions
Package: temporalio-google-genai.
Affected code: _ConnectionRecord.session() in _mcp.py. This bug predates #531.
Additional context
Use asyncio.shield() when waiting on shared readiness. Cancelling a caller should still cancel that caller, while leaving the connection attempt and other callers alone.
Add a test that pauses the connection with an event, cancels one of two callers, then lets the connection finish. The other caller should succeed.
Activity
fix(google_genai): cancelling one MCP caller no longer cancels the ot…