You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): Codex seat workspaces with a zero credit cap are no longer out of usage - #34239
On ChatGPT Business/Team workspaces that use paid seats, Codex reports an individualLimit with a 0 credit cap (limit: "0", remainingPercent: 0). T3 Code mapped that to a "Monthly credit limit" window at 100%, so the whole provider looked exhausted: new threads switched to the fallback model with "Codex is out of usage · resets <1st of next month>", even though the session and weekly allowance had room.
A 0 credit cap means no credits are allocated, and credits are only spent once the seat allowance runs out, so codexRateLimitsToWindows now leaves the individual window out when its limit is 0. Usage-based Enterprise plans, where the credit cap is the real allowance, keep the window. Because the fallback picker, text-generation fallback, MCP thread creation and codexUsageLimitResetAt all read these windows, they all stop treating Codex as out of usage.
Added a test with the snapshot from the issue; it fails on main and passes here.
Macroscope's review found this PR approvable — Zero credit caps no longer make Codex seat workspaces appear exhausted while seat allowance remains. The change is limited to usage interpretation and related fallback/reset behavior; provider-enforced limits remain unchanged.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between 69a5396 and e02aac0.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Codex usage-limit conversion now omits the individual monthly credit window when its configured limit is zero. A test verifies that the primary and secondary windows remain and that codexUsageLimitResetAt returns null.
Changes: Codex usage limits
Layer / File(s)
Summary
Individual limit conversion and test apps/server/src/provider/codexUsageLimits.ts, apps/server/src/provider/codexUsageLimits.test.ts
The snapshot type adds an optional individual limit. The conversion omits the individual monthly window when its numeric limit is zero. The test checks that the other two windows remain and the reset time is null.
pingdotgg/t3code#27792 — This issue describes Codex fallback when included allowance is exhausted despite spendable credits; this change addresses the distinct zero-credit-cap case.
Possibly related PRs
pingdotgg/t3code#21173 — Adds Codex credit metadata and supports credit-only limits without usage windows.
pingdotgg/t3code#18721 — Changes Codex usage-limit reset selection, which this change tests after omitting the zero-cap window.
Suggested labels:bugfix, size:S
Suggested reviewers:t3dotgg, macroscopeapp
Merge Risk: Minimal · previous review 69502
This change stops Codex from being treated as out of usage for paid-seat workspaces whose credit cap is zero. No concrete merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly identifies the main change: preventing zero-credit-cap Codex seat workspaces from being treated as out of usage. It is specific and uses a conventional commit format.
Description check
The description explains the problem, the code change, the affected workspace types, the linked issue, and the verification result. It does not use the template headings and does not provide the exact…
Linked Issues check
For issue #34234, codexRateLimitsToWindows now omits the individual window when individualLimit.limit is "0". The added test uses the reported team snapshot and verifies that only primary an…
Out of Scope Changes check
The changes stay within issue #34234. They add the optional individualLimit.limit field, apply the zero-cap filter in apps/server/src/provider/codexUsageLimits.ts, and add a focused regression tes…
Full details: Description check
Explanation
The description explains the problem, the code change, the affected workspace types, the linked issue, and the verification result. It does not use the template headings and does not provide the exact test command or explicit approval details, but it is sufficiently complete and focused.
Full details: Linked Issues check
Explanation
For issue #34234, codexRateLimitsToWindows now omits the individual window when individualLimit.limit is "0". The added test uses the reported team snapshot and verifies that only primary and secondary remain. It also verifies that codexUsageLimitResetAt returns null. The change preserves the individual window for nonzero or missing limits. The reported fallback and reset consumers read these windows, so the zero-cap window no longer marks Codex as exhausted.
Full details: Out of Scope Changes check
Explanation
The changes stay within issue #34234. They add the optional individualLimit.limit field, apply the zero-cap filter in apps/server/src/provider/codexUsageLimits.ts, and add a focused regression test in codexUsageLimits.test.ts. No unrelated behavior or files are changed.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 8c9af54 and 6950292.
Files selected for processing: 2
apps/server/src/provider/codexUsageLimits.test.ts
apps/server/src/provider/codexUsageLimits.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The automated pipeline stopped on this pull request and will not merge it:
the proof has no capture anyone can open:
Permanent blocker: first-party ChatGPT OAuth usage flows are unavailable on this VM, preventing the required zero-credit-cap Business/Team workspace reproduction.
Base fallback selection and monthly-limit warning were not observed.
Head retention of the configured Codex model and omission of the zero-cap monthly row were not observed.
Comment written by Claude Sonnet 5.5 in T3 Code, on behalf of Jaiden
The "out of usage" symptom this PR fixes is already fixed on main by #34243, merged 2026-11-11, so this PR looks superseded.
How I checked: #34243 changes exhaustedUsageWindow in packages/shared/src/usageLimits.ts. For Codex, the individual credit window no longer counts as exhausted while the primary or secondary plan windows exist. A seat-based workspace with a zero credit cap therefore stays usable, and #34243's test covers that case.
The two differ in one way: this PR drops the "Monthly credit limit" row when its limit is 0, while main still reports that row. If hiding the row is wanted, a rebased PR limited to that would be worth keeping. Otherwise this can likely be closed.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).vouch:unvouchedPR author is not yet trusted in the VOUCHED list.
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #34234
On ChatGPT Business/Team workspaces that use paid seats, Codex reports an
individualLimitwith a 0 credit cap (limit: "0",remainingPercent: 0). T3 Code mapped that to a "Monthly credit limit" window at 100%, so the whole provider looked exhausted: new threads switched to the fallback model with "Codex is out of usage · resets <1st of next month>", even though the session and weekly allowance had room.A 0 credit cap means no credits are allocated, and credits are only spent once the seat allowance runs out, so
codexRateLimitsToWindowsnow leaves theindividualwindow out when itslimitis 0. Usage-based Enterprise plans, where the credit cap is the real allowance, keep the window. Because the fallback picker, text-generation fallback, MCP thread creation andcodexUsageLimitResetAtall read these windows, they all stop treating Codex as out of usage.Added a test with the snapshot from the issue; it fails on
mainand passes here.Claude Opus 5.5 via Claude Code in T3 Code