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 authored and copyberry committed 2026-09-03 01:26:35 +00:00
1 parent deb1471166
commit b7f710273e
25 files changed
+659 -92

No files matched your search

+4 -9
View File
@@ -36,14 +36,9 @@ pub(super) async fn reconnect(
presentation: ReconnectPresentation,
) -> Result<Reconnected> {
let mode = target.thread_params_mode();
let endpoint = match target {
AppServerTarget::Remote { endpoint } | AppServerTarget::LocalDaemon { endpoint } => {
endpoint
}
AppServerTarget::Embedded => {
color_eyre::eyre::bail!("in-process sessions have no connection to restore")
}
};
if matches!(target, AppServerTarget::Embedded) {
color_eyre::eyre::bail!("in-process sessions have no connection to restore");
}
if let ThreadToolTransport::Mcp(server) = &task_tools {
server.suspend();
}
@@ -58,7 +53,7 @@ pub(super) async fn reconnect(
for delay in [0, 1, 2, 4, 8] {
let attempt = async {
tokio::time::sleep(Duration::from_secs(delay)).await;
let client = crate::connect_remote_app_server(endpoint.clone()).await?;
let client = crate::app_server_connection::connect(&target).await?;
let mut session = AppServerSession::new(client, mode)
.with_startup_config(&config)
.with_remote_cwd_override(remote_cwd.clone())