Skip to content

Multi Instance

Ra1nify edited this page Oct 31, 2026 · 1 revision

Death Certificate for Multi-Instance

Epitaph: Antigravity 2.28.2 · multi-instance multi-account (2024 – 2026-10-31) Cause of death: Google moved credential storage from per-profile files to a system-wide singleton slot

Antigravity once supported running several instances, each signed into a different account. Each kept its own credential file, and the accounts never met.

On 2026-10-31, that capability disappeared.

This page records how it died, and what we tried.


1. Cause of Death

Older builds stored OAuth credentials as a file:

<profile>/.gemini/oauth_creds.json

Files can be copied, symlinked, and isolated per directory. "Several instances, several accounts" held by construction.

From 2.28 the credentials moved into a single global entry in Windows Credential Manager:

LegacyGeneric:target=gemini:antigravity

The target name is a compile-time constant carrying no account information. Exactly one such entry exists at any moment.

Sign in as A → CredWrite(gemini:antigravity, blob(A))
Sign in as B → CredWrite(gemini:antigravity, blob(B))   ← A is overwritten

There is no "slot for A" and no "slot for B".

It did not raise an error. It did not refuse. It simply overwrote the other account, quietly.


2. Autopsy

The credential as measured

{
  "token": {
    "access_token":  "ya29.…",
    "token_type":    "Bearer",
    "refresh_token": "1//0gh5-…",
    "expiry":        "2026-10-30T19:47:05.1885982+08:00",
    "expires_in":    3599
  },
  "auth_method":    "consumer",
  "id_token_email": "user@example.com"
}

563 bytes, type LegacyGeneric, readable by the current user — DPAPI encrypts per user, so any process running as that user can decrypt it.

Field differences from the old format

Aspect Previous Current
Location File Credential Manager
Email source id_token (JWT payload decode) id_token_email (plain text)
Structure Flat, access_token at top level Nested under token
id_token Present Absent

access_token itself was not removed — still a ya29. prefix at roughly 260 characters. What moved is the safe, not the key.

The credential stack in the binary

codeassistclient.NewCompositeTokenStorage
├── KeyringTokenStorage      Windows Credential Manager
└── fileTokenStorage         File (fallback)

Built on github.com/zalando/go-keyring and github.com/danieljoos/wincred.

The target name comes from keyring.windowsKeychain.credName(service, user). Both arguments are compile-time constants. There is no configuration surface.


The full symbol listing is on its own page: Symbol Summary.

3. Rescue Attempts

Three escape routes. All tried. All failed.

Route 1: ANTIGRAVITY_CREDENTIAL_SCOPE

The variable exists in the binary, together with a full scope mechanism (userScopedStore, PinnedScope, scopeFilePath).

Three isolated sandboxes were started with different values (gl-probe-a, aaaaaaaa, unset). None produced a new credential entry; no credential-user-scope file appeared.

The scope governs an internal data partition in authstore. It does not affect the CredWrite target name.

Route 2: AGY_ACCOUNT

The prompt text in the binary looked promising:

To run a sandboxed CLI command with a specific account, prefix it with
AGY_ACCOUNT=<account> (e.g. `AGY_ACCOUNT=account-2 gh api user`).
Without the prefix, the default account is used.

Backed by an Account{ID, Alias, Identity, Label, StorageKey, Default} struct and interfaces such as sandboxproxy.ListAccounts.

The whole system belongs to the Plugins Manager (OAuth for third-party CLIs). It shares no credential layer with the main Gemini account.

Route 3: HostAuthProvider

A complete host-auth interface exists in the binary — 24 methods including GetTokenSource, GetOAuthTokenInfo, ResolveAuthMode. The switch -use_host_auth=true is accepted by the flag parser.

But the mode reads initial metadata from stdin:

F1031 main.go:326] Language server failed - Failed to read initial metadata from stdin

And of the 15 arguments Electron passes, none relate to authentication — and stdin is closed immediately:

// Close stdin immediately — the LS may block waiting for metadata on stdin.
_lsProcess.stdin.end();

HostAuthProvider serves enterprise gateway deployments (AUTH_MODE_ENTERPRISE_GATEWAY). The consumer path does not take it.

Other areas checked

Area Finding
HostBridgeService.GetOAuthToken A Connect listener was attached via --host_bridge_url; zero calls during cold start
fileTokenStorage fallback Triggered by a keyring timeout, which requires an existing sign-in — circular
~/.gemini/antigravity-acp/acp_token.json A file-based OAuth store, but it belongs to the ACP sub-product; appears 0 times in the main binary
-override_oauth_client_id Can substitute the OAuth client, limited by device fingerprint validation

4. Three Controlled Experiments

Experiment Action Result
Scope isolation Started sandboxes with three scope values No new entry, no scope file
Host bridge probe Attached a Connect listener via --host_bridge_url 0 requests received
Launch without credentials Backed up and deleted the entry, then launched Started normally, no marker file, credential fully restored

Shared conclusion: the language server does not touch credential storage during cold start. Every fallback can only be activated from within a real authentication flow.


5. Verdict

Three boundaries hold at once, forming a seal that cannot be crossed:

  1. The credential target is fixed at compile time, with no configuration surface
  2. The official path does not use host authentication — no auth switch among Electron's arguments
  3. Every fallback needs an existing sign-in, and without a separate slot, sign-ins cannot coexist

This is not an oversight. It is the design. Antigravity is a single-user, single-account desktop IDE; multi-account capability lives only in the plugin ecosystem.

Alternatives ruled out

Option Why it fails
Separate Windows users One system account per instance, requiring net user and CreateProcessWithLogonW — too heavy a price
Hooking CredWrite Go's static linking leaves no IAT; inline hook only, redone on every core update
Patching the asar credential/wincred/oauth_creds appear 0 times in app.asar/dist/main.js — Electron is only a shell

6. Legacy

1. The account pool changed meaning

Before After
Multi-instance · multi-account · concurrent Fast switching · single instance · single account

The pool went from a parallel container to an account shelf. Switching accounts now means stopping the instance, changing the binding, and launching again.

2. Workaround: yielding the credential slot

Since the slot is a singleton, it gets used in turns:

1. Launch an instance → Gravityless writes that account's credential
2. Wait for the language server to finish reading (about 8 seconds)
3. Gravityless clears the credential slot
4. The next instance can sign in with a different account

The key premise: the language server reads credentials once at startup, then renews with the in-memory refresh_token. Confirmed in the binary by oauth2.(*reuseTokenSource).Token and oauth2.(*tokenRefresher).Token.

The cost: renewal writes back to storage (SaveToken appears 7 times). If another account holds the slot at that moment, the write overwrites it incorrectly. So this is serial switching, not concurrency.

Safety:   verify the blob's email before clearing, so another account is never deleted
Fault    tolerance: skip clearing when the process exited early, keeping the slot for retry
Rollback: Gravityless injects the instance-local oauth_creds.json, so the account pool can be written back on exit

3. Launch warning

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.

The program does not stop you. It only tells you the price.


7. The Previous Mechanism

Before the change, credentials were files:

<profile>/.gemini/oauth_creds.json      credential payload
<profile>/.gemini/google_accounts.json  account label
<profile>/.gemini/installation_id       device fingerprint
{
  "access_token":  "ya29.…",
  "token_type":    "Bearer",
  "refresh_token": "1//0…",
  "expiry_date":   1793372233334,
  "id_token":      "eyJhbGciOiJSUzI1NiIsImtpZCI6…"
}

Flat structure, access_token at the top level, the address tucked inside id_token (a standard JWT whose second segment, base64url-decoded, carries email).

Files can be copied and isolated per directory. Several files meant several accounts, with no interference.

8. The Cross-Account Failure Chain

The fixed entry name has a direct consequence:

1. Sign in as A; the slot now holds A
2. Sign in as B; the slot is overwritten with B
3. A's instance renews its token and reads B's payload
4. Result: signed in as a, quota shown for b

9. Sandbox Contents Compared

After a capture under the new mechanism, the temporary sandbox holds:

temp/capture_<guid>/
├── .gemini/
│   ├── antigravity/          state, conversation store, builtin skills
│   └── config/               config.json, mcp_config.json
│   (no oauth_creds.json, no google_accounts.json)
├── AppData/Roaming/antigravity/
│   └── credential-user-scope reference key (when present)
└── UserData/                 Chromium profile

Under the previous mechanism, the account archive held:

data/accounts/<id>/
├── oauth_creds.json     payload, including id_token
├── google_accounts.json {"active":"…","old":[]}
└── installation_id      device fingerprint

The difference is clear: the new flow produces only a reference key, and the credential goes to the system store.


10. Epitaph

With a single architectural migration, Google turned an application that naturally supported multiple instances into a system-wide singleton.

Under the old mechanism, "several accounts" was a default property — files divide naturally. Under the new one, "one account" is an architectural constraint — the slot is born unique.

We did not lose to technical difficulty. We lost to design intent.

It did not raise an error. It did not refuse. It simply overwrote the other account, quietly.


Don't be evil

The line stood in Google's 2000 code of conduct, written by Paul Buchheit and Amit Patel.

It is an imperative, not a slogan. No subject, no object, no qualifying clause — it never defines what counts as evil, never says who decides, never names an exception. That unhedged absoluteness is what made it read as a company binding itself.

In 2018 Google removed it from the opening of the code, leaving only a paraphrase near the end:

"Remember... don't be evil, and if you see something that you think isn't right — speak up!"

From the first line of a code of conduct to a reminder at its end. The wording did not change. The position did.

In the 2.28.2 change we see a quiet design decision: pull application-level credentials into a system-wide singleton, turning multiple instances from a default property into an architectural constraint. No announcement, no migration tool, no replacement for the workflows that depended on it.

The technical decision is understandable. Centralising sign-in state reduces the attack surface and simplifies the implementation.

It is only that the one word that mattered in that motto was evil

Clone this wiki locally