Add per-provider menu bar percent window picker - #3124
Conversation
The menu bar percent comes from the layout's % tokens, each carrying its own PercentWindow, and the layout editor is the only place to change them. An account whose stored metric preference resolves to the weekly lane therefore shows a nearly-full weekly percent with no obvious way to switch to session — confusing on plans where exhausting a session does not fill the week. The menu_bar_metric_title / menu_bar_metric_subtitle strings are already translated but no longer used by any pane. Add an Auto/Session/Weekly picker to the provider pane for the common case where every percent in the layout reads the same window. Mixed layouts report Custom and are left to the layout editor, and a layout with no percent hides the picker entirely.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Heads up: this touches the same spot in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0964dfd42e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| MenuBarLayoutEditorPersistence.activate( | ||
| preference.applied(to: layout), | ||
| for: self.provider, | ||
| settings: self.settings) |
There was a problem hiding this comment.
Preserve the global menu-bar style when changing a provider window
When the user has selected the Critters or Bars style, this picker is still visible because the legacy layout resolution can contain a percent token. Choosing an option calls MenuBarLayoutEditorPersistence.activate, which sets menuBarIconStyle = .iconAndPercent; consequently a per-provider window change unexpectedly replaces the global style for every provider. The layout editor itself is disabled for non-percent styles in PreferencesMenuBarPane.swift, so this picker should likewise avoid activation or be hidden in those modes.
Useful? React with 👍 / 👎.
| ForEach(MenuBarPercentWindowPreference.allCases) { preference in | ||
| Text(preference.label).tag(MenuBarPercentWindowPreference?.some(preference)) | ||
| } |
There was a problem hiding this comment.
Filter out windows the provider cannot render
Presenting all three choices lets balance-only providers select unusable windows. For example, Mistral snapshots deliberately have both primary and secondary set to nil, so its semantic session and weekly windows are nil; selecting either option here replaces the useful Automatic spend text with an unavailable percent. The choices should be constrained using provider capabilities/metadata, or the control should be hidden when no session or weekly quota exists.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed August 21, 2026, 12:22 PM ET / 16:22 UTC. ClawSweeper reviewWhat this changesThe PR adds a per-provider Auto, Session, or Weekly picker that rewrites top-level percent tokens in the resolved menu-bar layout. Merge readiness⛔ Blocked until real behavior proof is added - 8 items remain Keep open: the feature is plausible, but the current picker can change an existing global menu-bar style and can select unavailable windows for Mistral. It also needs contributor-provided after-fix UI evidence before merge. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherCodexBar resolves global or provider-specific menu-bar layouts into tokens that render provider usage in the macOS menu bar. The provider settings pane persists layout overrides, which feed the next menu-bar render. flowchart LR
A[Provider usage snapshot] --> B[Resolved menu bar layout]
B --> C[Percent tokens and windows]
C --> D[Provider settings picker]
D --> E[Persisted provider layout override]
E --> B
C --> F[Menu bar display]
Decision needed
Why: The PR adds a new settings surface and persistence behavior; code fixes can make it safe, but maintainers should confirm that this shortcut belongs in the provider pane. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: If sponsored, show the picker only in Icon + percent mode, limit choices to renderable provider windows, add focused coverage, and provide a redacted after-fix settings/menu-bar demonstration. Do we have a high-confidence way to reproduce the issue? Yes, from source: choose a window while Critters or Bars is selected and the picker invokes the helper that sets Icon + percent; Mistral can likewise select a Session or Weekly token that has no render window. No live app run was performed in this read-only review. Is this the best way to solve the issue? No. Reusing the layout editor's activating persistence helper is unsafe outside Icon + percent mode, and the unfiltered options disregard provider capabilities; a gated, capability-aware picker is the narrower maintainable path. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f74117aeb7a9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Summary
The menu bar percent is driven by the layout's
%tokens, each carrying its ownPercentWindow(session/weekly/automatic). That is expressive, but the layouteditor is the only place to change it. An account whose stored metric preference resolves
to the weekly lane shows a nearly-full weekly percent with no obvious way to switch to
session — confusing on plans where exhausting a session does not come close to filling the
week, since a quick glance at the menu bar reads as "almost out".
menu_bar_metric_title/menu_bar_metric_subtitleare still translated in all 22catalogs but no longer referenced by any pane, which suggests this control used to exist
and was lost when layouts replaced the metric preference UI.
Changes
MenuBarPercentWindowPreference: maps the common case — every percent token in a layoutreading the same window — onto a single Auto/Session/Weekly choice, with pure
current(in:)/applied(to:)/hasPercentToken(in:)helpers.ProviderMenuBarPercentWindowSettingsView: a picker in the provider pane that writes aper-provider layout override through the existing
MenuBarLayoutEditorPersistence.activate.Session · Weekly) report "Custom" and are left to the layouteditor rather than being flattened. A layout with no percent token hides the picker.
layout editor's control.
Commands run
swift build --target CodexBar— clean (typechecks the whole module)node Scripts/check-app-locales.mjs—App locales OK: Checked 22 catalogs against 1479 English keys.Verification caveat
Developed on a machine with only CommandLineTools and no Xcode, so
make testandswiftlintcould not run here (Testingmodule unavailable; swiftlint fails loadingsourcekitdInProc), and there is no screenshot of the new picker for the same reason.Relying on CI for the suite — happy to iterate on anything it flags.