Skip to content

fix(codex): isolate Spark quota and stabilize quota UI - #6336

Merged
diegosouzapw merged 3 commits into
diegosouzapw:release/v3.8.46from
xz-dev:fix/codex-quota-scope-ui-order
Jul 7, 2026
Merged

diegosouzapw merged 3 commits into
diegosouzapw:release/v3.8.46from
xz-dev:fix/codex-quota-scope-ui-order

Conversation

@xz-dev

@xz-dev xz-dev commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Scope hydrated Codex quota exhaustion by requested model so an exhausted GPT-5.3-Codex-Spark window no longer filters normal Codex requests such as codex/gpt-5.5.
  • Stabilize OpenAI Codex quota row/column order as: Session, Weekly, GPT-5.3-Codex-Spark Session, GPT-5.3-Codex-Spark Weekly, Banked Reset Credits.
  • Preserve bankedResetCredits through provider-limits cache serialization and stale refresh fallback so Banked Reset Credits can render without requiring a manual Refresh Now.

Context

Production on v3.8.44 already had per-window quota_snapshots.is_exhausted from #5941, but lazy hydration still promoted any exhausted snapshot row into connection-level exhaustion. When the Spark weekly window was exhausted and normal Codex windows still had quota, the quota-aware selection path could treat the whole Codex connection as exhausted and return 429 for normal Codex traffic. This keeps the #4293/#5941 per-window model boundary during selection/hydration.

Tests

  • node --import tsx/esm --test tests/unit/codex-quota-selection-hydration.test.ts tests/unit/sse-auth.test.ts tests/unit/provider-limits-ui.test.ts tests/unit/provider-columns.test.ts tests/unit/db-provider-limits.test.ts tests/unit/provider-limits-recovery.test.ts
  • npm run check:file-size
  • npm run check:dead-code
  • node node_modules/typescript/bin/tsc --pretty false -p tsconfig.typecheck-core.json
  • git diff --check

@xz-dev
xz-dev requested a review from diegosouzapw as a code owner July 6, 2026 09:22

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Codex-specific quotas, including Spark session/weekly limits and banked reset credits. It updates the UI columns, sorting, and caching mechanisms to handle these new fields, and refactors the credential selection logic to use a request-aware quota exhaustion check (isQuotaExhaustedForRequest) instead of a generic connection-wide check. A critical issue was identified in src/domain/quotaCache.ts where isQuotaExhaustedForRequest uses every instead of some to check for exhausted scoped windows, which would incorrectly allow requests to proceed even if one of the required quota windows is fully exhausted.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/domain/quotaCache.ts
Comment on lines +220 to +225
return (
scopedWindowNames.length > 0 &&
scopedWindowNames.every(
(windowName) => getQuotaWindowStatus(connectionId, windowName, 100)?.reachedThreshold
)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using every here means the connection will only be considered exhausted for the requested model if all of its scoped windows are exhausted. However, if even a single scoped window (such as session or weekly) is exhausted, any request to that model will be blocked and return a 429. To prevent sending requests to connections with partially exhausted quotas, this should use some instead of every.

Suggested change
return (
scopedWindowNames.length > 0 &&
scopedWindowNames.every(
(windowName) => getQuotaWindowStatus(connectionId, windowName, 100)?.reachedThreshold
)
);
return (
scopedWindowNames.length > 0 &&
scopedWindowNames.some(
(windowName) => getQuotaWindowStatus(connectionId, windowName, 100)?.reachedThreshold
)
);

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.8.46 July 7, 2026 00:18
@diegosouzapw
diegosouzapw merged commit 9570805 into diegosouzapw:release/v3.8.46 Jul 7, 2026
1 check was pending
@diegosouzapw

Copy link
Copy Markdown
Owner

Merged into release/v3.8.46 — thank you, @xz-dev! Synced onto the release tip, added the CHANGELOG entry, and verified tests green. 🙌

HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…6336)

isolate Spark quota + stabilize quota UI (diegosouzapw#6336). Tests 44/44, no file-size drift from its files. Integrated into release/v3.8.46.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…6336)

isolate Spark quota + stabilize quota UI (diegosouzapw#6336). Tests 44/44, no file-size drift from its files. Integrated into release/v3.8.46.
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.

2 participants