GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(auth): account pool round-robin and fill-first strategies by Wibias · Pull Request #593 · lidge-jun/opencodex

Conversation

@Wibias

@Wibias Wibias commented Jul 28, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

  • Add opt-in Codex/Anthropic account-pool rotation strategies: quota (default, unchanged), round-robin, and fill-first
  • Strategies apply to new sessions only; live thread/session affinity, cooldown, and reauth quarantine stay intact
  • Dashboard + management API controls (accountPoolStrategy / stickyLimit; Anthropic nested fields)
  • Docs + fairness regression tests

Fixes #592

Improvements (measured)

Fixture: 3 Codex pool accounts, equal quota, unbound new sessions.

Metric Baseline (quota) Round-robin Margin
New-session share max−min 100pp (100/0/0) 0pp (33/33/33) Fairness ↑ 100pp
Mid-thread affinity flips 0 0 (50 re-resolves) No regression
Operator control Threshold only Strategy + stickyLimit Parity with peer RR/Sticky, better affinity

vs 9Router / OmniRoute: session-granular RR (not request-granular), three composable strategies instead of a large menu, keeps existing generation/cooldown integrity.

Test plan

  • bun run typecheck
  • bun run privacy:scan
  • bun run lint:gui
  • Feature suites: codex-pool-rotation, anthropic-account-pool, account-pool-management-api, GUI strategy tests
  • CI Cross-platform green (ubuntu/mac/windows)
  • CodeRabbit + Codex review addressed
  • Security review (auth/routing) clean

Summary by CodeRabbit

  • New Features
    • Added account-pool rotation controls for Codex and experimental Anthropic OAuth pools.
    • You can now configure accountPoolStrategy (quota, round-robin, fill-first) and accountPoolStickyLimit for new sessions.
    • Rotation and failover behavior is now strategy-aware during quota/rate-limit events.
    • Updated the Codex/Anthropic account-pool settings UI to edit and save these options.
  • Documentation
    • Expanded getting-started and configuration docs to clarify new-session rebalancing, cooldown/re-auth skipping, and provider-enforcement limits (with details across languages).
  • Tests
    • Added and expanded automated coverage for settings UI, API persistence/validation, and rotation/failover behavior.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Wibias added 10 commits July 28, 2026 05:19
@Wibias
feat(codex): add account pool round-robin selector
5237c63
@Wibias
feat(codex): honor accountPoolStrategy for new sessions
6608de5
@Wibias
feat(anthropic): account pool rotation strategies
da4bcbc
@Wibias
feat(api): expose account pool rotation strategy
8797e78
@Wibias
feat(gui): account pool rotation strategy controls
766c3cc
@Wibias
fix(gui): optimistic account pool strategy select
f73e2ff
@Wibias
docs: account pool rotation strategies
faa8318
@Wibias
docs: clarify Anthropic pool strategy quota window
0d6647b
@Wibias
test(codex): assert round-robin fairness histogram
ea1e2b0
@Wibias
fix(auth): peek RR preview and harden pool strategy tests
6f92d7d
@Wibias
Wibias requested review from Ingwannu and lidge-jun as code owners July 28, 2026 03:20
@coderabbitai

This comment was marked as outdated.

Sign in to view
@github-actions github-actions Bot added the enhancement New feature or request label Jul 28, 2026
@Wibias

This comment was marked as outdated.

Sign in to view
@coderabbitai

This comment was marked as outdated.

Sign in to view
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Wibias added 2 commits July 28, 2026 05:43
@Wibias
fix(auth): address Codex pool-strategy review findings
8bd9505
Seed RR on manual select, gate affinity re-eval to quota, validate before mutate, keep automatic picks in-memory, and advance fill-first/RR on 429.
@Wibias
fix(gui): keep auto-switch tests mounting with strategy card
95fd3f4
Mock shared /active defaults and pool-strategy so CodexPoolStrategySetting no longer races the auto-switch harness.
@Wibias

This comment was marked as outdated.

Sign in to view
@coderabbitai

This comment was marked as resolved.

Sign in to view
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Wibias
fix(auth): typecheck and remaining pool-strategy P2s
2a04ae6
@Wibias

This comment was marked as resolved.

Sign in to view
@coderabbitai

This comment was marked as resolved.

Sign in to view
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Wibias
fix(auth): restore #584 retry and harden pool rotation edges
a96d705
@Wibias

This comment was marked as outdated.

Sign in to view
@coderabbitai

This comment was marked as resolved.

Sign in to view
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: a96d705d86

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Wibias
fix(api): reject non-object pool-strategy bodies
e6467e3
Return 400 for null/array/scalar JSON instead of throwing 500, and use POOL_KEY_ANTHROPIC in the sticky-release test.
@Wibias

Wibias commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Addressed remaining CodeRabbit nits in e6467e3:

  • Reject non-object pool-strategy / anthropic pool bodies with 400 (null/array/scalar)
  • Anthropic sticky-release test uses POOL_KEY_ANTHROPIC
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit="a96d705d"

echo '=== Commit metadata and changed files ==='
git show --no-ext-diff --format=fuller --stat "$commit"
git diff-tree --no-commit-id --name-only -r "$commit" | sort

echo '=== Source/test outlines for changed TypeScript files ==='
git diff-tree --no-commit-id --name-only -r "$commit" |
  while IFS= read -r file; do
    case "$file" in
      *.ts|*.tsx)
        echo "--- $file"
        ast-grep outline "$file" --items all 2>/dev/null || true
        ;;
    esac
  done

echo '=== Exact implementation/test patch ==='
git show --no-ext-diff --format= --find-renames "$commit" -- \
  src/codex/routing.ts \
  src/codex/auth-context.ts \
  src/server/responses/core.ts \
  src/oauth/anthropic-routing.ts \
  src/codex/pool-rotation.ts \
  tests/codex-pool-rotation.test.ts \
  tests/anthropic-account-pool.test.ts \
  tests/server-auth.test.ts

echo '=== Relevant code at the reviewed commit ==='
git show "$commit:src/codex/routing.ts" | nl -ba | sed -n '1,180p;500,720p;900,1060p'
git show "$commit:src/oauth/anthropic-routing.ts" | nl -ba | sed -n '140,260p;340,540p'
git show "$commit:src/server/responses/core.ts" | nl -ba | sed -n '260,360p'
git show "$commit:src/codex/pool-rotation.ts" | nl -ba | sed -n '80,190p'

echo '=== Focused regression-test sections at the reviewed commit ==='
git show "$commit:tests/codex-pool-rotation.test.ts" | nl -ba | sed -n '220,290p;360,500p'
git show "$commit:tests/anthropic-account-pool.test.ts" | nl -ba | sed -n '170,420p'
git show "$commit:tests/server-auth.test.ts" | nl -ba | sed -n '1650,1730p'

Length of output: 45280


🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit="a96d705d"

show_range() {
  local file="$1"
  local range="$2"
  echo "=== ${file}:${range} @ ${commit} ==="
  git show "${commit}:${file}" | cat -n | sed -n "${range}p"
}

echo '=== Complete commit patch (including auth API) ==='
git show --no-ext-diff --format= --find-renames "$commit"

show_range src/codex/routing.ts '470,750'
show_range src/codex/routing.ts '740,1035'
show_range src/oauth/anthropic-routing.ts '130,340'
show_range src/oauth/anthropic-routing.ts '330,525'
show_range src/codex/auth-api.ts '500,760'

echo '=== Exact relevant call sites at the reviewed commit ==='
git grep -n -E \
  'getEffectiveActiveCodexAccountId\(|promoteActiveCodexAccount\(|rememberActiveCodexAccount\(|setActiveCodexAccount\(|resolveAnthropicAccountForSession\(|getAnthropicPoolAccessToken\(|rotateAnthropicAccountOn429\(' \
  "$commit" -- src tests || true

echo '=== Full modified test files at the reviewed commit ==='
git show "$commit:tests/codex-pool-rotation.test.ts" | cat -n | sed -n '1,500p'
git show "$commit:tests/anthropic-account-pool.test.ts" | cat -n | sed -n '1,430p'

Length of output: 139947


@Wibias Reviewed a96d705d; no new correctness findings.

  • Quota 429 failover is restored without regressing RR behavior. In src/codex/routing.ts, Lines 984–1019 record the cooldown and reuse meta.promoteAccountId when the retry path already chose an alternate. This prevents a second RR selection. Lines 698–705 persist the promoted account for quota, while RR/fill-first only update the in-memory cursor.

  • Automatic strategies no longer overwrite the operator-selected config. src/codex/routing.ts Lines 677–705 separates runtimeActiveCodexAccountId from config.activeCodexAccountId; Lines 587–618 use the runtime cursor for committed RR/fill-first new-session picks. tests/codex-pool-rotation.test.ts Lines 363–378 verifies RR requests do not create or sync-write config.json.

  • Fill-first correctly bypasses known-drained successors. Both src/codex/routing.ts Lines 529–569 and src/oauth/anthropic-routing.ts Lines 188–215 traverse stable successor order and prefer an eligible account below the threshold, only falling back to a drained account if no eligible lower-usage alternative exists. The corresponding Codex and Anthropic regressions are at tests/codex-pool-rotation.test.ts Lines 261–272 and tests/anthropic-account-pool.test.ts Lines 325–335.

  • Keyless Anthropic requests retain active-account stability. src/oauth/anthropic-routing.ts Lines 360–381 preserves an eligible active account for null/empty keys under RR and fill-first. Identified new sessions still use strategy routing and create affinity, so the account-spreading behavior remains available where a session identity exists. This is covered by tests/anthropic-account-pool.test.ts Lines 215–225.

  • Manual selection remains authoritative. src/codex/routing.ts Lines 335–344 clears the automatic cursor during manual selection, and src/codex/auth-api.ts Lines 607–629 persists that explicit choice while reporting the effective active account.

The documented preview-reserve limitation remains properly constrained to the subagent fallback path and does not invalidate the routing changes in this commit.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request Jul 28, 2026
fix: scope Spark cooldowns to its native quota #599
Merged
3 tasks done
@Wibias Wibias linked an issue Jul 28, 2026 that may be closed by this pull request
[Feature]: Account pool round-robin / fill-first rotation strategies #592
Closed
5 tasks done
@Wibias
Wibias merged commit c380ef7 into lidge-jun:dev Jul 28, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Wibias
Wibias deleted the feat/account-pool-round-robin branch July 28, 2026 05:56
This was referenced Jul 29, 2026
feat(codex): account pause controls and bulk exhaustion (takeover #565) #667
Merged
feat(codex): selection order for the account pool #715
Merged
fix(gui): gate Codex pool writes until hydrated and ignore stale strategy polls #739
Merged
@luvs01 luvs01 mentioned this pull request Jul 31, 2026
Codex Auth UI/docs conflate usage-based switching with rotation and misdefine “new session” #806
Closed
2 of 10 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Aug 1, 2026
docs(codex): clarify pool routing and account continuity #862
Merged
@luvs01 luvs01 mentioned this pull request Aug 2, 2026
feat(gui): show weighted Codex pool capacity and next recovery in Providers overview #874
Closed
3 tasks done
This was referenced Aug 2, 2026
feat(gui): show weighted Codex pool capacity and next recovery #878
Merged
fix(routing): keep unbound account quota unknown #1195
Closed
fix(codex): rotate pool accounts on model capacity #1313
Closed
This was referenced Aug 9, 2026
fix(codex): retain quota cooldown after account retry #1353
Merged
feat: Command Code OAuth account pool with Codex-style rotation #1552
Closed
@Yoonkeee Yoonkeee mentioned this pull request Aug 25, 2026
[Feature]: Allow Anthropic account-pool quota routing to select by weekly usage #2539
Closed
3 tasks done
@wonny-log wonny-log mentioned this pull request Aug 29, 2026
[Feature]: reset-window ordering for Codex and Anthropic account pools #2874
Closed
3 tasks done
@coderabbitai coderabbitai Bot mentioned this pull request Aug 29, 2026
feat(codex): add reset-window account routing #2881
Closed
7 tasks done
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
@Wibias
feat(auth): account pool round-robin and fill-first strategies (lidge…
edb47b3
…-jun#593)

* feat(codex): add account pool round-robin selector

* feat(codex): honor accountPoolStrategy for new sessions

* feat(anthropic): account pool rotation strategies

* feat(api): expose account pool rotation strategy

* feat(gui): account pool rotation strategy controls

* fix(gui): optimistic account pool strategy select

* docs: account pool rotation strategies

* docs: clarify Anthropic pool strategy quota window

* test(codex): assert round-robin fairness histogram

* fix(auth): peek RR preview and harden pool strategy tests

* fix(auth): address Codex pool-strategy review findings

Seed RR on manual select, gate affinity re-eval to quota, validate before mutate, keep automatic picks in-memory, and advance fill-first/RR on 429.

* fix(gui): keep auto-switch tests mounting with strategy card

Mock shared /active defaults and pool-strategy so CodexPoolStrategySetting no longer races the auto-switch harness.

* fix(auth): typecheck and remaining pool-strategy P2s

* fix(auth): restore lidge-jun#584 retry and harden pool rotation edges

* fix(api): reject non-object pool-strategy bodies

Return 400 for null/array/scalar JSON instead of throwing 500, and use POOL_KEY_ANTHROPIC in the sticky-release test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments
@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments
@lidge-jun lidge-jun Awaiting requested review from lidge-jun lidge-jun is a code owner
@Ingwannu Ingwannu Awaiting requested review from Ingwannu Ingwannu is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Feature]: Account pool round-robin / fill-first rotation strategies

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Wibias
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.