Skip to content

fix: compact DeepSeek balance in custom menu-bar layouts - #2816

Merged
steipete merged 2 commits into
steipete:mainfrom
Yuxin-Qiao:codex/fix-2638-deepseek-layout-balance
Aug 9, 2026
Merged

fix: compact DeepSeek balance in custom menu-bar layouts#2816
steipete merged 2 commits into
steipete:mainfrom
Yuxin-Qiao:codex/fix-2638-deepseek-layout-balance

Conversation

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

DeepSeek reports balance text such as ¥2.23 (Paid: ¥2.23 / Granted: ¥0.00). Saved/custom menu-bar reset tokens previously rendered that full value, which could overflow the status item. The live layout-editor preview also resolved its automatic window independently, so a status-only fix made the preview disagree with the saved result.

This PR now applies one display-only automatic-window normalizer to both the running status item and MenuBarLayoutPreview.liveData. DeepSeek reset-countdown and reset-absolute tokens render only the leading balance (¥2.23) on both surfaces. Used percentage, reset time, regeneration metadata, window duration, and placeholder state are preserved; other providers are unchanged.

Changes

  • Centralize DeepSeek automatic-window display normalization in MenuBarLayoutAutomaticWindowDisplayNormalizer.
  • Route both status-item render data and live editor-preview data through that owner.
  • Cover both reset token styles on both surfaces, non-DeepSeek behavior, and all preserved RateWindow metadata.
  • Add an opt-in synthetic production-view screenshot proof to the existing render harness.
  • Record the fix under 0.49.1 — Unreleased.

Visual proof

Synthetic data only; no accounts, credentials, or personal information. The two values in each row are the reset-countdown and reset-absolute tokens.

Synthetic DeepSeek editor-preview and saved menu-bar proof

Validation

  • swift test --filter StatusItemBalanceDisplayTests — 37 passed.
  • swift test --filter MenuBarLayoutRendererTests — 16 passed.
  • swift test --filter MenuBarLayoutEditorTests — 10 passed.
  • swift test --filter ProviderArchitectureGatekeeperTests — 38 passed.
  • Synthetic screenshot harness — 1 passed; both surfaces visibly match.
  • make check — passed; SwiftLint reported 0 violations.
  • make test — 833 selections in 70 groups; all 70 passed on the first attempt, with 0 retries and 0 timeouts.
  • Final Codex autoreview — clean, no actionable findings (patch is correct, 0.99 confidence).

Out of scope

The issue's separate “granted/bonus credit only” preference remains a product decision and is intentionally not included.

Refs #2638

@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

@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: 5c7dde5ae7

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

return (
semanticWindows.session,
semanticWindows.weekly,
Self.compactDeepSeekMenuBarWindow(provider: provider, snapshot: snapshot, window: automatic))

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 Keep the DeepSeek layout editor preview compact

When a live DeepSeek snapshot is available, this normalization only affects the status-item render path; MenuBarLayoutPreview.liveData independently assigns the unmodified automatic window in MenuBarLayoutEditor.swift, so resetCountdown and resetAbsolute still show the full ¥2.23 (Paid: …) string in the editor while the saved layout shows ¥2.23. Share this normalization with the preview path so the editor remains an accurate representation of the resulting menu-bar layout.

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. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 9, 2026, 6:02 PM ET / 22:02 UTC.

ClawSweeper review

What this changes

This PR centralizes DeepSeek balance shortening for automatic reset tokens and uses it for both the menu-bar item and its live layout-editor preview.

Merge readiness

Blocked until real behavior proof from a real setup is added - 3 items remain

The patch appears correct and resolves the prior editor-preview mismatch, but it needs real after-fix application proof before merge; the attached image is explicitly a synthetic test-harness render.

Priority: P2
Reviewed head: be2ea99084c01193846969bc47999bf0efcef900

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused implementation and coverage look mergeable, but the required real behavior proof is still absent.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The synthetic render-harness screenshot supports the regression tests but is not after-fix evidence from the built application in a real DeepSeek setup; add a redacted live-app screenshot or recording, then update the PR body for re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The synthetic render-harness screenshot supports the regression tests but is not after-fix evidence from the built application in a real DeepSeek setup; add a redacted live-app screenshot or recording, then update the PR body for re-review.
Evidence reviewed 5 items Current rendering gap: Current main forwards the automatic window unchanged to the status-item layout renderer, while the editor independently resolves and renders its own automatic window; neither path compacts DeepSeek’s reset description.
Patch addresses both surfaces: The supplied PR diff adds one DeepSeek-only normalizer, applies it to status-item automatic data and preview automatic data, and adds coverage for both reset token styles.
History and ownership: The editor preview lines are attributed to Peter Steinberger on current main; Yuxin Qiao previously added the menu-bar window classification and reset-time behavior relevant to this rendering surface.
Findings None None.
Security None None.

How this fits together

CodexBar converts provider usage snapshots into rate-window data, then renders that data in the macOS menu bar and the settings layout preview. The change alters only DeepSeek’s display text on those two rendering paths.

flowchart LR
  A[DeepSeek usage snapshot] --> B[Automatic rate window]
  B --> C[DeepSeek display normalizer]
  C --> D[Menu bar render data]
  C --> E[Layout preview render data]
  D --> F[Saved menu bar]
  E --> G[Settings preview]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The synthetic render-harness screenshot supports the regression tests but is not after-fix evidence from the built application in a real DeepSeek setup; add a redacted live-app screenshot or recording, then update the PR body for re-review.
  • Resolve merge risk (P1) - The supplied screenshot is generated by a synthetic test harness, so it does not yet show the freshly built application rendering a real DeepSeek snapshot in both the settings preview and menu bar.
  • Complete next step (P2) - Await contributor-supplied real application proof; no mechanical code repair is indicated.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test delta production +60/-23, tests +219/-0, changelog +1 The production change is small and focused, with substantially more regression coverage across the two render surfaces.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the shared display-only normalization after a redacted live-app capture confirms that the editor preview and saved menu-bar item both show the compact balance.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the shared display-only normalization after a redacted live-app capture confirms that the editor preview and saved menu-bar item both show the compact balance.

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

Yes, from source: a DeepSeek snapshot whose primary reset description contains the paid/granted breakdown reaches the automatic reset tokens unchanged on current main; the PR’s focused tests model that path.

Is this the best way to solve the issue?

Yes. A shared, DeepSeek-only display projection is narrower and safer than changing provider data or duplicating formatting logic in the menu bar and preview.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded menu-bar display defect affecting DeepSeek custom layouts without evidence of data, security, or availability impact.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The synthetic render-harness screenshot supports the regression tests but is not after-fix evidence from the built application in a real DeepSeek setup; add a redacted live-app screenshot or recording, then update the PR body for re-review.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame assigns the live preview construction to this area’s recent work, and the latest PR follow-up commit adjusts that preview path. (role: recent area contributor; confidence: high; commits: 0e46d1940c35, be2ea99084c0; files: Sources/CodexBar/MenuBarLayoutEditor.swift, Sources/CodexBar/StatusItemController+MenuBarLayout.swift)
  • Yuxin Qiao: History credits this contributor with the current-main menu-bar window classification and reset-time behavior that this change extends. (role: feature contributor; confidence: medium; commits: b841e34e5f91, da3b758f4bcc; files: Sources/CodexBar/MenuBarLayoutEditor.swift, Sources/CodexBar/MenuBarDisplayText.swift)

Rank-up moves

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

  • Add a redacted capture from the freshly built app showing the live editor preview and resulting menu-bar item for a DeepSeek balance with paid/granted detail.
  • Update the PR body after adding proof; if no fresh review appears, ask a maintainer to comment @clawsweeper re-review.

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 (2 earlier review cycles)
  • reviewed 2026-08-09T17:01:35.808Z sha 5c7dde5 :: needs real behavior proof before merge. :: [P2] Keep the editor preview compact
  • reviewed 2026-08-09T17:14:37.953Z sha 5c7dde5 :: needs real behavior proof before merge. :: [P2] Keep the editor preview compact

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 9, 2026
@steipete
steipete force-pushed the codex/fix-2638-deepseek-layout-balance branch from 5c7dde5 to be2ea99 Compare August 9, 2026 21:57
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 9, 2026
@steipete
steipete merged commit a0d77c3 into steipete:main Aug 9, 2026
9 checks passed
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Merged as a0d77c37f9cc85d8703eb0a501c6764112f5a6e8.

Landing proof:

  • Focused tests passed: 37 balance/status, 16 renderer, 10 editor, and 38 architecture-gate tests.
  • make check passed.
  • The full suite passed on the first attempt: 833 selections across 70 groups, with no retries or timeouts.
  • Exact CI run 31338177810 completed successfully for head be2ea99084c01193846969bc47999bf0efcef900, including lint, changes, Linux arm64/x64/musl, both macOS shards, aggregate, and security checks.
  • Sanitized synthetic visual proof: DeepSeek compact-balance visual proof

The separate bonus/granted-credit product preference in #2638 remains open; this PR intentionally used Refs #2638 and did not close it.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants