feat(cli): show codex rate limits in status bar - #6250
Closed
schin-300 wants to merge 12 commits into
Closed
Conversation
When using the Codex provider, the status bar now shows remaining request quota and time until reset. Rate-limit info is fetched via a lightweight HTTP request to the Codex API, cached for 60 seconds to avoid burning quota on status polling. - Add _codex_rate_limits tracking to the agent (run_agent.py) - Add _refresh_codex_rate_limits() method with 60s cache - Hook into agent loop to refresh after each API call - Surface rate-limit data in _get_status_bar_snapshot() - Display rate limits in status bar text + fragments - Add 3 tests for the new feature
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
Adds Codex rate-limit monitoring to the status bar. When the active provider is
openai-codex, the bar shows remaining request quota and time until the rate window resets.Example:
⚕ codex │ 12.4K/200K │ 6% │ 🎫 42 reqs (reset 15m) │ 14mChanges
run_agent.py
_codex_rate_limits,_codex_rate_limits_ts,_codex_rate_limits_intervalto agent init_refresh_codex_rate_limits()— makes a HEAD request (falls back to GET/models) to the Codex API, parsesx-ratelimit-*response headers, caches for 60scli.py
_get_status_bar_snapshot()— includescodex_rate_limits,codex_remaining_pct,codex_resets_in_min_build_status_bar_text()— showsN reqs (reset Xm)in medium and wide terminals_get_status_bar_fragments()— styled version with 🎫 prefixtests/cli/test_cli_status_bar.py
TestCodexRateLimits.test_snapshot_includes_codex_limits_when_presentTestCodexRateLimits.test_snapshot_has_no_codex_limits_when_absentTestCodexRateLimits.test_status_bar_shows_codex_reqs_on_wide_terminalTesting
pytest tests/cli/test_cli_status_bar.py -vDesign Notes