Where
src/oauth/xai.ts line 98 (retryDelay), on dev:
seconds=retryAfter!==null&&/^\d+$/.test(retryAfter)?Number(retryAfter):0
Problem
RFC 9110 §10.2.3 allows Retry-After as either delay-seconds or an HTTP-date. The regex accepts integer seconds only, so an HTTP-date (Retry-After: Sun, 06 Nov 1994 08:49:37 GMT) or a fractional value (1.5) becomes seconds = 0 and the server instruction is silently dropped; the client falls back to the 100/250ms jittered base delay.
Measured on Node 24:
retryDelay(1, "Sun, 06 Nov 1994 08:49:37 GMT", () => 0.5) -> 100
retryDelay(1, "1.5", () => 0.5) -> 100
Fix
Parse as number first, then fall back to Date.parse:
function parseRetryAfterMs(raw: string | null): number | undefined {
if (!raw) return undefined;
const n = Number(raw);
if (Number.isFinite(n)) return Math.max(0, n * 1000);
const t = Date.parse(raw);
return Number.isFinite(t) ? Math.max(0, t - Date.now()) : undefined;
}
Found while porting this module into ima2-gen (devlog 260909_grok_native_oauth/001_opencodex_port_spec.md D2). Independent of the 2000ms cap issue but the same function.
Where
src/oauth/xai.tsline 98 (retryDelay), ondev:Problem
RFC 9110 §10.2.3 allows
Retry-Afteras either delay-seconds or an HTTP-date. The regex accepts integer seconds only, so an HTTP-date (Retry-After: Sun, 06 Nov 1994 08:49:37 GMT) or a fractional value (1.5) becomesseconds = 0and the server instruction is silently dropped; the client falls back to the 100/250ms jittered base delay.Measured on Node 24:
Fix
Parse as number first, then fall back to
Date.parse:Found while porting this module into ima2-gen (devlog
260909_grok_native_oauth/001_opencodex_port_spec.mdD2). Independent of the 2000ms cap issue but the same function.