Codex multi-account menu can misclassify Spark quota windows as refreshed primary/weekly limits
Summary
After updating to CodexBar 0.41.0, the Codex multi-account menu can show some accounts as if their main session / weekly limits have fully refreshed, even though a direct all-account usage fetch still reports the account as depleted or partially used.
This can also trigger a false "quota reset" notification because the reset detector sees the cached account snapshot jump from high usage to near-zero usage.
Environment
- CodexBar: 0.41.0 (100)
- Distribution: official signed app (
TeamIdentifier=Y5PE65HELJ) - Provider: Codex
- Setup: multiple visible Codex OAuth accounts
- Codex Spark windows are present in the usage response
Observed behavior
The in-app Codex multi-account menu can show an account as nearly fully refreshed for the main session / weekly limits.
However, running the bundled CLI for all visible Codex accounts returns different values for the same account. In the affected case, the CLI still reports the account's main session as exhausted and weekly quota as partially used, while the app's persisted account snapshot shows both as nearly refreshed.
Sanitized example:
CLI --all-accounts, account C:
session: exhausted
weekly: partially used
App account snapshot / menu, same account C:
session: nearly fully refreshed
weekly: nearly fully refreshed
The mismatch appears after Spark-related quota windows are present, for example:
Codex Spark 5-hour
Codex Spark Weekly
Those should remain supplemental extraRateWindows; they should not replace or overwrite the account's primary session / weekly Codex windows.
Reproduction outline
- Configure multiple visible Codex OAuth accounts.
- Use CodexBar 0.41.0 with Codex Spark quota windows present in the response.
- Open the Codex multi-account menu.
- Compare the menu/account snapshot values with:
/Applications/CodexBar.app/Contents/Helpers/CodexBarCLI usage --provider codex --all-accounts --format json --pretty
- Observe that at least one account can differ: the CLI reports the true primary/weekly windows, while the menu/account cache shows refreshed primary/weekly values.
Expected behavior
- The multi-account menu should show the same primary / weekly limits as
usage --provider codex --all-accounts. - Spark quota windows should be displayed as additional windows only.
- False reset notifications should not fire from a transient or incorrectly mapped account snapshot.
Actual behavior
- The app's account cache/menu can show a non-refreshed account as refreshed.
- The reset detector can then post a false quota reset notification.
Privacy note
This report intentionally omits screenshots, account emails, account IDs, local usernames, exact quota percentages, and raw response payloads. I can provide a redacted minimal snapshot shape if needed.
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 8, 2026, 1:26 AM ET / 05:26 UTC.
Summary Keep open: this is a fresh, concrete quota-display bug report against v0.41.0, and current source/tests prove Spark should stay in extraRateWindows but do not yet cover the reported multi-account persisted-menu/cache mismatch or false reset notification path.
Reproducibility: no. high-confidence current-main reproduction was established. The issue gives a detailed real setup and CLI comparison, but source inspection only confirms the intended Spark extra-window mapping and still needs a redacted payload/cache fixture for the multi-account mismatch.
Ways to help us reproduce this
- Add a screenshot or short recording showing the behavior.
- Add expected vs actual behavior.
Next step A focused fix PR is reasonable, but it should first add a synthetic multi-account fixture that reproduces the menu/cache mismatch because the basic Spark parser path already has passing coverage.
Review details
Best possible solution:
Keep Spark windows supplemental, add a focused multi-account regression that reproduces the persisted menu snapshot and false-reset path, then fix only the transform that can place Spark-derived values into primary/weekly lanes.
Do we have a high-confidence way to reproduce the issue?
No high-confidence current-main reproduction was established. The issue gives a detailed real setup and CLI comparison, but source inspection only confirms the intended Spark extra-window mapping and still needs a redacted payload/cache fixture for the multi-account mismatch.
Is this the best way to solve the issue?
Unclear until the failing transform is isolated. The best fix is likely a narrow regression and repair in the Codex visible-account snapshot/cache/reset-notification path, not a new quota model or config option.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
- The report intentionally omits the raw usage payload and persisted cache shape, so the exact failing transform still needs a redacted fixture or synthetic reproduction.
- Existing parser tests already cover the desired Spark mapping, which suggests the remaining bug may sit in multi-account snapshot persistence, reset backfill, or notification state rather than the basic OAuth/dashboard parser.
Codex review notes: model internal, reasoning high; reviewed against aa401f1d8b74.
Label changes
Label changes:
- add
P2: Wrong Codex account quota values and false reset notifications are a normal priority user-facing bug with limited blast radius. - add
impact:ux-friction: The multi-account menu and notification flow can mislead users about which Codex account has quota available without blocking setup or first run. - add
issue-rating: 🦐 gold shrimp: Current issue advisory state selects this label. - add
clawsweeper:needs-info: Current issue advisory state selects this label.
Label justifications:
P2: Wrong Codex account quota values and false reset notifications are a normal priority user-facing bug with limited blast radius.impact:ux-friction: The multi-account menu and notification flow can mislead users about which Codex account has quota available without blocking setup or first run.
Evidence reviewed
Acceptance criteria:
- swift test --filter CodexAdditionalRateLimitsTests
- swift test --filter CodexAccountVisibleHistoryBackfillTests
- swift test --filter UsageStoreSessionQuotaTransitionTests
- make check
What I checked:
- Repository policy read: AGENTS.md was read fully; its guidance led this review to avoid live account/Keychain probes and prefer source, parser, and model seams. (
AGENTS.md:29, aa401f1d8b74) - Maturity shortlist unavailable: The required maturity helper reported no qa/maturity-scores.yaml in this repository, so no maturity:stable label can be applied.
- Codex docs define the expected mapping: The Codex provider docs say rate_limit.primary_window/secondary_window map to session/weekly lanes, while additional_rate_limits such as Spark map to extraRateWindows and leave the snapshot otherwise unchanged. (
docs/codex.md:39, aa401f1d8b74) - Spark mapper keeps supplemental windows separate: Current main maps Spark additional_rate_limits through CodexAdditionalRateLimitMapper.sparkWindows into named extra windows, not primary or secondary lanes. (
Sources/CodexBarCore/Providers/Codex/CodexAdditionalRateLimitMapper.swift:34, aa401f1d8b74) - Parser regression coverage exists but is narrower than the report: CodexAdditionalRateLimitsTests asserts primary=22 and secondary=43 remain unchanged while Spark 5-hour/weekly windows are emitted as extraRateWindows. (
Tests/CodexBarTests/CodexAdditionalRateLimitsTests.swift:55, aa401f1d8b74) - Reported path uses persisted multi-account snapshots: refreshCodexVisibleAccountsForMenu resolves each visible Codex account, applies reset backfill, then persists currentSnapshots to the Codex account snapshot store; this is the app-specific path the CLI comparison does not exercise directly. (
Sources/CodexBar/UsageStore+TokenAccounts.swift:105, aa401f1d8b74)
Likely related people:
- steipete: Peter Steinberger authored the Spark weekly fix and several recent Codex visible-account/reset-cache hardening commits in the affected paths. (role: recent area contributor; confidence: high; commits: fd33445d5675, fa8d8f636266, fca42e99d0ec; files:
Sources/CodexBarCore/Providers/Codex/CodexAdditionalRateLimitMapper.swift,Sources/CodexBar/UsageStore+TokenAccounts.swift,Tests/CodexBarTests/OpenAIDashboardSparkTests.swift) - LeoLin990405: The merged Spark usage work was authored by Zhongyue Lin / LeoLin990405 and added the initial CodexAdditionalRateLimitMapper and Spark tests. (role: introduced Spark support; confidence: medium; commits: afe4e802239f; files:
Sources/CodexBarCore/Providers/Codex/CodexAdditionalRateLimitMapper.swift,Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift,Tests/CodexBarTests/OpenAIDashboardSparkTests.swift) - Alasdair McCall: The stacked-vs-segmented multi-account menu work appears in history for the account snapshot/menu path now implicated by the report. (role: introduced related multi-account menu behavior; confidence: medium; commits: 28f53946ea27; files:
Sources/CodexBar/UsageStore+TokenAccounts.swift,Tests/CodexBarTests/StatusMenuTokenAccountSwitcherTests.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-reviewcomments, 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-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only. - Maintainers can also comment
@clawsweeper reviewto 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 explainto ask for more context, or@clawsweeper stopto stop active automation.
I traced this on current main (aa401f1d8b74) before attempting a patch. A parser/dashboard change does not look safe yet.
What looks ruled out by current tests:
- OAuth
additional_rate_limitskeeps the primary and weekly Codex lanes unchanged and maps Spark intoextraRateWindows. - The OpenAI dashboard path carries Spark through
OpenAIDashboardSnapshot.toUsageSnapshot()without replacing primary or weekly lanes. - Existing visible-account reset/history backfill guards still keep same-email and same-workspace cases separated.
Local proof on current main:
swift test --filter CodexAdditionalRateLimitsTests- 8 tests passed.swift test --filter OpenAIDashboardSparkTests- 7 tests passed.swift test --filter CodexAccountVisibleHistoryBackfillTests- 15 tests passed.
That makes the remaining failure more likely to be in the persisted visible-account snapshot/menu cache path after a real account refresh, or in a stale cached row being matched to the wrong visible account, rather than in the basic Spark mapper.
The most useful next fixture would be a redacted pair for one affected account:
- the
usage --provider codex --all-accounts --format json --prettyaccount entry that shows the expected primary/weekly values; - the matching app-side account snapshot/menu cache row that shows refreshed primary/weekly values, with emails, account IDs, workspace IDs, and local paths replaced by stable placeholders;
- whether the affected row is a live system account, managed account, or profile-home account, and whether
workspaceAccountIDis present.
With that shape, the regression should probably land in CodexAccountVisibleHistoryBackfillTests or StatusMenuCodexSwitcherTests against the visible-account snapshot transform, not in the existing Spark parser/dashboard tests.