From 030a29774eada812753a396e877883c331d3f1b4 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 24 Nov 2026 18:34:10 +0000 Subject: [PATCH 1/2] test(server): Antigravity quota failure keeps the 'Resets in' reset time Repro for #42325: fails on main because resetAtFrom ignores 'Resets in .' Co-Authored-By: Claude Opus 5.5 --- .../provider/acp/AntigravityTurnOutcome.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/server/src/provider/acp/AntigravityTurnOutcome.test.ts b/apps/server/src/provider/acp/AntigravityTurnOutcome.test.ts index 962da73bfc2bd..b1c15b1396a7b 100644 --- a/apps/server/src/provider/acp/AntigravityTurnOutcome.test.ts +++ b/apps/server/src/provider/acp/AntigravityTurnOutcome.test.ts @@ -60,6 +60,13 @@ const STATUS_NOT_FOUND_ERROR = Buffer.concat([ 'NOT_FOUND (code 404): Requested entity was not found.\u001a\u0080\u0001HTTP 404 Not Found\n\n{"error":{"code":404,"message":"Requested entity was not found.","status":"NOT_FOUND"}}', ), ]); +// Antigravity 1.5 states the quota reset only as a Go duration in its message. +const STATUS_QUOTA_ERROR = Buffer.concat([ + Buffer.from([0x12, 0x6e]), + Buffer.from( + "RESOURCE_EXHAUSTED (code 429): Individual quota reached. Please upgrade your subscription to increase your limits. Resets in 4m42s.", + ), +]); // The model's reply quoting the agent's quota notice is an ordinary planner response. const QUOTED_NOTICE = Buffer.from( "Usage Limit Reached\n\nYou have reached your current quota for this period. Your limit will reset in 1 hour.", @@ -122,6 +129,13 @@ describe("watchAntigravityPromptOutcome", () => { resetAt: "1970-01-01T01:00:00.000Z", }), ); + assert.deepInclude( + (yield* turn([ + [USER_INPUT, input], + [ERROR_MESSAGE, STATUS_QUOTA_ERROR], + ]))?.failure, + { class: "usage_limit", resetAt: "1970-01-01T00:04:42.000Z" }, + ); // The earlier error step is outside this turn. assert.isUndefined( yield* turn( From 435c7fa15feaa4ef45933ec08488546307d47bb5 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 24 Nov 2026 18:42:17 +0000 Subject: [PATCH 2/2] fix(server): Antigravity quota failures keep the 'Resets in' reset time Antigravity 1.5 can state a quota reset only as 'Resets in .' in the error message, which resetAtFrom did not read, so the usage_limit failure had no resetAt. Fall back to that duration after quotaResetDelay and retryDelay. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/provider/acp/AntigravityTurnOutcome.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/server/src/provider/acp/AntigravityTurnOutcome.ts b/apps/server/src/provider/acp/AntigravityTurnOutcome.ts index 35ed2f347df1d..59057794722d3 100644 --- a/apps/server/src/provider/acp/AntigravityTurnOutcome.ts +++ b/apps/server/src/provider/acp/AntigravityTurnOutcome.ts @@ -35,6 +35,8 @@ const RESET_TIMESTAMP = /\bquotaResetTimeStamp:([^\s\]]+)/; const RESET_DELAY = /\bquotaResetDelay:((?:\d+(?:\.\d+)?(?:ns|us|µs|μs|ms|h|m|s))+)(?=[\s\]])/; // google.rpc.RetryInfo, which plain rate limits carry instead of a quota reset. const RETRY_DELAY = /\bretryDelay:((?:\d+(?:\.\d+)?(?:ns|us|µs|μs|ms|h|m|s))+)(?=[\s\]])/; +// Antigravity 1.5 may state the reset only in the message: "... Resets in 4m42s.". +const RESETS_IN = /\bResets in ((?:\d+(?:\.\d+)?(?:ns|us|µs|μs|ms|h|m|s))+)(?!\w|\.\d)/; const GO_DURATION_PART = /(\d+(?:\.\d+)?)(ns|us|µs|μs|ms|h|m|s)/g; const GO_DURATION_UNIT_MS: Record = { ns: 1e-6, @@ -113,7 +115,8 @@ function resetAtFrom(text: string, now: DateTime.Utc | undefined): string | unde // makeProviderFailure drops a timestamp that does not parse, so fall back to the delay. const timestamp = RESET_TIMESTAMP.exec(text)?.[1]; if (timestamp !== undefined && Option.isSome(DateTime.make(timestamp))) return timestamp; - const delay = RESET_DELAY.exec(text)?.[1] ?? RETRY_DELAY.exec(text)?.[1]; + const delay = + RESET_DELAY.exec(text)?.[1] ?? RETRY_DELAY.exec(text)?.[1] ?? RESETS_IN.exec(text)?.[1]; if (delay === undefined || now === undefined) return undefined; let delayMs = 0; for (const [, amount, unit] of delay.matchAll(GO_DURATION_PART)) {