Add observers for initial exec-server connection attempts (#52724)

## What changed

Expose `Environment::observe_connection_attempts` and `ConnectionAttemptOutcome` to report elapsed time and success, failure, or cancellation for initial connections. Measure from the end of provisioning through client installation, including connection retries.

The first registered observer wins. Past attempts and reconnections are omitted.

## Testing

Extend tests to assert failure followed by success when startup is retried, and a single cancellation notification when an environment is replaced during startup.

GitOrigin-RevId: 88300f38dcf9428b824c5ff36aa1b40d7d466b6f
This commit is contained in:
aaronl-openai
2026-10-09 23:28:38 +00:00
committed by copyberry
parent 2dc0791c7d
commit 7efd184c24
7 changed files with 93 additions and 2 deletions
@@ -251,6 +251,7 @@ impl LazyRemoteExecServerClient {
reconnect: std::sync::Arc::new(std::sync::Mutex::new(None)),
refresh_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
environment_connection_state_tx,
connection_observer: Default::default(),
}
}