Skip to content

Show raw Codex credit totals#1683

Merged
steipete merged 4 commits into
steipete:mainfrom
avenoxai:codex/dashboard-exec-cost-usd
Jul 5, 2026
Merged

Show raw Codex credit totals#1683
steipete merged 4 commits into
steipete:mainfrom
avenoxai:codex/dashboard-exec-cost-usd

Conversation

@avenoxai

@avenoxai avenoxai commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Shows calendar-correct raw Codex dashboard credit totals without pretending dashboard credits are billed dollars.

Maintainer rewrite

  • Adds compact Today and Last 30 days credit totals above the existing dashboard usage-breakdown chart.
  • Keeps the chart and totals in native dashboard credits; removes the unsupported universal 25 credits = $1 conversion.
  • Preserves local token-log costs, project/worktree rollups, and 7/30/90-day cost comparisons unchanged.
  • Filters by an inclusive local-calendar window, excluding future and older rows instead of taking the latest 30 records.
  • Uses Gregorian dashboard keys with the user's timezone, including non-Gregorian system-calendar configurations.
  • Recomputes service totals after removing skill, invalid, negative, and non-finite values; overflow fails closed.
  • Keeps both edge date labels fully visible instead of clipping the final chart date.
  • Drops the debug-only packaged fixture and all production startup branches from the previous draft.

Proof

  • swift test --filter OpenAIDashboardModelsTests: 8 tests passed.
  • make check: SwiftFormat clean; SwiftLint 0 violations; repository checks clean.
  • make test: all 47 shards passed on the exact head.
  • Structured autoreview found one Gregorian/system-calendar issue; fixed with regression coverage. A second review of the final chart-label change was clean.
  • Deterministic production-view render verified the Today and Last 30 days totals, exclusion of a future row, stacked service bars, and fully visible first/last dates.
  • ./Scripts/compile_and_run.sh: fresh signed app packaged, launched, and remained running.

Exact head: 06e85486117a149dd622e336f3561b3e8f30af72

Contributor

Thanks @avenoxai for the original dashboard-credit totals direction. The rewrite preserves contributor credit while choosing raw, account-scoped credits over an unsupported dollar estimate.

@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 4:26 AM ET / 08:26 UTC.

Summary
The PR adds raw Codex dashboard Today and Last 30 days credit totals to the usage-breakdown menu, calendar-window summary logic, chart label anchoring, tests, and an unreleased changelog entry.

Reproducibility: not applicable. this is a feature/UI improvement rather than a broken existing behavior. Review confidence comes from source inspection, focused tests, and inspected fixture screenshots for the changed menu UI.

Review metrics: 3 noteworthy metrics.

  • Diff surface: 5 files, +341/-8. The change is bounded to one dashboard model, one SwiftUI menu view, focused tests, and the unreleased changelog.
  • Regression coverage: 6 model cases, 3 view-state cases. The tests cover the calendar, sanitization, absent-today, overflow, timezone, and totals-only paths most likely to regress.
  • Visible proof: 2 screenshots inspected. The attached fixtures directly show the changed menu states that source and unit tests cannot fully demonstrate.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Next step before merge

  • [P2] No repair lane is needed because the current head has sufficient proof and no actionable review findings.

Security
Cleared: No concrete security or supply-chain concern found; the diff changes Swift model/view/test code and an unreleased changelog entry only.

Review details

Best possible solution:

Land this branch after ordinary CI and maintainer approval, keeping dashboard credits displayed as raw credits and separate from local token-log dollar rollups.

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

Not applicable; this is a feature/UI improvement rather than a broken existing behavior. Review confidence comes from source inspection, focused tests, and inspected fixture screenshots for the changed menu UI.

Is this the best way to solve the issue?

Yes. The current head uses the existing dashboard model and chart view, avoids unsupported dollar conversion, preserves local cost rollups, and fixes the earlier absent-today edge case with regression coverage.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The maintainer-attached screenshots and described packaged-app run show the after-fix chart and totals-only menu behavior on the current head.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The maintainer-attached screenshots and described packaged-app run show the after-fix chart and totals-only menu behavior on the current head.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The maintainer-attached screenshots and described packaged-app run show the after-fix chart and totals-only menu behavior on the current head.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority user-facing Codex dashboard improvement with limited blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The maintainer-attached screenshots and described packaged-app run show the after-fix chart and totals-only menu behavior on the current head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The maintainer-attached screenshots and described packaged-app run show the after-fix chart and totals-only menu behavior on the current head.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The maintainer-attached screenshots and described packaged-app run show the after-fix chart and totals-only menu behavior on the current head.
Evidence reviewed

What I checked:

  • AGENTS.md policy read: Repository guidance was read fully and applied: focused tests are preferred for parser/provider behavior, live Keychain-triggering validation should be avoided unless explicitly requested, and visible menu changes benefit from runtime/UI proof. (AGENTS.md:19, f1de7006027e)
  • Raw credit totals rendered in the menu: The PR head computes a recent usage summary, then renders Today and Last 30 days credit metrics above the existing chart when data is present. (Sources/CodexBar/UsageBreakdownChartMenuView.swift:45, 675f7dc6bd11)
  • Calendar-correct summary logic: The model uses Gregorian day keys in the user's timezone, filters to an inclusive local 30-day window, excludes future/invalid rows, sanitizes non-finite and negative service values, and returns 0 for Today when recent history exists but no current-day row is present. (Sources/CodexBarCore/OpenAIDashboardModels.swift:197, 675f7dc6bd11)
  • Focused regression coverage: Added tests cover calendar windows, future-row exclusion, invalid-value sanitization, absent-today zero display, overflow fail-closed behavior, timezone handling, and non-Gregorian system calendars. (Tests/CodexBarTests/OpenAIDashboardModelsTests.swift:106, 675f7dc6bd11)
  • Totals-only presentation covered: The latest head adds a presentation-state seam and tests that aggregate totals remain visible when dashboard service rows are absent. (Tests/CodexBarTests/UsageBreakdownChartMenuViewTests.swift:7, 675f7dc6bd11)
  • Real behavior proof inspected: The maintainer comment at the current head attached two screenshots; inspected artifacts show chart mode with Today 0 credits and Last 30 days 19.6 credits, plus totals-only mode with Today 0 credits and Last 30 days 4 credits. (675f7dc6bd11)

Likely related people:

  • steipete: Introduced the Swift Charts usage-breakdown surface and OpenAI dashboard parsing/model area, authored the current rewrite commits, and supplied the latest proof comment. (role: feature-history contributor and current rewrite author; confidence: high; commits: 0b77ed9dae66, 8a94bb49c844, 675f7dc6bd11; files: Sources/CodexBar/UsageBreakdownChartMenuView.swift, Sources/CodexBarCore/OpenAIDashboardModels.swift, Tests/CodexBarTests/OpenAIDashboardModelsTests.swift)
  • xiaoqianWX: Recent OpenAI dashboard refresh work touched the dashboard model, chart view, and related tests around the same data surface. (role: recent dashboard contributor; confidence: medium; commits: cbd59562addc; files: Sources/CodexBar/UsageBreakdownChartMenuView.swift, Sources/CodexBarCore/OpenAIDashboardModels.swift, Tests/CodexBarTests/OpenAIDashboardModelsTests.swift)
  • elijahfriedman: Recently changed selection-band and detail-line behavior in the same usage-breakdown chart view. (role: recent chart behavior contributor; confidence: medium; commits: 21e0ca711f1a; files: Sources/CodexBar/UsageBreakdownChartMenuView.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

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.
Review history (5 earlier review cycles)
  • reviewed 2026-07-05T04:51:11.448Z sha 6932501 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-05T04:55:17.476Z sha 6932501 :: needs real behavior proof before merge. :: [P2] Treat missing today rows as zero usage
  • reviewed 2026-07-05T05:04:05.393Z sha 06e8548 :: needs real behavior proof before merge. :: [P2] Treat missing today rows as zero usage
  • reviewed 2026-07-05T05:16:53.405Z sha 06e8548 :: needs real behavior proof before merge. :: [P2] Treat absent today usage as zero
  • reviewed 2026-07-05T08:22:24.131Z sha 675f7dc :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Jun 20, 2026
@steipete

steipete commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Maintainer review against current main (55327375) and exact head f8b9f833:

Focused tests are green (OpenAIDashboardModelsTests: 5; MenuCardCostHintTests: 4), and the attached-dashboard account boundary is correct. The branch is not ready to land:

  • It selects the latest dashboard usage entry for sessionCostUSD, while the menu presents that field as “Today”. A stale latest entry therefore becomes a false current-day cost. Selection must be local-calendar-day-aware, with a regression test for stale-only data.
  • Dashboard credits are usage units. Showing the conversion as authoritative “cost” needs an explicit product decision; my recommendation is “USD-equivalent usage estimate” unless the source is confirmed to be charged spend.
  • The branch is far behind/conflicted and overlaps the active cost-correctness work in Fix Codex cost inflation from cached input double-billing #1797. Rebase only after that lands.

The 25-credits-per-dollar conversion has external support in the Codex student-program terms, while the current Codex rate card describes credit usage by task rather than billing semantics. That does not settle the UI label. Recommendation: keep the account-scoped conversion, fix day selection, label it as an estimate, and reassess after #1797. No merge from this review.

@steipete steipete force-pushed the codex/dashboard-exec-cost-usd branch from f8b9f83 to 2e3a1ac Compare July 1, 2026 10:28
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 1, 2026
@steipete steipete force-pushed the codex/dashboard-exec-cost-usd branch from 0ea4e61 to 6932501 Compare July 5, 2026 04:45
@steipete steipete changed the title [codex] Use dashboard credits for Codex cost totals Show raw Codex credit totals Jul 5, 2026
@steipete steipete marked this pull request as ready for review July 5, 2026 04:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6932501311

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let recent = self.removingSkillUsageServices(from: breakdown)
.compactMap { self.sanitized($0, startKey: startKey, todayKey: todayKey, calendar: dayCalendar) }
.sorted { $0.day < $1.day }
let todayCredits = recent.first(where: { $0.day == todayKey })?.totalCreditsUsed

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat absent today usage as zero

When the dashboard has usage in the 30-day window but none today, the scraper omits zero-value bars, so recent contains no row for todayKey. This makes the new Today metric render instead of 0 credits for a normal no-usage-today case while the Last 30 days total still shows data; default the today total to 0 when there is recent breakdown data but no today row.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Jul 5, 2026
@steipete steipete force-pushed the codex/dashboard-exec-cost-usd branch from 06e8548 to 675f7dc Compare July 5, 2026 08:16
@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Maintainer repair pushed at exact head 675f7dc6bd112c92655cc02363e0a346b91eb59f.

What changed:

  • preserves raw Codex dashboard credit totals (no currency conversion)
  • uses calendar-correct Today / 30-day windows and reports 0 credits when valid history simply has no row for today
  • keeps both chart edge dates visible
  • keeps aggregate totals visible when the dashboard supplies no per-service rows
  • adds maintainer changelog credit for @avenoxai

Proof:

  • swift test --filter OpenAIDashboardModelsTests — 9 tests passed
  • swift test --filter UsageBreakdownChartMenuViewTests — 3 tests passed
  • make check — passed; 0 SwiftFormat changes, 0 SwiftLint violations
  • make test — all 47 shards passed on the exact candidate
  • AutoReview — clean; no accepted/actionable findings
  • source-blind render contract — both chart and totals-only fixtures passed
  • packaged CodexBar.app — stayed alive under disposable HOME / CFFIXED_USER_HOME, isolated config and credential homes, and CODEXBAR_DISABLE_KEYCHAIN_ACCESS=1; no child/browser process, browser canary untouched, no real-home reference

Chart fixture (today intentionally absent):

chart fixture showing Today 0 credits and both edge dates

Aggregate-only fixture (no service rows):

totals-only fixture showing Today 0 credits and Last 30 days 4 credits

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 5, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 5, 2026
@steipete steipete merged commit 9f1a96c into steipete:main Jul 5, 2026
17 of 19 checks passed
@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Landed in 9f1a96c3. Thanks @avenoxai!

Final exact-head proof:

  • all 10 required checks passed, including all four macOS shards and both Linux builds
  • focused model and presentation-state tests passed
  • all 47 local test shards passed; make check clean
  • built app stayed alive under an isolated HOME/config fixture with Keychain access disabled
  • menu proof and totals-only proof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants