Skip to content

feat(cli): show account quota in status bar (codex provider) - #20786

Closed
sawx0002-COLN wants to merge 1 commit into
NousResearch:mainfrom
sawx0002-COLN:review/quota-status-bar-pr-ready
Closed

feat(cli): show account quota in status bar (codex provider)#20786
sawx0002-COLN wants to merge 1 commit into
NousResearch:mainfrom
sawx0002-COLN:review/quota-status-bar-pr-ready

Conversation

@sawx0002-COLN

@sawx0002-COLN sawx0002-COLN commented May 6, 2026

Copy link
Copy Markdown

What does this PR do?

Adds a compact quota X% label to the CLI status bar for the openai-codex provider, 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_compact in agent/account_usage.py picks the session/primary window and emits the terse quota X% label.

Related Issue

N/A — small UX-only addition.

Type of Change

  • ✨ New feature (non-breaking change that adds functionality)

Changes Made

  • agent/account_usage.py (+23) — new render_account_usage_compact helper that selects the session/primary quota window and formats it as a compact label
  • cli.py (+67) — status-bar wiring for the new label, with a 60s TTL background refresher so render isn't blocked on the provider API
  • tests/cli/test_cli_status_bar.py (+20) — new test cases covering the codex quota label rendering and narrow-terminal collapse behavior
  • tests/test_account_usage.py (+15) — unit tests for the compact renderer's session/primary window preference

No changes to existing behavior for non-codex providers; the label only appears when openai-codex is the active provider and a quota window is available.

How to Test

  1. Configure a Hermes session with the openai-codex provider authenticated against a ChatGPT account that has a quota window.
  2. Launch the CLI: hermes.
  3. The status bar should display a quota X% segment alongside the other status fragments. On narrow terminals it should collapse cleanly.
  4. Targeted test run:
    pytest tests/cli/test_cli_status_bar.py tests/test_account_usage.py -q
    

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this feature (no unrelated commits)
  • I've run the relevant tests and they pass (33/33 on the two test files; 73/73 on tests/tools/test_checkpoint_manager.py for sanity)
  • I've added tests for my changes
  • I've tested on my platform: Linux 6.17 (Ubuntu-flavored)

Documentation & Housekeeping

  • No documentation changes needed — internal status-bar UX, no new config keys or CLI surface
  • No cli-config.yaml.example changes — no config keys added
  • No architecture/workflow changes
  • Cross-platform: status-bar rendering goes through existing prompt-toolkit width fragments, no platform-specific paths
  • No tool description/schema changes

Screenshots / Logs

Status-bar renders inline like the existing fragments — ... | quota 73% | .... Refresh is silent in the background.

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>
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard provider/openai OpenAI / Codex Responses API labels May 6, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #19063 which implements the same Codex quota indicator in the CLI status bar. See also #16644 (closed TUI version) and #17654 (configurable status bar fields).

@sawx0002-COLN sawx0002-COLN closed this by deleting the head repository Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have provider/openai OpenAI / Codex Responses API type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants