Skip to content

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

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

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

@github-actions github-actions Bot added the missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md) label Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This repository only keeps pull requests open when they're linked to an issue that a maintainer has assigned to the author — CONTRIBUTING.md explains why and how we work. This PR has been closed for now because its description doesn't yet link an open issue in this repository (with Fixes #123 or similar).

If there isn't an issue for this yet, please open one — a clear description of the problem is genuinely the most useful thing for us. Then add Fixes #<number> to this PR's description. If a maintainer would like the change as a PR from you, they'll assign you to the issue and this PR will reopen automatically.

There's no need to open a new PR — this one will be reopened. While it's closed, please push any updates as new commits rather than force-pushing, since GitHub can't reopen a PR whose branch has been rewritten.

Maintainers: reopening this PR, removing the missing-issue-link label, or adding bypass-issue-check bypasses the check.

@github-actions github-actions Bot closed this Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant