Practical technical guides / Recent development: openai/codex PR 63075, merged 22 November 2026

MCP Request IDs Belong to Their Sender, So a Reply Cannot Answer Yours

Codex now requires 202 or 204 for MCP reply POSTs, because a server error reusing your request id could resolve the wrong call. The collision and the test.

By Sandeep Belgavi · Published 2026-11-22

Codex now requires 202 or 204 for MCP reply POSTs, because a server error reusing your request id could resolve the wrong call. The collision and the test.

What changed on 22 November

On 22 November 2026 at 02:21 UTC, OpenAI merged a small change to the MCP client inside Codex: pull request 63075, "Prevent MCP reply POSTs from resolving pending requests", merge commit 6fd5841. Its description states the problem in two sentences. Codex and an MCP server assign JSON-RPC request ids independently, and if both use the same id, a server message returned in response to one of Codex's reply POSTs can incorrectly resolve Codex's own pending request. The fix accepts HTTP 202 and 204 as acknowledgements for outgoing JSON-RPC results and errors and, after handling authentication challenges, rejects any other status for a reply POST before decoding its body as JSON or server-sent events.

When this was read, on 22 November, the change was on the main branch; the newest Codex release, 0.173.0-alpha.4, was published on 21 November, before the merge. The bug class is not specific to Codex. Any client of a bidirectional JSON-RPC protocol that correlates responses by id alone can have it, and this guide explains why, reproduces it, and shows what to test in your own client or server.

Ids are scoped to the sender

JSON-RPC uses the id of a request to match it with its response. MCP adds rules on top. In MCP revision 2025-11-25, a request must include a string or integer id, the id must not be null, and the request id must not have been previously used by the requestor within the same session. The uniqueness rule is about the requestor. A client numbering its requests 1, 2, 3 and a server numbering its own requests 1, 2, 3 are both following it.

In a protocol where only one side sends requests, that never matters. MCP is bidirectional: in revisions 2025-03-26 through 2025-11-25 the server can send its own requests to the client over the Streamable HTTP transport, for example to ask for user input through elicitation or to request a model sample. The client answers each one by POSTing a JSON-RPC response. Now two id spaces share one connection, and a response with id 7 is ambiguous unless you also know which direction it belongs to.

The collision, step by step

The companion example models a client with one pending request and a server that has sent a request of its own, both with id 7:

  1. The client sends request id 7, tools/call, looking up an order for a help-desk case at the fictional Belgavi's Book Store. It is pending.
  2. The server sends its own request id 7, elicitation/create.
  3. The client POSTs its reply: {"jsonrpc": "2.0", "id": 7, "result": {"action": "accept"}}.
  4. The server cannot accept the reply and answers the POST with HTTP 409 and a JSON-RPC error that carries id 7, "unknown request".

A client that dispatches every JSON-RPC response it receives by id now finds id 7 in its pending map and resolves its own tools/call with the server's error about the reply. When the real result of the tool call arrives a moment later, nothing is pending under id 7, and the client drops it as unknown. The user sees a failed tool call; the log shows an error that has nothing to do with the tool.

The model's results for the HTTP status of the reply POST:

  • Naive client, 409 with a JSON error body: request 7 resolved with the wrong error, real result dropped.
  • Naive client, 200 with the same body: the same.
  • Strict client, 409 or 200: the reply POST fails as "expected acknowledgement", and request 7 receives its real result.
  • Both clients, 202 or 204: acknowledged, request 7 receives its real result.

The Codex regression test covers the same matrix, including a 200 response whose body is an SSE stream carrying the error.

What the specification says a server should send

The 2025-11-25 Streamable HTTP transport is precise. When the body of a client POST is a JSON-RPC response or notification and the server accepts it, the server must return 202 Accepted with no body. When it cannot accept it, the server must return an HTTP error status such as 400, and the body may be a JSON-RPC error response that has no id. A server that answers a reply POST with an error carrying the reply's id is therefore outside the specification, but servers are written by many people and some will do it. A client must be robust to that, and the Codex change makes it so.

The rule to implement

The direction of a message is known from how it arrived, so use it:

  • A response to one of your requests arrives on the HTTP response, or the SSE stream, of the POST that carried that request.
  • The HTTP response to a POST that carried your reply to the peer can only be an acknowledgement. Anything else is an error about your reply, and must never be decoded into the dispatcher.
ACK = {202, 204}

def post_reply(self, reply, status, body):
    if status in ACK:
        return 'acknowledged'
    # A reply answers the peer's request. Its HTTP response cannot answer ours.
    raise TransportError(f'expected acknowledgement for reply id {reply["id"]}, got HTTP {status}')

If your client correlates through a single shared map, key it by direction as well as id, or keep separate maps for requests you sent and requests you received. Either way, the test is the same: give both sides the same id and check that nothing crosses over.

The newest revision removes the case

MCP revision 2026-07-28 changed Streamable HTTP substantially. Its transport page says the body of a client POST must be a single request or notification and that the client must not send JSON-RPC responses. Server-to-client interactions such as sampling, elicitation and roots are embedded in results as input requests, following the Multi Round-Trip Requests design, and the server must not send independent requests on a response stream. With no client reply POSTs, this particular collision cannot happen.

That does not make the fix obsolete. Clients negotiate protocol versions, and a client that supports 2025-11-25 servers keeps the old code path. Keep the strict acknowledgement rule wherever reply POSTs still exist.

What to check in your own stack

  • If you maintain an MCP client: send a request with id 7 while the server has an outstanding request with id 7, answer the server, and make the server return 409 with a body carrying id 7. Your request must still receive its own result.
  • If you maintain an MCP server: return 202 with no body for accepted responses and notifications, and an error with no id for rejected ones, as the transport section requires.
  • If you write any bidirectional JSON-RPC bridge, such as a proxy that sits between an agent and several servers: the proxy must not merge the id spaces of its two sides. Rewrite ids on the way through and keep the mapping per direction.
  • If you use your own numbering scheme to make collisions unlikely, such as prefixed string ids: that reduces the chance, but the dispatcher should still be correct when ids collide, because the peer's ids are not under your control.

Practical implications

For Codex users the change is protective and needs no configuration. It arrives with whichever release first includes merge commit 6fd5841; check the release notes rather than assuming the version. For people building agents on MCP, the broader lesson is about correlation: ids are a per-sender namespace, and the transport, not the id, tells you which way a message is going.

Verification

The companion example's six tests check that the naive client resolves its own request with the server's rejection for both 409 and 200, that it then drops the real result, that the strict client rejects non-acknowledgements and still receives the result, that 202 and 204 are accepted, that message kinds are classified correctly, and that a pending request with a different id is unaffected. The interactive lab linked below lets you change the ids, the status and the client rule and watch the dispatch trace.

Run the example yourself

The naive and strict clients, the same-id scenario for each status and six tests. No MCP server is used. Companion code on GitHub; its README lists the prerequisites, exact commands, expected output and limits.

Interactive experiment

JSON-RPC ids by direction: when a reply collides with your own request. Synthetic inputs computed in your browser; read the lab notes on assumptions and limits before drawing conclusions.

Primary references and authorship

Sources read 22 November 2026. Original explanation, measurements and synthetic examples by Sandeep Belgavi. Views are my own and do not represent any employer, past or present.

Related on this site: