6472241329
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