fix(coding-agent): respected google retry hints

Parsed provider retry hint text before falling back to quota cooldowns so Google per-minute token limits use the server-provided delay.

Fixes #1253
This commit is contained in:
roboomp
2026-05-21 09:38:43 +00:00
parent 8dc9125b0b
commit 1b6ef3b5dc
2 changed files with 69 additions and 0 deletions
@@ -76,6 +76,7 @@ import {
} from "@oh-my-pi/pi-ai";
import { MacOSPowerAssertion } from "@oh-my-pi/pi-natives";
import {
extractRetryHint,
getAgentDbPath,
isEnoent,
isUnexpectedSocketCloseMessage,
@@ -6949,6 +6950,11 @@ export class AgentSession {
}
}
const retryHintMs = extractRetryHint(undefined, errorMessage);
if (retryHintMs !== undefined) {
return retryHintMs;
}
const resetMsMatch = /x-ratelimit-reset-ms\s*[:=]\s*(\d+)/i.exec(errorMessage);
if (resetMsMatch) {
const resetMs = Number(resetMsMatch[1]);