Extract exec-server CLI startup into a dedicated module (#47143)

## What changed

Move `codex exec-server` argument definitions, transport validation, configuration loading, authentication, and shutdown orchestration from `codex-rs/cli/src/main.rs` into `codex-rs/cli/src/exec_server_command.rs`.

Expose startup through `ExecServerCommand::run`, merge the root `--strict-config` flag into the command before dispatch, and update existing argument tests to use the new entry point.

GitOrigin-RevId: 4bcc59db2bd6e1d153a366142bd0b93ad03c6951
This commit is contained in:
Adam Perry @ OpenAI
2026-09-22 01:01:44 +00:00
committed by copyberry
parent b045757052
commit 517f51a6f7
3 changed files with 493 additions and 462 deletions
+15 -16
View File
@@ -2,6 +2,7 @@ use clap::error::ErrorKind;
use pretty_assertions::assert_eq;
use super::*;
use crate::exec_server_command::ExecServerRemoteTransport;
fn exec_server_from_args(args: &[&str]) -> ExecServerCommand {
let cli = MultitoolCli::try_parse_from(
@@ -199,14 +200,13 @@ async fn exec_server_sigv4_does_not_enable_aws_auth_for_noise() {
args.extend(options);
let command = exec_server_from_args(&args);
// Unset runtime paths prove validation runs before startup or credential loading.
let error = run_exec_server_command(
command,
&Arg0DispatchPaths::default(),
&CliConfigOverrides::default(),
/*strict_config*/ false,
)
.await
.expect_err("Noise auth is unchanged");
let error = command
.run(
&Arg0DispatchPaths::default(),
&CliConfigOverrides::default(),
)
.await
.expect_err("Noise auth is unchanged");
assert_eq!(
error.to_string(),
"--aws-sigv4 requires --remote-transport direct"
@@ -250,14 +250,13 @@ async fn exec_server_direct_forwarding_remains_rejected() {
"bedrock-mantle"
),
);
let error = run_exec_server_command(
command,
&Arg0DispatchPaths::default(),
&CliConfigOverrides::default(),
/*strict_config*/ false,
)
.await
.expect_err("Direct forwarding is unsupported before startup");
let error = command
.run(
&Arg0DispatchPaths::default(),
&CliConfigOverrides::default(),
)
.await
.expect_err("Direct forwarding is unsupported before startup");
assert_eq!(
error.to_string(),
"direct exec-server transport does not support forwarding"