Skip to content

Add exec-server stub server and protocol docs#15089

Merged
starr-openai merged 14 commits intomainfrom
starr/exec-server-stub-fresh
Mar 19, 2026
Merged

Add exec-server stub server and protocol docs#15089
starr-openai merged 14 commits intomainfrom
starr/exec-server-stub-fresh

Conversation

@starr-openai
Copy link
Contributor

Stacked PR 1/3.

This is the initialize-only exec-server stub slice: binary/client scaffolding and protocol docs, without exec/filesystem implementation.

starr-openai and others added 5 commits March 18, 2026 10:29
This adds the standalone exec-server stdio JSON-RPC crate and its
smoke tests without wiring it into the CLI or unified-exec yet.

Co-authored-by: Codex <noreply@openai.com>
Document the standalone exec-server crate, its stdio JSON-RPC
transport, and the current request/response and notification
payloads.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Keep only the standalone handshake transport in the first PR. Leave exec RPC behavior unimplemented here so the working process implementation can land in a separate follow-up.\n\nCo-authored-by: Codex <noreply@openai.com>
Move process-oriented client helpers and exports into the exec follow-up. Keep the first PR focused on spawning the stub server and running the initialize handshake.\n\nCo-authored-by: Codex <noreply@openai.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

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

Copy link
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: 76071974bb

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

continue;
}

let message = serde_json::from_str::<JSONRPCMessage>(&line)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

P1 Badge Handle malformed JSON without exiting server

run_main deserializes each input line with serde_json::from_str(...)? in the main loop. A single malformed line propagates an error out of run_main, so the binary exits and drops the stdio session instead of replying with a JSON-RPC error and continuing. This lets one bad client message take down the whole server process.

Useful? React with 👍 / 👎.

starr-openai and others added 5 commits March 18, 2026 13:59
Introduce API-agnostic server envelope parsing/encoding and a tiny method-registration router in the initialize-only exec-server slice.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>

#[derive(Debug, Parser)]
struct ExecServerArgs {
/// Transport endpoint URL. Supported values: `stdio://` (default),
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should test over the same protocol that we use in prod (I assume ws?)

not blocking

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InitializeResponse {
pub protocol_version: String,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd nix versioning until we know what we are actually doing with it.


while let Some(event) = incoming_rx.recv().await {
match event {
JsonRpcConnectionEvent::Message(message) => match message {
Copy link
Collaborator

Choose a reason for hiding this comment

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

JsonRpcConnectionEvent doesn't exist in app server so I'm surprised to see this here.

use crate::rpc::RpcRouter;
use crate::server::ExecServerHandler;

pub(crate) fn build_router() -> RpcRouter<ExecServerHandler> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I tend to favor a match statement in a loop?


#[allow(clippy::print_stderr)]
fn print_websocket_startup_banner(addr: SocketAddr) {
eprintln!("codex-exec-server listening on ws://{addr}");
Copy link
Collaborator

Choose a reason for hiding this comment

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

We try to ban println and eprintln (there's a lint to block them). Favor the tracing crate.

eprintln!("codex-exec-server listening on ws://{addr}");
}

#[cfg(test)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Look at core as an example: we do something slightly non-standard and create separate _tests.rs files.


## Transport

The server speaks newline-delimited JSON-RPC 2.0 over stdio.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not quite? Or does it?

- `stdout`: one JSON-RPC message per line
- `stderr`: reserved for logs / process errors

Like the app-server transport, messages on the wire omit the `"jsonrpc":"2.0"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah yep!

starr-openai and others added 2 commits March 18, 2026 23:30
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@starr-openai
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor Author

recheck

starr-openai and others added 2 commits March 18, 2026 23:53
Handle malformed JSON-RPC input by replying with an invalid-request error and keeping the connection open, and trim stale transport wording in the README.

Co-authored-by: Codex <noreply@openai.com>
Remove dead stub-only dependencies and disable doctests for the exec-server library target so cargo-shear stays green.

Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai enabled auto-merge (squash) March 19, 2026 00:23
@starr-openai starr-openai merged commit 81996fc into main Mar 19, 2026
33 checks passed
@starr-openai starr-openai deleted the starr/exec-server-stub-fresh branch March 19, 2026 00:30
@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 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