Skip to content

Recover exec process stdin writes#28895

Merged
jif-oai merged 4 commits into
mainfrom
jif/recover-exec-process-write
Jun 18, 2026
Merged

Recover exec process stdin writes#28895
jif-oai merged 4 commits into
mainfrom
jif/recover-exec-process-write

Conversation

@jif-oai

@jif-oai jif-oai commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Remote stdio MCP servers send tool calls by writing JSON-RPC bytes through process/write.

When the exec-server websocket drops at the wrong time, the remote process can survive session recovery, but the stdin write can still fail back to RMCP as a transport send error. RMCP then closes the stdio MCP transport, so tools like node_repl are lost even though the process/session recovery path is working.

This changes process/write to be safe to retry across exec-server recovery:

  • adds a required writeId to process/write
  • retries remote Session::write with the same writeId after reconnect
  • remembers accepted write ids per process so duplicate retries return Accepted without writing the same bytes to child stdin again
  • covers both the client retry path and server-side write id dedupe with tests

In simple terms:

before:
write to MCP stdin -> websocket closes -> write errors -> RMCP closes node_repl

after:
write to MCP stdin -> websocket closes -> reconnect -> retry same writeId
server either writes once or recognizes it already did

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff17d0ebd0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/exec-server/src/protocol.rs
Comment thread codex-rs/exec-server/src/local_process.rs
Comment thread codex-rs/exec-server/src/local_process.rs Outdated
@jif-oai jif-oai merged commit 83e6a78 into main Jun 18, 2026
49 of 55 checks passed
@jif-oai jif-oai deleted the jif/recover-exec-process-write branch June 18, 2026 17:04
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants