CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

Codex weekly quota stays at 1% left when previous reset-credit inventory is missing; fresh reads contain credits

Open kcharlan opened this issue 2 months ago • 2 comments

Summary

After I used a weekly reset, CodexBar continued to show Weekly 1% left and Updated 50m ago in the menu card. The attached anonymized screenshot excerpt captures that display. The captured app refreshes contain fresh quota and reset-credit data. Confirmation records preservePrevious; delayed-candidate creation then records rejected / missingCreditInventory with no inventory in the previous snapshot.

Version and environment

  • Upstream version/source: 0.71.0, captured on a locally built app.
  • The installed executable matches the successful package receipt. The build driver checked for a clean tracked source tree before and after packaging. The Codex provider trees, app credit-enrichment file, and named publication/menu/snapshot files are unchanged from upstream 0.71.0. The captured rejection executes upstream code; see build-proof.json, source-comparison.json.
  • macOS 27.0.1, arm64; single persisted account record with sourceLabel: oauth.
  • Source citations below are pinned to the release commit cb5f0cbe8861.

Decisive comparison

The app's 2026-10-02T19:01:12.654Z candidate-creation trace reports:

Logged field Previous snapshot Initial read Confirmation read
weeklyUsedPercent 99.000 1.000 1.000
creditsPresent false true true
creditsAvailableCount nil 3 3
resetBoundary 1791307920 1791569581 1791569581

The confirmation line immediately before candidate creation records stage=confirmation decision=preservePrevious. The candidate-creation trace reports initialConfirmationAccountMatches=true, stableAccountCompatible=true and stablePlanCompatible=true, followed by stage=candidateCreation decision=rejected reason=missingCreditInventory.

These are fields selected verbatim from the app log, not separate CLI observations. resetBoundary is logger-rounded Unix seconds; weeklyUsedPercent is used quota, so 1.000 used corresponds to 100 − 1 = 99% remaining. The trace emitter maps these fields to the observed snapshots. The full paired records are in 01-reset-publication.log at 19:01:12.653Z and 19:01:12.654Z.

What the captured path does

  1. Candidate creation invokes positiveCreditInventoryRejection. Its compactMap count must equal the snapshot count; a missing previous inventory returns .missingCreditInventory.
  2. In the preserve-previous branch, the confirmation result is retained as withheldSuccess while the admitted outcome is nil. The single-account refresh resolver then returns nil; the refresh caller returns before applying a provider outcome.
  3. The Codex reset-credit row reads snapshot.codexResetCredits and returns no row when it is absent. The Updated label reads the displayed snapshot's updatedAt.

This accounts for the captured combination: fresh reads contain reset credits, while the preserved menu snapshot shows the old quota, old update age and no reset-credit row.

Persisted observations and later recovery

Saved snapshot secondary.usedPercent Remaining (100 − used) codexResetCredits.availableCount Snapshot updatedAt (UTC, whole-second rendering)
Stale 99 1% absent 2026-10-02T18:10:43Z
Recovered 2 98% 3 2026-10-02T19:06:11Z

The captured post-relaunch log has 5 candidate-creation rejections with missingCreditInventory; their full timestamps and inputs are preserved in 01-reset-publication.log. This is a selected post-relaunch interval, not a claim about every earlier refresh.

The later persisted 2% state is above the evaluator's threshold: threshold constant, initial-read publication branch, confirmation-read publication branch. The recovered snapshot does not establish which read first reported that value or which branch accepted it.

Reproduction evidence and gaps

Observed sequence: use a weekly reset with the previous quota near exhaustion; capture a saved previous snapshot with missing reset credits; observe fresh low-usage reads with credits present and the rejection above; retain the later recovered snapshot. The reset action and its redemption response/time were not captured.

The missing historical inventory is established. The original fetch that left it absent was not captured, so its cause remains unknown.

The capture is from a verified local build of the 0.71.0 source baseline; an official-binary reproduction is not included.

Evidence bundle

CodexBar-0.71.0-reset-evidence-20261002.zip: the relevant reset-publication log interval, redacted stale/recovered snapshots, anonymized screenshot, and narrowly scoped build/source evidence. Its README.md records spans, redactions, timestamp conventions and source coverage; manifest.json records SHA-256 hashes.

CodexBar-0.71.0-reset-evidence-20261002.zip

kcharlan avatar Oct 02 '26 20:10 kcharlan

Codex review: this still needs some work. Reviewed October 2, 2026, 4:07 PM ET / 20:07 UTC.

Summary Current main still withholds the reported reset sequence. This is distinct from the previously fixed rolling-boundary failure, but changing the deliberate missing-inventory safeguard needs an owner-approved evidence rule.

Reproducibility: yes. from source: feed the publication path a high-use previous snapshot without credits followed by matching early 1%-used observations with credits; confirmation is withheld and candidate creation rejects missingCreditInventory. No current-main runtime reproduction was executed.

Maintainer decision needed

Question Recommendation
Should delayed weekly-reset recovery accept independently repeated exact OAuth observations when only the historical credit inventory is missing? Approve bounded missing-history recovery: Define a separate delayed corroboration rule with stable fresh inventories, account and plan checks, bounded age, and transient-reset counterexamples.

Why: Current code and prior owner discussion deliberately require historical inventory; selecting replacement evidence changes the trusted-publication contract.

Next step Obtain owner approval for missing-history corroboration before commissioning a focused repair; the existing safeguard makes this unsafe for strict bug automation.

Review details

Best possible solution:

Provide bounded recovery from missing historical inventory using independently corroborated, account-scoped observations, while preserving rejection of transient resets and avoiding invented redemption evidence.

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

Yes, from source: feed the publication path a high-use previous snapshot without credits followed by matching early 1%-used observations with credits; confirmation is withheld and candidate creation rejects missingCreditInventory. No current-main runtime reproduction was executed.

Is this the best way to solve the issue?

Unclear until the owner defines sufficient replacement evidence; deleting the inventory guard alone would weaken a documented safeguard.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • The acceptable corroboration rule when historical inventory is unknown remains undecided; bypassing it could publish transient low quota readings or trigger false reset celebrations.

Codex review notes: model internal, reasoning medium; reviewed against 29ae87e25231.

Label changes

Label changes:

  • add P2: A bounded Codex reset edge case leaves quota and freshness information stale without blocking account use.
  • add impact:ux-friction: Fresh successful reads can leave the menu displaying old quota, an old update age, and no reset-credit row.
  • 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: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: A bounded Codex reset edge case leaves quota and freshness information stale without blocking account use.
  • impact:ux-friction: Fresh successful reads can leave the menu displaying old quota, an old update age, and no reset-credit row.
Evidence reviewed

What I checked:

  • Current rejection mechanism: Candidate creation checks previous, initial, and confirmation inventories together. The helper returns missingCreditInventory whenever any inventory is absent. Immediate confirmation also returns no reset-credit evidence for an absent previous inventory; its comment explicitly preserves conservative treatment of unknown inventory. (Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:424, 29ae87e25231)
  • Publication consequence: The preservePrevious branch returns no admitted outcome, retaining the confirmation as withheldSuccess. The single-account resolver consequently returns nil, and the refresh caller exits without applying the fresh provider result. The menu reads reset credits and updatedAt from the retained snapshot. (Sources/CodexBar/Providers/Codex/UsageStore+CodexWeeklyResetConfirmation.swift:177, 29ae87e25231)
  • Missing inventory is a supported fetch outcome: Credit enrichment is best effort. For an otherwise successful usage refresh, an enrichment failure can explicitly attach nil credits; absence therefore cannot safely be interpreted as zero available credits or proof of redemption. This establishes a possible source path, not the cause of the reporter’s historical omission. (Sources/CodexBar/UsageStore+CodexResetCredits.swift:66, 29ae87e25231)
  • Existing safety contract: Documentation requires unchanged positive credit inventory for delayed recovery. Tests reject changed credit identities and zero-to-positive inventories. Simply removing the previous-inventory requirement would expand the existing admission contract. (docs/codex.md:58, 29ae87e25231)
  • Reporter evidence and limits: The supplied issue body reports paired app traces with previous usage 99%, fresh usage 1%, previous inventory absent, both fresh inventories containing three credits, matching account/plan checks, and missingCreditInventory rejection. It also discloses the uncaptured redemption response and original missing-inventory fetch. The linked ZIP was not independently inspected; the review establishes the rejection path from current source rather than claiming a live reproduction.
  • Release-to-main comparison: The evaluator, publication admission, and single-account resolver have no differences between reported v0.71.0 commit cb5f0cbe88615a441272c6f9e44675bf594a3fa3 and the reviewed main revision. The reported mechanism remains present rather than already fixed on main. (Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:426, 29ae87e25231)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Zihao-Qi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
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 Oct 02 '26 20:10 clawsweeper[bot]

Thanks @kcharlan for the paired traces — they made this a clean reproduction. A 99%-used snapshot without credit inventory followed by two matching 1%-used reads reproduces on main and is fixed by #4218: when the account, plan, inventories and freshness checks of both fresh reads agree, the fresh quota, the three credits and the update timestamp are published instead of being rejected for a missing previous inventory. The known-inventory consumption checks and the delayed confirmation for unchanged reset boundaries are unchanged. Ships in 0.71.1.

steipete avatar Oct 03 '26 02:10 steipete