The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 05:45 UTC
fix(antigravity): rate-limited turns keep their reset time (#29594)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 3, 2026 at 22:17 UTC
7c22e24e3fa1a3bb3a95f27aea000067f198fe7f
2 files changed
+22
-3
apps/server/src/provider/acp/AntigravityTurnOutcome.test.ts
+18
-2
@@ -22,9 +22,12 @@ const errorPayload = (error: string) =>
22
`Agent execution terminated due to error.\u0012agent executor error: ${error}: ${error}\n(1) attached stack trace\n -- stack trace:`,
23
),
24
]);
25
-// An unparsable reset timestamp must not hide the reset delay.
25
+// An unparsable reset timestamp must not hide the reset delay, nor a retry delay outrank it.
26
const QUOTA_ERROR = errorPayload(
27
- "Error 429, Message: Quota exhausted for test model., Status: RESOURCE_EXHAUSTED, Details: [map[@type:type.googleapis.com/google.rpc.ErrorInfo domain:googleapis.com metadata:map[quotaResetDelay:3600s quotaResetTimeStamp:soon] reason:QUOTA_EXHAUSTED]]",
27
+ "Error 429, Message: Quota exhausted for test model., Status: RESOURCE_EXHAUSTED, Details: [map[@type:type.googleapis.com/google.rpc.RetryInfo retryDelay:42s] map[@type:type.googleapis.com/google.rpc.ErrorInfo domain:googleapis.com metadata:map[quotaResetDelay:3600s quotaResetTimeStamp:soon] reason:QUOTA_EXHAUSTED]]",
28
+);
29
+const RATE_LIMIT_ERROR = errorPayload(
30
+ "Error 429, Message: Resource has been exhausted (e.g. check quota)., Status: RESOURCE_EXHAUSTED, Details: [map[@type:type.googleapis.com/google.rpc.ErrorInfo domain:cloudcode-pa.googleapis.com reason:RATE_LIMIT_EXCEEDED] map[@type:type.googleapis.com/google.rpc.RetryInfo retryDelay:42s]]",
31
);
32
const INVALID_ARGUMENT_ERROR = errorPayload(
33
"Error 400, Message: Request contains an invalid argument., Status: INVALID_ARGUMENT, Details: []",
@@ -101,6 +104,19 @@ describe("watchAntigravityPromptOutcome", () => {
104
},
105
),
106
);
107
+ assert.deepEqual(
108
+ yield* turn([
109
+ [USER_INPUT, input],
110
+ [ERROR_MESSAGE, RATE_LIMIT_ERROR],
111
+ ]),
112
+ {
113
+ class: "usage_limit",
114
+ message: "Resource has been exhausted (e.g. check quota).",
115
+ code: "RESOURCE_EXHAUSTED",
116
+ retryable: true,
117
+ resetAt: "1970-01-01T00:00:42.000Z",
118
+ },
119
+ );
120
assert.deepEqual(
121
yield* turn([
122
[USER_INPUT, input],
apps/server/src/provider/acp/AntigravityTurnOutcome.ts
+4
-1
@@ -21,6 +21,8 @@ const API_ERROR = /Error (\d{3}), Message: (.+?), Status: ([A-Z_]+)/s;
21
const QUOTA_EXHAUSTED = /\breason:QUOTA_EXHAUSTED\b/;
22
const RESET_TIMESTAMP = /\bquotaResetTimeStamp:([^\s\]]+)/;
23
const RESET_DELAY = /\bquotaResetDelay:((?:\d+(?:\.\d+)?(?:ns|us|µs|μs|ms|h|m|s))+)(?=[\s\]])/;
24
+// google.rpc.RetryInfo, which plain rate limits carry instead of a quota reset.
25
+const RETRY_DELAY = /\bretryDelay:((?:\d+(?:\.\d+)?(?:ns|us|µs|μs|ms|h|m|s))+)(?=[\s\]])/;
26
const GO_DURATION_PART = /(\d+(?:\.\d+)?)(ns|us|µs|μs|ms|h|m|s)/g;
27
const GO_DURATION_UNIT_MS: Record<string, number> = {
28
ns: 1e-6,
@@ -76,7 +78,7 @@ function resetAtFrom(text: string, now: DateTime.Utc): string | undefined {
78
// makeProviderFailure drops a timestamp that does not parse, so fall back to the delay.
79
const timestamp = RESET_TIMESTAMP.exec(text)?.[1];
80
if (timestamp !== undefined && Option.isSome(DateTime.make(timestamp))) return timestamp;
79
- const delay = RESET_DELAY.exec(text)?.[1];
81
+ const delay = RESET_DELAY.exec(text)?.[1] ?? RETRY_DELAY.exec(text)?.[1];
82
if (delay === undefined) return undefined;
83
let delayMs = 0;
84
for (const [, amount, unit] of delay.matchAll(GO_DURATION_PART)) {
@@ -120,6 +122,7 @@ function turnFailure(
122
message: message!.trim(),
123
code: status ?? null,
124
retryable: rateLimited || Number(httpStatus) >= 500,
125
+ resetAt: resetAtFrom(text, now) ?? null,
126
});
127
}
128