Skip to content

Accounts

Ra1nify edited this page Oct 31, 2026 · 1 revision

Accounts

The account pool stores the Google accounts available on this machine, together with their credentials, bindings, and quota.

Since Antigravity 2.28, credentials live in a single global entry in Windows Credential Manager, and only one account can hold sign-in state at a time. The pool is therefore a shelf of accounts, not a set of parallel containers: accounts coexist in the list, but only one can be running at any moment.

For why this limit exists and how it was verified, see Multi-Instance.

List columns

Column Meaning
Account Google email, or a custom display name
Status Idle / In use
Bound instance Running instance holding the account
Gemini 5h / 7d Remaining quota ratio and reset time
Claude 5h / 7d Remaining quota ratio and reset time

A null quota shows --, meaning not fetched or expired.

Toolbar

Button Behavior
New sandbox capture Launches a temporary Antigravity instance; archives credentials after sign-in
Refresh all tokens Refreshes OAuth tokens and quota for every account
Force unlock all Clears every account mutex

Row actions

Button Behavior
Details Credential paths, quota, bindings, display name
Refresh token Refreshes one account
Force unlock Clears the mutex for one account
Delete Removes the account and its credential archive

Delete requires the account to be free. The archive directory data\accounts\{id}\ is removed as well.

Capture flow

New sandbox capture starts a dedicated instance:

  1. Create a temporary sandbox, pointing USERPROFILE / HOME / APPDATA / LOCALAPPDATA at it;
  2. Back up and clear the host credential slot so the sandbox starts signed out;
  3. Launch Antigravity and wait for the user to sign in;
  4. Watch two signals at once:
    • writes to .gemini\oauth_creds.json inside the sandbox;
    • the appearance of gemini:antigravity in Windows Credential Manager;
  5. Parse id_token_email from the signal and archive the credential into data\accounts\{id}\;
  6. Restore the host credential, close the temporary instance, release the lock.

The UI shows stage hints during capture. Cancelling restores the host credential, closes the temporary instance, and adds nothing to the pool.

The whole capture holds the mutex; no other instance can be started meanwhile.

Mutex

Lock state lives in data/accounts.json and the credential directory.

State Handling
Account free Record owning instance ID and PID
Held by the same instance Treated as re-entry; allowed
Held by another instance whose process is alive Launch fails with a conflict message
Held by another instance whose process is gone Stale lock; forced takeover allowed

Force unlock clears the owning instance ID and PID. Credential files are not modified.

Beyond the per-account lock there is a process-wide slot lock (CredentialManager.SlotLock, 10-second timeout) that serialises reads and writes of the global credential entry.

Yielding the credential slot

Because the slot is a global singleton, Gravityless gives it up once an instance has taken its token:

1. Write the account's credential when the instance launches
2. Wait for the language server to finish reading (about 8 seconds)
3. Clear the credential slot
4. The next instance can write a different account

This rests on the language server reading credentials only during startup and thereafter renewing with the in-memory refresh_token.

Case Handling
Credential belongs to the current account Cleared
Credential belongs to another account Skipped, so nothing foreign is deleted
Slot is empty Skipped
Process exited within the wait window Skipped, slot kept for a retry

The instance field CredentialSlotReleased records whether the hand-off completed.

Cross-account launch prompt

When the target instance's account differs from the current slot holder, a confirmation appears before launch:

The shared credential slot currently belongs to A.
Launching this instance writes the credentials for B, which can disrupt sign-in for instances that are already running.

Proceeding means you accept that risk.

Cancelling aborts the launch. Confirming proceeds as usual.

Credential archive

data\accounts\{id}\
  google_accounts.json     Account details
  oauth_creds.json         OAuth credentials
  installation_id          Device identifier

Credentials are plain JSON. Treat the whole data\ directory as sensitive.

Quota refresh

Refresh calls the account quota endpoint and writes:

Field Meaning
Gemini5hFraction Remaining ratio in the 5-hour window, 0–1
Gemini5hResetTime Window reset time
Gemini7dFraction Remaining ratio in the 7-day window
Gemini7dResetTime Window reset time
Claude5hFraction / Claude7dFraction Same, for Claude models
QuotaLastFetchedAt Time of the last successful fetch
QuotaRawText Raw endpoint response

A failed refresh keeps the previous values, increments FailedRefreshAttempts, and reports the reason. A batch refresh runs per account; one failure does not stop the rest.

Known limitation

A successful refresh_token renewal writes back to the credential slot. If another account holds the slot at that moment, the write produces an incorrect overwrite. The pool therefore suits serial switching, not sustained parallel operation across accounts.

Related files

File Role
data/accounts.json Definitions and lock state
data/accounts/{id}/ Credential archive
src/Gravityless.Core/Services/AccountPoolService.cs Capture, lock, refresh
src/Gravityless.Core/Native/CredentialManager.cs Slot read/write and hand-off
src/Gravityless.App/Resources/Languages/*.xaml Text keys Accounts_*

Clone this wiki locally