Skip to content

[Feature]: scale the Anthropic pool per-request failover cap like the generic OAuth roster #8759

Closed

Description

@vadymhimself

Area

Authentication and account pool

What are you trying to accomplish?

With a large Anthropic OAuth pool (6 or more accounts), I want one request to keep trying healthy accounts when several accounts return fresh 429s at the same moment. This happens after a restart, or in a burst before their cooldowns are known.

What prevents this today?

The Anthropic pool uses the fixed ANTHROPIC_POOL_MAX_FAILOVERS_PER_REQUEST = 3 (src/oauth/anthropic-routing.ts:67). That constant is checked at four hop sites:

  • messages-native.ts:940
  • adapter-continuation.ts:455
  • adapter-dispatch.ts:1370
  • sidecar-execution.ts:422

The send budget is never expanded for this path, so one request tries at most 4 accounts. If those 4 all return 429, the client gets the 429 while healthy accounts in the pool go unused. The next request does recover, because those 4 accounts are now cooled.

The generic OAuth roster already scales with the roster size. src/server/responses/request-transport.ts:1426-1428 snapshots the eligible roster and allows max(GENERIC_OAUTH_MAX_FAILOVERS_PER_REQUEST, min(roster, GENERIC_OAUTH_MAX_ACCOUNTS_PER_REQUEST) - 1) hops. It also funds the send budget through expandInferenceOAuthSendBudget (src/server/inference/context.ts:34). The 6-account clamp keeps a large roster from turning one request into a pool-wide 429 storm.

What should OpenCodex do?

The Anthropic pool should follow the same contract as the generic roster, with no new setting:

  • Snapshot the eligible Anthropic roster before the first send.
  • Allow max(3, min(roster, 6) - 1) hops.
  • Fund the send budget with the same expandInferenceOAuthSendBudget clamp.

Per-hop admission through reserveCredentialHop would not change. Pools of 4 or fewer accounts would keep today's behavior.

Example usage or interface

There is no interface change. A pool of 8 Anthropic accounts in which the first 4 return 429 on one request would serve that request from a 5th account instead of returning the 429.

Alternatives or workarounds

  • Retrying the request on the client side works, because the 4 refused accounts are cooled afterwards.
  • A fixed larger cap. The vadymhimself fork (4a620f7) uses 16 on a hosted gateway, but I don't propose that number for dev.

Additional context

I'd like to know whether you would accept a PR that mirrors the generic roster contract for the Anthropic pool. If you'd rather keep the fixed 3 for Anthropic, for example because of the default-off pool policy, I'll drop this.

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

  1. added
    account-pool
    on Nov 14, 2026
  2. github-actions commented on Nov 14, 2026

    @github-actions
    Contributor

    Issue reopened

    The report now contains the information required by the automated check. Thanks for updating it.

  3. changed the title [-][Design] Scale the Anthropic pool per-request failover cap like the generic OAuth roster[/-] [+][Feature]: scale the Anthropic pool per-request failover cap like the generic OAuth roster[/+] on Nov 14, 2026
  4. added
    enhancement
    on Nov 14, 2026
  5. Ingwannu commented on Nov 16, 2026

    @Ingwannu
    Owner

    I checked current dev da021e37: Anthropic's rotation paths still use the fixed ANTHROPIC_POOL_MAX_FAILOVERS_PER_REQUEST = 3. The generic Responses path snapshots the funded roster before cooldown writes, clamps it to GENERIC_OAUTH_MAX_ACCOUNTS_PER_REQUEST = 6, and uses max(3, fundedAccounts - 1), while each hop also needs the shared physical-send budget. It is not an unlimited “roster length” allowance.

    A focused parity PR is reasonable for review if it preserves that finite snapshot and the intersection with the request-wide send budget, covers every Anthropic path using the cap (ordinary dispatch, continuation, sidecar and native Messages), and leaves the pool's enablement/selection policy unchanged. Please include four refused accounts followed by a healthy one, a roster above the cap, cooldowns shrinking eligibility mid-turn, cancellation, and a spent send budget. None of these may replay a committed turn or turn a final upstream refusal into an invented quota result. No fixed 16-account default or live retry experiment is being accepted here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolenhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions