Files
codex/codex-rs/rmcp-client/src
Dylan Hurd 6fd58416e3 Prevent MCP reply POSTs from resolving pending requests (#63075)
## Why

Codex and an MCP server assign JSON-RPC request IDs independently. If
both use the same ID, a server message returned in response to Codex's
reply POST can incorrectly resolve Codex's own pending request.

## What changed

In the MCP Streamable HTTP client, accept HTTP `202` and `204` as
acknowledgements for outgoing JSON-RPC results and errors. After handling
authentication challenges, reject other statuses for reply POSTs before
decoding their bodies as JSON or server-sent events.

## Testing

Add a regression test that uses the same ID for a request and a reply.
It checks that the request still receives its JSON-RPC error, reply
POSTs reject HTTP `409` JSON and HTTP `200` JSON or SSE, and both
acknowledgement statuses are accepted.

GitOrigin-RevId: 9ab1528b5c1f4af0bd281f9a6942271d7cc9812b
2026-11-22 02:21:17 +00:00
..
…