#31695·eliza

Retry-After contract test intermittently rejects correct timer scheduling

Author: lalaluneCreated Sep 17, 2026Updated Sep 17, 2026

The remaining core server lane at 58cc489bb65e67db4cdb8cf70b6431d217599d72 fails src/utils/retry.backoff.test.ts:345: two requested 30 ms retry delays are correctly reported as [30, 30], but Date.now() measures 59 ms and the test requires at least 60. The other 13,313 tests pass.

retryAsync chooses the finite Retry-After value (subject to configured bounds) and awaits sleep(delay) between attempts. Wall-clock sampling is not a deterministic assertion of that scheduling contract. The consumer affected is the canonical core CI gate, which rejects an otherwise correct retry schedule.

Replace only this test's wall-clock threshold with the runner's controlled timer clock, keeping real retryAsync and sleep. Assert attempt counts immediately before and at each 30 ms boundary, the exact [30, 30] callbacks, and successful completion after the third attempt. Restore the real clock in finally. No production timing, bounds, retries, or timeouts change. Focused execution and a negative scheduling control remain required; source preparation is not a pass.