Classify daemon auto-start failures in TUI telemetry (#59058)

## What changed

Add a `failure_reason` tag to failed TUI auto-start events in `codex.daemon.start`, distinguishing `install`, `spawn`, `early_child_exit`, `readiness_timeout`, and `other` failures. Preserve the original error diagnostics through a classified startup API.

Detect managed child exits during process identity recording and distinguish exits before readiness from readiness timeouts.

## Testing

Extend daemon tests to assert classification of installation failures, spawn failures, early child exits, and readiness timeouts.

GitOrigin-RevId: 7c626f278e9e7f2ecd61b3fd1a90829a113eb232
This commit is contained in:
Eric Traut
2026-11-03 04:20:50 +00:00
committed by copyberry
parent c5122161fe
commit dbaead0106
10 changed files with 150 additions and 21 deletions
@@ -839,6 +839,12 @@ async fn readiness_waits_for_a_slow_managed_daemon() {
backend.start().await.unwrap();
tokio::time::pause();
// The process is alive but has no listening socket throughout the first deadline.
let error = daemon.wait_until_ready().await.unwrap_err();
assert_eq!(
crate::telemetry::StartError::from(error).failure_reason(),
"readiness_timeout"
);
let (ready, listener) = tokio::join!(daemon.wait_until_ready(), async {
// Model a cold start that takes longer than the old Linux readiness deadline.
tokio::time::sleep(Duration::from_secs(15)).await;