Add codex app-server --stdio alias (#24940)

## Summary
- Add `--stdio` as a direct alias for `codex app-server --listen
stdio://`.
- Keep `--stdio` and `--listen` mutually exclusive.
- Update the app-server README to document both forms.
This commit is contained in:
Adam Perry @ OpenAI
2026-05-28 12:43:30 -07:00
committed by GitHub
parent 9dd39f334e
commit b90ec46387
2 changed files with 30 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ Similar to [MCP](https://modelcontextprotocol.io/), `codex app-server` supports
Supported transports:
- stdio (`--listen stdio://`, default): newline-delimited JSON (JSONL)
- stdio (`--stdio` or `--listen stdio://`, default): newline-delimited JSON (JSONL)
- websocket (`--listen ws://IP:PORT`): one JSON-RPC message per websocket text frame (**experimental / unsupported**)
- unix socket (`--listen unix://` or `--listen unix://PATH`): websocket connections over `$CODEX_HOME/app-server-control/app-server-control.sock` or a custom socket path, using the standard HTTP Upgrade handshake
- off (`--listen off`): do not expose a local transport

View File

@@ -452,6 +452,10 @@ struct AppServerCommand {
)]
listen: codex_app_server::AppServerTransport,
/// Use stdio as the transport (equivalent to `--listen stdio://`).
#[arg(long = "stdio", conflicts_with = "listen")]
stdio: bool,
/// Enable remote control for this app-server process.
#[arg(long = "remote-control", hide = true)]
remote_control: bool,
@@ -965,6 +969,7 @@ async fn cli_main(arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
subcommand,
strict_config: app_server_strict_config,
listen,
stdio,
remote_control,
analytics_default_enabled,
auth,
@@ -978,7 +983,11 @@ async fn cli_main(arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
)?;
match subcommand {
None => {
let transport = listen;
let transport = if stdio {
codex_app_server::AppServerTransport::Stdio
} else {
listen
};
let auth = auth.try_into_settings()?;
let runtime_options = codex_app_server::AppServerRuntimeOptions {
remote_control_enabled: remote_control,
@@ -3197,6 +3206,25 @@ mod tests {
);
}
#[test]
fn app_server_stdio_flag_parses() {
let app_server = app_server_from_args(["codex", "app-server", "--stdio"].as_ref());
assert!(app_server.stdio);
}
#[test]
fn app_server_stdio_flag_conflicts_with_listen() {
let err = MultitoolCli::try_parse_from([
"codex",
"app-server",
"--stdio",
"--listen",
"stdio://",
])
.expect_err("--stdio and --listen should be rejected together");
assert_eq!(err.kind(), clap::error::ErrorKind::ArgumentConflict);
}
#[test]
fn app_server_listen_unix_socket_url_parses() {
let app_server =