Symptom
After antigravity-accounts.json or OpenCode auth state changes on disk, a fresh opencode run can recover, but an already-open TUI session can stay stuck on stale Antigravity state and still throw errors like:
All 1 account(s) rate-limited for claude...
No Antigravity accounts available. Run \opencode auth login`.`
Repro
- Start an OpenCode TUI session with an Antigravity Claude model.
- Change
~/.config/opencode/antigravity-accounts.json on disk (for example clear a stored Claude block, or swap to a rotated account).
- Send another prompt in the same already-open session.
- The open session can remain on stale in-memory provider/account state until restart.
Root cause found locally
Two layers contributed:
- Real OpenCode runs load the plugin from
~/.cache/opencode/node_modules/opencode-antigravity-auth, so patching only a global pnpm install does not affect the runtime.
- The plugin hard-fails on stale
accountManager state instead of doing an OpenCode-style provider-state reload + retry in the same session.
Local fix that worked
A local runtime patch fixed this by:
- reloading latest auth/account state from disk at request time
- flushing stale in-memory rate-limit/account-failure state
- retrying once before hard-failing on
No Antigravity accounts... / All accounts rate-limited...
- preserving Google API key for OpenCode internals but stripping
x-goog-api-key from Antigravity OAuth requests to avoid project-mismatch errors
Verification
- Fresh
opencode run succeeds after cache restore/patch.
- Same already-open tmux-backed TUI session continues serving prompts after disk state changes that previously required a restart.
If useful I can also post the concrete patch shape; the model here is very similar to OpenCode core's newer provider reload / retry-once flow on auth failure.
Symptom
After
antigravity-accounts.jsonor OpenCode auth state changes on disk, a freshopencode runcan recover, but an already-open TUI session can stay stuck on stale Antigravity state and still throw errors like:All 1 account(s) rate-limited for claude...No Antigravity accounts available. Run \opencode auth login`.`Repro
~/.config/opencode/antigravity-accounts.jsonon disk (for example clear a stored Claude block, or swap to a rotated account).Root cause found locally
Two layers contributed:
~/.cache/opencode/node_modules/opencode-antigravity-auth, so patching only a global pnpm install does not affect the runtime.accountManagerstate instead of doing an OpenCode-style provider-state reload + retry in the same session.Local fix that worked
A local runtime patch fixed this by:
No Antigravity accounts.../All accounts rate-limited...x-goog-api-keyfrom Antigravity OAuth requests to avoid project-mismatch errorsVerification
opencode runsucceeds after cache restore/patch.If useful I can also post the concrete patch shape; the model here is very similar to OpenCode core's newer provider reload / retry-once flow on auth failure.