Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.
This repository was archived by the owner on Mar 30, 2026. It is now read-only.

Already-open OpenCode sessions keep stale Antigravity auth/rate-limit state until restart #538

@Delqhi

Description

@Delqhi

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

  1. Start an OpenCode TUI session with an Antigravity Claude model.
  2. Change ~/.config/opencode/antigravity-accounts.json on disk (for example clear a stored Claude block, or swap to a rotated account).
  3. Send another prompt in the same already-open session.
  4. The open session can remain on stale in-memory provider/account state until restart.

Root cause found locally

Two layers contributed:

  1. 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.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/configConfiguration files, setupquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions