Repository navigation
Description
Client or integration
OpenCodex dashboard
Area
Authentication and account pool
Summary
After upgrading a pool (non-main) ChatGPT account from Plus to Pro, opencodex keeps the account at 5h 100% · limit reached on the dashboard, and routing skips it until the old Plus 5-hour window's shortResetAt elapses. Every WHAM probe since the upgrade reports no 5-hour window at all, so the reading being enforced comes from the old plan.
Expected: a complete WHAM observation that proves there is no burst window should retire the carried short-window tuple for pool accounts. #6287 (fixing #6244) already does this for the main account.
Root cause
parseMainPolicyUsageQuota() already derives shortWindowAbsent: true from this topology, and mergeAccountQuota() skips assignCarriedShort() when it sees that marker. Pool accounts never get there, for two reasons:
setAccountQuotaFromParsed()(src/codex/quota.ts:336) forwardsshortWindowAbsentonly whenisMain && mainWriter.- The pool probe (
src/codex/auth-api/pool-quota-probe.ts:380) and the re-login path (src/codex/auth-api/login-flow.ts:281) pass the plainparseUsageQuota()result as the policy observation, so the marker is never computed for pool accounts.
Pool accounts therefore always take the "unknown usage, retain the entire known tuple" branch. That branch is right for partial header observations, but wrong for a complete WHAM snapshot without a short window. Both lines are unchanged on dev as of today.
Proposed fix
Compute the marker for pool and login WHAM observations too, and let setAccountQuotaFromParsed() honour it for non-main accounts. Main-account behaviour without a mainWriter is unchanged.
--- a/src/codex/quota.ts
+++ b/src/codex/quota.ts
@@ -333,7 +333,7 @@
- const displayQuota: MainPolicyQuotaObservation = isMain && mainWriter && policyQuota?.shortWindowAbsent === true
+ const displayQuota: MainPolicyQuotaObservation = (!isMain || mainWriter) && policyQuota?.shortWindowAbsent === true
? { ...quota, shortWindowAbsent: true }
: quota;
@@ -952,6 +952,14 @@
+/** Pool policy evidence: a WHAM topology without a burst window retires a carried 5-hour reading (e.g. after a plan upgrade). */
+export function withWhamShortWindowAbsence(
+ data: WhamUsageResponse,
+ quota: Omit<StoredAccountQuota, "updatedAt">,
+): MainPolicyQuotaObservation {
+ return parseMainPolicyUsageQuota(data)?.shortWindowAbsent === true ? { ...quota, shortWindowAbsent: true } : quota;
+}
--- a/src/codex/auth-api/pool-quota-probe.ts
+++ b/src/codex/auth-api/pool-quota-probe.ts
@@ -377,7 +377,7 @@
- setAccountQuotaFromParsed(accountId, quota, writerGeneration, undefined, validPolicyObservation ? quota : null,
+ setAccountQuotaFromParsed(accountId, quota, writerGeneration, undefined, validPolicyObservation ? withWhamShortWindowAbsence(data, quota) : null,
--- a/src/codex/auth-api/login-flow.ts
+++ b/src/codex/auth-api/login-flow.ts
@@ -278,7 +278,7 @@
- policyQuota = isValidWhamHistoryObservation(data) ? quota : null;
+ policyQuota = quota && isValidWhamHistoryObservation(data) ? withWhamShortWindowAbsence(data, quota) : null;(plus the withWhamShortWindowAbsence import in both auth-api files)
Local verification on 2.94.0 with the bundled Bun 1.4.4, bun test ./short-absence.test.ts with OPENCODEX_HOME pointed at a temp dir: 3 pass, 0 fail. The three cases:
- The current pool path keeps
shortPercent: 100, which reproduces this bug. - The patched path clears
shortPercentandshortResetAtand keepsweeklyPercent: 0. - A Plus-style WHAM response with a 5-hour primary window does not get the marker.
Live check: after reloading the proxy, the first pool probe dropped the stale tuple, and GET /api/codex-auth/quota returned { weeklyPercent: 0, weeklyResetAt, resetCredits } for the upgraded account.
The patch touches auth-api, so I understand a PR would need maintainer-sponsored. I'm happy to open one against dev if this direction looks right.
Reproduction
- Add a ChatGPT Plus account to the Codex account pool (not the main account) and use it until its 5-hour window reads 100%.
- While that 5-hour window is still open, upgrade the same ChatGPT account to Pro. The next token refresh carries
chatgpt_plan_type: "pro"(credential generation 6 → 7 here). - Wait for the next pool WHAM probes. Each one now contains only a weekly window:
rate_limit.primary_windowis a 7-day window atused_percent: 0, and there is no 5-hour window. All latersource: "wham"history samples incodex-quota-cache.jsonshow onlyweekly 0%with a new reset 7 days after the upgrade. - Look at the account card in the dashboard, or at
quotas[<id>]incodex-quota-cache.json.shortPercent: 100,shortObservedAt(the last Plus-era sample) andshortResetAtare still present.updatedAtadvances every minute while the short tuple is carried forward unchanged, and the account stays excluded from routing.
The same thing in a unit-level repro against src/codex/quota.ts:
const now = Math.floor(Date.now() / 1000);
const preUpgrade = { shortPercent: 100, shortResetAt: now + 3600, shortWindowSeconds: 18000, weeklyPercent: 18, weeklyResetAt: now + 5 * 86400 };
const proWham = { plan_type: "pro", rate_limit: { allowed: true,
primary_window: { used_percent: 0, limit_window_seconds: 604800, reset_at: now + 7 * 86400 },
secondary_window: null } };
setAccountQuotaFromParsed("pool-a", preUpgrade, undefined, undefined, preUpgrade);
const q = parseUsageQuota(proWham);
setAccountQuotaFromParsed("pool-a", q, undefined, undefined, q); // what pool-quota-probe does today
getAccountQuota("pool-a")?.shortPercent; // 100, expected undefinedVersion
2.94.0
Operating system
Windows 11 (build 26300)
Provider and model
openai (Codex ChatGPT account pool, Pro plan)
Logs or error output
# codex-quota-cache.json, quotas[<pool account>] ~1.5 h after the upgrade (before the fix)
{"weeklyPercent": 0, "weeklyResetAt": 1793873765, "shortPercent": 100, "shortObservedAt": 1793268611036, "shortResetAt": 1793277412, "shortWindowSeconds": 18000, "resetCredits": 2}
# latest history samples for the same account (all after the upgrade)
observedAt 14:36:40 source=wham gen=7 windows={weekly: 0%}
observedAt 14:37:41 source=wham gen=7 windows={weekly: 0%}
observedAt 14:38:42 source=wham gen=7 windows={weekly: 0%}Screenshots and supporting files
No response
Redacted configuration
No response
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
fix(codex): retire a pool account's carried 5-hour window when WHAM s…
lidge-jun commentedon Oct 30, 2026
Fixed on
devby #7980, merged as ba0556d. Thanks @SupernovaTitanium for the diagnosis and proposed fix; you are credited as co-author.A complete, valid WHAM probe with no 5-hour window now retires a pool account's carried 5-hour tuple, as it already did for main (#6287), so an account upgraded from Plus to Pro is no longer held at "5h 100% · limit reached". Retirement requires a live captured credential writer for that account and credential generation. Partial or header-only observations, invalid or unparseable readings and an explicit
allowed: falsekeep the tuple.Closing manually because PRs into
devdo not auto-close issues. The fix reaches users with the next release.