mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
Support remote app servers in codex exec (#61707)
## What changed Allow `codex exec --remote <ADDR>` to run a noninteractive turn using an existing app server's configuration and credentials. Support starting a new thread or resuming one by UUID, with human-readable or JSON output and optional bearer-token authentication through `--remote-auth-token-env`. Accept remote options before or after `exec`, and reject conflicting endpoints. Reject unsupported agent configuration overrides and active threads, and report an error if the server disconnects before the turn completes. ## Testing Extend CLI integration coverage for remote execution and resume using server authentication, JSON completion events, human-readable thread IDs, and conflicting endpoints. Add a snapshot for `--remote` help text. GitOrigin-RevId: d4c3b16fb80eb6e8c523aff92110eaa878cbd3ee
This commit is contained in:
@@ -11,6 +11,17 @@ fn exec_help_documents_cyber_access_program() {
|
||||
.try_get_matches_from(["codex", "exec", "--help"])
|
||||
.expect_err("help should short-circuit");
|
||||
assert_eq!(help.kind(), clap::error::ErrorKind::DisplayHelp);
|
||||
let remote_help = help
|
||||
.to_string()
|
||||
.lines()
|
||||
.skip_while(|line| !line.contains("--remote <ADDR>"))
|
||||
.take_while(|line| !line.is_empty())
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
insta::assert_snapshot!(remote_help.trim(), @r"
|
||||
--remote <ADDR>
|
||||
Connect to an existing app server
|
||||
");
|
||||
let program_help = help
|
||||
.to_string()
|
||||
.lines()
|
||||
|
||||
@@ -1198,11 +1198,16 @@ async fn dispatch_cli(
|
||||
.await??;
|
||||
}
|
||||
Some(Subcommand::Exec(mut exec_cli)) => {
|
||||
reject_remote_mode_for_subcommand(
|
||||
root_remote.as_deref(),
|
||||
root_remote_auth_token_env.as_deref(),
|
||||
"exec",
|
||||
)?;
|
||||
if let Some(root_endpoint) = &root_remote
|
||||
&& let Some(exec_endpoint) = &exec_cli.remote
|
||||
&& root_endpoint != exec_endpoint
|
||||
{
|
||||
anyhow::bail!("`codex exec` received conflicting remote server endpoints");
|
||||
}
|
||||
exec_cli.remote = exec_cli.remote.or(root_remote);
|
||||
exec_cli.remote_auth_token_env = exec_cli
|
||||
.remote_auth_token_env
|
||||
.or(root_remote_auth_token_env);
|
||||
exec_cli
|
||||
.shared
|
||||
.inherit_exec_root_options(&interactive.shared);
|
||||
|
||||
Reference in New Issue
Block a user