Skip to content

Account Pooler: support Codex credit fallback and availability #4533

Description

@ymichael

Summary

Account Pooler ignores Codex credit availability, so an exhausted subscription window excludes an account even when credits remain. Extend the Claude fallback policy from #4475 / #4531 to Codex, while respecting independent workspace/member spending limits.

Versions and environment

Source f8ef913e181d35a41c6196d05540a82fe1e63651, macOS, Node 22.23.1. Source-level investigation only; no live paid-credit request.

Steps to reproduce

At this commit, invoke exported codexQuotaFromUsage in plugins/account-pool/src/codex-adapter.ts with a primary window at used_percent: 100, a future reset, and credits: {has_credits:true,unlimited:false,balance:"20"}. It returns exhausted windows and extraUsage:null. Passing only that credits object returns null. createCodexAdapter(...).quotaFromHeaders likewise ignores x-codex-credits-has-credits:true, x-codex-credits-unlimited:false, and x-codex-credits-balance:20 when no window headers are present.

Expected vs actual

Observed source-level output:

{"case":"usage with credits","extraUsage":null,"subscriptionExhausted":true}
{"case":"credit-only headers","extraUsage":null,"observedAt":null}
{"case":"credits without rate_limit","result":null}

Expected: prefer subscription quota, allow available credits as fallback, move back when subscriptions recover, and display only availability in Settings. Credit depletion and spending-control rejections must override stale allowance. Missing credit fields must not fabricate availability.

Evidence

Adapter at investigated commit.

Upstream Codex headers and usage schema expose credit availability, spending controls, and rejection reasons.

Investigation thread: thr_zhebfwg2vz (@thread:thr_zhebfwg2vz).

What you ruled out

Searched open and closed issues for Codex credits/pool. #4157 concerns reset scheduling; #3615 concerns Claude model entitlements. #4475 and #4531 cover Claude only. This is not an API-credit purchase feature; it concerns existing ChatGPT/Codex credits.

AGENT GENERATED

Activity

  1. added
    providers
    provider-codex
    on Sep 30, 2026
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

    provider-codexproviders

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions