CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

Codex early backend weekly reset remains stale when reset-credit inventory is unchanged and non-zero (#2790 follow-up)

Open kcharlan opened this issue 3 months ago • 4 comments

Summary

This is a follow-up to #2790, which was closed after #2897 fixed the explicitly-zero-reset-credit deadlock.

That fix was correct for the zero-credit state, but its boundary was narrower than the original report. The original #2790 incident had an unchanged positive reset-credit inventory (2 available -> 2 available). Fresh reports on CodexBar 0.54.1 and 0.55.0 reproduce that remaining case with 1 available -> 1 available.

When OpenAI performs an early/backend-propagated weekly reset without consuming the user's available reset credit, CodexBar fetches the fresh exact OAuth state but continues publishing the previous weekly percentage and reset boundary. Manual refresh and restart do not recover because the rejected baseline remains persisted.

This is not a regression introduced by #2897. It is the residual unchanged-positive-credit scenario from #2790 that #2897 did not cover.

Decisive comparison

Scenario Persisted weekly state Fresh exact OAuth state Reset-credit sequence Result
Original #2790 6% used, reset Aug 15 14:11Z 0% used, reset Aug 15 23:06Z 2 available -> 2 available Fresh state rejected
Zero-credit subcase fixed by #2897 82% used, reset Aug 18 0% used, reset Aug 20 0 available -> 0 available Fresh state now accepted
Fresh 0.54.1 reproduction 75% used, reset Aug 27 0% used, reset Aug 31 1 available -> 1 available Fresh state rejected

An independent 0.55.0 reproduction reports the same unchanged non-zero inventory, fresh exact OAuth helper output, stale persisted display, and immediate recovery after moving the account-snapshot cache aside.

Rejection boundary

Current main still routes an early observation through confirmsManualResetCreditConsumption and preserves the previous snapshot when that returns false:

https://github.com/steipete/CodexBar/blob/c9e7f4df556d914e4652e21fcb30ee9f3845a0b2/Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift#L140-L197

The merged exception returns true only when the previous inventory is explicitly zero:

guard !previouslyAvailableCredits.isEmpty else {
    return previousCredits.availableCount == 0
}

When an available credit remains present and unchanged, the existing path accepts only evidence that it became redeeming/redeemed or disappeared while the available count dropped. A backend-propagated reset does neither, so repeated consistent observations continue to evaluate to .preservePrevious.

The remaining case is therefore a policy decision: which corroborating provider evidence is sufficient to accept a genuine backend reset when a reset credit exists but was not consumed. It is not the mechanical zero-credit deadlock addressed by #2897.

Fresh live evidence

The 0.54.1 reproduction recorded:

Source Captured/updated (UTC) Weekly used Next reset Reset credits
Persisted app snapshot 00:41:54 75% 2026-08-27 06:55:31 1 available
Packaged OAuth helper 00:56:03 0% 2026-08-31 00:42:29 1 available
Direct authorized wham/usage response ~00:42 0% 2026-08-31 1 available (applicable_available_count: 0)

The account identity and OAuth source were unchanged, dataConfidence was exact, and the same reset credit remained available. The reporter also connected the timing to a public statement that a reset had been propagated to affected accounts. That context supports the backend-reset explanation; the unchanged credit inventory independently shows that this was not a user redeeming the available credit.

The applicable_available_count: 0 field may be useful as additional corroboration if CodexBar retains it, but this report does not assume that field is sufficient by itself.

Expected behavior

After a bounded confirmation sequence establishes a genuine early/backend weekly reset for the same account and exact OAuth source, CodexBar should publish the fresh weekly state even when an unrelated available reset credit legitimately remains unchanged.

Actual behavior

  • The packaged helper and authorized provider response return the fresh exact weekly state.
  • CodexBar continues publishing the previous percentage, boundary, and old update time.
  • Manual refresh and relaunch do not replace the persisted baseline.
  • No authentication, browser-cookie, provider-routing, or account-selection error is present.

Minimal reproduction

  1. Begin with a persisted exact OAuth weekly snapshot whose usage is above the low-reset threshold and whose reset boundary remains in the future.
  2. Keep at least one reset credit present and available.
  3. Have OpenAI perform an early/backend-propagated weekly reset without consuming that credit.
  4. Let CodexBar obtain its initial and confirmation observations for the same account/source.
  5. Confirm that the packaged helper reports low usage and a consistent, materially later future boundary while the reset-credit inventory remains unchanged.
  6. Observe that CodexBar retains the old persisted/public weekly state through manual refresh and restart.

Requested decision and safe boundary

Please track the remaining policy decision separately from the zero-credit fix: should CodexBar admit two consistent exact OAuth observations of an early backend reset when the positive reset-credit inventory remains explicitly unchanged?

A bounded admission path could require all of the following across the complete previous/initial/confirmation sequence:

  • stable owner/account and OAuth source;
  • exact data confidence;
  • present, monotonically newer observations;
  • two low-usage observations with equivalent valid future reset boundaries;
  • a new boundary materially later than the persisted boundary;
  • reset-credit inventories present in every observation, with the same positive count, credit identities, and available statuses;
  • no single-sample bypass.

Existing safeguards should remain for missing/unknown inventories, account or source changes, non-exact data, non-monotonic timestamps, inconsistent boundaries, and a single transient low observation.

Concrete counterexamples that should still be rejected:

  • previous inventory contains available credit A, but the initial/confirmation inventory contains different credit B despite the same aggregate count;
  • previous inventory is zero but either later inventory becomes non-zero (previous=0, initial=1, confirmation=1);
  • the initial and confirmation observations disagree on the new weekly boundary.

Workaround

The recoverable workaround remains:

  1. Quit CodexBar.
  2. Move ~/Library/Application Support/CodexBar/codex-account-snapshots.json to a backup.
  3. Relaunch CodexBar.

This immediately rebuilt the fresh OAuth baseline in the current reports. Toggling the Codex provider helped one commenter but did not work for another, so it is not a reliable workaround.

Related but distinct

#3168 is a separate presentation-synchronization report where re-clicking the active Codex tab repaints already-published fresh data. In this issue, the fresh observation is rejected at the weekly-reset admission boundary and the persisted account snapshot remains stale.

References

  • Original report and full history: #2790
  • Narrow zero-credit fix: #2897
  • Fresh 0.54.1 unchanged-positive-credit evidence: comment
  • Independent 0.55.0 confirmation: comment

kcharlan avatar Aug 24 '26 20:08 kcharlan

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed August 24, 2026, 4:26 PM ET / 20:26 UTC.

Summary Current main still preserves the older snapshot for the reported unchanged positive-credit sequence. This is a valid remaining provider-data policy gap that needs maintainer sign-off, not a duplicate of the zero-credit fix.

Reproducibility: yes. for the policy path: current source deterministically preserves an early, low-usage confirmation when a positive available credit remains unchanged; the report supplies matching released-version observations, though this review did not access a live OAuth account.

Root-cause cluster Relationship: canonical Canonical: https://github.com/steipete/codexbar/issues/3179 Summary: This issue isolates the unchanged positive-inventory case left outside the merged zero-inventory fix.

Members:

  • partial_overlap: https://github.com/steipete/codexbar/issues/2790 - The original report covered the same early-reset admission family, but the merged fix addressed only explicitly zero available credits.
  • partial_overlap: https://github.com/steipete/codexbar/pull/2897 - The merged PR implemented the zero-credit exception, while current source still rejects the positive unchanged-inventory case.
  • adjacent_distinct: https://github.com/steipete/codexbar/issues/3168 - That report attributes stale rendering to menu repaint behavior after fresh data is published; this report identifies rejection before publication.

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Maintainer decision needed

Question Recommendation
Should two corroborating early Codex OAuth observations replace a persisted weekly baseline when the same positive reset-credit inventory remains available and unconsumed? Approve a bounded admission rule: Accept only the three-snapshot, same-account/source, exact, advanced-equivalent-boundary, unchanged-credit-identity case and retain all fail-closed counterexamples.

Why: Current code intentionally treats a positive available credit as requiring consumption evidence; changing that trust rule affects provider-auth-derived data and persisted display behavior, which VISION.md reserves for sign-off.

Next step A maintainer must choose the acceptable evidence threshold for admitting a positive unchanged reset-credit inventory before a bounded implementation can proceed.

Review details

Best possible solution:

Approve a narrowly bounded positive-inventory admission rule only if it retains stable account/source identity, exactness, monotonic observations, equivalent advanced boundaries, and unchanged credit identities and statuses; then add focused acceptance and counterexample tests.

Do we have a high-confidence way to reproduce the issue?

Yes for the policy path: current source deterministically preserves an early, low-usage confirmation when a positive available credit remains unchanged; the report supplies matching released-version observations, though this review did not access a live OAuth account.

Is this the best way to solve the issue?

Unclear until sign-off: the proposed bounded three-observation rule is the narrowest apparent repair, but current code intentionally requires consumption evidence for positive inventories and the new trust condition needs approval.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • Admitting unchanged positive-credit inventories without an explicit rule could publish a transient or mis-associated low-usage response before the prior reset boundary.

Codex review notes: model internal, reasoning high; reviewed against c9e7f4df556d.

Label changes

Label changes:

  • add P2: The issue can leave a released provider-usage display stale until a technical cache workaround, but it is not an availability or security emergency.
  • add impact:auth-provider: The affected admission path processes exact Codex OAuth usage and reset-credit state before publishing provider data.
  • add impact:ux-friction: Users can be left with an incorrect weekly display through refresh and relaunch, with cache manipulation as the reported recovery path.
  • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
  • add clawsweeper:source-repro: Current issue advisory state selects this label.
  • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
  • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.
  • add clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.
  • add clawsweeper:needs-product-decision: Current issue advisory state selects this label.

Label justifications:

  • P2: The issue can leave a released provider-usage display stale until a technical cache workaround, but it is not an availability or security emergency.
  • impact:auth-provider: The affected admission path processes exact Codex OAuth usage and reset-credit state before publishing provider data.
  • impact:ux-friction: Users can be left with an incorrect weekly display through refresh and relaunch, with cache manipulation as the reported recovery path.
Evidence reviewed

What I checked:

Likely related people:

  • JiaJian: History attributes the manual reset refresh and omitted-consumed-credit handling to this author. (role: introduced and extended reset-credit handling; confidence: high; commits: 5014285fa781, 6d19a437b292; files: Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift, Sources/CodexBar/Providers/Codex/UsageStore+CodexWeeklyResetConfirmation.swift)
  • luantu: The history identifies this author’s focused zero-inventory confirmation change as the immediate predecessor policy change. (role: introduced the zero-credit exception; confidence: high; commits: dd6eefd964db; files: Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift, Tests/CodexBarTests/CodexWeeklyResetConfirmationTests.swift)
  • Peter Steinberger: History identifies the original confirmation work and the current release tree as connected to this area. (role: original reset-confirmation contributor and recent area owner; confidence: medium; commits: b2b9c535e513, 061593ca15d9; files: Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift, Sources/CodexBar/Providers/Codex/UsageStore+CodexWeeklyResetConfirmation.swift)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

clawsweeper[bot] avatar Aug 24 '26 20:08 clawsweeper[bot]

Status: PR #3177 attempts this, but review found the exact 1 → 1 unchanged-positive-inventory case from your table still doesn't publish (the confirmation gate requires credit consumption, explicit zero inventory, or an unchanged boundary — a real backend reset satisfies none), and the relaunch migration doesn't repair the separately-persisted stale snapshot. Changes requested with file:line specifics; your decisive-comparison table is now the acceptance test for the next revision. Excellent report — it's rare that a follow-up so cleanly isolates the residual case.

steipete avatar Aug 25 '26 02:08 steipete

Independent live reproduction on CodexBar 0.55.0 (build 129), macOS 26.6.2 (25G83), arm64.

Source Updated/captured (UTC) Weekly used Next reset Reset credits
Persisted app snapshot 2026-08-25 13:45:49 23% 2026-08-31 02:08:09 1 available
CodexBar menu at ~15:13 — 23% / 77% remaining old boundary 1 available
Bundled OAuth helper, three consecutive probes ~15:18 1% / 99% remaining 2026-09-01 14:13:38 1 available

The bundled helper returned source: oauth successfully on every probe. Account identity and credentials were unchanged and are omitted here.

Manual refresh left the menu showing “Refreshing…” while retaining the old 77% value. The persisted codex-account-snapshots.json also remained unchanged after the live OAuth probes.

This matches the unchanged-positive-credit admission gap described here:

  • previous weekly usage was above the 1% threshold;
  • the new weekly usage was exactly 1%;
  • the reset boundary advanced materially;
  • the same reset credit remained available (1 → 1);
  • the old weekly snapshot was therefore preserved.

No configuration, snapshot, credential, or cookie changes were made while collecting this evidence.

yolopsx avatar Aug 25 '26 15:08 yolopsx

Reproduced again on CodexBar 0.55.0 (129), macOS 26.6.2, on 2026-08-27 after the Codex limits reset.

Redacted comparison:

Source Updated (UTC) Weekly used Reset-credit inventory
Bundled CodexBarCLI, OAuth 17:25:36 0%; new reset boundary in September 1 available
CodexBar account snapshot 17:23:58 0%; same new boundary 1 available
App-owned widget/derived snapshot generated 17:25:47; entry updated 16:23:44 20% (80% left); old boundary 1 available

The helper succeeds with exact OAuth data, but the user-visible derived snapshot remains on the old 20% value. The new boundary is later, usage fell to 0%, and the positive reset-credit inventory stayed unchanged (1 → 1), matching the unchanged-positive-credit early-reset shape described here.

This installation is still on 0.55.0; the 0.55.1 changelog says #3177/#3179 is fixed there. No account identifiers, credentials, or raw response data are included.

Sedrak-Hovhannisyan avatar Aug 27 '26 17:08 Sedrak-Hovhannisyan