Fix Codex quota refresh after manual reset - #2710
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 6, 2026, 10:42 AM ET / 14:42 UTC. ClawSweeper reviewWhat this changesThe PR accepts an early Codex weekly quota reset only when the same reset credit changes from available to redeemed, and adds regression coverage for that transition. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain The patch is narrowly scoped and source-consistent; it remains open because the previously requested real provider-behavior proof is still missing. Priority: P2 Review scores
Verification
How this fits togetherCodexBar collects Codex quota and reset-credit responses, then confirms low-usage weekly snapshots before publishing them. This safeguard feeds the quota state shown in the menu bar and CLI. flowchart LR
A[Codex usage response] --> B[Usage snapshot]
A --> C[Reset-credit response]
B --> D[Weekly reset confirmation]
C --> D
D --> E{Confirmed early reset?}
E -->|No| F[Keep prior quota]
E -->|Yes| G[Publish refreshed quota]
G --> H[Menu bar and CLI]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the narrow same-credit redemption exception only after a redacted live trace shows the credit transition and refreshed weekly quota while the no-redemption path remains guarded. Do we have a high-confidence way to reproduce the issue? Yes at source level: a high-usage snapshot with an available stable credit, followed by matching low-usage snapshots with that credit redeemed, reaches the new branch. A real provider reproduction has not yet been shown. Is this the best way to solve the issue? Yes, pending real behavior proof: the same stable credit’s redemption is a narrow condition that preserves the existing timestamp, boundary, and two-sample checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 50c5b00221ff. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Landed. Verified before merge (independent maintainer-agent review): root cause confirmed in |
|
@clawsweeper re-review |
|
🦞🧹 Reason: re-review requires an open issue or PR. |
Summary
availabletoredeemedRoot cause
CodexWeeklyResetConfirmationrejected every reset observed more than two minutes before the previously scheduled weekly boundary. A manual reset credit intentionally moves that boundary early, so the app kept preserving the stale pre-reset snapshot even after two matching low-usage samples.The merged confirmation path treats a provider-reported redemption of the same stable reset credit ID as evidence that the early boundary change is legitimate. All other boundary and two-sample confirmation checks remain in place.
User impact
For providers that retain the consumed credit as
redeemed, Codex quota usage refreshes automatically after a user redeems a manual reset credit, without weakening protection against transient or premature zero-usage responses.Validation for the merged change
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcrun swift test --filter CodexWeeklyResetConfirmationTests(16 tests passed)DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make checkDEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make test(821 selections across 69 groups, 0 failures)No UI changes; screenshots are not applicable.
Post-merge provider finding
This PR was merged at head
288380d52eb75e49c93fdc7754f877a25b0ac2aabefore the following provider trace was recovered. The follow-up described here is not part of this merged PR.Observed on CodexBar 0.47.0 with a signed-in Codex OAuth account. Account identity, tokens, and reset-credit IDs are omitted.
The successful reset-credit inventory persisted with the post-redemption observation was:
{"availableCount":0,"credits":[]}A later read-only live OAuth fetch returned the same successful empty inventory. In this observed provider shape, the consumed credit is omitted instead of retained as a
redeemedrow, so the merged same-row transition remains conservative and may still preserve the stale snapshot.Follow-up commit
endless7/CodexBar@78035f4fhandles both representations, but only when two independent low-usage inventories corroborate consumption and the available count decreased. It has 18 focused tests, a cleanmake check, and 821 full-suite selections across 69 groups with no failures or retries. The account has no reset credit remaining, so this validation replays the exact redacted timeline through production decision code; it is not presented as a second live redemption.