Skip to content

Commit 101e881

Browse files
committed
Opt the streaming story client into log delivery
The streaming story's client asserts that three log messages arrive during the countdown, but never opted in, so on 2026-07-28 arms it depended on the server hand-sending the notification around the per-request log gate. Pass log_level="info" so the story models the spec-correct opt-in, and rewrite the server comment that promised a non-deprecated logging helper - protocol logging is deprecated (SEP-2577), so the raw send is what keeps the example warning-free.
1 parent 72ddad4 commit 101e881

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

examples/stories/streaming/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ async def main(target: Target, *, mode: str = "auto") -> None:
1515
async def on_log(params: LoggingMessageNotificationParams) -> None:
1616
logs.append(params)
1717

18-
async with Client(target, mode=mode, logging_callback=on_log) as client:
18+
# `log_level` is the 2026-07-28 per-request opt-in: without it a modern server
19+
# sends no log notifications at all (pre-2026 servers ignore it and send anyway).
20+
async with Client(target, mode=mode, logging_callback=on_log, log_level="info") as client:
1921
# ── progress + logging: a short countdown delivers exactly `steps` of each, in order ──
2022
updates: list[tuple[float, float | None, str | None]] = []
2123

examples/stories/streaming/server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ async def countdown(steps: int, ctx: Context) -> dict[str, int]:
1616
try:
1717
for i in range(1, steps + 1):
1818
await ctx.report_progress(float(i), float(steps), f"step {i}/{steps}")
19-
# No non-deprecated logging helper on Context yet, so send the raw
20-
# notification. `related_request_id` keeps it on this request's response
21-
# stream (matters over streamable HTTP).
19+
# Protocol logging is deprecated (SEP-2577), so the raw notification
20+
# keeps this warning-free. On 2026-07-28+ the client only receives it
21+
# because it opts in with `log_level=`; `related_request_id` keeps it on
22+
# this request's response stream (matters over streamable HTTP).
2223
await ctx.request_context.session.send_notification(
2324
types.LoggingMessageNotification(
2425
params=types.LoggingMessageNotificationParams(

0 commit comments

Comments
 (0)