feat(reset-credits): add banked rate-limit reset credits#1053
Conversation
|
nice work on this — the ui and openspec coverage are way ahead of my overlapping pr (#1056). while implementing and testing the same feature against real upstream accounts, i ran into a few gaps that might be worth folding in here: 1. refresh usage after consume#1014 asks for an immediate 2. block paused / reauth / deactivated on consumethe scheduler correctly skips paused accounts for polling, but the dashboard still shows redeem on paused accounts and the consume endpoint doesn't check account status. i'd return 409 for paused, reauth_required, and deactivated before hitting upstream. 3. proxy-aware upstreamaccounts with per-account upstream routes need the codex transport path for credits fetch and consume, not only direct 4. visibility without extra polling
5. live fetch at consume timecache-first is fast but can go stale. fetching credits once at click time (then consume) is closer to what the desktop client does and avoids 409s when the cache lags behind upstream. 6. audita small happy to help with a follow-up pr on this branch for any of the above. planning to close my duplicate #1056 in favor of this one. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10f685b67c
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 433b956ddd
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
when will this be added @Soju06 ? :) I want to be able to check bank reset and reset accounts via codex-lb |
|
+1 |
|
I am not converting to ready to merge as
Once these items are resolved, I will convert the status to "Ready to Merge" |
|
also tried, reset worked for me in 2 accounts |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed5f5de1f8
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd35115f6f
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67b0a32022
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80be8a6766
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6832cdc905
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffd51023f4
ℹ️ 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".
| await _refresh_account_reset_credits( | ||
| account, | ||
| encryptor=TokenEncryptor(), | ||
| store=store, | ||
| fetch_fn=fetch_reset_credits, | ||
| resolve_route=_resolve_reset_credit_route, | ||
| ) |
There was a problem hiding this comment.
Keep reset-credit GET cache-only
When an eligible account has no local snapshot (after restart, invalidate, or a failed poll), this dashboard GET now calls _refresh_account_reset_credits, even though the change artifacts describe the endpoint as returning the cached snapshot or null and relying on the scheduler cadence. Because this route only requires a dashboard session, read-only users can trigger outbound ChatGPT calls and cache writes on cache misses, and repeated misses can bypass the intended 60s background polling cadence; return null on misses or move this refresh behind an explicit write/refresh path.
Useful? React with 👍 / 👎.
This reverts commit 6fd64f4.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6bf30df864
ℹ️ 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".




UPDATE: tested redeeming a reset credit, and it is a success, so I am updating it to
Ready to ReviewMay need a several pass of codex review to truly ready.
Summary
Adds banked rate-limit reset credit support across the backend and dashboard so operators can see per-account credit counts, expiry timing, and redeem the soonest-expiring credit without leaving codex-lb.
Type of change
fix:— bug fix (no behavior change beyond the bug)feat:— new user-facing feature or capabilityrefactor:— internal refactor (no behavior change, no API change)docs:— documentation onlychore:/ci:/build:— tooling, CI, packagingtest:— test-only change!after the type, e.g.feat!:or includeBREAKING CHANGE:footer)Linked issue: None specified.
OpenSpec
shape, SSE framing, OAuth flow) and preserves upstream-equivalent behavior
Change directory:
openspec/changes/add-rate-limit-reset-credits/Changes
/wham/rate-limit-reset-credits, plus a dashboard consume endpoint that serializes per-account redemption and invalidates stale snapshots.available_reset_creditsandreset_credit_nearest_expires_at, and preserve account status on upstream reset-credit polling failures.Reset (N)actions, expiry countdowns, and a confirmation dialog across the Accounts page, dashboard table/grid views, and the Accounts nav tab.Most reset credits.Test plan