Skip to content

Fix menu bar layout not showing provider balance - #3494

Open
zkforge wants to merge 6 commits into
steipete:mainfrom
zkforge:fix-deepseek-layout-balance
Open

Fix menu bar layout not showing provider balance#3494
zkforge wants to merge 6 commits into
steipete:mainfrom
zkforge:fix-deepseek-layout-balance

Conversation

@zkforge

@zkforge zkforge commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #3492.

The default icon + automatic-percent layout omitted balance/spend text already supported by legacy display. DeepSeek and DeepInfra consequently showed meaningless percentages; providers with no quota window showed a dash despite available money or points.

Share balance extraction between legacy display, the actual status-item data builder, and the layout editor's live-data builder. Automatic text takes precedence for balance-only windows; providers with usable quota limits retain percentages, including DeepInfra billing-cycle spending limits. Explicit session/weekly tokens, OpenRouter's legacy preference rules, Mistral monthly plans, MiMo selection, and Kiro display modes retain their existing behavior. Remove the duplicated provider branches and obsolete wrappers: production LOC is net -33. Includes changelog and UI documentation. Thanks @zkforge!

The isolated native proof uses Developer ID-signed baseline/candidate test bundles on macOS 26.6.2 (25G83), dictionary-backed defaults, in-memory credential stores, a synthetic home/config, and no provider transports. It feeds synthetic usage snapshots through the real stored-status-item application method and hosts the actual editor preview view.

The native editor baseline shows DeepSeek as 100% and Poe as unavailable. The candidate shows ¥100.00 and 512 points. OpenRouter remains a real 75% remaining quota. Zero-balance and show-used checks also passed: DeepSeek stays monetary, Poe stays in points, and only the real quota switches to 25% used. Actual status-item accessibility output and width receipts agree with those values. Screenshots below show the native editor proof.

Before:
Native editor baseline with synthetic balances

After:
Native editor after the fix with synthetic balances

Zero balance and show-used control:
Native editor with zero balance and real quota in used mode

Validation: 149 focused balance, renderer, and architecture tests passed. The final full make test run passed all 1,036 selections across 87 groups on the first pass, with no retries or timeouts. make check and independent P0–P2 review passed. CI for commit 325f1d1 is pending.

The layout render path only wired the automaticText override for Mistral,
so DeepSeek's synthetic balance window rendered as a meaningless quota
percent (100% remaining / 0% used) instead of the balance that the legacy
path shows. Share the override helper, let DeepSeek supply its balance
text, and prefer automaticText over the automatic lane percent.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@clawsweeper

clawsweeper Bot commented Sep 8, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. 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 Sep 8, 2026
@clawsweeper

clawsweeper Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed September 8, 2026, 3:48 AM ET / 07:48 UTC.

ClawSweeper review

What this changes

The PR shares provider balance extraction across legacy menu-bar text, saved layouts, and editor previews, while retaining real quota percentages and adding tests and documentation.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

Needs changes before merge - 2 items remain

The fix remains necessary and has convincing native proof, but the previously reported DeepSeek combined-layout duplication remains unresolved. The DeepInfra quota regression is fixed, and the description now identifies the reviewed head.

Priority: P2
Reviewed head: 325f1d10e6d885abb387c18e65c6ab12e8ac7f71

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong native proof supports a useful, compact refactor, but one previously identified display regression still blocks merge.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected native before/after editor screenshots and the contributor's live menu-bar screenshot: the changed status-item and preview paths show balances instead of fake percentages, preserve real quota percentages, and display zero correctly. The macOS native harness exercises actual production builders; the combined preset remains a separate correctness finding.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected native before/after editor screenshots and the contributor's live menu-bar screenshot: the changed status-item and preview paths show balances instead of fake percentages, preserve real quota percentages, and display zero correctly. The macOS native harness exercises actual production builders; the combined preset remains a separate correctness finding.
Evidence reviewed 8 items Repository guidance: Read the complete root policy; it informed review of shared helpers, provider isolation, focused tests, and native proof. No nested AGENTS.md or maintainer-notes directory was present. Builds and tests were not executed under the read-only review contract.
Still needed on main and latest release: Both fetched main and v0.56.8 populate automaticText only for Mistral; they lack the balance wiring requested by #3492. The paired issue remains open.
Outstanding combined-layout defect: The introduced automatic-text override returns the compact DeepSeek balance. The normalizer also assigns that balance to resetDescription, and the percentAndReset preset renders both tokens independently, producing ¥100.00 · ¥100.00.
Findings 1 actionable finding [P2] Avoid repeating DeepSeek balance in combined layouts
Security None None.

How this fits together

CodexBar turns provider usage snapshots into configurable menu-bar text and editor previews. The automatic token chooses between a quota percentage and provider-specific money or points.

flowchart TD
  A[Provider usage snapshot] --> B[Automatic window selection]
  A --> C[Shared balance extraction]
  B --> D[Quota or balance decision]
  C --> D
  D --> E[Layout token renderer]
  E --> F[Menu bar status item]
  E --> G[Editor preview]
Loading

Before merge

  • Avoid repeating DeepSeek balance in combined layouts (P2) - The existing percentAndReset preset still renders ¥100.00 · ¥100.00: this override supplies the compact balance, while MenuBarLayoutAutomaticWindowDisplayNormalizer sets resetDescription to that identical value and the reset token renders it independently. Both status-item and editor builders use that normalizer, so the paid/granted breakdown mentioned in the inline response does not reach the renderer. This repeats the unresolved prior finding. Avoid duplicate output when the tokens are combined, while retaining the balance in reset-only layouts.
  • Complete next step (P2) - Remove duplicate DeepSeek balance output from combined layouts while preserving reset-only layouts, and add focused regression coverage.

Findings

  • [P2] Avoid repeating DeepSeek balance in combined layouts — Sources/CodexBar/MenuBarLayoutRenderer.swift:681-684
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test LOC production -33 net; tests +700 net Shared extraction reduces production code while adding provider regressions and an opt-in native proof harness.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #3492
Summary: This PR is the explicit implementation candidate for the paired balance-layout issue; neither should close before the fix lands.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Render an automatic balance once in combined layouts while preserving reset-only balance visibility, real quota percentages, and stored layout preferences.

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

Yes, source establishes the original default-layout omission and the remaining combined-layout defect: a funded DeepSeek snapshot with percentAndReset supplies the same compact balance to both tokens. No reviewer-side runtime tests were executed.

Is this the best way to solve the issue?

The shared extraction is the appropriate narrow fix, but the renderer must also handle the existing combined preset without duplicating the balance.

Full review comments:

  • [P2] Avoid repeating DeepSeek balance in combined layouts — Sources/CodexBar/MenuBarLayoutRenderer.swift:681-684
    The existing percentAndReset preset still renders ¥100.00 · ¥100.00: this override supplies the compact balance, while MenuBarLayoutAutomaticWindowDisplayNormalizer sets resetDescription to that identical value and the reset token renders it independently. Both status-item and editor builders use that normalizer, so the paid/granted breakdown mentioned in the inline response does not reach the renderer. This repeats the unresolved prior finding. Avoid duplicate output when the tokens are combined, while retaining the balance in reset-only layouts.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs incorrect menu-bar balance presentation with a limited display-only blast radius.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): Inspected native before/after editor screenshots and the contributor's live menu-bar screenshot: the changed status-item and preview paths show balances instead of fake percentages, preserve real quota percentages, and display zero correctly. The macOS native harness exercises actual production builders; the combined preset remains a separate correctness finding.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected native before/after editor screenshots and the contributor's live menu-bar screenshot: the changed status-item and preview paths show balances instead of fake percentages, preserve real quota percentages, and display zero correctly. The macOS native harness exercises actual production builders; the combined preset remains a separate correctness finding.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected native before/after editor screenshots and the contributor's live menu-bar screenshot: the changed status-item and preview paths show balances instead of fake percentages, preserve real quota percentages, and display zero correctly. The macOS native harness exercises actual production builders; the combined preset remains a separate correctness finding.

Evidence

Acceptance criteria:

  • [P1] swift test --filter MenuBarLayoutRendererTests.
  • [P1] swift test --filter StatusItemBalanceDisplayTests.
  • [P1] make test.
  • [P1] make check.

What I checked:

  • Repository guidance: Read the complete root policy; it informed review of shared helpers, provider isolation, focused tests, and native proof. No nested AGENTS.md or maintainer-notes directory was present. Builds and tests were not executed under the read-only review contract. (AGENTS.md:1, 325f1d10e6d8)
  • Still needed on main and latest release: Both fetched main and v0.56.8 populate automaticText only for Mistral; they lack the balance wiring requested by Menu bar layout doesn't show provider balance (DeepSeek, DeepInfra, Moonshot, Poe, OpenCode Go, OpenRouter) #3492. The paired issue remains open. (Sources/CodexBar/StatusItemController+MenuBarLayout.swift:124, 6ef82690b4a7)
  • Outstanding combined-layout defect: The introduced automatic-text override returns the compact DeepSeek balance. The normalizer also assigns that balance to resetDescription, and the percentAndReset preset renders both tokens independently, producing ¥100.00 · ¥100.00. (Sources/CodexBar/MenuBarLayoutRenderer.swift:681, 325f1d10e6d8)
  • Review continuity: The renderer and automatic-window normalizer are unchanged from the previous reviewed head. This repeats the existing finding rather than introducing a late concern. The contributor's inline response acknowledges redundancy, but its claimed longer reset breakdown is removed by the normalizer. (Sources/CodexBar/MenuBarLayoutAutomaticWindowDisplayNormalizer.swift:21, 325f1d10e6d8)
  • DeepInfra correction retained: The shared resolver restricts DeepInfra overrides to descriptive, non-resetting balance windows. Added status-item and editor tests preserve the real billing-cycle window at 25% used when a spending limit exists. (Tests/CodexBarTests/StatusItemBalanceDisplayTests.swift:1301, 325f1d10e6d8)
  • Native proof inspected: Inspected all four prepared images. Native editor screenshots show DeepSeek changing from 100% to ¥100.00, Poe from unavailable to 512 points, and OpenRouter retaining 75% remaining; the zero/show-used screenshot shows ¥0.00 and 25%. The contributor's live screenshot shows ¥0.39 in the actual menu bar matching the provider card. The captured body describes macOS 26.6.2 and the production status-item/editor entrypoints; screenshots do not cover the combined preset.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Yuxin Qiao: Raw commit a0d77c3 adds Sources/CodexBar/MenuBarLayoutAutomaticWindowDisplayNormalizer.swift:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a0d77c37f9cc; files: Sources/CodexBar/MenuBarLayoutAutomaticWindowDisplayNormalizer.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve combined-layout balance duplication and add coverage for combined and reset-only layouts through both data builders.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-08T04:53:15.059Z sha b1d2319 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-08T06:00:09.528Z sha e4a43a4 :: needs real behavior proof before merge. :: [P1] Preserve DeepInfra's real spending-limit percentage | [P2] Avoid displaying DeepSeek's balance twice in combined layouts
  • reviewed 2026-09-08T06:51:16.679Z sha 29efe18 :: needs real behavior proof before merge. :: [P2] Avoid repeating DeepSeek balance in percent-and-reset layouts
  • reviewed 2026-09-08T07:25:12.247Z sha 29efe18 :: blocked before merge. :: [P2] Avoid repeating DeepSeek balance in combined layouts

@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: b1d2319c97

ℹ️ 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".

Comment on lines +680 to +683
if window == .automatic, let automaticText {
// Balance-only providers (e.g. DeepSeek) send a valid window whose percent is meaningless;
// the resolved text is the balance they should surface instead.
return (automaticText, true)

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 Avoid duplicating balance in percent-and-reset layouts

For DeepSeek, the automatic window's resetDescription is already normalized to the same compact balance used by automaticText. Consequently, the shipped percentAndReset preset (.percent(.automatic) · .resetCountdown) now renders values such as ¥100.00 · ¥100.00; the same duplication affects equivalent custom layouts. The override should avoid causing both tokens to surface the identical balance, for example by suppressing the reset value when it is serving as the automatic-percent replacement.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed, with context: before this PR the reset token was the only place the layout path surfaced DeepSeek's balance at all — for balance-only providers resetDescription doubles as the balance detail, so the pre-fix percentAndReset preset already rendered 100% · ¥100.00 (Paid: …). After this change both tokens show balance text: redundant, but strictly more informative than the fake 100%, and the full breakdown string differs from the compact percent-token text.

Suppressing the reset value would require the renderer to reason about sibling tokens, and risks hiding the balance entirely in reset-only layouts, where the reset token is the only balance surface. Leaving the token-pairing question to the maintainer — happy to implement whichever direction is preferred in a follow-up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@zkforge zkforge changed the title Fix DeepSeek menu bar layout showing percent instead of balance Fix menu bar layout not showing provider balance Sep 8, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Sep 8, 2026
@steipete

steipete commented Sep 8, 2026

Copy link
Copy Markdown
Owner

I’m preparing this for landing. The missing balance wiring is reproducible in both the status-item and editor data builders. I’m consolidating the existing extraction logic so those paths and legacy display share it, preserving real-quota priority and the existing provider-specific preference rules. I’ll add native before/after proof and the changelog entry before landing. Thanks @zkforge!

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Sep 8, 2026
@zkforge

zkforge commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks Peter! A few notes since your comment:

  • The DeepInfra spending-limit case from the automated review is fixed on the branch (29efe18ab): the balance text now only replaces the synthetic balance-health window, so a configured spending limit keeps its real billing-cycle percentage. Regression test included.
  • Replied inline on the percentAndReset balance-duplication finding — left it to your judgment since you're consolidating this area anyway.
  • Verified against a live build: DeepSeek shows ¥0.39 and a limit-less OpenRouter shows $5.52 in the menu bar (screenshots attached).

Full sharded suite is green on the head (87/87 groups, 0 failures). Feel free to rework anything in the consolidation — happy to help if anything comes up.
Claude 2026-09-08 14 50 04
Lark Helper 2026-09-08 14 33 14

steipete and others added 2 commits September 8, 2026 00:14
Preserve actual quota percentages while showing balance-only money and points in the automatic layout. Reuse extraction across legacy display, status-item data, and editor previews, removing duplicate branches and wrappers. Add isolated native proof and regression coverage.

Co-authored-by: Zhou Kai <kaizhou0305@gmail.com>
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 8, 2026
@steipete

steipete commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Thanks for the DeepInfra spending-limit follow-up. I’ve incorporated that behavior into the shared resolver and added editor-preview coverage alongside the status-item regression. The maintainer refactor remains net negative in production code (-33 lines).

The push correctly stopped because your branch advanced. I’m completing the merge review and final suite before pushing the integrated commits; the PR body and native screenshots currently describe that prepared candidate, not yet the branch head. The native DeepSeek/Poe/OpenRouter proof paths are unchanged by the DeepInfra correction.

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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Menu bar layout doesn't show provider balance (DeepSeek, DeepInfra, Moonshot, Poe, OpenCode Go, OpenRouter)

2 participants