mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +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,7 @@ mod event_processor;
|
||||
mod event_processor_with_human_output;
|
||||
pub(crate) mod event_processor_with_jsonl_output;
|
||||
pub(crate) mod exec_events;
|
||||
mod remote;
|
||||
mod worktree;
|
||||
|
||||
pub use cli::Cli;
|
||||
@@ -272,6 +273,12 @@ fn exec_stderr_env_filter() -> EnvFilter {
|
||||
}
|
||||
|
||||
pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
|
||||
if let Some(endpoint) = codex_app_server_client::resolve_remote_endpoint(
|
||||
cli.remote.clone(),
|
||||
cli.remote_auth_token_env.clone(),
|
||||
)? {
|
||||
return remote::run(cli, endpoint).await;
|
||||
}
|
||||
if cli.trust && cli.ignore_user_config {
|
||||
anyhow::bail!(
|
||||
"--trust cannot be combined with --ignore-user-config: saved project trust decisions must be checked"
|
||||
@@ -283,6 +290,8 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
|
||||
let Cli {
|
||||
mut command,
|
||||
remote: _,
|
||||
remote_auth_token_env: _,
|
||||
strict_config,
|
||||
shared,
|
||||
thread_source,
|
||||
@@ -1450,6 +1459,9 @@ async fn finish_turn(
|
||||
};
|
||||
|
||||
let Some(server_event) = server_event else {
|
||||
if matches!(client, AppServerClient::Remote(_)) {
|
||||
anyhow::bail!("app-server disconnected before turn completion");
|
||||
}
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user