Add scoped-weekly (Fable) percentage as a menu-bar layout token - #2440
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a8187071f
ℹ️ 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".
| case .scopedWeekly: | ||
| prefix = "F" | ||
| accessibilityPrefix = L("Fable only") |
There was a problem hiding this comment.
Preserve the scoped weekly model label
When Claude exposes a scoped weekly limit for any model other than Fable, or when a non-Fable scoped limit is the most constrained one, this branch still renders the menu-bar token and accessibility text as F/Fable only. The resolver added in this change intentionally accepts any claude-weekly-scoped- id and the new test even covers someothermodel, so users can see a Fable quota for a different model and make decisions from the wrong usage lane. Carry the NamedRateWindow.title (or restrict the resolver to Fable only) before hard-coding the label here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0d53922. The resolver now returns the NamedRateWindow, and the token derives its label from the active window's title: the bar prefix is the first letter of the model (F for Fable, H for a hypothetical Haiku window) and the accessibility text is the full title, e.g. "Fable only". I carried the title rather than restricting the resolver to Fable, so a rotated promo still labels the correct model.
Added a resolver test that makes a non-Fable scoped window the most constrained and asserts its title is the one carried through.
The editor palette label stays "Fable %" for now, since Fable is the only scoped window today and it reads the same across locales; glad to switch it to a generic term if you'd prefer.
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 12:24 PM ET / 16:24 UTC. ClawSweeper reviewWhat this changesAdds a model-scoped weekly percentage token to the configurable menu-bar layout, resolving Claude’s active scoped weekly carve-out, rendering its active-model label, refreshing on scoped-only changes, and localizing the editor label. Merge readinessThe PR is a coherent, proof-backed implementation of the requested menu-bar capability. Current Priority: P3 Review scores
Verification
How this fits togetherCodexBar turns provider usage snapshots into configurable menu-bar tokens. Claude scoped weekly windows enter the snapshot as named extra rate windows; this PR selects the most constrained active one and carries it through layout persistence, rendering, accessibility text, and title-refresh observation. flowchart LR
A[Claude usage snapshot] --> B[Named scoped weekly windows]
B --> C[Scoped weekly resolver]
C --> D[Persistent layout token]
D --> E[Menu-bar renderer]
C --> F[Refresh signature]
F --> G[Status item update]
E --> G
Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Merge this focused scoped-weekly percentage token after the normal exact-head review, preserving the model-generic editor vocabulary and active-model rendering established in the owner’s integration update. Do we have a high-confidence way to reproduce the issue? Not applicable as a defect report: the PR adds a new opt-in layout token. The supplied after-fix menu-bar screenshot directly shows the selected Claude scoped value and the unavailable Codex placeholder, and the owner’s follow-up confirms the rebuilt head retains those states. Is this the best way to solve the issue? Yes. Reusing the existing named scoped-window snapshot contract, keeping the saved editor token model-generic, and deriving the visible prefix/accessibility label from the active scoped model is narrower and safer than adding a Fable-specific setting. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e59539db730b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
Claude's model-scoped weekly carve-outs (the "Fable only" window from steipete#1851) already show in the dropdown and in quota notifications, but the always-visible menu bar could only show session, weekly, or automatic. This adds a scoped-weekly token so the promo-window limit can sit in the bar. - New PercentWindow.scopedWeekly, shown with an "F" prefix, selectable in the layout editor (palette, label, live and representative previews). - scopedWeeklyWindow resolver matches the claude-weekly-scoped-* id prefix rather than a model name; when several are active it shows the most constrained one. - The scoped-weekly percent is added to the icon-observation signature so a scoped-only change refreshes the title, mirroring weekly= and avoiding the stale-title problem from steipete#2300 and steipete#2299. - Absent window renders the standard "–" placeholder; editor label localized. Addresses steipete#2360. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codex flagged that the token hard-coded "F" / "Fable only" while the resolver accepts any claude-weekly-scoped-* window and picks the most constrained, so a non-Fable window could be shown under the wrong model label. - scopedWeeklyNamedWindow now returns the NamedRateWindow. - The .scopedWeekly token derives its prefix from the active window's title (first letter) and its accessibility text from the full title, instead of a fixed "F" / "Fable only". - Carry the title through MenuBarLayoutRenderData and include it in the icon-observation signature, so a model change refreshes the title. - Resolver test now asserts a non-Fable most-constrained window carries its title. The editor palette label stays "Fable %" (a proper noun that reads the same across locales); a generic name is left as a naming choice. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0d53922 to
7631fb8
Compare
The 0.45 layout editor replaced the old Percent/Pace/Both display modes, but no token exposes the signed pace delta the Both mode used to render. `Runs out` is not a substitute: it answers when a window ends, always estimating from the weekly (or automatic) lane, while pace answers how far off the sustainable rate usage currently runs. Add Session/Weekly/Auto pace tokens that mirror the percent tokens' window selection and reuse the existing `MenuBarDisplayText.paceText` formatting (`+11%` ahead of the rate, `-8%` behind, `0%` on pace). Each token resolves pace for its own window, so Weekly pace never borrows the session delta. Pace needs the store's historical dataset and work-day setting, so it is resolved upstream like `runsOut` through a shared `menuBarLayoutPaceText` helper that both the status item and the editor preview call. The existing 3% expected-usage floor in `weeklyPace` still applies, so a token renders the en-dash placeholder early in a window while its siblings stay visible. Refs steipete#2534
Pace values change with the historical dataset, the work-day setting, and the clock, none of which move the percent fields already hashed by providerStoreIconObservationSignature. A historicalPaceRevision bump therefore woke the icon observer but produced an unchanged signature, so updateIcons() was skipped and a custom pace token kept its stale value until an unrelated icon change forced a redraw. Contribute the active layout's pace values to the signature the same way cost and account tokens already do, gated on the layout actually containing a pace token. The regression test renders two snapshots with identical used percents but different resets: without this fix both signatures were identical. Refs steipete#2534
|
Gate update: I merged current I resolved the two overlapping layout-editor/test hunks, renamed the persistent palette label from Proof on head
No PR was merged. |
|
CI follow-up: macOS shard 0 exposed one localization-contract issue in the first run. The generic English label had been copied verbatim into Italian, so Fixed in Replacement run |
Co-authored-by: Luca Campanella <luca.campanella1@gmail.com>
|
Resolved the current Semantic result: Session/Weekly/Auto pace tokens, the percentage-only Scoped weekly % token, and the draggable editor all coexist. Exhaustive scoped-weekly pace paths render unavailable rather than borrowing another lane, and the scoped token now has explicit drag-transfer coverage. Proof:
|
Summary
Claude's model-scoped weekly carve-outs, like the "Fable only" window from #1851, already show in the dropdown and in quota notifications. The always-visible menu bar title could only show session, weekly, or automatic. During a promo window like Fable 5, the scoped weekly quota is often the number you most want at a glance, and it lived one click away.
This adds a scoped-weekly token to the custom menu bar layout, so that number can sit in the bar. Requested in #2360.
What it does
PercentWindow.scopedWeekly, shown with anFprefix (for exampleF 48%), available as a "Fable %" token in the layout editor: palette, label, and both the live and representative previews.scopedWeeklyWindowmatches theclaude-weekly-scoped-*id prefix rather than a specific model, so it keeps working if the promo rotates to another model.–placeholder when none is active.weekly=handling and avoids the stale-title problem from Custom menu-bar cost tokens stay stale after token-cost refresh #2300 and Custom menu-bar reset tokens do not schedule their own refreshes #2299.Open UX choice
The prefix defaults to
Fand the editor label to "Fable %", since Fable is the only scoped window today. I can make the label generic or derive it from the model name if you prefer. I'm flagging it because #2360 is marked needs-product-decision.Credit and relationship to #2372
This started from @smkwray's #2372. I checked out that branch to try its scoped-weekly card fix, then built the menu-bar token on top of it so I could run both together locally. The two touch different files and have no code dependency, so I rebased this onto
mainfor review and it stands alone. They fit together: #2372 adds pace and reserve detail to the scoped weekly card in the dropdown, and this puts the same window's percentage in the menu-bar title. Credit to @smkwray for the scoped-weekly card work that led me here.Test plan
swift build: clean.swift test --filter "MenuBarLayoutTests|MenuBarLayoutRendererTests": 23 pass. New coverage checks that the renderer emitsF 80%, that the placeholder renders when the window is absent, and that the resolver picks the most-constrained window, ignores non-scoped windows, and returns nil when there is none../Scripts/lint.sh lint: 0 violations across 1581 files, app locales OK across 22 catalogs.Screenshots
Menu bar with Claude selected. The
F 75%sits after Weekly; Codex has no scoped window, so it showsF –:The dropdown "Fable only" window this mirrors, for reference: