Skip to content

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

Open
aibrahim-oai wants to merge 1 commit intodev/remote-mcp-stdio-runtimefrom
dev/remote-mcp-executor-stdio
Open

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

Conversation

@aibrahim-oai
Copy link
Copy Markdown
Collaborator

@aibrahim-oai aibrahim-oai commented Apr 16, 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  #18089 [6/8] Wire remote MCP stdio through executor
│
@  #18088 [5/8] Add executor process transport for MCP stdio
│
o  #18087 [4/8] Abstract MCP stdio server launching
│
o  #18020 [3/8] Add pushed exec process events
│
o  #18086 [2/8] Support piped stdin in exec process API
│
o  #18085 [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: 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 +180 to +186
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 lagged event streams instead of terminating transport

RecvError::Lagged means this receiver skipped broadcast entries, not that the process is dead. The code sets closed = true, which makes receive() return EOF and triggers transport shutdown, aborting otherwise healthy MCP sessions during bursty output. Since ExecProcess also exposes retained read() data, this path should resync (or fail explicitly) rather than force-close.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio-runtime branch from b440257 to c603449 Compare April 16, 2026 06:20
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-executor-stdio branch from f6e61df to f11cc84 Compare April 16, 2026 06:20
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: f11cc84bdc

ℹ️ 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 +229 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 Drain buffered frames after parse errors

take_stdout_message drops an invalid line and returns None, then receive_message immediately waits on events.recv(). If a single output chunk contains bad\n{valid-json}\n, the valid JSON frame remains in self.stdout but is never processed until another event arrives. A quiet server can then stall MCP initialization until timeout.

Useful? React with 👍 / 👎.

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

ℹ️ 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".


impl ExecutorProcessTransport {
pub(super) fn new(process: Arc<dyn ExecProcess>, program_name: String) -> Self {
let events = process.subscribe_events();
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 Replay missed process events before awaiting broadcast

ExecutorProcessTransport::new subscribes to process.subscribe_events() only after start() has already returned. If the child exits immediately, Closed/Failed can be emitted before this subscription and are not replayed by broadcast. receive_message() then waits on events.recv() with closed == false, which can stall MCP handshake/reads indefinitely for dead-on-start servers.

Useful? React with 👍 / 👎.

@edward-bayes edward-bayes marked this pull request as draft April 16, 2026 07:18
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 16, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@edward-bayes edward-bayes marked this pull request as ready for review April 16, 2026 07:19
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: 0af64c7008

ℹ️ 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 process when handshake setup fails

Add cleanup parity with local stdio: this branch keeps no guard/owner for the spawned executor process. If serve_client errors or time::timeout elapses during initialization, the future is dropped and the process can remain running without a later terminate(), leaking MCP subprocesses across retries.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio-runtime branch from c603449 to db32dd3 Compare April 16, 2026 13:55
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-executor-stdio branch from 0af64c7 to aad254a Compare April 16, 2026 13:56
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-executor-stdio branch from aad254a to ad686d6 Compare April 16, 2026 13:59
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio-runtime branch from db32dd3 to 2ccbd13 Compare April 16, 2026 13:59
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