Skip to content

Widgets: show Claude model-scoped weekly quotas - #2645

Open
alfredjbclaw wants to merge 2 commits into
steipete:mainfrom
alfredjbclaw:fix/claude-scoped-weekly-widget
Open

Widgets: show Claude model-scoped weekly quotas#2645
alfredjbclaw wants to merge 2 commits into
steipete:mainfrom
alfredjbclaw:fix/claude-scoped-weekly-widget

Conversation

@alfredjbclaw

@alfredjbclaw alfredjbclaw commented Aug 4, 2026

Copy link
Copy Markdown

Draft PR: Widgets: show Claude model-scoped weekly quotas

Summary

  • Project known Claude model-scoped weekly windows from the shared extraRateWindows snapshot into Usage widgets.
    This surfaces Fable and future model carve-outs without adding another parser or provider-specific fetch path.
  • Add a Show model-specific weekly usage in widgets Claude provider setting. It is off by default (opt-in), updates the
    widget snapshot immediately, and is display-only.
  • Document the setting and widget behavior, add an unreleased changelog entry, and cover projection, rendering,
    default/persistence, and descriptor behavior with synthetic tests.

Why this follow-up

This PR only consumes the existing shared snapshot data. It does not change Claude authentication, fetching,
parsing, menu rows, CLI output, or Daily Routines visibility.

Validation

  • Passed locally: git diff --check, Swift parser validation for every changed Swift file, documentation
    index/link checks, and swift test --filter Widget (78 tests across six widget suites).
  • The final isolated Codex review reported no accepted/actionable findings.
  • Full CI will run the repository's normal formatting/lint and macOS test shards.

Manual verification

  1. Set a synthetic Claude snapshot that has Session, Weekly, and a known claude-weekly-scoped-fable window.
  2. In Preferences → Providers → Claude → Options, enable Show model-specific weekly usage in widgets (off by default).
  3. Add or refresh a medium/large CodexBar Usage widget configured for Claude; it shows Fable only after the
    normal Claude usage rows. Turning the setting off removes the row after the widget snapshot refresh; re-enabling restores it.

Notes for reviewers

  • Unknown-usage windows and claude-routines are intentionally excluded: neither represents a reliable
    model-scoped weekly percentage for this widget feature.
  • The projection uses the claude-weekly-scoped- ID namespace rather than a hard-coded Fable name, so new model
    carve-outs work automatically.

Review response — 2026-08-07 (head d55dba1d)

All blocking items addressed:

  1. [P2] Preserved scoped rows now respect the visibility setting. preservedClaudeWidgetUsage takes includesModelScopedWeeklyRows: and the no-live-snapshot fallback path filters persisted claude-weekly-scoped-* rows when the setting is disabled — a previously saved model-scoped row can no longer outlive turning the setting off.
  2. [P3] Release-owned changelog untouched. This branch no longer modifies CHANGELOG.md.
  3. Default flipped to OFF (opt-in). A fresh install keeps widgets on the standard quota lanes; enabling the Claude setting projects the model-scoped weekly carve-outs. This deliberately narrows the product surface of what was a default-on presentation change — happy to revisit if default-on is preferred.
  4. Rebased onto current main and revalidated against the declarative provider-details refactor — projection re-verified as wired on the current architecture, not just textually merged.

Proof — terminal output covering both setting states

✔ Test "widget snapshot includes known Claude model scoped weekly quotas only when enabled" passed after 0.169 seconds.
✔ Test "widget snapshot drops persisted Claude model scoped weekly rows once the setting is off" passed after 0.170 seconds.
✔ Test "Claude model scoped widget usage defaults off persists and refreshes only menus" passed after 0.156 seconds.
✔ Test "Claude widget renders projected model scoped weekly rows" passed after 0.001 seconds.
✔ Test run with 119 tests in 7 suites passed after 0.470 seconds.

Full sharded suite (make test): 27/28 groups green with this diff. The single failing suite, CostUsagePricingTests (4 float expectations on codex pricing), fails identically on clean current main in the same environment, verified by stashing this diff and re-running — unrelated to this change.


Proof — live widget, setting off → on → off (redacted)

Redacted before/after captures from a live desktop Usage widget configured for Claude (not synthetic data). Account cost/token figures are blacked out; the quota percentages are the feature payload.

Provider setting (Preferences → Providers → Claude → Options):

Toggle off (default) Toggle on
model-scoped weekly setting off model-scoped weekly setting on

Widget, setting off → on — the Fable only weekly row appears after the standard Session/Weekly lanes:

Setting off — standard lanes only Setting on — Fable weekly row added
Claude widget, model-scoped weekly off Claude widget, model-scoped weekly on, Fable only row present

Setting on → off again — the row is removed and the standard lanes are restored (drop and restore):

Claude widget after turning the setting back off, Fable row gone

The row appears and disappears live as the toggle flips, with no app relaunch.

Widget shots were captured from a locally Apple-Development-signed build with the app-group container remapped to the test team (the shipping group belongs to the upstream team and cannot be provisioned locally); feature/display logic is unchanged.

@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: 743abcb8b2

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

Comment on lines +456 to +460
if provider == .claude, self.settings.claudeModelScopedWeeklyUsageVisible {
// Claude fetchers place model-scoped weekly quotas (for example, Fable) in extraRateWindows.
// Keep the widget projection generic so newly surfaced Claude model quotas appear without UI changes.
rows.append(contentsOf: (snapshot.extraRateWindows ?? []).compactMap { namedWindow in
guard namedWindow.id.hasPrefix("claude-weekly-scoped-"), namedWindow.usageKnown else { return nil }

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 Honor hidden scoped quotas when reusing Claude widget rows

When Claude has no in-memory usage snapshot, such as just after launch before OAuth/Web refresh succeeds or while a failed refresh preserves the previous widget data, makeWidgetEntry falls back to preservedClaudeUsage?.usageRows from the prior on-disk snapshot. Rows added here are persisted as claude-weekly-scoped-*, but the new setting is only checked during fresh projection, so turning Show model-specific weekly usage in widgets off in that state rewrites the snapshot with the old Fable rows still visible until a successful Claude usage fetch. Apply the setting when preserving/filtering previous rows as well.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 2:55 AM ET / 06:55 UTC.

ClawSweeper review

What this changes

This PR adds an off-by-default Claude preference that displays known model-scoped weekly quotas in desktop Usage widgets.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer feature sign-off. The branch is a focused opt-in widget enhancement, its persisted-snapshot fallback is filtered correctly, and supplied redacted screenshots demonstrate the live widget behavior.

Priority: P2
Reviewed head: 66df58d96a8a1e748a71a3b2fbbb8cd7ef2e2fb1
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with direct live UI proof and targeted regression coverage, pending the required product decision.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Prepared redacted screenshots directly show the preference off and on and a live Claude widget without and with the Fable-only row.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Prepared redacted screenshots directly show the preference off and on and a live Claude widget without and with the Fable-only row.
Evidence reviewed 8 items Current main lacks this widget projection: The current widget projection only appends Claude's standard lanes and has special extra-window handling for Kimi; it has no Claude model-scoped weekly setting or row projection.
Branch projects only known scoped rows: The PR appends Claude extra windows only when the opt-in setting is enabled, filters by the established scoped-window prefix, and excludes unknown usage.
Persisted fallback respects disabling: The branch filters previously persisted scoped rows when the setting is off, covering the no-live-snapshot path raised in the earlier review.
Findings None None.
Security None None.

How this fits together

Claude usage sources produce shared quota windows, which CodexBar projects into a persisted widget snapshot. The desktop widget reads that snapshot, while the new preference determines whether model-scoped weekly rows are included.

flowchart LR
A[Claude usage sources] --> B[Shared quota windows]
C[Widget visibility setting] --> D[Widget snapshot projection]
B --> D
D --> E[Persisted widget snapshot]
E --> F[Desktop Usage widget]
E --> G[Offline fallback rows]
Loading

Decision needed

Question Recommendation
Should CodexBar add an opt-in Claude setting for model-scoped weekly quota rows in desktop widgets? Sponsor the opt-in widget rows: Accept the new setting and retain the branch's default-off behavior and persisted-row filtering.

Why: The implementation is bounded and proven, but VISION.md reserves new features for maintainer sign-off.

Before merge

  • Resolve merge risk (P1) - The only unresolved merge consideration is product acceptance: VISION.md requires sign-off for a new preference and widget surface.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and test delta production +55/-2, docs +10/-1, tests +270 The feature adds a small persisted-setting and widget-projection path with substantial focused coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    If sponsored, merge the narrow off-by-default projection so existing widgets remain unchanged until a Claude user explicitly enables the extra weekly quota rows.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

If sponsored, merge the narrow off-by-default projection so existing widgets remain unchanged until a Claude user explicitly enables the extra weekly quota rows.

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

Not applicable: this PR introduces an opt-in widget capability rather than repairing established broken behavior; the supplied live screenshots nevertheless demonstrate both setting states.

Is this the best way to solve the issue?

Yes, conditionally: it reuses the already-shipped generic Claude quota windows, leaves existing widget defaults intact, and avoids adding a fetcher or parser path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8d113c642516.

Labels

Label justifications:

  • P2: This is a bounded optional widget enhancement with limited impact on existing users.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Prepared redacted screenshots directly show the preference off and on and a live Claude widget without and with the Fable-only row.
  • proof: sufficient: Contributor real behavior proof is sufficient. Prepared redacted screenshots directly show the preference off and on and a live Claude widget without and with the Fable-only row.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Prepared redacted screenshots directly show the preference off and on and a live Claude widget without and with the Fable-only row.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger merged the related Claude scoped-window ordering work and is the strongest available owner for the product decision. (role: recent area contributor and merger; confidence: high; commits: 0611e8e634c8, 330ae4384b18; files: Sources/CodexBar/UsageStore+WidgetSnapshot.swift, VISION.md)
  • konon4: Ivan Kononov authored the merged change that introduced the generic Claude model-scoped quota windows consumed by this PR. (role: introduced shared data behavior; confidence: high; commits: 21e3beb37743; files: Sources/CodexBarCore/Providers/Claude/ClaudeScopedWeeklyLimitMapper.swift)

Rank-up moves

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

  • Obtain maintainer sign-off for the new Claude widget preference.

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 (15 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-05T13:32:19.811Z sha 743abcb :: needs real behavior proof before merge. :: [P2] Filter preserved scoped rows by the visibility setting | [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-07T23:52:42.882Z sha d55dba1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-08T05:03:41.684Z sha d55dba1 :: needs real behavior proof before merge. :: [P2] Register the new Claude branch with the provider gatekeeper
  • reviewed 2026-08-08T11:26:49.408Z sha d55dba1 :: needs real behavior proof before merge. :: [P2] Register the new Claude branch with the provider gatekeeper
  • reviewed 2026-08-08T23:41:51.867Z sha d55dba1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-09T04:56:06.418Z sha d55dba1 :: needs real behavior proof before merge. :: [P2] Register the new Claude widget branch with the gatekeeper
  • reviewed 2026-08-09T07:16:43.803Z sha d55dba1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-10T22:59:46.595Z sha 66df58d :: needs real behavior proof before merge. :: none

@alfredjbclaw
alfredjbclaw force-pushed the fix/claude-scoped-weekly-widget branch from 743abcb to d55dba1 Compare August 7, 2026 23:49
@alfredjbclaw

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Aug 7, 2026
@alfredjbclaw
alfredjbclaw force-pushed the fix/claude-scoped-weekly-widget branch from d55dba1 to 66df58d Compare August 10, 2026 22:55
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. 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. 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 Aug 11, 2026
@alfredjbclaw

Copy link
Copy Markdown
Author

@steipete Gentle ping on the product decision here — ClawSweeper has this at ready for maintainer look with no contributor-facing items left; the one open box is the VISION.md sign-off for the new (default-off) Claude model-scoped weekly rows in the Usage widgets.

No rush. If you want it, I'm happy to rebase onto current main and adjust anything to taste; if it doesn't fit the product direction, equally happy to close it out.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant