Skip to content

feat(dashboard): make Codex quota card windows reflect reality - #8054

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
insoln:fix/codex-quota-latent-windows
Jul 22, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
insoln:fix/codex-quota-latent-windows

Conversation

@insoln

@insoln insoln commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #8051

Two accuracy problems in the Codex quota card, both in buildCodexUsageQuotas (open-sse/services/codexUsageQuotas.ts).

1. Latent, never-used per-feature windows shown as permanent noise

ChatGPT Codex's /wham/usage advertises a latent per-feature ceiling for the spark feature (metered_feature: "codex_bengalfox") to accounts by default. For a never-used bucket the window is unanchored — used_percent: 0 and reset_after_seconds == limit_window_seconds — so it recomputes its reset as now + full_window on every fetch. It was rendered as a permanent GPT-5.3-Codex-Spark row at 100% whose reset "snaps to exactly 7 days" on every refresh, for a model the operator never used (ChatGPT's own UI doesn't show it).

Fix: skip latent spark windows (isLatentWindow: used_percent === 0 and a full-window reset_after_seconds); they reappear once the feature is actually used. The display name now comes from the payload's own limit_name (falling back to the constant), so it tracks whatever OpenAI reports instead of a hardcoded version.

2. Window labels ignored the real window duration

primary_window → "session" / secondary_window → "weekly" were assigned purely by position, never reading limit_window_seconds. On a Pro account whose primary_window is a 7-day window (limit_window_seconds: 604800) with no secondary, the card labeled it "Session".

Fix: the internal session/weekly keys (routing semantics — combo quota scoring, preflight, cooldowns) are unchanged; only the display label is corrected from limit_window_seconds (windowDurationLabel), so a 7-day primary_window shows "Weekly". Genuine 5h windows keep the default label.

Testing

  • New tests/unit/codex-usage-quotas-latent-window.test.ts (5 cases): latent spark window omitted; used spark window shown; display name from payload limit_name with constant fallback; 7-day primary labeled "Weekly"; genuine 5h/7d windows keep defaults.
  • Existing codex-banked-reset-credits-5199 + codex-usage-quotas-review-window pass (12/12, no regressions). npm run typecheck:core and ESLint clean.

Two accuracy problems in buildCodexUsageQuotas (open-sse/services/codexUsageQuotas.ts):

1. ChatGPT Codex's /wham/usage advertises a latent per-feature ceiling for the
   spark feature (metered_feature codex_bengalfox) to accounts by default. A
   never-used bucket is unanchored (used_percent 0, reset_after_seconds ==
   limit_window_seconds), so it recomputes its reset as now + full_window on
   every fetch and was rendered as a permanent GPT-5.3-Codex-Spark row at 100%
   for a model the operator never used. Skip latent windows (isLatentWindow);
   they reappear once the feature is actually used. The label now comes from the
   payload's own limit_name, falling back to the constant.

2. primary_window/secondary_window were labeled session/weekly purely by
   position, ignoring limit_window_seconds, so a 7-day primary_window showed
   'Session'. The session/weekly keys (routing semantics) stay unchanged; only
   the display label is corrected from the real window duration
   (windowDurationLabel), so a 7-day window shows 'Weekly'.

Fixes cheaper-inference#8051.
@insoln
insoln requested a review from diegosouzapw as a code owner July 21, 2026 21:38
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@diegosouzapw
diegosouzapw merged commit 1a07646 into cheaper-inference:release/v3.8.49 Jul 22, 2026
5 checks passed
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Obrigado, @insoln — mergeado na release/v3.8.49. Validado no tip combinado (merge-train: typecheck + file-size + 106 testes das áreas tocadas + vitest 271/271 verdes). O único red de CI era o base-red compartilhado de complexity (pré-existente na tip da release, não deste PR).

HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…er-inference#8054)

Two accuracy problems in buildCodexUsageQuotas (open-sse/services/codexUsageQuotas.ts):

1. ChatGPT Codex's /wham/usage advertises a latent per-feature ceiling for the
   spark feature (metered_feature codex_bengalfox) to accounts by default. A
   never-used bucket is unanchored (used_percent 0, reset_after_seconds ==
   limit_window_seconds), so it recomputes its reset as now + full_window on
   every fetch and was rendered as a permanent GPT-5.3-Codex-Spark row at 100%
   for a model the operator never used. Skip latent windows (isLatentWindow);
   they reappear once the feature is actually used. The label now comes from the
   payload's own limit_name, falling back to the constant.

2. primary_window/secondary_window were labeled session/weekly purely by
   position, ignoring limit_window_seconds, so a 7-day primary_window showed
   'Session'. The session/weekly keys (routing semantics) stay unchanged; only
   the display label is corrected from the real window duration
   (windowDurationLabel), so a 7-day window shows 'Weekly'.

Fixes cheaper-inference#8051.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…er-inference#8054)

Two accuracy problems in buildCodexUsageQuotas (open-sse/services/codexUsageQuotas.ts):

1. ChatGPT Codex's /wham/usage advertises a latent per-feature ceiling for the
   spark feature (metered_feature codex_bengalfox) to accounts by default. A
   never-used bucket is unanchored (used_percent 0, reset_after_seconds ==
   limit_window_seconds), so it recomputes its reset as now + full_window on
   every fetch and was rendered as a permanent GPT-5.3-Codex-Spark row at 100%
   for a model the operator never used. Skip latent windows (isLatentWindow);
   they reappear once the feature is actually used. The label now comes from the
   payload's own limit_name, falling back to the constant.

2. primary_window/secondary_window were labeled session/weekly purely by
   position, ignoring limit_window_seconds, so a 7-day primary_window showed
   'Session'. The session/weekly keys (routing semantics) stay unchanged; only
   the display label is corrected from the real window duration
   (windowDurationLabel), so a 7-day window shows 'Weekly'.

Fixes cheaper-inference#8051.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(backend): Codex quota card renders latent per-feature windows as active quotas

2 participants