Skip to content

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

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

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

Conversation

@alfredjbclaw

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 on by default, 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. Add or refresh a medium/large CodexBar Usage widget configured for Claude; it shows Fable only after the
    normal Claude usage rows.
  3. In Preferences → Providers → Claude, turn off Show model-specific weekly usage in widgets; the Fable row is
    removed after the widget snapshot refresh. Turn it back on to restore 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.

@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 real behavior proof before merge. Reviewed August 4, 2026, 9:31 PM ET / August 5, 2026, 01:31 UTC.

ClawSweeper review

What this changes

The PR adds a default-on Claude preference that includes known model-scoped weekly quota rows, such as Fable, in Usage widgets.

Merge readiness

Blocked until real behavior proof is added - 8 items remain

Keep open: the visibility setting is bypassed when the widget reuses its cached Claude rows, and the PR still lacks after-fix runtime proof. It also edits the release-owned changelog contrary to repository policy.

Priority: P2
Reviewed head: 743abcb8b276dbddb54a68546c10ad57eb95afe8
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused but has a real cached-snapshot defect and no after-fix runtime proof.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR describes manual verification and synthetic tests but provides no inspectable redacted after-fix widget screenshot, recording, terminal output, or runtime log for either setting state. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR describes manual verification and synthetic tests but provides no inspectable redacted after-fix widget screenshot, recording, terminal output, or runtime log for either setting state. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items Fresh projection honors the setting: The new branch filters model-scoped Claude rows only while projecting a live usage snapshot.
Cached-row fallback bypasses it: When no current Claude snapshot exists, current main directly reuses preserved widget rows; that path has no model-scoped visibility filter.
Coverage misses the fallback: The added test disables the setting only with an in-memory Claude snapshot and does not exercise a preserved prior entry after the live snapshot disappears.
Findings 2 actionable findings [P2] Filter preserved scoped rows by the visibility setting
[P3] Remove the release-owned changelog entry
Security None None.

How this fits together

Claude usage fetchers place quota windows in a shared usage snapshot, and CodexBar projects that into a persisted widget snapshot for WidgetKit. The proposed preference determines whether model-scoped Claude rows enter that snapshot.

flowchart LR
A[Claude usage sources] --> B[Shared usage snapshot]
B --> C[Widget row projection]
D[Claude visibility setting] --> C
C --> E[Persisted widget snapshot]
E --> F[Desktop Usage widgets]
Loading

Decision needed

Question Recommendation
Should CodexBar ship model-scoped Claude widget rows behind a separate default-on persisted preference? Approve the separate opt-out: Keep the default-on preference after the cached-row fix, with documentation and runtime proof of both states.

Why: The PR adds a new user-visible default and independent setting; existing discussion in the provided context supports a widget follow-up but does not establish approval for this specific preference contract.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR describes manual verification and synthetic tests but provides no inspectable redacted after-fix widget screenshot, recording, terminal output, or runtime log for either setting state. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Filter preserved scoped rows by the visibility setting (P2) - When the live Claude snapshot is absent, the widget reuses cached rows without applying this new setting. Disabling it therefore leaves a prior claude-weekly-scoped-* row visible until a successful refresh; filter preserved rows too and cover that fallback.
  • Remove the release-owned changelog entry (P3) - Repository policy reserves CHANGELOG.md for releases. Keep the user-visible release context in the PR body or commit message instead of editing this file.
  • Resolve merge risk (P1) - Disabling the new preference does not remove cached model-scoped rows when Claude has no current usage snapshot, so users can see a setting state the widget does not honor.
  • Resolve merge risk (P1) - The default-on persisted preference changes existing Claude widget contents; its product direction and upgrade behavior need maintainer confirmation.
  • Resolve merge risk (P1) - No redacted after-fix widget evidence demonstrates either enabled or disabled state in a real app run.
  • Complete next step (P2) - The two code-policy findings have a narrow mechanical repair, while real behavior proof and the preference direction remain human merge gates.

Findings

  • [P2] Filter preserved scoped rows by the visibility setting — Sources/CodexBar/UsageStore+WidgetSnapshot.swift:456-466
  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:18-19
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch composition production +42/-0, tests +141/-0, docs/changelog +11/-1 The focused implementation has substantial test additions, but they need one cached-snapshot regression case to cover the reported preference behavior.

Merge-risk options

Maintainer options:

  1. Repair cached snapshot filtering (recommended)
    Filter preserved Claude scoped rows by the preference, add a regression test for a missing live snapshot, and remove the release-owned changelog entry before merge.
  2. Choose the widget preference contract
    Confirm whether a separate default-on preference is the intended upgrade behavior before accepting the new widget default.
  3. Pause the presentation change
    Close or defer the PR if the product does not want model-scoped rows or another preference in existing widgets.

Technical review

Best possible solution:

Preserve the focused widget projection, filter scoped cached rows whenever the preference is off, remove the release-owned changelog edit, and land only after a maintainer confirms the separate default-on preference and sees redacted runtime proof.

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

Yes, from source: seed a prior Claude widget entry containing a scoped row, clear the live snapshot, disable the preference, and persist again; the fallback currently retains that row.

Is this the best way to solve the issue?

No. The fresh projection is appropriately generic, but the same visibility rule must apply to preserved rows, and the release-owned changelog entry should be removed.

Full review comments:

  • [P2] Filter preserved scoped rows by the visibility setting — Sources/CodexBar/UsageStore+WidgetSnapshot.swift:456-466
    When the live Claude snapshot is absent, the widget reuses cached rows without applying this new setting. Disabling it therefore leaves a prior claude-weekly-scoped-* row visible until a successful refresh; filter preserved rows too and cover that fallback.
    Confidence: 0.99
  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:18-19
    Repository policy reserves CHANGELOG.md for releases. Keep the user-visible release context in the PR body or commit message instead of editing this file.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The widget setting can visibly fail for cached Claude usage, but the defect is bounded to this new presentation path.
  • merge-risk: 🚨 compatibility: A persisted default-on widget preference can display stale scoped quota rows despite being disabled when the live Claude snapshot is unavailable.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR describes manual verification and synthetic tests but provides no inspectable redacted after-fix widget screenshot, recording, terminal output, or runtime log for either setting state. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Acceptance criteria:

  • [P1] swift test --filter UsageStoreWidgetSnapshotTests.
  • [P1] make check.
  • [P1] make test.

What I checked:

Likely related people:

  • steipete: Recent commits on the persisted widget-snapshot path include its test-isolation and provider-identity refactors. (role: recent widget-snapshot contributor; confidence: high; commits: 5a7468826e4f, 15a855a2132a, a6722f39bc83; files: Sources/CodexBar/UsageStore+WidgetSnapshot.swift)
  • konon4: The merged foundational change identified in the PR context introduced the Claude model-scoped weekly window data this PR consumes. (role: introduced shared Claude scoped-window behavior; confidence: medium; commits: 21e3beb37743; files: Sources/CodexBar/Providers/Claude/ClaudeOAuthUsageFetcher.swift, Sources/CodexBar/Providers/Claude/ClaudeWebExtraRateWindowParser.swift)

Rank-up moves

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

  • Filter cached scoped rows when the preference is disabled and add a preservation-fallback regression test.
  • Remove the CHANGELOG.md edit.
  • Post redacted evidence from a freshly built widget showing the enabled and disabled states; update the PR body to trigger re-review.

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 (5 earlier review cycles)
  • reviewed 2026-08-04T09:10:53.521Z sha 743abcb :: needs real behavior proof before merge. :: [P2] Filter retained scoped rows by the visibility setting
  • reviewed 2026-08-04T09:17:01.464Z sha 743abcb :: needs real behavior proof before merge. :: [P2] Filter retained scoped rows by the visibility setting
  • reviewed 2026-08-04T15:02:28.974Z sha 743abcb :: needs real behavior proof before merge. :: [P2] Filter preserved scoped rows when the setting is disabled | [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-04T16:38:27.692Z sha 743abcb :: needs real behavior proof before merge. :: [P2] Filter retained scoped rows when the setting is disabled | [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-04T19:59:12.123Z sha 743abcb :: needs real behavior proof before merge. :: [P2] Filter preserved scoped rows when the setting is disabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant