Skip to content

fix(antigravity): read the local language server for its own account - #108

Merged
bernardopg merged 5 commits into
mainfrom
fix/antigravity-local-rpc
Nov 8, 2026
Merged

bernardopg merged 5 commits into
mainfrom
fix/antigravity-local-rpc

Conversation

@bernardopg

@bernardopg bernardopg commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #107. Merge the stack bottom-up with a merge commit; until #107 merges, this diff also shows its commits.

Summary

Split out of #101: keeps @DotRedstone's commit (local language server fast path, Gemini 4 Argon label, Chinese window names, reset countdown), with one follow-up commit on top.

While the Antigravity app runs, its local language server answers RetrieveUserQuotaSummary over loopback Connect-RPC. I verified this against the running app: the server returns the Gemini Models pool, while v1internal:retrieveUserQuotaSummary on the cloud endpoint returned only "Claude and GPT models" for the same account.

fix(antigravity): match the local language server to its own account fixes the following in the original fast path:

  • Wrong account. The fast path ran inside antigravity_fetch_account, so every account (each IDE install and the agy CLI) received the running app's quota under its own email. The local answer is now collected once per refresh and stored under the email that GetUserStatus reports (userStatus.email, confirmed live). An account uses it only when the emails match; every other account keeps the cloud endpoint. Live run with two signed-in accounts: the app's account read Gemini + Claude from the local server, and the IDE's account kept its own cloud numbers. With the original commit, both would have shown the app account's data.

  • Wrong process. pgrep -f "resources/bin/language_server" matches any process that merely mentions the path in its arguments; on my machine it matched a shell. The server is now found with pgrep -x language_server, checked by its exe path.

  • Narrower surface. Only 127.0.0.1 / [::1] listeners are tried (at most 6), with --proto =https and a 2 s timeout. --csrf_token=VALUE is read as well as --csrf_token VALUE. The token stays in a curl --config pipe. ANTIGRAVITY_NO_LOCAL_RPC=1 turns the path off, and a retargeted ANTIGRAVITY_API_BASE_URL skips it.

  • Omitted fraction. Protobuf JSON omits a zero, so a bucket that reports a reset but no remainingFraction is used up. It now reads 100% instead of being dropped, and a fraction nested under remaining is accepted. The legacy family path already treated a missing fraction as 0.

  • Dashboard regression. The account window aside change dropped the server's own description in used mode. The description is back; the countdown follows a bare percentage only.

  • Email lost with uutils coreutils (pre-existing). antigravity_email_from_idtoken appended padding with printf '=%.0s' $(seq 1 "$pad"). With pad=0 this still printed one =, and the uutils base64 on the ubuntu-26.04 runner (unlike GNU) then returned nothing, so the account showed "Antigravity account". The function now appends exactly pad characters, and a strict-decoder shim tests every padding length; that test fails without the fix.

Tests:

  • tests/test-cov-b-antigravity.sh covers email matching (case-insensitive), a mismatched email that keeps the cloud answer, the opt-out, the = token form, a decoy process, non-loopback and foreign ports, the token kept off argv and output, nested and omitted fractions, group order, and that a pinned test DB never probes local servers.
  • tests/test-widget-runtime.sh checks the three aside cases.

Docs: configuration.md, providers.md, troubleshooting.md and security.md (the loopback CSRF and TLS exception).

Related issues

Part of #101.

Type of change

  • New provider
  • Bug fix
  • Enhancement
  • Documentation / i18n
  • CI / tooling

Checklist

  • plugin.json .version and CHANGELOG.md are consistent (not release-bearing; ## Unreleased bullet)
  • New/changed provider scripts are executable and emit valid JSON
  • i18n/en.json keys have translations in every locale
  • Every commit is signed off (git commit -s) under the DCO
  • CI is green

Local gates: check-metadata, check-changelog, check-dco, bash -n, shellcheck -S warning, qmllint, actionlint, gitleaks, every tests/test-*.sh (including the native widget runtime on Wayland), and AIOC_COVERAGE_MIN=95 scripts/coverage.

DotRedstone and others added 3 commits November 8, 2026 15:51
…er RPC

Query the running local Antigravity language_server Connect-RPC endpoint when available so multi-group pools (including Gemini 4 Argon) and their reset countdowns stay synchronized with the IDE.

Signed-off-by: dotredstone <[email protected]>
The local fast path ran inside antigravity_fetch_account, so every
account (each IDE install and the agy CLI) received the running app's
quota, shown under the wrong email. It also found the server with
pgrep -f, which matches any process that merely mentions the path in
its arguments, and read the CSRF token from whichever came first.

Collect the local answer once per refresh instead. The server is found
by its executable, only loopback listeners are tried, and each answer
is stored under the email GetUserStatus reports, so an account uses it
only when the emails match and every other account keeps the cloud
endpoint. --csrf_token=VALUE is read too, the token stays in a curl
config pipe, and ANTIGRAVITY_NO_LOCAL_RPC=1 turns the path off.

A bucket that reports a reset but no remaining fraction is used up
(protobuf JSON omits a zero), so it now reads 100% instead of being
dropped, and a fraction nested under remaining is accepted.

The account window aside kept the countdown but dropped the server's
own description in used mode on every account row; the description
is back and the countdown follows a bare percentage only.

Signed-off-by: Bernardo Pinto Gomes <[email protected]>
@github-actions github-actions Bot added documentation Improvements or additions to documentation area:providers Provider adapters (providers/) area:i18n Translations (i18n/) area:qml QML UI code area:ci CI, workflows, tooling labels Nov 8, 2026
bernardopg and others added 2 commits November 8, 2026 16:02
antigravity_email_from_idtoken appended padding with printf '=%.0s'
over seq 1 $pad. With pad 0 seq prints nothing and printf still runs
its format once, so a payload that needed no padding gained a stray =.
GNU base64 prints the data before complaining, but uutils coreutils
(Ubuntu 26.04) prints nothing, so the account lost its email. Append
exactly pad characters instead, and test every padding length against
a strict decoder.

Signed-off-by: Bernardo Pinto Gomes <[email protected]>
@github-actions github-actions Bot removed the area:i18n Translations (i18n/) label Nov 8, 2026
@bernardopg
bernardopg merged commit b0cbbea into main Nov 8, 2026
20 checks passed
@bernardopg
bernardopg deleted the fix/antigravity-local-rpc branch November 8, 2026 19:27
gtheys pushed a commit to gtheys/AiOverviewControl that referenced this pull request Nov 12, 2026
Generated with scripts/render-contributors. The contributors API lists
alvorithm already but lags behind on DotRedstone, whose commits from
bernardopg#108 and bernardopg#109 resolve to the account; that login was passed as a
one-off pinned entry for this run. The grid is append-only, so later
renders keep both entries without a change to PINNED.

Signed-off-by: Bernardo Pinto Gomes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, workflows, tooling area:providers Provider adapters (providers/) area:qml QML UI code documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants