fix(tui): avoid false prompt queueing from credits-only rate-limit state#6
Merged
Merged
Conversation
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.
fix(tui): avoid false prompt queueing from credits-only rate-limit state
Summary
Fixes a TUI regression where prompt submissions could be queued indefinitely even though the account still had available Codex usage.
The bug came from treating a missing separate credits balance as a hard quota exhaustion signal. That was too strict:
credits.has_credits == falsedoes not necessarily mean the active Codex usage windows are exhausted.Fixes #5.
Root cause
In
codex-rs/tui/src/chatwidget/rate_limits.rs,rate_limit_snapshot_has_exhausted_quota()treated this state as exhausted quota:That conflated two different concepts:
When that false exhaustion state was detected, the TUI enabled queue suppression and stopped autosending queued prompts.
What changed
rate_limit_snapshot_has_exhausted_quota()rate_limit_reached_typeexplicitly indicates a rate, usage, or credits limitused_percent >= 100codex_rate_limit_reached_typeinput_queue.suppress_queue_autosendUser-visible behavior
Before:
After:
Scope
This patch is limited to:
codex-rs/tui/src/chatwidget/rate_limits.rsValidation
cargo build -p codex-clicargo build -p codex-cli --release