Support the app-server daemon on Windows (#42405)

## Why

The managed app-server daemon and automatic TUI attachment were limited to
Unix, so Windows users could not share a background server across Codex
sessions.

## What changed

- Enable daemon lifecycle commands, `codex agents` startup, and AF_UNIX daemon
  discovery on Windows.
- Require Windows daemons to start non-elevated and verify the discovered
  socket directory and peer before connecting.
- Preflight detached process support, preserve path-based environment settings,
  and keep daemon processes out of the launching project's working directory.
- Fall back to an embedded server when an implicitly discovered daemon cannot
  connect, while preserving errors for explicit remote endpoints and bypassing
  daemon reuse when `CODEX_EXEC_SERVER_URL` is set.

## Testing

Add coverage for Windows launch restrictions and socket validation, implicit
connection fallback, executor selection, daemon discovery, and the agents
dashboard startup result.

GitOrigin-RevId: e7fd63cf8690bcca8b5155266416f31f2f792aa2
This commit is contained in:
Eric Traut
2026-09-03 01:26:35 +00:00
committed by copyberry
parent deb1471166
commit b7f710273e
25 changed files with 659 additions and 92 deletions
+2 -2
View File
@@ -1133,7 +1133,7 @@ async fn cli_main(
/*remote*/ None,
root_remote_auth_token_env.clone(),
)?;
#[cfg(not(unix))]
#[cfg(not(any(unix, windows)))]
anyhow::bail!("`codex agents` requires `--remote` on this platform");
}
interactive.agents_overview = true;
@@ -2600,7 +2600,7 @@ async fn run_interactive_tui(
}
}
#[cfg(unix)]
#[cfg(any(unix, windows))]
if interactive.agents_overview && remote.is_none() {
if !std::io::stdin().is_terminal() {
return Ok(AppExitInfo::fatal("stdin is not a terminal"));