feat(quota): support Google Antigravity weekly quota and Ollama Cloud quota (carry of #3447) - #3587
Conversation
Carries #3447 by @hualiny (Antigravity weekly windows via retrieveUserQuotaSummary, plus Ollama Cloud quota from /api/usage), rebased rename-aware onto tests/providers/. The provider-level probe added there sent the stored account bearer to an operator-configured baseUrl with default redirect following, while fetchAntigravityUsageQuota in the same file already pins the identical request. Route it through providerOutboundPost against ANTIGRAVITY_ACCOUNT_QUOTA_BASE with the providerRedirectError check so a configured baseUrl stays a routing choice for model requests, not a second destination for Google's accounting. The fetchAvailableModels fallback is unchanged from dev. Co-authored-by: hualiny <82697947+hualiny@users.noreply.github.com>
…ogle's host Co-authored-by: hualiny <82697947+hualiny@users.noreply.github.com>
…vider quota test After the summary probe moved off globalThis.fetch, this test made a real request to Google (sandbox DNS failure masked it as a fallthrough). Inject the seam with a 404 so the fetchAvailableModels fallback is what the test exercises, as before. Co-authored-by: hualiny <82697947+hualiny@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
|
Warning Review limit reachedNext included review available in 6 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a721e459d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | `googleMode?` | `"ai-studio" \| "vertex" \| "cloud-code-assist"` | Google transport/auth mode. Default `ai-studio`. | | ||
| | `directGeminiWireRenames?` | `boolean` | Google only. Applies only to direct AI Studio requests. Omitted or `true` keeps the `-tiered` wire rename for Gemini Flash ids (`gemini-3.7-flash` -> `gemini-3.7-flash-tiered`); `false` sends the requested bare ids to the wire unchanged. Vertex preserves the requested model ID, and Cloud Code Assist routing is unchanged. Set `false` when the configured upstream still serves the bare ids. | | ||
| | `project?` | `string` | Vertex or Antigravity Cloud Code Assist project id. | | ||
| | — | — | Antigravity account quota probes (`retrieveUserQuota` and `retrieveUserQuotaSummary`) always go to Google's own Cloud Code host through the pinned outbound transport, regardless of a configured `baseUrl`; the account bearer is never sent to an operator-configured endpoint and a redirect aborts the probe. Only the model-list fallback still honors `baseUrl`. | |
There was a problem hiding this comment.
Correct the claim that the bearer never reaches
baseUrl
When retrieveUserQuotaSummary returns a non-success response other than 401/403, throws, or contains no recognized windows, fetchAntigravityQuota falls through to the model-list request at src/providers/quota.ts:2577-2584; that request uses the operator-configured baseUrl, includes the Google bearer, and follows redirects by default. The new statement that the bearer is never sent to such an endpoint is therefore false precisely during summary fallback and may encourage an unsafe custom configuration; either pin the fallback as well or explicitly document that credential exposure exception.
AGENTS.md reference: docs-site/AGENTS.md:L7-L10
Useful? React with 👍 / 👎.
리뷰 · 우선순위 63 / 80이 PR은 @hualiny 의 #3447을 보안 핀이 왜 중요하냐면, 요약 프로브는 계정 bearer를 들고 Google로 갑니다. 예전 캐리 초안은 그 요청을 운영자가 넣은 테스트는 꽤 단단합니다. 다만 같은 라인 / 경로로 보면 아래를 보면 됩니다. 경로 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
Summary
Google Antigravity quota now includes the weekly window (from
retrieveUserQuotaSummary) alongside the 5-hour window, and Ollama Cloud quota is parsed and shown. Carries #3447 (author @hualiny, head745b70e1e, cherry-picked;git merge-treeclean — GitHub's CONFLICTING flag was rename-detection noise from thetests/<domain>/move).Two maintainer additions on top of the carry:
src/providers/quota.tsfetchAntigravityQuota: the new summary request carried the account bearer to an operator-configuredbaseUrlwith default redirect following. It now goes throughproviderOutboundPostagainst the pinnedANTIGRAVITY_ACCOUNT_QUOTA_BASEwith aproviderRedirectErrorcheck — the exact shapefetchAntigravityUsageQuotaalready uses. Only the model-list fallback still honorsbaseUrl(unchanged from dev). Documented inreference/configuration/providers.md.globalThis.fetch).CodeRabbit's "duplicate
const seen" finding on #3447 is a false positive (two separatetest()scopes). Supersedes #3447.Stack (wp4 quota stack; merge bottom-up):
dev(#2973 / codex/260905-quota-window-activation is independent and targets
devdirectly.) Unit:devlog/_plan/260905_open_work_closeout/(040, 041, 042).Verification
bun run typecheck— exit 0.bun test tests/providers/provider-quota.test.ts— RED with the bearer fix reverted: 117 pass / 4 fail (does not send the account bearer to a configured baseUrl,refuses a redirected summary response, and the two summary-mapping tests once they stopped stubbingglobalThis.fetch); GREEN 121 pass / 0 fail. Withprovider-account-quota+ layout guard: 156 pass / 0 fail (unsandboxed).bun test tests/ci-workflows/repo-hygiene.test.ts— 14 pass / 0 fail (no duplicate basename recreated attests/root).Checklist
devCo-authored-bytrailer in the branch commitsCo-authored-by: hualiny 82697947+hualiny@users.noreply.github.com