Skip to content

[app-server] Include reset-credit details in rate limits - #30395

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

[app-server] Include reset-credit details in rate limits#30395
jayp-oai merged 5 commits into
mainfrom
codex/reset-credit-details

Conversation

@jayp-oai

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

Copy link
Copy Markdown
Contributor

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.

@jayp-oai
jayp-oai force-pushed the codex/reset-credit-details branch from faed994 to 136386e Compare June 28, 2026 22:55
@jayp-oai jayp-oai changed the title [codex] Show usage-limit reset expiry details [app-server] Expose rate-limit reset credit details Jun 28, 2026
@jayp-oai
jayp-oai requested a review from owenlin0 July 4, 2026 01:18
@jayp-oai

jayp-oai commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@jayp-oai jayp-oai self-assigned this Jul 4, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: b526131d98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@subweave-bot

Copy link
Copy Markdown

Love having the reset credit details exposed for the UI — super helpful 🤩
Explore here →

Subweave map of openai/codex#30395

Maintainer? Turn off weaves from non-maintainers →
Carefully crafted by Subweave · 🧶 used ~79k LLM tokens

@jayp-oai jayp-oai changed the title [app-server] Expose rate-limit reset credit details [app-server] Include reset-credit details in rate limits Jul 6, 2026
Comment thread codex-rs/app-server/README.md Outdated
- The backend may cap `rateLimitResetCredits.credits`, so `availableCount` is the authoritative total and can be greater than the number of detail rows.
- Reset-credit `id` values are opaque strings. `grantedAt` and `expiresAt` are Unix timestamps in seconds; `expiresAt` is `null` for a credit that does not expire.
- `title` and `description` are backend-provided display text. Either field can be `null` when the backend does not provide it.
- `resetType` is currently `codexRateLimits`. `status` reports the credit lifecycle state: `available`, `redeeming`, or `redeemed`.

@owenlin0 owenlin0 Jul 6, 2026

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.

field-by-field documentation seems quite overkill... but i see this is just following the pattern above 😬

we already have field-level documentation via docstrings

/// Opaque backend identifier for this reset credit.
pub id: String,
pub reset_type: RateLimitResetType,
pub status: RateLimitResetCreditStatus,

@owenlin0 owenlin0 Jul 6, 2026

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.

Can we add an unknown variant for resetType / status? Users can be on older Codex binary versions while codex-backend deploys frequently, so an older app should degrade gracefully if the backend introduces a new value

Looks like we currently drop all reset-credit details

@jayp-oai
jayp-oai merged commit 58ec528 into main Jul 6, 2026
35 checks passed
@jayp-oai
jayp-oai deleted the codex/reset-credit-details branch July 6, 2026 19:54
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants