-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Gate log notifications on the per-request log-level opt-in at 2026-07-28 #3198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
72ddad4
Gate log notifications on the per-request log-level opt-in at 2026-07-28
maxisbey 101e881
Opt the streaming story client into log delivery
maxisbey 84724a4
Keep the log-level gate helper out of connection.py __all__
maxisbey 2636cb9
Keep the log-delivery opt-in request-only and drop the mock from the …
maxisbey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 This new migration section is now contradicted by docs/deprecated.md and docs/whats-new.md, which the PR leaves untouched: deprecated.md's warning box and Recap still name only sampling and roots as the SEP-2577 features that actually stop working on a 2026-07-28 connection ("Nothing breaks today" / "There are no wire changes"), and whats-new.md still says "nothing changes on the wire" — but after this PR, protocol logging on a modern connection (including the default in-process
Client(server)) delivers nothing unless the request opts in. A sentence in deprecated.md's warning box (plus a clause in its Recap and in whats-new.md) linking to this section would restore consistency with the updated callbacks.md.Extended reasoning...
The inconsistency. This PR gates 2026-07-28 log delivery on the per-request
io.modelcontextprotocol/logLevelopt-in and documents that as a breaking change here indocs/migration.mdand indocs/client/callbacks.md("On a 2026-era connection the callback alone gets you nothing"). Butdocs/deprecated.md— the page other docs defer to as the authoritative account of how the SEP-2577-deprecated features behave (docs/handlers/logging.mdpoints readers there) — is not in the diff and still asserts the pre-PR behavior:docs/whats-new.mdlikewise says "deprecated is advisory, everything keeps working against 2025-era sessions, and nothing changes on the wire. What you notice is MCPDeprecationWarning"; the following paragraph mentions thelogging/setLevelremoval but not the opt-in gate.Why it's now wrong. After this PR, on a 2026 connection every protocol-log emitter —
ctx.info()and friends on MCPServer'sContext,ctx.session.send_log_message(...),Context.log— is silently dropped (debug-logged) unless the request's_metacarries the reserved key, andConnection.lognever sends there at all (allowed_log_levelsreturnsfrozenset()withmeta=None). So "nothing changes on the wire" and "only sampling and roots stop working on a modern connection" are both false for logging now, and the PR's own description labels this a breaking change.Concrete walk-through. A reader of deprecated.md builds the default in-process client, which negotiates 2026-07-28: (1)
async with Client(server, logging_callback=on_log)— nolog_level=, since deprecated.md told them logging keeps working with only a warning attached; (2) a tool callsctx.info("progress"); (3)ServerSession._allowed_log_levelsis the empty frozenset (no_metaopt-in on the request), so the notification is dropped with only a server-side debug log; (4)on_lognever fires, and nothing in the page they consulted explains why. Meanwhile the PR-updated callbacks.md says the opposite ("the callback alone gets you nothing") — the docs now disagree with each other about the same behavior.Why nothing else catches it. The PR's doc updates went to
callbacks.mdandmigration.mdonly. AGENTS.md requires updating the relevant page(s) underdocs/in the same PR when a change affects user-visible behavior, anddeprecated.mdis the page dedicated to exactly this feature set's runtime behavior. This is distinct from the other findings on this PR (an example-server comment, theServerSessiondocstring): fixing those leaves these two pages still asserting logging is unaffected at the wire.How to fix. A short paragraph in deprecated.md's warning box noting that at 2026-07-28 protocol logging is additionally gated per-request — dropped unless the request opts in via the reserved
_metakey /Client(log_level=...)— plus a matching clause in the Recap and in whats-new.md, each linking to this migration section ("Log messages are delivered only to requests that opt in").Severity. Nit: docs-only, nothing breaks functionally at merge, and the behavior is documented correctly in migration.md and callbacks.md — this is about the two stale pages contradicting them.