Repository navigation
feat: Multi-account OAuth with round-robin rotation - #269
Merged
Merged
Conversation
Changes writeOAuthCredentials and applyAuthProfileConfig calls to use the email from OAuth response as part of the profile ID instead of hardcoded ":default". This enables multiple accounts per provider - each login creates a separate profile (e.g., google-antigravity:[email protected]) instead of overwriting the same :default profile. Affected files: - src/commands/onboard-auth.ts (generic writeOAuthCredentials) - src/commands/configure.ts (Antigravity flow) - src/wizard/onboarding.ts (Antigravity flow)
Adds usage tracking to auth profiles for automatic rotation: - ProfileUsageStats type with lastUsed, cooldownUntil, errorCount - markAuthProfileUsed(): tracks successful usage, resets errors - markAuthProfileCooldown(): applies exponential backoff (1/5/25/60min) - isProfileInCooldown(): checks if profile should be skipped - orderProfilesByMode(): now sorts by lastUsed (oldest first) On auth/rate-limit failures, profiles are marked for cooldown before rotation. On success, usage is recorded for round-robin ordering. This enables automatic load distribution across multiple accounts (e.g., Antigravity 5-hour rate limit windows).
Antigravity rate limits cause requests to hang indefinitely rather than returning 429 errors. This change detects timeouts and treats them as potential rate limits: - Added timedOut flag to track timeout-triggered aborts - Timeout now triggers profile cooldown + rotation - Logs: "Profile X timed out (possible rate limit). Trying next account..." This ensures automatic failover when Antigravity hangs due to rate limiting.
mukhtharcm
force-pushed
the
feat/multi-account-roundrobin
branch
from
January 6, 2026 05:20
3b23b63 to
18c7795
Compare
mukhtharcm
added a commit
to mukhtharcm/clawdbot
that referenced
this pull request
Jan 6, 2026
…ation When multiple OAuth accounts are configured, the round-robin rotation was not working because lastGood was always prioritized, defeating the sort by lastUsed. Changes: - Remove lastGood prioritization in resolveAuthProfileOrder - Always apply orderProfilesByMode (sorts by lastUsed, oldest first) - Only respect configuredOrder when explicitly set in config - preferredProfile still takes priority for explicit user choice Tested with 2 Google Antigravity accounts - verified alternating usage. Follow-up to PR openclaw#269.
steipete
pushed a commit
that referenced
this pull request
Jan 6, 2026
…ation (#281) * fix(auth): prioritize round-robin over lastGood for multi-account rotation When multiple OAuth accounts are configured, the round-robin rotation was not working because lastGood was always prioritized, defeating the sort by lastUsed. Changes: - Remove lastGood prioritization in resolveAuthProfileOrder - Always apply orderProfilesByMode (sorts by lastUsed, oldest first) - Only respect configuredOrder when explicitly set in config - preferredProfile still takes priority for explicit user choice Tested with 2 Google Antigravity accounts - verified alternating usage. Follow-up to PR #269. * style: fix formatting
dgarson
added a commit
to dgarson/clawdbot
that referenced
this pull request
Feb 9, 2026
* feat: CRN proposal * CRN: validate canonicalized resource-id (openclaw#271) * Docs: tighten CRN parser resource-id rule (openclaw#269) * CRN: add session and cron metadata (openclaw#267)
heatherstew44-maker
pushed a commit
to heatherstew44-maker/openclaw
that referenced
this pull request
Mar 8, 2026
* fix: tooltip overflow * Adds more responsive Css * StartHidden has tooltip bottom * in debug setting too --------- Co-authored-by: CJ Pais <[email protected]>
Fato07
referenced
this pull request
in Fato07/elav
Mar 26, 2026
fix(server): serve cached index.html in SPA catch-all to prevent 500
Addressing review feedbackP1: metabase_api.py consumers ✅Restored in eea9b3c with deprecation notice. Active consumers confirmed:
P2: bq_query.sh consumers ✅Restored in eea9b3c with deprecation notice. Consumer: P2: Memory materialization in bq-query/run.pyThis is upstream nimbus-cortex code, imported as-is. The 20GB scan cap + practical row counts keep memory safe. Can patch downstream or contribute upstream if needed. |
lovewanwan
pushed a commit
to lovewanwan/openclaw
that referenced
this pull request
Apr 28, 2026
…undrobin feat: Multi-account OAuth with round-robin rotation
lovewanwan
pushed a commit
to lovewanwan/openclaw
that referenced
this pull request
Apr 28, 2026
…ation (openclaw#281) * fix(auth): prioritize round-robin over lastGood for multi-account rotation When multiple OAuth accounts are configured, the round-robin rotation was not working because lastGood was always prioritized, defeating the sort by lastUsed. Changes: - Remove lastGood prioritization in resolveAuthProfileOrder - Always apply orderProfilesByMode (sorts by lastUsed, oldest first) - Only respect configuredOrder when explicitly set in config - preferredProfile still takes priority for explicit user choice Tested with 2 Google Antigravity accounts - verified alternating usage. Follow-up to PR openclaw#269. * style: fix formatting
Primus-max
referenced
this pull request
in Primus-max/god-mode-core
May 7, 2026
…y helper
Фаза 3 sub-plan'а ['commitment_kernel_intent_contractor_freshness.plan.md'](../.cursor/plans/commitment_kernel_intent_contractor_freshness.plan.md) — pure scoring helper над типами Phase 2. NO contractor wiring, NO consumer changes; Phase 4 ландит провод в 'intent-contractor-impl.ts'.
Размещение: NEW 'src/platform/freshness/score-by-recency.ts'. Импорты — только sibling Phase 2 модуль ('./freshness-config.js') + stdlib (инвариант #8). Frozen-слой 'src/platform/commitment/**' и 5 frozen-контрактов — НЕ ТРОНУТЫ ('git diff --stat src/platform/decision/ src/platform/commitment/' пустой; инвариант #11).
Контракт хелпера ('ScoreByRecencyDeps<T>'):
- 'items: ReadonlyArray<T>' — каллер передаёт массив; helper его не мутирует.
- 'getTimestamp: (item: T) => number | null | undefined' — extractor задаётся каллером (Phase 4 будет передавать 'Date.parse(metadata.recordedAt)' для memory и 'Date.parse(updatedAt ?? createdAt)' для tasks).
- 'nowMs: number' — clock-injected (sub-plan §6: помощь purity load-bearing; внутри хелпера НЕТ 'Date.now()').
- 'config: ResolvedFreshnessConfig' — резолвед один раз на 'classify' call (lock-step консистенция, audit §c.3).
Decay-формула:
1. 'getTimestamp(item)' → 'rawTs'.
2. 'rawTs' null/undefined/NaN/Infinity → policy-driven branch ('penalize_to_floor' → 'ageMs=null, recencyDecay=DECAY_FLOOR'; 'treat_as_now' → 'ageMs=0, recencyDecay=1.0').
3. Иначе 'ageMs = max(0, nowMs - tsMs)' (negative ages clock-skew clamped to 0).
4. 'decay = Math.pow(0.5, ageMs / decayHalfLifeMs)'.
5. Cap at 1.0; floor at 'DECAY_FLOOR'.
Stable-sort discipline: каждый scored-envelope несёт internal '__idx' (original position); после сортировки ('b.recencyDecay - a.recencyDecay' с tiebreaker 'a.__idx - b.__idx') индекс снимается перед возвратом. Это исключает зависимость от engine 'Array.sort' стабильности (контракт sub-plan'а §6: equal decay → original order preserved).
Fail-soft posture (инварианты #9/#10/#15):
- Внутри ноль 'Date.now()' / 'console.*' / 'throw'.
- 'NaN' / 'Infinity' / 'null' / 'undefined' timestamp — фолбэк на policy.
- Future-stamped entry (negative raw age) — 'ageMs' clamped to 0, 'recencyDecay' capped at 1.0 (живой clock-skew vector audit §2.4).
Тесты ('__tests__/score-by-recency.test.ts', 15 кейсов, fail-first verified):
1. Empty array → empty result.
2. ageMs=0 → recencyDecay=1.0.
3. Exactly one half-life → recencyDecay=0.5 (strict equality, no FP fuzz at exponent=1).
4. 'penalize_to_floor' missing-ts → 'ageMs=null, recencyDecay=DECAY_FLOOR'.
5. 'treat_as_now' missing-ts → 'ageMs=0, recencyDecay=1.0'.
6. Two items different ages → fresher first (input order reversed → helper actually reorders).
7. Stable sort: three items с identical timestamps preserve declaration order.
8. Future-stamped (clock skew) → 'ageMs=0, recencyDecay=1.0' (cap holds).
9. 10× half-life → recencyDecay=DECAY_FLOOR (floor holds; pow(0.5,10)=0.000976 < floor).
10. Configurable half-life: 1h half-life + 1h-old item → recencyDecay=0.5.
11. Generic over T: 'Mem={id,ts}' shape works.
12. Generic over T: 'Task={name,recordedAt}' shape works.
13. Input array NOT mutated (length, snapshot equality, slot identity).
14. Item objects NOT mutated (Object.keys unchanged, envelope item === source).
15. NaN-tolerance: 'getTimestamp() => NaN' → falls into missing-ts branch (Phase 4 'Date.parse' regression guard, инвариант #15 fail-soft).
Fail-first evidence: с stubbed 'scoreByRecency' возвращающим '[]', vitest сообщил '14 failed | 1 passed' (только empty-array case прошёл — корректно). После реал-имплементации — 15/15 green. 'pnpm exec tsgo --noEmit' — exit 0, чисто.
Plan-Step: PR-#269 (freshness phase 3 — scoring helper)
Plan-Status: completed
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
May 9, 2026
…undrobin feat: Multi-account OAuth with round-robin rotation
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
May 9, 2026
…ation (openclaw#281) * fix(auth): prioritize round-robin over lastGood for multi-account rotation When multiple OAuth accounts are configured, the round-robin rotation was not working because lastGood was always prioritized, defeating the sort by lastUsed. Changes: - Remove lastGood prioritization in resolveAuthProfileOrder - Always apply orderProfilesByMode (sorts by lastUsed, oldest first) - Only respect configuredOrder when explicitly set in config - preferredProfile still takes priority for explicit user choice Tested with 2 Google Antigravity accounts - verified alternating usage. Follow-up to PR openclaw#269. * style: fix formatting
muneebhashone
pushed a commit
to muneebhashone/clawdbot
that referenced
this pull request
Aug 25, 2026
…undrobin feat: Multi-account OAuth with round-robin rotation
muneebhashone
pushed a commit
to muneebhashone/clawdbot
that referenced
this pull request
Aug 25, 2026
…ation (openclaw#281) * fix(auth): prioritize round-robin over lastGood for multi-account rotation When multiple OAuth accounts are configured, the round-robin rotation was not working because lastGood was always prioritized, defeating the sort by lastUsed. Changes: - Remove lastGood prioritization in resolveAuthProfileOrder - Always apply orderProfilesByMode (sorts by lastUsed, oldest first) - Only respect configuredOrder when explicitly set in config - preferredProfile still takes priority for explicit user choice Tested with 2 Google Antigravity accounts - verified alternating usage. Follow-up to PR openclaw#269. * style: fix formatting
zeekay
pushed a commit
to Dream-AI-4444/bot
that referenced
this pull request
Sep 11, 2026
…undrobin feat: Multi-account OAuth with round-robin rotation
zeekay
pushed a commit
to Dream-AI-4444/bot
that referenced
this pull request
Sep 11, 2026
…ation (openclaw#281) * fix(auth): prioritize round-robin over lastGood for multi-account rotation When multiple OAuth accounts are configured, the round-robin rotation was not working because lastGood was always prioritized, defeating the sort by lastUsed. Changes: - Remove lastGood prioritization in resolveAuthProfileOrder - Always apply orderProfilesByMode (sorts by lastUsed, oldest first) - Only respect configuredOrder when explicitly set in config - preferredProfile still takes priority for explicit user choice Tested with 2 Google Antigravity accounts - verified alternating usage. Follow-up to PR openclaw#269. * style: fix formatting
This was referenced Oct 3, 2026
lhfer
pushed a commit
to lhfer/openclaw
that referenced
this pull request
Oct 11, 2026
…undrobin feat: Multi-account OAuth with round-robin rotation
lhfer
pushed a commit
to lhfer/openclaw
that referenced
this pull request
Oct 11, 2026
…ation (openclaw#281) * fix(auth): prioritize round-robin over lastGood for multi-account rotation When multiple OAuth accounts are configured, the round-robin rotation was not working because lastGood was always prioritized, defeating the sort by lastUsed. Changes: - Remove lastGood prioritization in resolveAuthProfileOrder - Always apply orderProfilesByMode (sorts by lastUsed, oldest first) - Only respect configuredOrder when explicitly set in config - preferredProfile still takes priority for explicit user choice Tested with 2 Google Antigravity accounts - verified alternating usage. Follow-up to PR openclaw#269. * style: fix formatting
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 OAuth accounts per provider with automatic round-robin load balancing and failover.
Changes
1. Email-based profile IDs
:default(e.g.,google-antigravity:[email protected])clawdbot configureflow2. Round-robin rotation
usageStats(lastUsed, cooldownUntil, errorCount) per profilelastUsedfirst (least-recently-used)3. Exponential backoff cooldown
4. Timeout-based failover
Files changed
src/commands/onboard-auth.ts- Email-based profile IDsrc/commands/configure.ts- Email-based profile IDsrc/wizard/onboarding.ts- Email-based profile IDsrc/agents/auth-profiles.ts- Usage tracking, cooldown, round-robin logicsrc/agents/pi-embedded-runner.ts- Timeout detection, cooldown/usage callsTesting
clawdbot configure