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
ClientSessionGroup leaves old tools after disconnecting a re-registered session #3713
Registering the same caller-owned session twice can leave tools behind after disconnect. The first catalog contains old; the second contains only new. Both connect_with_session() calls return successfully. After disconnect_from_server(), group.sessions == [] but group.tools still contains old.
I expected disconnect to remove every tool registered through that session. A deliberate rejection of repeated registration or a coherent refresh would both be reasonable; this report concerns the accepted repeat leaving stale entries.
The aggregation path replaces the session's reverse index with the latest catalog while updating the aggregate dictionary, which retains the earlier entries. Disconnect then removes only the names in the replacement index. This differs from #3490's transport leak after a rejected connection and #3384's empty-catalog failure.
uv run --frozen pytest tests/client/test_session_group.py::test_disconnect_removes_all_tools_after_same_session_reregistration -q
Python & MCP Python SDK
Python 3.14.7, Linux x86_64. Reproduces on latest stable 2.3.0 (2118f14f8a19bc158d8a1cf90af58d85d187f849) and main 754254c08fe1c3eda18b69da3d336106fe8d72d6. The other 12 session-group tests pass against each source revision.
AI-assisted investigation and test reproduction, with a human in the loop.
Activity