Files
Claude 6472241329 fix(client): contain arbitrary POST failures and dedupe the status-error mapping
Address the third review round:

- Broaden the SSE message POST's failure catch to a terminal containment
  boundary (except Exception): user-supplied auth flows and hooks raise
  arbitrary types from inside client.post(), so an enumerated catch cannot
  keep the caller from hanging.
- Extract the status -> JSON-RPC error mapping into
  mcp.client._transport.status_error_data and use it from the message POST
  handler, the resumption GET, and the SSE POST; the message POST keeps its
  pre-session 404 -> METHOD_NOT_FOUND case locally. Wire-identical.
- Contain the SSE error-resolution send against a concurrently closed read
  stream (BrokenResourceError/ClosedResourceError -> debug log), mirroring
  _resolve_abandoned_request, so the teardown race cannot kill the write
  loop.

Tests: the auth-failure test is parametrized over OAuthTokenError and
RuntimeError, and a raw-stream teardown-race test pins that a failing
POST whose error is undeliverable leaves the write loop serving later
messages. Both fail against the previous revision.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AuJi8kEB3bhikW2pzbmhUL
2026-08-11 06:26:42 +00:00
..
2024-09-24 22:04:19 +01:00