Skip to content

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

Closed
wiggzz wants to merge 2 commits intodbt-labs/patched-1.27.0from
wj/DI-3218-lowlevel-disconnect-debug
Closed

refactor(streamable_http): remove writer notification on ClientDisconnect#6
wiggzz wants to merge 2 commits intodbt-labs/patched-1.27.0from
wj/DI-3218-lowlevel-disconnect-debug

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 this caused the low-level server's case Exception(): handler to catch it and log ERROR-level noise, requiring a separate fix in the low-level server.

Solution

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

This eliminates the need for the low-level server fix entirely — no Disconnect/Cancel exceptions reach it anymore.

Changes

  • Remove writer.send(ClientDisconnect()) from _handle_post_request
  • Remove 2 tests that verified writer notification (no longer applicable)\n- No change to low-level server (the original fix commit is replaced by this)

wiggzz added 2 commits May 5, 2026 14:35
The low-level server's generic case-Exception handler logs any exception
from the session stream at ERROR level. When the streamable HTTP transport
sends ClientDisconnect through the writer (to unblock the inner session
task), it was caught here and logged as ERROR — producing the same noise
we're trying to eliminate.

Add a guard clause matching Disconnect/Cancel exception types (by name,
to keep the low-level server transport-agnostic) and log at DEBUG instead.
Also skip sending 'Internal Server Error' to the client (there is none).
…sconnect

The connect() context manager closing streams is sufficient to unblock the
session task — no need to send ClientDisconnect through the writer. This
avoids the low-level server's case-Exception handler catching it and
producing ERROR-level noise (or requiring a separate DEBUG-level handler).

Session task exits cleanly when streams are closed on context manager exit.
@wiggzz wiggzz changed the title fix(lowlevel): log Disconnect/Cancel exceptions at DEBUG, not ERROR refactor(streamable_http): remove writer notification on ClientDisconnect May 5, 2026
@wiggzz wiggzz closed this May 5, 2026
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