mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add --no-daemon to bypass the shared background server (#46088)
## What changed - Run with `--no-daemon` without starting or probing the shared server, even when it is already running. Preserve the flag through `resume` and `fork`, and honor it for session archive commands. - Reject combinations with `--remote`, `codex agents`, and `codex queue`, which require a server connection. Point users to `codex --no-daemon` when the agents overview cannot start its shared server. - Centralize daemon eligibility checks and exclude launches using `--profile` or `CODEX_EXEC_SERVER_URL` from implicit daemon reuse. ## Testing Add coverage for flag propagation, incompatible command combinations, and daemon eligibility. Add a PTY test verifying that `--no-daemon` starts the TUI without creating daemon state or connecting to an existing control socket. GitOrigin-RevId: acc6a7cb339df6433bb8273c796194cdceda37c1
This commit is contained in:
1 parent
8452164c76
commit
787823cf95
10 files changed
+271
-67
No files matched your search
@@ -298,3 +298,35 @@ async fn features_list_honors_cloud_managed_feature_requirements() -> Result<()>
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_daemon_rejects_agents_and_explicit_remote_targets() -> Result<()> {
|
||||
for args in [
|
||||
"--no-daemon agents",
|
||||
"agents --no-daemon",
|
||||
"--no-daemon queue --thread example --message hello",
|
||||
"--no-daemon --remote ws://localhost:9999 agents",
|
||||
"--no-daemon --remote ws://localhost:9999",
|
||||
"--no-daemon --remote ws://localhost:9999 archive example",
|
||||
"--no-daemon --remote ws://localhost:9999 queue --thread example --message hello",
|
||||
"--remote ws://localhost:9999 resume --no-daemon --last",
|
||||
"--no-daemon fork --remote ws://localhost:9999 session-name",
|
||||
] {
|
||||
let args = args.split_whitespace().collect::<Vec<_>>();
|
||||
let home = TempDir::new()?;
|
||||
let expected = if args.contains(&"agents") {
|
||||
"--no-daemon cannot be used with codex agents."
|
||||
} else if args.contains(&"queue") && !args.contains(&"--remote") {
|
||||
"--no-daemon cannot be used with codex queue."
|
||||
} else {
|
||||
"--no-daemon cannot be used with --remote."
|
||||
};
|
||||
codex_command(home.path())?
|
||||
.args(args)
|
||||
.assert()
|
||||
.failure()
|
||||
.stderr(contains(expected));
|
||||
assert!(!home.path().join("app-server-daemon").exists());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user