mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
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:
@@ -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(());
|
||||
|
||||
@@ -1103,7 +1103,10 @@ async fn sse_failure_without_retry_after_exhausts_stream_retries(code: &str) ->
|
||||
|
||||
submit_user_input(&test, "exhaust the headerless rate-limited stream").await?;
|
||||
let retry = telemetry.next_retry().await;
|
||||
assert!((FIRST_RETRY_MIN_DELAY..FIRST_RETRY_MAX_DELAY).contains(&retry.delay));
|
||||
assert!(
|
||||
(FIRST_RETRY_MIN_DELAY..FIRST_RETRY_MAX_DELAY).contains(&retry.delay),
|
||||
"{retry:?}",
|
||||
);
|
||||
assert_eq!(
|
||||
retry,
|
||||
RetryTelemetryEvent {
|
||||
|
||||
Reference in New Issue
Block a user