CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

Discrepancies in Codex cost estimates (CLI vs. menu display)

Open dstier-git opened this issue 5 months ago • 2 comments

As the title suggests, the main app display shows singificantly higher cost estimates than the CLI. Discovered on Macbook Pro M4, CLi ran through iTerm2. CodexBar version 0.37.3.

Disclosure: this problem seemed to emerge only after I redeemed one of Codex's new bank-able rate limit resets for the first time.

Codex costs according to CLI (left), vs. app opened from menu (right)--actual behavior:

Image

(CLI command: codexbar cost --provider codex)

Claude estimates, for example, are roughly consistent--expected behavior:

Image

(CLI command: codexbar cost --provider claude )

dstier-git avatar Jun 30 '26 05:06 dstier-git

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 30, 2026, 4:12 AM ET / 08:12 UTC.

Summary Keep open: current main has not proven the Codex menu and codexbar cost CLI agree for the reporter's reset-credit/priority-cost scenario, and the repo profile says to review conservatively rather than auto-close.

Reproducibility: no. high-confidence current-main reproduction yet: the reporter provided strong screenshots and the source paths are clear, but this review did not run a live reset-credit/provider account check and the external CLI may not match the app build.

Ways to help us reproduce this

  • Add a screenshot or short recording showing the behavior.
  • Add expected vs actual behavior.

Next step This should stay with maintainer or reporter triage until the installed CLI/app version parity and reset-credit account behavior are confirmed.

Review details

Best possible solution:

First verify the app and CLI are the same build, then fix any remaining shared scanner/cache/rendering divergence so the menu and current CLI report the same intended Codex cost basis for priority/reset-credit usage with regression coverage.

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

No high-confidence current-main reproduction yet: the reporter provided strong screenshots and the source paths are clear, but this review did not run a live reset-credit/provider account check and the external CLI may not match the app build.

Is this the best way to solve the issue?

Unclear until version parity is confirmed; if versions match, the narrowest fix should be in shared CostUsageFetcher/scanner/cache semantics plus CLI/menu parity tests, not a menu-only workaround.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • The discrepancy may be an external codexbar CLI binary that is older than the app bundle or current main, so version parity must be checked before assuming a scanner bug.
  • No live Codex reset-credit account reproduction was run because AGENTS.md says live provider probes and real account checks need explicit request.
  • The closest open dashboard-credit PR is conflicting and review-blocked, so it should not be treated as owning this issue yet.

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

Label changes

Label changes:

  • add issue-rating: 🦐 gold shrimp: Current issue advisory state selects this label.
  • add clawsweeper:needs-info: Current issue advisory state selects this label.
  • remove issue-rating: 🐚 platinum hermit: Current issue advisory state no longer selects this label.
  • remove clawsweeper:needs-live-repro: Current issue advisory state no longer selects this label.

Label justifications:

  • P2: Incorrect Codex cost estimates affect spend planning for a supported provider, but the report is limited to display accuracy rather than data loss or app availability.
  • impact:other: The issue concerns user-visible provider cost reporting accuracy, which is meaningful maintainer-visible impact outside the specific owned impact categories.
Evidence reviewed

Acceptance criteria:

  • Compare codexbar --version with the app-bundled CodexBarCLI --version before code repair.
  • Run swift test --filter CostUsageScannerCodexPriorityTests for priority-rate scanner changes.
  • Run swift test --filter CostUsageFetcherCacheSnapshotTests and swift test --filter UsageStoreCachedTokenHydrationTests for cache/menu hydration changes.
  • Run swift test --filter CLICostTests for CLI output parity.
  • Run make check before handoff for any eventual patch.

What I checked:

  • Repository policy read: AGENTS.md was read fully; its guidance against unrequested live provider probes or Keychain-touching validation shaped this source-only review. (AGENTS.md:1, f5340ad62732)
  • Vision fit: VISION.md defines CodexBar as a provider limits, credits, spend, status, and reset-window control surface, and lists bounded bug fixes as merge-by-default. (VISION.md:1, f5340ad62732)
  • Reporter evidence: The issue body reports Codex menu cost much higher than CLI cost, notes CodexBar 0.37.3, and says the discrepancy appeared after redeeming a bank-able Codex rate-limit reset.
  • CLI cost path: The CLI cost command loads CostUsageFetcher.loadTokenSnapshot with the requested history window and renders Today plus the history-window totals from the returned snapshot. (Sources/CodexBarCLI/CLICostCommand.swift:41, f5340ad62732)
  • Menu cost path: The menu model chooses a projected provider token snapshot or the stored UsageStore token snapshot, then renders token-cost lines separately from the CLI text path. (Sources/CodexBar/StatusItemController+MenuCardModel.swift:43, f5340ad62732)
  • Menu rendering path: The token usage section formats Today and history-window lines from CostUsageTokenSnapshot values and labels Codex estimates as local Codex logs for the selected account. (Sources/CodexBar/MenuCardView+Costs.swift:92, f5340ad62732)

Likely related people:

  • steipete: Git blame attributes the current CLI cost command, app token-cost refresh comments/call, and much of the priority-cost baseline to the v0.37.2 release commit, and PR history shows recent merges in this area. (role: baseline and recent area contributor; confidence: high; commits: f380287041b8, 290155a7a145; files: Sources/CodexBarCLI/CLICostCommand.swift, Sources/CodexBar/UsageStore.swift, Sources/CodexBarCore/Vendored/CostUsage/CostUsagePricing.swift)
  • kiranmagic7: Merged Codex archived-usage work shortly before this report touched cost scanner cache helpers, priority pricing tests, and Codex row dedupe behavior. (role: recent scanner contributor; confidence: medium; commits: 0065ca42e6ab, 537fd8ff4f6d; files: Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner+CacheHelpers.swift, Sources/CodexBarCore/Vendored/CostUsage/CostUsagePricing.swift, Tests/CodexBarTests/CostUsageScannerBreakdownTests.swift)
  • Zihao-Qi: Recently merged current-day cost bucket and cost-summary display changes adjacent to the Today and history-window values shown in the report. (role: recent adjacent contributor; confidence: medium; commits: 929d55aaf1d7; files: Sources/CodexBarCore/CostUsageFetcher.swift, Tests/CodexBarTests/StatusMenuCostSummaryDisplayStyleTests.swift)
  • elijahfriedman: Recent menu and cost-history display PRs touched the menu rendering surface that consumes the token-cost snapshot. (role: recent menu/cost display contributor; confidence: low; commits: eb0bc92e24ae; files: Sources/CodexBar/StatusItemController+CostMenuCard.swift, Sources/CodexBar/MenuCardView+Costs.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 Jun 30 '26 05:06 clawsweeper[bot]

Closed: introduced by my local changes, fixing now

dstier-git avatar Jun 30 '26 19:06 dstier-git