Skip to content

fix(client): release owned dispatcher exception hook - #3306

Open
qdivan wants to merge 2 commits into
modelcontextprotocol:mainfrom
qdivan:fix/client-session-dispatcher-hook-lifetime
Open

fix(client): release owned dispatcher exception hook#3306
qdivan wants to merge 2 commits into
modelcontextprotocol:mainfrom
qdivan:fix/client-session-dispatcher-hook-lifetime

Conversation

@qdivan

@qdivan qdivan commented Aug 14, 2026

Copy link
Copy Markdown

Summary

  • release the hook that ClientSession installs on an injected JSONRPCDispatcher during cleanup
  • preserve caller-owned or subsequently replaced hooks via identity-based ownership tracking
  • cover exit cleanup, dispatcher reuse, and caller-hook preservation

Tests

  • uv run pytest tests/client -q (714 passed, 1 xfailed)
  • uv run ruff check src/mcp/client/session.py tests/client/test_session.py
  • uv run pyright src/mcp/client/session.py tests/client/test_session.py

Closes no issue: identified by the existing TODO at the dispatcher/session ownership seam.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant