Skip to content

Show banked rate limit resets on the Codex tab - #7799

Closed
btsouth wants to merge 1 commit into
omacom:quattrofrom
btsouth:codex-banked-resets
Closed

btsouth wants to merge 1 commit into
omacom:quattrofrom
btsouth:codex-banked-resets

Conversation

@btsouth

@btsouth btsouth commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Why

Codex grants accounts "reset credits" — banked resets that clear a rate limit window before it runs out. An account holding one has no way to learn that from Omarchy: account/rateLimits/read, which the collector already speaks, does not report them, so nothing ever reached the agents panel.

I went looking for this after hitting a weekly window at 63% and finding out from the ChatGPT web UI, not from the bar, that I had a free reset sitting unused.

What changed

  • bin/omarchy-agent-usage-codex reads GET /backend-api/wham/rate-limit-reset-credits from the same backend the Codex CLI authenticates against, reusing the token codex login already wrote to auth.json, and reports it as resetCreditsAvailable.
  • shell/plugins/agents/Main.qml carries the count into the provider view model, normalized to -1 when a collector never read it.
  • shell/plugins/agents/Panel.qml prints it under LIMITS: "1 reset banked".

Notes

  • The fetch is advisory. Signed out, offline, an HTTP error, or a changed response shape all report nothing, and the record still reaches the panel intact. It cannot take the rest of the Codex tab down with it.
  • A zero is held apart from a silence. A read that reports no banked resets stays distinct from a read that never happened — neither prints, since a standing "0 resets banked" line is noise on an account that never has any, but the distinction is there for a surface that wants it.
  • The count is per-account, so it stays out of providerSnapshot() the way limits and balances already do, rather than merging across devices.
  • This adds a field rather than reusing title on a limit entry, since title already means the window's name (Claude emits "Fable Weekly", and Codex collector: plan label and model-scoped limit windows #7725 extends that).
  • Only Codex is wired up here. Grok has the same concept, so resetCreditsAvailable is deliberately provider-neutral — a Grok collector can fill it in with no panel change.

Testing

test/shell.d/agent-usage-codex-reset-credits-test.sh covers the reported tally, a zero, the fallback that counts credits when a response omits the tally (skipping spent, expired, and unparseable ones), an unreachable endpoint, and being signed out. It follows agent-usage-claude-limits-test.sh: the collector loads as a module and a recorded payload stands in for the response, so the suite makes no network call.

Verified in the running shell against a real account holding one banked reset:

LIMITS
Weekly                                    63%
Resets in 4d 10h
1 reset banked

Codex grants accounts "reset credits": banked resets that clear a rate
limit window before it runs out. The app-server RPC the collector already
speaks does not report them, so nothing in the agents panel ever showed
one — an account holding a free reset had no way to learn it from Omarchy.

The collector reads them from the same backend the Codex CLI authenticates
against, reusing the token `codex login` wrote, and the panel prints the
count under LIMITS.

- the fetch is advisory: signed out, offline, or a changed endpoint all
  report nothing and the record still reaches the panel intact
- a read that reports no banked resets stays distinct from a read that
  never happened, though neither prints — a standing "0 resets banked"
  line is noise on an account that never has any
- the count is per-account, so it stays out of the cross-device snapshot
  the way limits and balances already do
Copilot AI balanced review requested due to automatic review settings August 22, 2026 17:36
@btsouth
btsouth changed the base branch from master to quattro August 22, 2026 17:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Codex banked reset-credit reporting to the Agents panel.

Changes:

  • Fetches and parses reset credits from the authenticated ChatGPT backend.
  • Propagates the count through the provider model and displays it under limits.
  • Adds collector tests for counts and failure scenarios.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
bin/omarchy-agent-usage-codex Fetches and parses banked resets.
shell/plugins/agents/Main.qml Normalizes reset-credit data.
shell/plugins/agents/Panel.qml Displays banked resets.
test/shell.d/agent-usage-codex-reset-credits-test.sh Tests parsing and failure behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +614 to +615
Text {
visible: root.bankedResets > 0
@omarchybot omarchybot added the enhancement New feature or request label Sep 27, 2026
@dhh

dhh commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thanks! The Codex collector now reads banked resets from the app-server reply (rateLimitResetCredits), and the panel shows them under Codex ("4 free resets · next expires in…"), without a separate call to chatgpt.com. Closing.

@dhh dhh closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants