feat: Antigravity multi-account round-robin with automatic failover#203
Closed
mukhtharcm wants to merge 3 commits intoopenclaw:mainfrom
Closed
feat: Antigravity multi-account round-robin with automatic failover#203mukhtharcm wants to merge 3 commits intoopenclaw:mainfrom
mukhtharcm wants to merge 3 commits intoopenclaw:mainfrom
Conversation
Member
Author
|
@steipete yet to confirm rate limit since I haven't hit limits in this run I'm currently running on 3 accounts btw :) |
- Add namespaced storage for multiple Antigravity accounts (google-antigravity:[email protected]) - Implement round-robin selection based on least-recently-used - Add automatic failover on retryable errors (401, 403, 429, quota, rate limit, timeout) - Add exponential backoff for failed accounts (1min → 5min → 25min → 1hr max) - Track account state in antigravity-state.json (lastUsed, errorCount, cooldownUntil) - Add CLI commands: clawdbot antigravity add/list The storage swap trick allows multiple accounts without modifying upstream pi-ai library - we create a temp storage object with the selected account mapped to 'google-antigravity' so the library's token refresh works transparently.
3d2a48f to
df4c14a
Compare
When an Antigravity request times out (hangs without error), treat it as a rate limit hit and automatically fail over to the next available account. Previously, timeouts would just abort the session without triggering account rotation, causing the gateway to hang indefinitely on rate-limited accounts.
df4c14a to
36d6909
Compare
Member
Author
|
Closing in favor of #263 which builds on Peter's new auth-profiles system instead of duplicating it. The round-robin logic is now integrated with the existing profile ordering mechanism. |
dgarson
added a commit
to dgarson/clawdbot
that referenced
this pull request
Feb 7, 2026
* refactor(tools): create shared tool execution module * refactor(pi): use shared tool execution in pi-tool-definition-adapter * refactor(sdk): use shared tool execution in tool-bridge * test(tools): add tests for shared tool execution module * docs: add unified tool execution coverage gap analysis * fix(auto-reply): use unified tool execution for inline skill commands * docs(tools): document wrapper reliance on runtime adapters * test(auto-reply): add inline skill command error handling tests * docs: update gap analysis with completed fixes * fix: missing stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for multiple Antigravity accounts with automatic round-robin load balancing and failover.
Problem
@mariozechner/pi-aiexpects credentials under a singlegoogle-antigravitykeySolution
Multi-account storage
Accounts stored with namespaced keys in
oauth.json:{ "google-antigravity": { ... }, "google-antigravity:[email protected]": { ... } }Round-robin selection
Each request picks the account with the oldest
lastUsedtimestamp (least-recently-used).Automatic failover
On retryable errors (401, 403, 429, quota, rate limit, timeout), marks the account as failed and automatically retries with the next available account.
Timeout-based failover (new)
Since Antigravity rate limits cause hangs rather than errors, we added timeout detection:
agent.timeoutSeconds), treat it as a rate limitAntigravity account X timed out (possible rate limit). Trying next account...Exponential backoff
Failed accounts get cooldown: 1min → 5min → 25min → 1hr max. State tracked in
antigravity-state.json.The storage swap trick
We create a temp storage object with the selected account mapped to
google-antigravity, so the upstream library's token refresh works transparently without modification.CLI Commands
Files changed
src/agents/model-auth.ts- Core multi-account logicsrc/agents/pi-embedded-runner.ts- Failover retry loop with timeout detectionsrc/cli/antigravity-cli.ts- CLI command registrationsrc/cli/program.ts- Register antigravity subcommandsrc/commands/antigravity.ts- Add/list/remove implementationsConfiguration
The failover timeout is controlled by
agent.timeoutSeconds(default: 600s / 10 min). For faster failover on rate limits, lower this value:{ "agent": { "timeoutSeconds": 180 } }Trade-off: Lower timeout = faster failover but may cut off legitimately long-running tasks.
Testing
antigravity-state.jsontimestamps