Skip to content

refactor(streamable_http): remove writer notification on ClientDisconnect#7

Merged
wiggzz merged 1 commit intodbt-labs/patched-1.27.0from
wj/DI-3218-no-writer-notify
May 5, 2026
Merged

refactor(streamable_http): remove writer notification on ClientDisconnect#7
wiggzz merged 1 commit intodbt-labs/patched-1.27.0from
wj/DI-3218-no-writer-notify

Conversation

@wiggzz
Copy link
Copy Markdown

@wiggzz wiggzz commented May 5, 2026

Problem

The writer.send(ClientDisconnect()) call was intended to unblock the inner session task by sending a poison pill through the session stream. But ClientDisconnect inherits from Exception, so the low-level server's case Exception(): handler catches it and logs:

ERROR mcp.server.lowlevel.server - Received exception from stream: 

This produces the same ERROR-level noise in Datadog that the fix is trying to eliminate.

Solution

Remove the writer notification entirely. The connect() context manager already closes streams when the request handler returns — this is sufficient to unblock the session task (it gets ClosedResourceError/EndOfStream on the next receive()).

No low-level server change needed.

…nect

The writer.send(ClientDisconnect()) call was intended to unblock the inner
session task by sending a poison pill through the session stream. But this
caused the low-level server's case-Exception handler to catch it and log
ERROR-level noise.

Removing it — the connect() context manager closing streams is sufficient
to unblock the session task (ClosedResourceError/EndOfStream on next
receive()). No low-level server change needed.
@wiggzz wiggzz merged commit 0e888e3 into dbt-labs/patched-1.27.0 May 5, 2026
1 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant