Widgets: show Claude model-scoped weekly quotas - #2645
Conversation
There was a problem hiding this comment.
💡 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".
| 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 } |
There was a problem hiding this comment.
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 👍 / 👎.
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 2:55 AM ET / 06:55 UTC. ClawSweeper reviewWhat this changesThis PR adds an off-by-default Claude preference that displays known model-scoped weekly quotas in desktop Usage widgets. Merge readinessKeep 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 Review scores
Verification
How this fits togetherClaude 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]
Decision needed
Why: The implementation is bounded and proven, but VISION.md reserves new features for maintainer sign-off. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel 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
HistoryReview history (15 earlier review cycles; latest 8 shown)
|
743abcb to
d55dba1
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d55dba1 to
66df58d
Compare
|
@steipete Gentle ping on the product decision here — ClawSweeper has this at 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. |
Draft PR: Widgets: show Claude model-scoped weekly quotas
Summary
extraRateWindowssnapshot into Usage widgets.This surfaces Fable and future model carve-outs without adding another parser or provider-specific fetch path.
widget snapshot immediately, and is display-only.
default/persistence, and descriptor behavior with synthetic tests.
Why this follow-up
extraRateWindowsmapping for model-scoped weekly Claude quotas.once shared snapshot propagation existed.
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
git diff --check, Swift parser validation for every changed Swift file, documentationindex/link checks, and
swift test --filter Widget(78 tests across six widget suites).Manual verification
claude-weekly-scoped-fablewindow.normal Claude usage rows. Turning the setting off removes the row after the widget snapshot refresh; re-enabling restores it.
Notes for reviewers
claude-routinesare intentionally excluded: neither represents a reliablemodel-scoped weekly percentage for this widget feature.
claude-weekly-scoped-ID namespace rather than a hard-coded Fable name, so new modelcarve-outs work automatically.
Review response — 2026-08-07 (head
d55dba1d)All blocking items addressed:
preservedClaudeWidgetUsagetakesincludesModelScopedWeeklyRows:and the no-live-snapshot fallback path filters persistedclaude-weekly-scoped-*rows when the setting is disabled — a previously saved model-scoped row can no longer outlive turning the setting off.CHANGELOG.md.Proof — terminal output covering both setting states
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):
Widget, setting off → on — the Fable only weekly row appears after the standard Session/Weekly lanes:
Setting on → off again — the row is removed and the standard lanes are restored (drop and restore):
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.