Repository navigation
Gate log notifications on the per-request log-level opt-in at 2026-07-28 - #3198
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
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
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
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