Skip to content

Conversation

@aryanyk
Copy link

@aryanyk aryanyk commented Jan 3, 2026

Summary
Issue No : #13414

This PR fixes a deadlock in the Python MCP plugins where connection failures during background initialization could cause connect() to hang indefinitely.

Problem

connect() waits on a readiness future that was never resolved when _inner_connect() failed during session initialization (e.g. HTTP 401/403). The exception was trapped in the background task and never propagated.

Fix

Ensure _inner_connect() always resolves the readiness future with an exception when initialization fails, allowing the error to surface immediately and preventing hangs.

Scope

No changes to MCP protocol behavior

No changes to tool loading or normalization

Minimal diff, focused solely on error propagation

Notes

Some MCP unit tests are environment-dependent and may fail locally, including on main. This PR does not modify test behavior.

@aryanyk aryanyk requested a review from a team as a code owner January 3, 2026 21:49
@moonbox3 moonbox3 added the python Pull requests for the Python Semantic Kernel label Jan 3, 2026
@github-actions github-actions bot changed the title Fix MCP plugin hang when initialization fails #13414 Python: Fix MCP plugin hang when initialization fails #13414 Jan 3, 2026
@aryanyk
Copy link
Author

aryanyk commented Jan 3, 2026

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants