Skip to content

fix(antigravity): rotate image accounts on quota exhaustion - #8053

Closed
Ardem2025 wants to merge 2 commits into
diegosouzapw:mainfrom
Ardem2025:fix/antigravity-image-account-rotation-final-20260721
Closed

Ardem2025 wants to merge 2 commits into
diegosouzapw:mainfrom
Ardem2025:fix/antigravity-image-account-rotation-final-20260721

Conversation

@Ardem2025

Copy link
Copy Markdown
Contributor

Summary

  • rotate Antigravity image generation to one alternate account only after an explicit quota-exhausted 429
  • keep both attempts inside one shared 30-second deadline and re-resolve credentials/proxy per account
  • add request-scoped combo routing observations and warn if fallback advances while eligible same-model accounts remain

Behavioral boundaries

  • maximum two total image attempts
  • no retry for request-invalid 400 or ambiguous/non-quota 429
  • no durable image cooldown writes from this retry path
  • no change to normal combo selection or fallback semantics
  • account identifiers in routing observations are limited to 8-character prefixes

Validation

  • targeted image rotation and routing instrumentation tests: 7/7 passing
  • changed-file ESLint: passing
  • git diff --check: passing
  • mock validation only; no live Antigravity image quota was consumed

@Ardem2025
Ardem2025 requested a review from diegosouzapw as a code owner July 21, 2026 21:33
@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks for this — the account-rotation goal here is the same one #9908 (your more recent PR)
covers more narrowly and cleanly, and we're merging that one instead. The AbortSignal/499
cancellation piece has also been independently superseded — the current imageGeneration.ts
already threads a signal through many more call sites than this PR added. The one piece
that isn't duplicated anywhere is the combo routing instrumentation (routingInstrumentation.ts)
— if that's still something you'd like to pursue, happy to look at it as its own focused PR
rebased on the current release branch; closing this one in favor of #9908 for the core fix.

Triage note: this is the review recommendation — the close itself happens only after the maintainer's per-PR sign-off (and, where a superseding PR is named, after it has landed). Nothing is being closed by this comment.

diegosouzapw pushed a commit that referenced this pull request Sep 16, 2026
…9908)

Merged after batch validation on a combined worktree cut from `release/v3.8.51` with #9944 and #7138.

**Evidence**
- Focused tests: 36/36 pass on the combined tree, including your 4 classification-boundary cases in `tests/unit/antigravity-image-credential-retry.test.ts` (Antigravity quota-exhausted `429` rotates; generic `RESOURCE_EXHAUSTED`, ordinary image rate-limit and non-Antigravity `429` stay terminal).
- Gates on the combined tree: `check-complexity` PASS, `check-cognitive-complexity` PASS, `typecheck:core` PASS, `check-changelog-integrity` PASS.
- The red `check-file-size` reproduces byte-identical on the pure `release/v3.8.51` tip — inherited base-red, not from this PR. The red CI run on this PR dates from 2026-09-15 against an older base.

**Related dispositions**
- #8053 is being closed in your favour: it chased the same account-rotation goal across 3 files plus a new `routingInstrumentation.ts`, while its `AbortSignal` half was already superseded on the tip by independent work. This PR does the same job in 31 lines of production code by reusing the existing `classify429` engine.

Thanks, @Ardem2025 — the deliberate narrowness here is the reason this merged and the bigger version didn't. Gating rotation on `provider === "antigravity" && status === 429 && classify429() === "quota_exhausted"` keeps non-idempotent image generation from being retried on ordinary rate limits, and you proved each negative case rather than just the happy path.
@diegosouzapw

Copy link
Copy Markdown
Owner

Closing in favour of your own #9908, which just merged into release/v3.8.51.

What covers the goal
src/sse/services/imageCredentialRetry.ts now rotates Antigravity image accounts on an explicit quota-exhausted 429, gated on provider === "antigravity" && status === 429 && classify429(error) === "quota_exhausted", with the four boundary cases proven in tests/unit/antigravity-image-credential-retry.test.ts. That is the same core behaviour this PR set out to deliver, in 31 lines of production code instead of 464 across three files.

What was already superseded independently
The AbortSignal/499-on-abort half of this PR is obsolete: the tip's open-sse/handlers/imageGeneration.ts threads signal through 9+ points today, covering more image formats than this branch did — that landed by separate evolution, not by #9908.

What genuinely dies here
open-sse/services/combo/routingInstrumentation.ts (request-scoped combo routing observations) has no equivalent on the tip or in #9908. It is the one original piece in this PR — but it has no consumer today beyond this branch, which has been CONFLICTING against a main base since 21 July. If you want that observability, a fresh small PR against the current release branch, just the instrumentation and a consumer, would get a fast review.

Thanks for both attempts, @Ardem2025 — the narrow one is what shipped, and it shipped because you had already worked out exactly which 429s are safe to retry.

muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…iegosouzapw#9908)

Merged after batch validation on a combined worktree cut from `release/v3.8.51` with diegosouzapw#9944 and diegosouzapw#7138.

**Evidence**
- Focused tests: 36/36 pass on the combined tree, including your 4 classification-boundary cases in `tests/unit/antigravity-image-credential-retry.test.ts` (Antigravity quota-exhausted `429` rotates; generic `RESOURCE_EXHAUSTED`, ordinary image rate-limit and non-Antigravity `429` stay terminal).
- Gates on the combined tree: `check-complexity` PASS, `check-cognitive-complexity` PASS, `typecheck:core` PASS, `check-changelog-integrity` PASS.
- The red `check-file-size` reproduces byte-identical on the pure `release/v3.8.51` tip — inherited base-red, not from this PR. The red CI run on this PR dates from 2026-09-15 against an older base.

**Related dispositions**
- diegosouzapw#8053 is being closed in your favour: it chased the same account-rotation goal across 3 files plus a new `routingInstrumentation.ts`, while its `AbortSignal` half was already superseded on the tip by independent work. This PR does the same job in 31 lines of production code by reusing the existing `classify429` engine.

Thanks, @Ardem2025 — the deliberate narrowness here is the reason this merged and the bigger version didn't. Gating rotation on `provider === "antigravity" && status === 429 && classify429() === "quota_exhausted"` keeps non-idempotent image generation from being retried on ordinary rate limits, and you proved each negative case rather than just the happy path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants