Skip to content

Add scoped-weekly (Fable) percentage as a menu-bar layout token - #2440

Merged
steipete merged 11 commits into
steipete:mainfrom
lucacampanella:feat/menu-bar-scoped-weekly-token
Aug 3, 2026
Merged

Add scoped-weekly (Fable) percentage as a menu-bar layout token#2440
steipete merged 11 commits into
steipete:mainfrom
lucacampanella:feat/menu-bar-scoped-weekly-token

Conversation

@lucacampanella

@lucacampanella lucacampanella commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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

Open UX choice

The prefix defaults to F and 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 main for 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 emits F 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 shows F –:

Screenshot 2026-07-24 at 12 15 03

The dropdown "Fable only" window this mirrors, for reference:

Screenshot 2026-07-24 at 12 15 10

@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: 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".

Comment on lines +240 to +242
case .scopedWeekly:
prefix = "F"
accessibilityPrefix = L("Fable only")

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 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 👍 / 👎.

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.

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.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 12:24 PM ET / 16:24 UTC.

ClawSweeper review

What this changes

Adds 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 readiness

⚠️ Ready for maintainer review - 1 item remains

The PR is a coherent, proof-backed implementation of the requested menu-bar capability. Current main already contains the prerequisite pace-token vocabulary from the merged predecessor, and the PR head resolves that integration; the remaining action is ordinary maintainer merge review, not automated repair or closure.

Priority: P3
Reviewed head: 9ef71bbcda57aee35ded54a8c5ce7bfd5332b027

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused feature patch with direct UI proof, regression coverage across the resolver/render/refresh boundary, complete localization updates, and an owner-resolved integration pass.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The PR supplies a screenshot showing the scoped percentage in the menu bar and its unavailable fallback for Codex; the owner additionally documented fresh-head artifact verification and focused layout/check results. No private information is visible in the reviewed evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The PR supplies a screenshot showing the scoped percentage in the menu bar and its unavailable fallback for Codex; the owner additionally documented fresh-head artifact verification and focused layout/check results. No private information is visible in the reviewed evidence.
Evidence reviewed 6 items Current producer boundary: Current main already treats claude-weekly-scoped-* extra windows as distinct Claude quota lanes, so the PR consumes an established provider-owned data shape rather than parsing a new source.
Scoped token implementation: The PR adds scopedWeekly, resolves only active non-placeholder claude-weekly-scoped-* windows, chooses the highest-used window, and preserves the named window so rendering can use the active model label.
Rendering and refresh coverage: The branch routes the selected window and title into the status-item render data, renders an unavailable placeholder when absent, and includes scoped usage and title in the icon-observation signature so a scoped-only update redraws the menu-bar title.
Findings None None.
Security None None.

How this fits together

CodexBar 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
Loading

Before merge

  • Complete next step (P2) - No mechanical repair is indicated; the branch is ready for ordinary maintainer merge review at its current clean head.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and regression coverage production +47/-0, tests +72/-2 The persistent-token and refresh-path addition is accompanied by focused resolver, renderer, placeholder, and drag-transfer coverage.
Localized surface 33 files affected; 23 locale catalogs updated The generic editor label is consistently available across the supported localized layout editor surface.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #2360
Summary: This PR is the concrete candidate implementation for the open scoped-weekly menu-bar token request; the merged pace-token PR is an adjacent prerequisite rather than the same remaining behavior.

Members:

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

Technical review

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

Labels

Label changes:

  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P3: This is a low-risk, opt-in menu-bar layout capability rather than a correction to existing user behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR supplies a screenshot showing the scoped percentage in the menu bar and its unavailable fallback for Codex; the owner additionally documented fresh-head artifact verification and focused layout/check results. No private information is visible in the reviewed evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies a screenshot showing the scoped percentage in the menu bar and its unavailable fallback for Codex; the owner additionally documented fresh-head artifact verification and focused layout/check results. No private information is visible in the reviewed evidence.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR supplies a screenshot showing the scoped percentage in the menu bar and its unavailable fallback for Codex; the owner additionally documented fresh-head artifact verification and focused layout/check results. No private information is visible in the reviewed evidence.

Evidence

What I checked:

  • Current producer boundary: Current main already treats claude-weekly-scoped-* extra windows as distinct Claude quota lanes, so the PR consumes an established provider-owned data shape rather than parsing a new source. (Sources/CodexBar/UsageStore+QuotaWarnings.swift:149, e59539db730b)
  • Scoped token implementation: The PR adds scopedWeekly, resolves only active non-placeholder claude-weekly-scoped-* windows, chooses the highest-used window, and preserves the named window so rendering can use the active model label. (Sources/CodexBar/MenuBarLayout.swift:4, 9ef71bbcda57)
  • Rendering and refresh coverage: The branch routes the selected window and title into the status-item render data, renders an unavailable placeholder when absent, and includes scoped usage and title in the icon-observation signature so a scoped-only update redraws the menu-bar title. (Sources/CodexBar/MenuBarLayoutRenderer.swift:240, 9ef71bbcda57)
  • Predecessor integration: The prerequisite pace-token work is already on current main through the merged predecessor, and the PR head was subsequently updated to coexist with it; current main history identifies the merged pace-token commit as the relevant shared vocabulary change. (Sources/CodexBar/MenuBarLayout.swift:4, f93e3ed460ad)
  • Head proof and merge state: The repository owner reports that commit 9ef71bbcd resolves current-main conflicts, adds explicit drag-transfer coverage, and passed the focused layout suite plus make check; supplied GitHub state marks this head cleanly mergeable. (Tests/CodexBarTests/MenuBarLayoutEditorTests.swift:143, 9ef71bbcda57)
  • Repository policy: The repository policy asks for focused logic coverage and stable model/render seams rather than live AppKit automation; the branch adds layout, renderer, resolver, editor drag-transfer, and localization coverage and supplies a status-item screenshot. (AGENTS.md:1, e59539db730b)

Likely related people:

  • Peter Steinberger: Introduced the layout model, renderer, and editor on current main; later resolved the PR’s generic-label/localization and current-main integration work in the PR discussion. (role: menu-bar layout feature owner and recent integrator; confidence: high; commits: d60a007e, 99eaa55d, 0f070a38; files: Sources/CodexBar/MenuBarLayout.swift, Sources/CodexBar/MenuBarLayoutEditor.swift, Sources/CodexBar/MenuBarLayoutRenderer.swift)
  • Petr Kratochvíl: Authored the merged pace-token expansion that this branch deliberately stacks alongside, including the related layout and refresh-signature paths. (role: adjacent token-vocabulary contributor; confidence: high; commits: f93e3ed4; files: Sources/CodexBar/MenuBarLayout.swift, Sources/CodexBar/MenuBarLayoutRenderer.swift, Sources/CodexBar/StatusItemController+IconObservation.swift)

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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-02T22:19:27.994Z sha 9ce0d6f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T22:39:54.880Z sha 9ce0d6f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T23:21:06.827Z sha 9e015f8 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T00:13:55.116Z sha 66f4b97 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T00:19:35.654Z sha 66f4b97 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T01:49:33.614Z sha 66f4b97 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T11:46:21.995Z sha 66f4b97 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T15:56:31.068Z sha 66f4b97 :: needs maintainer review before merge. :: none

lucacampanella and others added 2 commits July 31, 2026 11:31
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>
@lucacampanella
lucacampanella force-pushed the feat/menu-bar-scoped-weekly-token branch from 0d53922 to 7631fb8 Compare July 31, 2026 09:36
@clawsweeper clawsweeper Bot added 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 rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 31, 2026
kratocz and others added 6 commits August 2, 2026 21:28
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
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Gate update: I merged current origin/main, then stacked the reviewed #2540 branch because this token extends the same persistent PercentWindow vocabulary. Until #2540 merges, this PR is intentionally ordered after it; please land #2540 first, then #2440.

I resolved the two overlapping layout-editor/test hunks, renamed the persistent palette label from Fable % to the model-generic Scoped weekly % in every locale catalog, and kept the rendered status-item prefix/title driven by the active scoped model. Scoped weekly remains percentage-only: no scoped pace token is offered, and the pace renderer/observation switches explicitly treat the otherwise constructible .pace(.scopedWeekly) value as unavailable. The Unreleased changelog now credits @lucacampanella.

Proof on head 9ce0d6f6f6:

  • swift test --filter 'MenuBarLayout|UsagePace|StatusItemLayoutPaceSignature|HistoricalUsagePace' — 132 tests passed
  • make check — passed; app locales aligned, SwiftFormat clean, SwiftLint 0 violations in 1,690 files
  • structured Codex autoreview against origin/main — clean, no accepted/actionable findings
  • artifact check — the freshly built English resource resolves the label to Scoped weekly %; the existing runtime screenshot shows both F 75% and the unavailable F – state

No PR was merged.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. and removed 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. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 2, 2026
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Owner

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 LocalizationLanguageCatalogTests correctly rejected it as an unapproved unchanged value.

Fixed in 9e015f897c by providing localized scoped-weekly labels in all 22 non-English catalogs rather than weakening the contract. Local proof: 66 localization/layout tests passed, including the exact Italian test; make check remained clean; local and full-branch structured autoreviews remained clean.

Replacement run 30771718203 is fully green: Linux x64/arm64/musl, both macOS shards, lint, GitGuardian, and lint-build-test all passed. The #2540-before-#2440 ordering dependency remains unchanged.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 3, 2026
Co-authored-by: Luca Campanella <luca.campanella1@gmail.com>
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Resolved the current main conflicts in 9ef71bbcd without merging the PR.

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:

  • swift test --filter MenuBarLayout — 36 tests across layout, renderer, and editor suites passed
  • make check — passed (SwiftFormat clean; SwiftLint 0 violations)
  • Codex autoreview against origin/main — clean, no accepted/actionable findings

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Aug 3, 2026
@steipete
steipete merged commit 36541fe into steipete:main Aug 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants