feat(cli): show account quota in status bar (codex provider) - #20786
Closed
sawx0002-COLN wants to merge 1 commit into
Closed
feat(cli): show account quota in status bar (codex provider)#20786sawx0002-COLN wants to merge 1 commit into
sawx0002-COLN wants to merge 1 commit into
Conversation
Adds a compact "quota X%" label to the CLI status bar for the openai-codex provider, refreshed asynchronously on a 60s TTL via a background thread so the hot render path never blocks on the provider API. New helper render_account_usage_compact in agent.account_usage picks the session/primary window and emits the terse label. Co-Authored-By: Hermes <hermes@forge.local>
Collaborator
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.
What does this PR do?
Adds a compact
quota X%label to the CLI status bar for theopenai-codexprovider, so users running on a metered ChatGPT account can see their remaining quota without leaving the agent.The label is refreshed asynchronously on a 60s TTL via a background thread, so the hot render path never blocks on the provider API. A new helper
render_account_usage_compactinagent/account_usage.pypicks the session/primary window and emits the tersequota X%label.Related Issue
N/A — small UX-only addition.
Type of Change
Changes Made
agent/account_usage.py(+23) — newrender_account_usage_compacthelper that selects the session/primary quota window and formats it as a compact labelcli.py(+67) — status-bar wiring for the new label, with a 60s TTL background refresher so render isn't blocked on the provider APItests/cli/test_cli_status_bar.py(+20) — new test cases covering the codex quota label rendering and narrow-terminal collapse behaviortests/test_account_usage.py(+15) — unit tests for the compact renderer's session/primary window preferenceNo changes to existing behavior for non-codex providers; the label only appears when
openai-codexis the active provider and a quota window is available.How to Test
openai-codexprovider authenticated against a ChatGPT account that has a quota window.hermes.quota X%segment alongside the other status fragments. On narrow terminals it should collapse cleanly.Checklist
Code
tests/tools/test_checkpoint_manager.pyfor sanity)Documentation & Housekeeping
cli-config.yaml.examplechanges — no config keys addedScreenshots / Logs
Status-bar renders inline like the existing fragments —
... | quota 73% | .... Refresh is silent in the background.