When Antigravity returns 429, throw immediately instead of waiting for the
server-provided retry delay (which can be 10+ minutes). This lets clawdbot
quickly rotate to another account.
This patch was previously in PR #454 but was accidentally removed in 0dbb569
when bumping to pi-ai 0.40.0. The upstream release did NOT include this fix.
Context: Antigravity rate limits cause pi-ai to sleep for the full retry
delay inside the request, blocking the thread. Clawdbot's timeout would
eventually fire, but waiting 10+ minutes is unacceptable UX.
Bundled with the empty error message filter since both handle 429 recovery.
19 lines
1.2 KiB
Diff
19 lines
1.2 KiB
Diff
diff --git a/dist/providers/google-gemini-cli.js b/dist/providers/google-gemini-cli.js
|
|
index 0000000..1111111 100644
|
|
--- a/dist/providers/google-gemini-cli.js
|
|
+++ b/dist/providers/google-gemini-cli.js
|
|
@@ -248,6 +248,13 @@ async function* streamGeminiCli(model, context, credentials, options) {
|
|
break; // Success, exit retry loop
|
|
}
|
|
const errorText = await response.text();
|
|
+ // PATCH: Fail immediately on 429 to let caller rotate accounts
|
|
+ // Antigravity rate limits can have very long retry delays (10+ minutes).
|
|
+ // Instead of waiting, throw immediately so clawdbot can rotate to another account.
|
|
+ if (response.status === 429) {
|
|
+ console.log(`[pi-ai] 429 rate limit - failing fast to rotate account`);
|
|
+ throw new Error(`Cloud Code Assist API error (${response.status}): ${errorText}`);
|
|
+ }
|
|
// Check if retryable
|
|
if (attempt < MAX_RETRIES && isRetryableError(response.status, errorText)) {
|
|
// Use server-provided delay or exponential backoff
|