Skip to content

Gate log notifications on the per-request log-level opt-in at 2026-07-28 - #3198

Merged
maxisbey merged 4 commits into
mainfrom
request-scoped-log-gate
Jul 28, 2026
Merged

maxisbey merged 4 commits into
mainfrom
request-scoped-log-gate

Opt the streaming story client into log delivery

101e881
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 28, 2026 in 25m 19s

Code review found 7 potential issues

Found 5 candidates, confirmed 7. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 7
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/mcp/server/session.py:44-47 ServerSession class docstring still states the unqualified related_request_id selector rule the PR breaks for send_log_m
🟡 Nit docs/migration.md:2822-2834 docs/deprecated.md and docs/whats-new.md still say only sampling/roots stop working at 2026, contradicting the new log g
🟡 Nit examples/stories/streaming/server.py:19-22 Streaming example comment falsely claims the raw log notification is gated by the client opt-in

Annotations

Check warning on line 47 in src/mcp/server/session.py

See this annotation in the file changed.

@claude claude / Claude Code Review

ServerSession class docstring still states the unqualified related_request_id selector rule the PR breaks for send_log_message at 2026

The `ServerSession` class docstring still states the unqualified routing rule — "`related_request_id` on the public methods is the selector — present means request-scoped, absent means standalone" — but this PR deliberately breaks that rule for `send_log_message` on 2026-07-28+ connections, where delivery is request-scoped even without a `related_request_id`. Add the same one-line `send_log_message` caveat here that the method docstring and `docs/migration.md` already carry.

Check warning on line 2834 in docs/migration.md

See this annotation in the file changed.

@claude claude / Claude Code Review

docs/deprecated.md and docs/whats-new.md still say only sampling/roots stop working at 2026, contradicting the new log gate

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)`

Check warning on line 22 in examples/stories/streaming/server.py

See this annotation in the file changed.

@claude claude / Claude Code Review

Streaming example comment falsely claims the raw log notification is gated by the client opt-in

The rewritten comment claims the client "only receives it because it opts in with `log_level=`", but this raw `ctx.request_context.session.send_notification(LoggingMessageNotification(...))` path bypasses the PR's gate entirely — `ServerSession.send_notification` → `_notify` has no `_allowed_log_levels` check (the gate lives only in `send_log_message` / `Context.log` / `Connection.log`), so on a 2026 connection the notification is delivered whether or not the request opted in, and the client's n