Skip to content

[codex-cli] Show reset details in redemption picker - #30488

Merged
jayp-oai merged 5 commits into
mainfrom
codex/reset-credit-picker
Jul 7, 2026
Merged

[codex-cli] Show reset details in redemption picker#30488
jayp-oai merged 5 commits into
mainfrom
codex/reset-credit-picker

Conversation

@jayp-oai

@jayp-oai jayp-oai commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Why

Users can see that usage-limit reset credits are available, but not which credits they have, when each one expires, or which credit will be consumed. The TUI should use the supported rate-limit RPC for that information without maintaining a second reset-credit request path.

What changed

  • load reset-credit details through the existing account/rateLimits/read refresh when the user opens Redeem usage limit reset
  • show available credits sorted by expiry, using the backend title when present and a scope-based fallback otherwise
  • consume the exact selected credit and preserve its idempotency key across retries
  • fall back to the existing generic reset action when the RPC returns a positive count without detail rows
  • remove the dedicated list-RPC event, request, response-combining, and TUI state plumbing
  • handle a selected credit becoming unavailable without incorrectly caching the user's total count as zero
  • handle forward-compatible unknown reset types with the existing scope-based fallback label

TUI preview

Rendered from the final standard-width and narrow insta snapshots in this PR.

pr30488-reset-picker-preview

Validation

  • just test -p codex-tui chatwidget::tests::usage (32 passed)
  • just fix -p codex-tui
  • no pending insta snapshots

Uses the reset-credit details added by #30395.

Fixes #29618.

@fcoury-oai fcoury-oai 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.

I wasn't able to run a smoke test on this one since I don't have any resets. Code looks good and the proposed user interface does as wlel.

jayp-oai added a commit that referenced this pull request Jul 6, 2026
## Why

Supported clients currently receive only a reset-credit count from
`account/rateLimits/read`. The redemption UI and other app-server
clients need each available credit's expiry and ID so they can explain
what will expire and consume the credit a user selected. This
information belongs on the existing rate-limit read surface rather than
a second app-server list RPC that clients would need to coordinate.

## What changed

- extend `rateLimitResetCredits` on `account/rateLimits/read` with
nullable `credits` detail rows
- fetch usage and reset-credit details concurrently; if the detail
request fails, times out, or cannot be parsed, preserve the usage
response and return `credits: null`
- expose each credit's ID, reset type, status, grant time, expiry time,
title, and description
- add an optional nullable `creditId` to
`account/rateLimitResetCredit/consume`; omitting it preserves the
existing automatic-selection behavior
- forward a selected credit ID to the Codex backend and update the
app-server documentation and generated schemas

The TUI consumer is stacked in #30488.

## Validation

- `just test -p codex-app-server-protocol` (251 passed)
- `just test -p codex-backend-client` (16 passed)
- `just test -p codex-app-server rate_limit` (18 passed)

Part of #29618.
Base automatically changed from codex/reset-credit-details to main July 6, 2026 19:54
@jayp-oai
jayp-oai force-pushed the codex/reset-credit-picker branch from e0ab6a2 to 5527081 Compare July 6, 2026 22:59
@jayp-oai
jayp-oai force-pushed the codex/reset-credit-picker branch from 5527081 to 6a9c841 Compare July 7, 2026 04:09
@jayp-oai
jayp-oai merged commit d7ab20c into main Jul 7, 2026
35 checks passed
@jayp-oai
jayp-oai deleted the codex/reset-credit-picker branch July 7, 2026 04:19
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

2 participants