mirror of
https://github.com/openai/codex.git
synced 2026-11-01 19:33:35 +00:00
## Why The agent command center previously required a shared background server, preventing embedded sessions from opening it and rejecting `codex agents --no-daemon`. ## What changed - Allow `codex agents --no-daemon` to use an embedded app server and open the command center without a shared server. - Route `codex agents` through the normal daemon startup, eligibility, and compatibility checks, including embedded fallback where applicable. - Return embedded sessions to the command center when canceling directory trust or archived-session confirmation. ## Testing Add CLI coverage for `--no-daemon` before and after `agents`, plus an integration test that verifies embedded mode is used even when a daemon is running. Update archived-session tests to expect cancellation to return to the command center. GitOrigin-RevId: 3bdf18a00456eae2e4d38103d12126e039d44119
60 lines
1.7 KiB
Rust
60 lines
1.7 KiB
Rust
// Release builds exceed rustc's default query depth when laying out the async
|
|
// MessageProcessor::handle_initialized_client_request future.
|
|
#![recursion_limit = "256"]
|
|
|
|
use clap::Parser;
|
|
use codex_arg0::Arg0DispatchPaths;
|
|
use codex_arg0::arg0_dispatch_or_else;
|
|
use codex_config::LoaderOverrides;
|
|
use codex_tui::Cli;
|
|
use codex_tui::ExitReason;
|
|
use codex_tui::run_main;
|
|
use codex_utils_cli::CliConfigOverrides;
|
|
use std::io::Write;
|
|
use supports_color::Stream;
|
|
|
|
#[derive(Parser, Debug)]
|
|
struct TopCli {
|
|
#[clap(flatten)]
|
|
config_overrides: CliConfigOverrides,
|
|
|
|
#[clap(flatten)]
|
|
inner: Cli,
|
|
}
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
codex_build_info::initialize!();
|
|
arg0_dispatch_or_else(|arg0_paths: Arg0DispatchPaths| async move {
|
|
let top_cli = TopCli::parse();
|
|
let mut inner = top_cli.inner;
|
|
inner
|
|
.config_overrides
|
|
.raw_overrides
|
|
.splice(0..0, top_cli.config_overrides.raw_overrides);
|
|
let exit_info = run_main(
|
|
inner,
|
|
arg0_paths,
|
|
LoaderOverrides::default(),
|
|
/*explicit_remote_endpoint*/ None,
|
|
)
|
|
.await?;
|
|
let is_fatal = match &exit_info.exit_reason {
|
|
ExitReason::Fatal(message) => {
|
|
eprintln!("ERROR: {message}");
|
|
true
|
|
}
|
|
ExitReason::UserRequested | ExitReason::TurnInterrupted => false,
|
|
};
|
|
|
|
let color_enabled = supports_color::on(Stream::Stdout).is_some();
|
|
for line in exit_info.format_exit_messages(color_enabled) {
|
|
println!("{line}");
|
|
}
|
|
if is_fatal {
|
|
std::io::stdout().flush()?;
|
|
std::process::exit(1);
|
|
}
|
|
Ok(())
|
|
})
|
|
}
|