Skip to content

[5/8] Add executor process transport for MCP stdio#17987

Closed
aibrahim-oai wants to merge 1 commit intoopenai:dev/remote-mcp-stdio-runtimefrom
aibrahim-oai:dev/remote-mcp-executor-stdio
Closed

[5/8] Add executor process transport for MCP stdio#17987
aibrahim-oai wants to merge 1 commit intoopenai:dev/remote-mcp-stdio-runtimefrom
aibrahim-oai:dev/remote-mcp-executor-stdio

Conversation

@aibrahim-oai
Copy link
Copy Markdown
Collaborator

@aibrahim-oai aibrahim-oai commented Apr 15, 2026

Summary

  • Add an rmcp transport backed by executor process read/write calls.
  • Add an executor stdio launcher that starts non-tty processes with piped stdin.

Stack

o  #18027 [8/8] Fail exec client operations after disconnect
│
o  #18025 [7/8] Cover MCP stdio tests with executor placement
│
o  #17974 [6/8] Wire remote MCP stdio through executor
│
@  #17987 [5/8] Add executor process transport for MCP stdio
│
o  #17986 [4/8] Abstract MCP stdio server launching
│
o  #18020 [3/8] Add pushed exec process events
│
o  #17985 [2/8] Support piped stdin in exec process API
│
o  #17984 [1/8] Add MCP server environment config
│
o  main

Copy link
Copy Markdown
Contributor

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

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: 96607d5b20

ℹ️ 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/rmcp-client/src/stdio_transport_runtime.rs Outdated
@aibrahim-oai aibrahim-oai changed the title Add executor-backed rmcp stdio transport [4/5] Add executor-backed rmcp stdio transport Apr 15, 2026
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-executor-stdio branch from fdb0d74 to 377fd73 Compare April 15, 2026 21:48
@aibrahim-oai aibrahim-oai changed the title [4/5] Add executor-backed rmcp stdio transport [4/5] Add executor process transport for MCP stdio Apr 15, 2026
Copy link
Copy Markdown
Contributor

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

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: 377fd736cf

ℹ️ 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 on lines +997 to +1000
LaunchedStdioServerTransport::Executor { transport } => (
service::serve_client(client_service, transport).boxed(),
None,
None,
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.

P1 Badge Terminate executor MCP process when handshake aborts

connect_pending_transport wraps serve_client(...) in a timeout; on timeout or handshake error, that future is dropped before RunningService exists. In the executor branch there is no cleanup guard (None), and ExecutorProcessTransport only terminates the child in close(). This can leave remote MCP server processes running after failed initialization.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-executor-stdio branch from 377fd73 to c468eef Compare April 15, 2026 21:57
Copy link
Copy Markdown
Contributor

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

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: c468eef9bd

ℹ️ 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 on lines +230 to +235
Err(error) => {
debug!(
"Failed to parse remote MCP server message ({}): {error}",
self.program_name
);
None
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.

P1 Badge Fail fast when remote MCP emits invalid JSON-RPC

take_stdout_message drops lines that fail serde_json parsing and keeps the transport alive. If a malformed line is actually a response, the request is never surfaced as an error and can hang until an outer timeout. The local stdio transport treats decode errors as transport failure, so this new path diverges and can hide protocol breakage.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-executor-stdio branch from c468eef to 83e867a Compare April 15, 2026 22:47
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio-runtime branch from 595325e to 3842a64 Compare April 15, 2026 22:47
@aibrahim-oai aibrahim-oai changed the title [4/5] Add executor process transport for MCP stdio [5/6] Add executor process transport for MCP stdio Apr 15, 2026
Copy link
Copy Markdown
Contributor

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

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: 83e867a607

ℹ️ 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 on lines +180 to +185
Err(broadcast::error::RecvError::Lagged(skipped)) => {
warn!(
"Remote MCP server output stream lagged ({}): skipped {skipped} events",
self.program_name
);
self.closed = true;
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.

P1 Badge Recover from lagged events instead of ending MCP stream

In ExecutorProcessTransport::receive_message, a broadcast::RecvError::Lagged sets self.closed = true, which makes receive() return EOF on the next loop. Because exec event channels are bounded, bursty/large stdout can trigger lag and this path truncates in-flight JSON-RPC output while the process may still be running. That can break handshakes or tool responses under load instead of resynchronizing via retained output.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai changed the title [5/6] Add executor process transport for MCP stdio [5/7] Add executor process transport for MCP stdio Apr 15, 2026
@aibrahim-oai aibrahim-oai changed the title [5/7] Add executor process transport for MCP stdio [5/8] Add executor process transport for MCP stdio Apr 16, 2026
Add an rmcp transport and runtime that bridge stdio bytes through the executor process API.

Co-authored-by: Codex <noreply@openai.com>
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio-runtime branch from 3842a64 to b440257 Compare April 16, 2026 05:10
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-executor-stdio branch from 83e867a to f6e61df Compare April 16, 2026 05:11
Copy link
Copy Markdown
Contributor

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

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: f6e61df763

ℹ️ 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 on lines +326 to +343
let started = exec_backend
.start(ExecParams {
process_id,
argv,
cwd: cwd.unwrap_or(default_cwd),
env_policy: None,
env,
tty: false,
stdin: ExecStdinMode::Piped,
arg0: None,
})
.await
.map_err(io::Error::other)?;

Ok(LaunchedStdioServer {
transport: LaunchedStdioServerTransport::Executor {
transport: ExecutorProcessTransport::new(started.process, program_name),
},
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.

P1 Badge Subscribe to process events before starting executor process

launch_server awaits exec_backend.start(...) and only then builds ExecutorProcessTransport, which calls process.subscribe_events(). tokio::broadcast does not replay old messages, so early Output/Closed events can be lost. If the MCP process exits quickly, the terminal event may be missed and receive() can block until an external timeout (or forever if no timeout is configured).

Useful? React with 👍 / 👎.

@aibrahim-oai
Copy link
Copy Markdown
Collaborator Author

Recreated as #18088 from an openai/codex head branch so internal CI uses the normal credentials path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant