fix(rate-limits): keep Codex PTY reset text for weekly-only plans#8643
Open
moseoh wants to merge 1 commit into
Open
fix(rate-limits): keep Codex PTY reset text for weekly-only plans#8643moseoh wants to merge 1 commit into
moseoh wants to merge 1 commit into
Conversation
The PTY /status fallback parses '5h limit' and 'Weekly limit' lines by label, but the extracted reset text was only ever attached to the session window. Codex plans without a 5h session bucket (e.g. current Pro) produce a weekly-only parse, so the reset time the CLI printed was silently dropped. Fall back to the weekly window when no session window exists.
Contributor
📝 WalkthroughWalkthroughPTY rate-limit parsing now assigns reset descriptions to the available session or weekly window, preserving reset text for weekly-only plans. A new test exercises the PTY fallback, advances the settle timer, and verifies the weekly usage, reset description, null session, and 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
When both the backend and app-server RPC paths fail, Orca falls back to spawning the Codex CLI in a hidden PTY, sending
/status, and parsing the rendered output. That parser reads the5h limit/Weekly limitlines by label, but the extracted reset text was only ever attached to the session window:Codex plans without a 5h session bucket (e.g. the current Pro plan) have no
5h limitline in the Codex CLI's/statusoutput, so the parse yieldssession === null— and theResets in …text the Codex CLI did print was silently dropped, leaving the weekly window without any reset info. This fix falls back to the weekly window when no session window exists.This is independent of (and complementary to) #8493: the PTY path classifies windows by their text labels, so weekly-only output already lands in the
weeklyslot today — only the reset text was lost.Screenshots
No visual change beyond the weekly usage row regaining its reset text when the PTY fallback serves a weekly-only plan.
Testing
pnpm lint(pre-commit oxlint/react-doctor/oxfmt on changed files; repository lint config)pnpm typecheckcodex-fetcher-pty-settle.test.ts,codex-fetcher.test.ts— 20/20 passpnpm build(verified on the same workstation earlier today; this change is a 4-line main-process patch with no build-surface impact)resetDescriptionon the weekly windowAI Review Report
Reviewed the change against the enclosing
parsePtyStatusflow and its two callers (settle-timer path and exit path):{ session, weekly }from the same parser, so the fallback applies uniformly.resets…text in the output; with both windows present the behavior is unchanged (session keeps priority), so plans with a 5h bucket are unaffected.Security Audit
No new input surfaces: the change reorders which already-parsed window object receives an already-extracted string from the existing regex. No command execution, path, auth, or IPC changes.
Notes
Follow-up candidate (intentionally not included here):
RateLimitsService.refreshForCodexAccountChangegates the inactive-account snapshot cache onsessionexisting, which will skip weekly-only snapshots once #8493 lands. That belongs with/after #8493, not this PR.