Skip to content

[codex] Use dashboard credits for Codex cost totals#1683

Draft
avenoxai wants to merge 1 commit into
steipete:mainfrom
avenoxai:codex/dashboard-exec-cost-usd
Draft

[codex] Use dashboard credits for Codex cost totals#1683
avenoxai wants to merge 1 commit into
steipete:mainfrom
avenoxai:codex/dashboard-exec-cost-usd

Conversation

@avenoxai

Copy link
Copy Markdown

Summary

  • Convert Codex dashboard usageBreakdown credits (Exec/Desktop App/CLI/Unknown) into USD cost totals using the documented 25 credits = $1 conversion.
  • When the selected Codex account has an attached OpenAI dashboard, use dashboard credit usage as the Codex cost authority while preserving local token/request context from native logs.
  • Show dashboard-credit USD details in the Subscription Utilization hover view and label the menu-card cost source as dashboard credits.

Context

The Codex dashboard already reports service-level credits for Exec usage, but the Cost card was still driven by local token-log pricing. That meant Exec activity could appear in Subscription Utilization while not contributing to the displayed USD cost totals.

OpenAI docs used for the conversion:

Verification

  • swift test --filter OpenAIDashboardModelsTests
  • swift test --filter MenuCardCostHintTests
  • swift test --filter StatusMenuTests
  • make check
  • make test
  • make start launched the patched local CodexBar.app and reported OK: CodexBar is running.

@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed June 20, 2026, 9:37 AM ET / 13:37 UTC.

Summary
The PR converts Codex dashboard usage-breakdown credits into USD cost snapshots and uses them for Codex live-card and cost-history displays when an OpenAI dashboard is attached.

Reproducibility: yes. for the review finding: source inspection shows dashboard latest-day cost and local top-level session token/request fields are selected independently. I did not run tests because this review was required to keep the checkout read-only.

Review metrics: 1 noteworthy metric.

  • PR surface: 8 files changed, +345/-18. The change spans core dashboard models, live menu-card plumbing, hosted cost-history rendering, hover text, and focused tests.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until stronger real behavior proof is added.

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

Rank-up moves:

  • [P1] Fix the dashboard/local session-context date alignment and add a regression test with staggered dashboard and local dates.
  • [P1] Add redacted real behavior proof showing an attached Codex dashboard using dashboard-credit cost totals in the menu/card or cost-history view.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body lists tests and an app launch OK line, but it does not show the changed attached-dashboard cost totals or hover/menu labels in a real setup after the fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A visible CodexBar menu proof would materially help confirm the changed cost source and hover labels after the code fix. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify CodexBar with an attached Codex dashboard shows dashboard-credit cost totals and hover details in the menu.

Risk before merge

  • [P1] When dashboard usage lags behind local logs, the current patch can render a mixed Today line using dashboard cost from the latest dashboard date and local token/request context from a different local date.
  • [P1] Existing users with an attached OpenAI dashboard will see Codex cost totals switch from local token-log pricing to dashboard-credit conversion, so maintainers should require upgrade-visible proof for that source change.
  • [P1] The PR body contains tests and launch output, but no real attached-dashboard UI or log proof showing dashboard-credit totals in the changed menu surfaces.

Maintainer options:

  1. Fix date alignment before merge (recommended)
    Use the local daily entry matching the dashboard latest date for session token/request context, or leave that top-level context nil when no matching local day exists.
  2. Accept dashboard-source behavior after proof
    Maintainers may accept the intentional cost-source switch once the date-alignment bug is fixed and the PR shows redacted attached-dashboard proof.

Next step before merge

  • [P1] Needs a contributor-visible code fix plus real attached-dashboard proof; this should stay in human review rather than a repair lane because external real behavior proof is still missing.

Security
Cleared: The diff adds dashboard-to-cost mapping and UI plumbing without new dependencies, workflow changes, credential handling, or broader secret access.

Review findings

  • [P2] Align copied session context to the dashboard day — Sources/CodexBarCore/OpenAIDashboardModels.swift:191-193
Review details

Best possible solution:

Keep the dashboard-credit source, but tie copied local token/request context to the matching dashboard day or omit it when dates differ, then require redacted real behavior proof from an attached-dashboard setup before merge.

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

Yes for the review finding: source inspection shows dashboard latest-day cost and local top-level session token/request fields are selected independently. I did not run tests because this review was required to keep the checkout read-only.

Is this the best way to solve the issue?

No, not yet: using dashboard credits as the Codex cost authority is a reasonable path, but the merge logic should only preserve local session context for the same dashboard date. The safer fix is to look up the matching local daily entry or omit mismatched session context.

Full review comments:

  • [P2] Align copied session context to the dashboard day — Sources/CodexBarCore/OpenAIDashboardModels.swift:191-193
    sessionCostUSD comes from latest?.costUSD in the dashboard-derived daily array, but sessionTokens and sessionRequests are copied from the local snapshot's own latest/session values. If the dashboard usage breakdown lags or omits today's local-log date, the menu can render a mixed Today row with one day's dashboard cost next to another day's local token/request context. Please derive the session token/request context from the local daily entry whose date matches latest.date, or leave those fields nil when there is no match.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This is a normal-priority Codex cost-accounting improvement with a bounded but user-visible correctness issue before merge.
  • add merge-risk: 🚨 compatibility: The PR intentionally changes existing attached-dashboard users from local Codex token pricing to dashboard-credit cost totals, which needs correct upgrade behavior and proof.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body lists tests and an app launch OK line, but it does not show the changed attached-dashboard cost totals or hover/menu labels in a real setup after the fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a normal-priority Codex cost-accounting improvement with a bounded but user-visible correctness issue before merge.
  • merge-risk: 🚨 compatibility: The PR intentionally changes existing attached-dashboard users from local Codex token pricing to dashboard-credit cost totals, which needs correct upgrade behavior and proof.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body lists tests and an app launch OK line, but it does not show the changed attached-dashboard cost totals or hover/menu labels in a real setup after the fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

What I checked:

Likely related people:

  • steipete: Blame on OpenAIDashboardSnapshot, UsageStore dashboard state, and the current token-cost menu path points to Peter Steinberger's v0.37.0 release baseline commit. (role: baseline and dashboard/cost area owner; confidence: high; commits: 33a5f4362eab; files: Sources/CodexBarCore/OpenAIDashboardModels.swift, Sources/CodexBar/UsageStore.swift, Sources/CodexBar/StatusItemController+Menu.swift)
  • Elijah Friedman: Commit 8d7f1e5 recently changed compact menu usage rows and touched StatusItemController menu code adjacent to the cost-history submenu surface. (role: recent adjacent menu contributor; confidence: medium; commits: 8d7f1e53bbd4; files: Sources/CodexBar/StatusItemController+Menu.swift, Tests/CodexBarTests/StatusMenuHostedSubmenuRefreshTests.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.

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant