Stabilize Rosetta test timing and retry delay telemetry (#47832)

## Why

Cold Rosetta translation and cache invalidation from hard-linked executables can interfere with timed CLI tests. Sampling the clock twice also makes local retry telemetry report a delay shorter than the selected backoff.

## What changed

- Warm CLI fixtures with `--version` on macOS x86_64 before timed checks, and use copies or Unix symlinks to avoid invalidating the shared executable's Rosetta cache.
- Use one clock sample to calculate the response retry deadline and recorded delay.
- Include the retry telemetry event in delay-range assertion failures for the headerless rate-limit stream test.

GitOrigin-RevId: fc573bfff912e999cf74b94a1c6e7ae1be07974b
This commit is contained in:
jif
2026-09-24 13:09:49 +00:00
committed by copyberry
parent 61e23bc6a1
commit 282cd7b019
6 changed files with 72 additions and 7 deletions
+4 -4
View File
@@ -132,10 +132,10 @@ pub(crate) async fn handle_response_stream_error(
)
.await;
}
let retry_at = retry_after
.map(RetryAfter::deadline)
.unwrap_or_else(|| Instant::now() + delay);
let delay = retry_at.saturating_duration_since(Instant::now());
// Use one clock sample so local backoff telemetry retains the selected delay.
let now = Instant::now();
let retry_at = retry_after.map(RetryAfter::deadline).unwrap_or(now + delay);
let delay = retry_at.saturating_duration_since(now);
codex_client::record_retry!(retry_count, delay, operation);
tokio::time::sleep_until(retry_at).await;
return Ok(());