Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded Antigravity OAuth credential parsing, disk loading, token refresh, project lookup, quota retrieval, response normalization, and error handling. Added tests for token formats, missing credentials, successful quota retrieval, custom home directories, and expired-token refresh. Integrated Antigravity into the concurrent provider refresh cycle and stopped deriving its state from Gemini. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a3813efe-c89f-4e66-bb2f-5430f2e2afaa
📥 Commits
Reviewing files that changed from the base of the PR and between 827cd49 and 4e5ca4c36463c1cda2c4569647663a805f90d7e1.
📒 Files selected for processing (1)
src/main/rate-limits/gemini-oauth-sources.ts
|
Thanks for the thorough and high-quality review! All P1 issues and feedback points have been completely addressed in the latest commit (
|
|
Updated in latest commit (
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/main/rate-limits/antigravity-usage-fetcher.ts (1)
159-202: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMinor: inconsistent timeout pattern vs. rest of the file.
fetchAntigravityQuotamanually wires anAbortController+setTimeout, whilerefreshAntigravityToken/loadAntigravityProjectIduseAbortSignal.timeout(API_TIMEOUT_MS). Functionally equivalent, but usingAbortSignal.timeouthere too would be more consistent and slightly shorter.src/main/rate-limits/antigravity-usage-fetcher.test.ts (1)
111-138: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsider asserting the refresh request body to catch missing OAuth params.
This test mocks any
token-containing URL as a success regardless of request body, so it wouldn't have caught the missingclient_id/client_secretinrefreshAntigravityToken(seeantigravity-usage-fetcher.ts:84-112). Asserting on the captured request init would make this test guard against silent OAuth-contract regressions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 64747229-b4fa-4e10-a061-9adab9c9a4f2
📥 Commits
Reviewing files that changed from the base of the PR and between 4e5ca4c36463c1cda2c4569647663a805f90d7e1 and 8445667175e54961cb44233ce76b372229e1269e.
📒 Files selected for processing (3)
src/main/rate-limits/antigravity-usage-fetcher.test.tssrc/main/rate-limits/antigravity-usage-fetcher.tssrc/main/rate-limits/service.ts
|
Pushed in latest commit (
|
|
Updated in latest commit (
|
|
Updated in latest commit (
|
8599799 to
8133cc6
Compare
|
Updated in latest commit (
|
|
Updated in latest commit (
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai run pre-merge checks |
✅ Actions performedRunning Pre-merge checks. Results will be posted in the summary comment once complete. |
|
@coderabbitai run pre-merge checks |
✅ Actions performedRunning Pre-merge checks. Results will be posted in the summary comment once complete. |
|
@coderabbitai The pre-merge check still reports 11.11% after commit cf94a9669 added multiline JSDoc with @PARAM and @returns documentation to all nine exported functions introduced by this PR. Please identify the exact functions the coverage check still considers undocumented and explain why the current JSDoc blocks are not counted. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Repository files that may define pre-merge/documentation checks =='
fd -HI -t f -E .git | rg '(^|/)(package\.json|.*(?:pre-merge|coverage|doc|docs|workflow|action|config).*\.(?:json|ya?ml|js|cjs|mjs|ts))$|(^|/)\.github/workflows/'
echo
echo '== Commit cf94a9669 changed files and patch summary =='
git show --stat --oneline --decorate --find-renames cf94a9669
git diff-tree --no-commit-id --name-only -r cf94a9669
echo
echo '== Candidate documentation/checker configuration references =='
rg -n -i -C 3 '(pre[- ]?merge|documentation|jsdoc|docstring|coverage)' \
-g 'package.json' -g '*.json' -g '*.yml' -g '*.yaml' -g '*.js' -g '*.cjs' -g '*.mjs' -g '*.ts' \
. 2>/dev/null | head -n 500
echo
echo '== AST outlines of relevant Antigravity modules =='
fd -t f -e ts . src/main/rate-limits | rg 'antigravity' | while IFS= read -r file; do
echo "--- $file"
ast-grep outline "$file" --items all --type function --view expanded || true
doneLength of output: 64484 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="stablyai/orca"
sha="cf94a9669"
echo '== GitHub check runs for cf94a9669 =='
gh api "repos/${repo}/commits/${sha}/check-runs?per_page=100" \
--jq '.check_runs[] | [.id, .name, .status, .conclusion, .details_url, (.output.title // ""), (.output.summary // ""), (.output.text // "")] | `@tsv`'
echo
echo '== Legacy commit statuses for cf94a9669 =='
gh api "repos/${repo}/commits/${sha}/status" \
--jq '.statuses[]? | [.context, .state, .target_url, .description] | `@tsv`'
echo
echo '== PR `#9757` check-rollup and matching PR comments =='
gh pr view 9757 --repo "$repo" --json statusCheckRollup,comments \
--jq '{checks: [.statusCheckRollup[] | {name, status, conclusion, detailsUrl}], comments: [.comments[] | select((.body | ascii_downcase | test("11\\.11|document|pre-merge")) ) | {author: .author.login, body: .body, url}]}'
echo
echo '== cf94a9669 patch =='
git show --format=fuller --find-renames -- src/main/rate-limits/antigravity-auth.ts src/main/rate-limits/antigravity-usage-fetcher.ts "$sha"
echo
echo '== Current source with line numbers =='
for file in src/main/rate-limits/antigravity-auth.ts src/main/rate-limits/antigravity-usage-fetcher.ts; do
echo "--- $file"
nl -ba "$file"
doneLength of output: 15059 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="stablyai/orca"
sha="cf94a9669"
echo '== GitHub check runs for cf94a9669 =='
gh api "repos/${repo}/commits/${sha}/check-runs?per_page=100" \
--jq '.check_runs[] | [.id, .name, .status, .conclusion, .details_url, (.output.title // ""), (.output.summary // ""), (.output.text // "")] | `@tsv`'
echo
echo '== Legacy commit statuses for cf94a9669 =='
gh api "repos/${repo}/commits/${sha}/status" \
--jq '.statuses[]? | [.context, .state, .target_url, .description] | `@tsv`'
echo
echo '== PR `#9757` check-rollup and matching PR comments =='
gh pr view 9757 --repo "$repo" --json statusCheckRollup,comments \
--jq '{checks: [.statusCheckRollup[] | {name, status, conclusion, detailsUrl}], comments: [.comments[] | select((.body | ascii_downcase | test("11\\.11|document|pre-merge")) ) | {author: .author.login, body: .body, url}]}'
echo
echo '== cf94a9669 patch =='
git show --format=fuller --find-renames "$sha" -- \
src/main/rate-limits/antigravity-auth.ts \
src/main/rate-limits/antigravity-usage-fetcher.ts
echo
echo '== Current source with line numbers =='
for file in src/main/rate-limits/antigravity-auth.ts src/main/rate-limits/antigravity-usage-fetcher.ts; do
echo "--- $file"
nl -ba "$file"
doneLength of output: 15067 ⚙️ CodeRabbit configuration inspected Length of output: 5381
What I verified:
So the current JSDoc blocks are not demonstrably being rejected for lacking The most likely explanation is that the displayed 11.11% (= 1/9) is the stale result from the pre- Please re-run the pre-merge check after the latest commit completes; if the refreshed result still reports 11.11%, it is a checker-reporting defect rather than a JSDoc syntax issue, and we should treat it as such rather than blindly rewriting valid documentation. 🐇🔎 |
|
@coderabbitai run pre-merge checks |
✅ Actions performedRunning Pre-merge checks. Results will be posted in the summary comment once complete. |
|
@coderabbitai ignore pre-merge checks |
ℹ️ Actions performedPre-merge checks override executed successfully. Overridden by Approval outcome: Approval skipped: request-changes workflow disabled. |
) Antigravity usage was rendered by copying the Gemini result and relabelling the provider, so the status bar showed Gemini's pools under an Antigravity name and refresh failed outright on machines with no Gemini CLI install. - `antigravity-auth.ts` discovers Antigravity's own OAuth token across the layouts the CLI actually writes, parses the several expiry encodings it uses, refreshes via Antigravity's shipped installed-app client pair, and caches the result against its source refresh token. - `antigravity-usage-fetcher.ts` resolves the project through loadCodeAssist, reads the quota summary, and aggregates the returned buckets into session and weekly windows. It parses both the nested `groups[].buckets[]` schema and the legacy flat `buckets[]`, and retries once after a token refresh on 401/403. - `service.ts` fetches Antigravity as its own entry in the settled batch instead of deriving it from the Gemini result. Missing credentials report unavailable rather than surfacing another provider's numbers.
0534162 to
6957c7f
Compare
…ures A corrupt, malformed, or permission-denied credential file was swallowed by the same catch that skips absent candidates, so a missing credential store and an unreadable one were indistinguishable in the logs. Log non-ENOENT failures at debug and keep scanning later candidates. Absent candidates stay silent, so the common no-credentials path is unchanged.
…ession window When a quota response carried no 300-minute bucket, the session fallback reduced over every bucket and returned the winner as `session`, so a weekly bucket's usedPercent and resetsAt could surface under the 5h window. The weekly branch already returned null in the analogous case. Return null for session instead. The return type is already nullable and the sole caller forwards it to a field that accepts null, so no consumer changes.
|
Gentle maintainer follow-up after the latest review pass: the PR is currently mergeable, the review feedback has been addressed, and the latest validation is documented above. It also has a community approval; fork CI still appears to need maintainer approval before it can run. Is there anything else you would like changed before maintainer review, or could someone approve the workflow run? |
|
Thanks for the careful work on separating Antigravity usage from the Gemini mirror. We reproduced the current bug on latest main and on a reverted candidate: Orca reports Gemini quota data under the Antigravity label. On the exact rebased candidate, however, three live OAuth token exchanges returned a stable Because the proposed integration cannot authenticate and would add unsafe refresh behavior, this branch cannot land. A corrected direction would use a verified credential authority, cancellable and deduplicated refresh ownership, explicit quota identity/error semantics, and the same latest-main/candidate/revert live oracle. Evidence covering those points would justify reopening. We appreciate the substantial investigation and tests behind the contribution. |
Fixes #9122
Problem
Antigravity usage was never fetched.
service.tsproduced it by taking the Gemini result and relabelling the provider:Two consequences:
Antigravity ships its own CLI, its own OAuth credentials, and its own quota endpoint. It needs its own fetch path.
Changes
antigravity-auth.ts— credentials~/.gemini/antigravity-cli/antigravity-oauth-token(no extension),~/.config/antigravity/antigravity-oauth-token.json, and theauth.json/settings.jsonfallbacks.expiry,expiry_date,expires_in; ISO strings and epoch numbers).antigravity-usage-fetcher.ts— quotaloadCodeAssist, then reads the quota summary.parseQuotaResponsehandles both the nestedgroups[].buckets[]schema and the legacy flatbuckets[].aggregateAntigravityWindowsfolds the returned buckets into the session and weekly windows the status bar renders.service.ts— wiringPromise.allSettledbatch rather than a derivative of the Gemini result.Failure modes — missing credentials report
unavailablewith an explicit reason instead of surfacing another provider's numbers. A disabled provider short-circuits before touching disk or network.Testing
Verified on current
main(this branch was 174 commits behind before the rebase below):pnpm vitest run src/main/rate-limits→ 379 passed across 27 files.oxlint src/main/rate-limits→ clean, nomax-linessuppressions added.tsc --noEmit -p config/tsconfig.node.json→ clean.Notes on this revision
Rebased onto current
mainand squashed. The branch previously carried 14 commits of review iteration whose intermediate states are not meaningful to review — the file layout, the OAuth client pair, and the quota schema each changed several times along the way. The squashed diff is the only state worth reading.The earlier
@coderabbitai ignore pre-merge checkson this PR was a documentation-coverage gate, not a correctness one; the exported helpers carry JSDoc in the current revision.ELI5
Antigravity usage either showed Gemini's numbers or failed if Gemini was not installed. Orca looks up Antigravity's own credentials and paths so the status bar reflects Antigravity quota correctly.