Skip to content

fix(antigravity): keep unreported quota fraction unknown - #7138

Merged
diegosouzapw merged 3 commits into
diegosouzapw:release/v3.8.51from
Ardem2025:fix/antigravity-quota-unknown-v5
Sep 16, 2026
Merged

diegosouzapw merged 3 commits into
diegosouzapw:release/v3.8.51from
Ardem2025:fix/antigravity-quota-unknown-v5

Conversation

@Ardem2025

@Ardem2025 Ardem2025 commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • treat a missing or invalid Antigravity remainingFraction as unknown instead of confirmed exhaustion
  • keep explicit remainingFraction: 0 as exhausted
  • preserve the upstream reset timestamp while omitting unknown numeric quota fields so preflight fails open

Scope

This is a minimal, independent patch rebased on current main. It intentionally excludes model-scoped/exact-precedence changes, runtime/deployment fixes, configs, workflows, and unrelated files.

Verification

  • targeted unit tests: 18 passed, 0 failed
  • git diff origin/main...HEAD --check
  • changed-file scope verified: one service file and two focused unit-test files

No deployments are included.

@Ardem2025
Ardem2025 requested a review from diegosouzapw as a code owner July 14, 2026 07:31
@Ardem2025
Ardem2025 force-pushed the fix/antigravity-quota-unknown-v5 branch from a7bef4f to 725bd71 Compare July 14, 2026 14:46
@Ardem2025 Ardem2025 changed the title fix(antigravity): preserve unknown quota state fix(antigravity): keep unreported quota fraction unknown Jul 14, 2026
@Ardem2025

Copy link
Copy Markdown
Contributor Author

Rebased on current main; targeted tests pass (18/18).

@diegosouzapw

Copy link
Copy Markdown
Owner

Good catch — confirmed on the current tip that an unreported remainingFraction still ends
up as remainingPercentage: 0, indistinguishable from a genuinely exhausted quota. Probe run:
both of your test files pass in full (18 assertions, 0 failures) at your PR head, and the
#6295-referenced tests in generic-quota-fetcher.test.ts confirm this exact "unreported ≠
0%" pattern already matters elsewhere in the codebase. Before merge: retarget to
release/v3.8.51 and add a changelog fragment. If your other PR #10011 also lands, we'll
double-check its lease logic treats an omitted remainingPercentage as "unknown" rather than
"exhausted" too, since it reads from the same cache this PR fixes.

@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.8.51 September 15, 2026 11:30
diegosouzapw and others added 2 commits September 15, 2026 19:57
# Conflicts:
#	tests/unit/antigravity-usage-service.test.ts
#	tests/unit/generic-quota-fetcher.test.ts
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw pushed a commit that referenced this pull request Sep 16, 2026
Merged after batch validation on a combined worktree cut from `release/v3.8.51` with #9908 and #7138.

**Evidence**
- Focused tests: 36/36 pass on the combined tree (`oauth-modal-codex-lan-ip-8046`, `antigravity-image-credential-retry`, `antigravity-usage-service`, `generic-quota-fetcher`), including the 2 pre-existing anchor tests that assert `codex` stays in `PKCE_CALLBACK_SERVER_PROVIDERS` and that the `localhost:1455` redirect URI is untouched.
- Gates on the combined tree: `check-complexity` PASS, `check-cognitive-complexity` PASS, `typecheck:core` PASS, `check-changelog-integrity` PASS.
- `check-file-size` is red, but reproduces byte-identical on the pure `release/v3.8.51` tip (`imageGeneration.ts`, `roundRobinCombo.ts`, `stream.ts`) — inherited base-red, not from this PR.

**Reconciled**
- `changelog.d/fixes/codex-manual-loopback-action.md` did not start with a markdown bullet, which is the one thing `check-changelog-integrity` failed on. Fixed in your branch (d3dbb5b) so the fragment convention holds; nothing else in your diff was touched.

Thanks for this one, @Ardem2025 — exposing the manual callback entry that already existed in the code instead of adding a new flow is exactly the right shape for the LAN/remote case, and keeping every PKCE/state check untouched made it easy to verify.
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
diegosouzapw merged commit a2c6f71 into diegosouzapw:release/v3.8.51 Sep 16, 2026
9 of 16 checks passed
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
Merged after batch validation on a combined worktree cut from `release/v3.8.51` with diegosouzapw#9908 and diegosouzapw#7138.

**Evidence**
- Focused tests: 36/36 pass on the combined tree (`oauth-modal-codex-lan-ip-8046`, `antigravity-image-credential-retry`, `antigravity-usage-service`, `generic-quota-fetcher`), including the 2 pre-existing anchor tests that assert `codex` stays in `PKCE_CALLBACK_SERVER_PROVIDERS` and that the `localhost:1455` redirect URI is untouched.
- Gates on the combined tree: `check-complexity` PASS, `check-cognitive-complexity` PASS, `typecheck:core` PASS, `check-changelog-integrity` PASS.
- `check-file-size` is red, but reproduces byte-identical on the pure `release/v3.8.51` tip (`imageGeneration.ts`, `roundRobinCombo.ts`, `stream.ts`) — inherited base-red, not from this PR.

**Reconciled**
- `changelog.d/fixes/codex-manual-loopback-action.md` did not start with a markdown bullet, which is the one thing `check-changelog-integrity` failed on. Fixed in your branch (d3dbb5b) so the fragment convention holds; nothing else in your diff was touched.

Thanks for this one, @Ardem2025 — exposing the manual callback entry that already existed in the code instead of adding a new flow is exactly the right shape for the LAN/remote case, and keeping every PKCE/state check untouched made it easy to verify.
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.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…w#7138)

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

**Evidence**
- Focused tests: 36/36 pass on the combined tree, including `convertUsageToQuotaInfo skips Antigravity quota entries with an unknown fraction` and the `diegosouzapw#6295` regression that guards the same class of bug on another provider.
- 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 here dates from 2026-09-15 against an older base.

Thanks, @Ardem2025 — this is the smallest diff of your batch and arguably the one with the widest blast radius avoided. Writing `remainingPercentage: 0` for an unreported fraction made "we don't know" numerically indistinguishable from "fully exhausted" to every downstream consumer of the quota cache; omitting the field so preflight fails open is the correct read of the upstream's silence.
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