Bound managed app-server and updater stderr logging (#55856)

## Why

Managed stderr logs previously retained a tail only before a new launch, allowing logs to grow during a long-running process. Direct stderr writes could also block lifecycle operations on disk I/O.

## What changed

- Route managed app-server and updater logs through a shared nonblocking worker with a bounded queue. Drop records when the queue is full or a record exceeds 16 KiB, and avoid waiting for the worker at shutdown.
- Prune live logs when they exceed 1 MiB, preserving the latest 256 KiB in `.log.previous` before truncating the current file. Keep inherited stderr handles usable after truncation.
- Pause predecessor pruning during Windows updater handoff and resume it after a failed handoff only when ownership has been restored.
- Keep ordinary stderr output when managed logging has not been initialized.

## Testing

Add regression tests for stalled workers and queue overflow, tail retention, inherited append and nonappend handles, and pruning exclusion during updater handoff.

GitOrigin-RevId: b6301962b1180fa6cdb231a56edce2429dc20b54
This commit is contained in:
jif
2026-10-21 10:31:12 +00:00
committed by copyberry
parent 4faf60f126
commit 6bae551093
12 changed files with 464 additions and 56 deletions
+8
View File
@@ -1285,6 +1285,14 @@ async fn cli_main(
listen
};
let auth = auth.try_into_settings()?;
if managed_daemon
&& matches!(
&transport,
codex_app_server::AppServerTransport::UnixSocket { .. }
)
{
let _ = codex_app_server_daemon::maintain_stderr_log();
}
let runtime_options = codex_app_server::AppServerRuntimeOptions {
cloud_skills_snapshot,
code_mode_host_transport: code_mode_host.into(),