feat: list show reset credits#144
Conversation
Greptile SummaryThis PR adds a
Confidence Score: 5/5Safe to merge — all changed paths are additive and self-contained, existing behaviour is unchanged for accounts without reset-credit data, and the new early-return guard in parseUsageResponse is covered by a dedicated test. The change adds a new nullable field with a null default, so all existing stored snapshots deserialise cleanly without modification. The width-adjustment function now reduces all six columns, parsing round-trips correctly between the nested API format and the flat registry format, and two new test cases cover the most important edge cases. No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant CLI as codex-auth list
participant API as ChatGPT Usage API
participant Parse as parseUsageResponse
participant Snap as RateLimitSnapshot
participant Table as writeAccountsTable
CLI->>API: GET /usage
API-->>Parse: "{ rate_limit_reset_credits: { available_count: N }, rate_limit: {...} }"
Parse->>Parse: parseResetCredits(rate_limit_reset_credits)
Parse->>Snap: "snapshot.reset_credits = N"
Note over Snap: preserved even when primary/secondary windows are null
Snap-->>CLI: stored in registry as reset_credits: N
CLI->>Table: writeAccountsTableWithUsageOverrides(reg, ...)
Table->>Table: resetCreditsCellAlloc(usage, override)
Table-->>CLI: ACCOUNT PLAN RESET CREDITS 5H WEEKLY LAST ACTIVITY
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant CLI as codex-auth list
participant API as ChatGPT Usage API
participant Parse as parseUsageResponse
participant Snap as RateLimitSnapshot
participant Table as writeAccountsTable
CLI->>API: GET /usage
API-->>Parse: "{ rate_limit_reset_credits: { available_count: N }, rate_limit: {...} }"
Parse->>Parse: parseResetCredits(rate_limit_reset_credits)
Parse->>Snap: "snapshot.reset_credits = N"
Note over Snap: preserved even when primary/secondary windows are null
Snap-->>CLI: stored in registry as reset_credits: N
CLI->>Table: writeAccountsTableWithUsageOverrides(reg, ...)
Table->>Table: resetCreditsCellAlloc(usage, override)
Table-->>CLI: ACCOUNT PLAN RESET CREDITS 5H WEEKLY LAST ACTIVITY
Reviews (2): Last reviewed commit: "docs: clarify reset credits list output" | Re-trigger Greptile |
|
Thanks, this is useful. I think we should narrow the scope of this PR. For now, I think we only need to surface the available count in I would prefer not to add the |
|
Cool! Fair enough!
…On Thu, 18 Jun 2026 at 21:55, Loongphy ***@***.***> wrote:
*Loongphy* left a comment (Loongphy/codex-auth#144)
<#144 (comment)>
Thanks, this is useful. I think we should narrow the scope of this PR.
For now, I think we only need to surface the available count in list. I
would not add it to other account-selection surfaces in this PR, and the
column label should be RESET CREDITS.
I would prefer not to add the reset command to codex-auth. The official
CLI/TUI can own the reset-consumption flow later, so I do not think we need
to implement it here as well. There is already follow-up work on the Codex
side: openai/codex#27915 (comment)
<openai/codex#27915 (comment)>
—
Reply to this email directly, view it on GitHub
<#144?email_source=notifications&email_token=AABREN33N6KZHJ65EPRQTTT5ARJM7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINZUGYYDKOJRGE2KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4746059114>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABREN52HYG2USF2FACMWM35ARJM7AVCNFSNUABGKJSXA33TNF2G64TZHMYTCNJUGI2DAOJUGA5US43TOVSTWNBWHEYTKNRRGI4DDILWAI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Cheers, John
|
|
Codex CLI supported reset credits: https://github.com/openai/codex/releases/tag/rust-v0.142.0 |
@loongphy/codex-auth-darwin-arm64
@loongphy/codex-auth-darwin-x64
@loongphy/codex-auth-linux-arm64
@loongphy/codex-auth-linux-x64
@loongphy/codex-auth-win32-arm64
@loongphy/codex-auth-win32-x64
@loongphy/codex-auth
commit: |
This PR shows available ChatGPT reset credits in
codex-auth list.It adds a
RESET CREDITScolumn backed byrate_limit_reset_credits.available_count.Credit consumption remains handled by codex-cli's
/usage.