Skip to content

Notify on Claude extra-window quota thresholds (Fable, Daily Routines)#1887

Merged
steipete merged 5 commits into
steipete:mainfrom
cleanerzkp:claude-extra-window-notifications
Jul 4, 2026
Merged

Notify on Claude extra-window quota thresholds (Fable, Daily Routines)#1887
steipete merged 5 commits into
steipete:mainfrom
cleanerzkp:claude-extra-window-notifications

Conversation

@cleanerzkp

@cleanerzkp cleanerzkp commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Claude's model-scoped weekly windows (claude-weekly-scoped-*, such as the promotional Fable carve-out) and Daily Routines (claude-routines) already render in the menu, but quota-warning notifications only covered the primary session and weekly lanes.

This extends the existing quota-warning path to Claude's named extra windows:

  • Reuses the existing weekly toggle and thresholds, with no new settings surface (consistent with the product call in Add toggles to hide extra rate windows from menu bar #1123).
  • Keys warning state and OS notification identifiers by windowID, so sibling windows notify independently.
  • Shows the real window label in notification copy (for example, "Fable only" or "Daily Routines").
  • Preserves fired-threshold state across missing web-extras payloads, preventing duplicate alerts after a transient browser-enrichment failure.
  • Reconciles absent tracked IDs when another notifiable window makes the payload authoritative, so a later incarnation can warn again.
  • Clears all Claude extra-window state on an explicit weekly-warning opt-out.
  • Excludes Antigravity summary windows, which already feed the primary/weekly lanes.
  • Adds the user-facing changelog entry and thanks @cleanerzkp.

Scope notes

  • Extra windows intentionally share the weekly notification toggle; there is no independent opt-out.
  • NamedRateWindow.title is provider-supplied and currently English, matching its existing menu presentation.

Validation

  • swift test --filter 'ClaudeExtraWindowQuotaWarningTests|QuotaWarningNotificationLogicTests|UsageStoreSessionQuotaTransitionTests' — 43 tests passed.
  • make check — format, lint, locale, repository, security, release, and package checks passed.
  • make test — all 47 shards passed.
  • Structured Codex autoreview on exact head 37733252d174cc47dab3c88117daf3209dfb0143 — no accepted/actionable findings.
  • Signed production bundle via ./Scripts/compile_and_run.sh — built, packaged, launched, and remained running.
  • Real-account live proof using the existing Chrome profile: the Claude usage page exposed the Fable weekly window at 74% used; the exact built app posted its OS notification and rendered the click-through Claude Fable only quota low overlay at 26% remaining. Account identity was redacted and the screenshot stayed local.
  • User preferences were captured before the live test and restored exactly afterward; no SecurityAgent process appeared.

Regression coverage

  • Fable scoped-weekly and Daily Routines emit independent warnings with distinct state and notification ids.
  • Transient missing extra-window payloads preserve fired state.
  • Authoritative partial payloads prune state for windows that disappeared while sibling windows remain.
  • Explicit weekly opt-out clears Claude extra-window state.
  • Antigravity summary windows do not enter the Claude-only lane.
  • Notification copy uses the extra-window label.

Claude's model-scoped weekly windows (claude-weekly-scoped-*, e.g. the
promotional Fable carve-out) and Daily Routines (claude-routines) reach
the menu but were silent for quota-warning notifications. Only the
session and weekly lanes fired, so you can hit 100% Fable with no warning.

Add a generic extra-window notification lane mirroring the Antigravity
special case:
- Generic over the Claude extra-window ids, so a future carve-out (or
  Fable's return) surfaces automatically.
- Reuses the existing weekly toggle/thresholds; no new settings surface.
- Adds a windowID discriminator to QuotaWarningStateKey so sibling
  windows keep independent fired-threshold state.
- Notification copy shows the real window name ("Fable only",
  "Daily Routines"); OS notification ids stay unique per window.
- Prunes fired-threshold state when a scoped window disappears.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown

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

Summary
The branch adds Claude extra-window quota warnings with per-window state/notification identifiers, user-facing copy using the named window label, regression tests, and a changelog entry.

Reproducibility: yes. at source level: current main emits Claude extraRateWindows, while quota-warning transitions only process primary and secondary lanes. I did not run a live Claude account in this read-only review.

Review metrics: 2 noteworthy metrics.

  • Changed surface: 6 files changed, +408/-8. The patch is focused, but it changes user-visible notification behavior and warning-state semantics.
  • Test surface: 1 test file added, 1 test file extended. The branch adds focused regression coverage for the new Claude extra-window notification lane and notification copy.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Maintainers should explicitly accept or reject using the existing weekly warning setting for Claude extra-window alerts before merge.

Mantis proof suggestion
A short visible macOS notification/overlay proof would materially help maintainers if they want stronger proof than the PR-body live-output transcript. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify CodexBar posts a Claude extra-window quota warning for Fable or Daily Routines when a configured weekly threshold is crossed.

Risk before merge

  • [P1] Existing users who enabled Claude weekly quota warnings may start receiving Fable/Daily Routines alerts without a separate opt-out; that appears intentional, but maintainers should accept the preference semantics before merge.
  • [P1] The PR body supplies live-output proof rather than an attached screenshot/log artifact, so maintainers may still want visual proof if they need higher confidence in the macOS notification path.
  • [P1] At inspection time some GitHub macOS test shards were queued or running; merge should wait for normal required-check completion.

Maintainer options:

  1. Accept Weekly-Toggle Coverage (recommended)
    Maintainers can merge after explicitly accepting that the stored Claude weekly warning preference now includes Fable and Daily Routines extra-window quota alerts.
  2. Gate Extra-Window Alerts
    If weekly warnings should not imply extra-window alerts, revise the branch to preserve current behavior by default and add a separate opt-in or maintainer-approved policy path.

Next step before merge

  • [P2] Maintainer review should decide whether the weekly warning setting intentionally includes Claude extra-window alerts; there is no concrete automated repair needed.

Security
Cleared: The diff changes local Swift notification state/copy, tests, and a changelog line; it adds no dependency, workflow, credential, network, or supply-chain execution surface.

Review details

Best possible solution:

Land the branch if maintainers accept that Claude weekly quota-warning preferences cover named extra windows; otherwise keep current behavior as the default and add an explicit policy gate for extra-window alerts.

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

Yes at source level: current main emits Claude extraRateWindows, while quota-warning transitions only process primary and secondary lanes. I did not run a live Claude account in this read-only review.

Is this the best way to solve the issue?

Likely yes: the per-window state key and notification identifier/copy changes are narrow and reuse the existing weekly warning path. The remaining decision is whether weekly warning settings should intentionally cover these extra windows.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3191f129f994.

Label changes

Label justifications:

  • P2: This is a bounded user-visible Claude quota-warning improvement with limited blast radius.
  • merge-risk: 🚨 compatibility: Merging broadens an existing stored weekly warning preference by sending Claude extra-window alerts without a separate opt-out.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes after-fix real-account live-run proof describing the built app posting the Claude Fable-only quota notification and overlay, though no public screenshot is attached.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix real-account live-run proof describing the built app posting the Claude Fable-only quota notification and overlay, though no public screenshot is attached.
Evidence reviewed

What I checked:

Likely related people:

  • steipete: Authored the latest hardening commits on this PR and supplied the related product decision against per-extra-window settings in Add toggles to hide extra rate windows from menu bar #1123. (role: recent area contributor and product-decision commenter; confidence: high; commits: 37733252d174, 1e7ee2042fa8; files: Sources/CodexBar/UsageStore+QuotaWarnings.swift, Sources/CodexBar/SessionQuotaNotifications.swift, Tests/CodexBarTests/ClaudeExtraWindowQuotaWarningTests.swift)
  • Alekstodo: Commit history for the touched notification/state files points to the original quota-warning controls, state, notifications, and tests that this branch extends. (role: introduced quota-warning behavior; confidence: high; commits: 18eb73dde236; files: Sources/CodexBar/SessionQuotaNotifications.swift, Sources/CodexBar/UsageStore.swift, Tests/CodexBarTests/QuotaWarningNotificationLogicTests.swift)
  • konon4: Added the Claude model-scoped weekly limit mapper and Fable coverage that produce the claude-weekly-scoped-* windows targeted by this notification lane. (role: recent adjacent contributor; confidence: high; commits: 21e3beb37743; files: Sources/CodexBarCore/Providers/Claude/ClaudeScopedWeeklyLimitMapper.swift, Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift, Tests/CodexBarTests/ClaudeScopedWeeklyLimitMapperTests.swift)
  • AISupplyGuy: Added Claude Daily Routines/design-style extra-window parsing and OAuth support used by the extra-window data path this PR consumes. (role: introduced adjacent Claude extra-window behavior; confidence: medium; commits: 06e732e29fa1; files: Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift, Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebExtraRateWindowParser.swift, Tests/CodexBarTests/ClaudeOAuthTests.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (4 earlier review cycles)
  • reviewed 2026-07-04T12:35:03.209Z sha d73e24d :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-04T12:47:43.783Z sha 0c91c0c :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-04T14:37:36.060Z sha 1e7ee20 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-04T16:21:38.345Z sha 3773325 :: needs maintainer review before merge. :: none

@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: d73e24d418

ℹ️ 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 thread Sources/CodexBar/UsageStore+QuotaWarnings.swift Outdated
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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. labels Jul 4, 2026
A failed web-extras fetch returns a snapshot with empty extraRateWindows
while the main usage data is intact. The unconditional prune treated that
transient miss as every scoped window disappearing and cleared their
fired-threshold state, so the next successful fetch re-posted an
already-crossed Fable/Routines warning.

Only prune when the refresh actually delivered extra-window data (at least
one active window); a window that genuinely ends while others remain is
still reconciled. Also derive the active-id set immutably after the
transition loop.

Addresses the Codex review feedback on steipete#1887.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cleanerzkp

Copy link
Copy Markdown
Contributor Author

Thanks @chatgpt-codex-connector — good catch, that's a real duplicate-notification path. Fixed in 0c91c0c.

applyWebExtrasIfNeeded returns the snapshot unchanged when the web-extras fetch fails, so extraRateWindows comes back empty/nil (→ nil at ClaudeProviderDescriptor.swift:404) while the primary data is intact. The prune then treated that transient miss as every scoped window disappearing and cleared the fired-threshold state, re-posting an already-crossed Fable/Routines warning on recovery.

The lane now only prunes when the refresh actually delivered extra-window data (≥1 active window); a window that genuinely ends while others remain is still reconciled. Added a regression test (claude extra-window state survives a transient extras miss without re-posting) plus a disappears but others remain prune test. make check and the suite are green.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 4, 2026

@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: 1e7ee2042f

ℹ️ 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 thread Sources/CodexBar/UsageStore+QuotaWarnings.swift
@clawsweeper clawsweeper Bot added 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 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. labels Jul 4, 2026
@steipete
steipete merged commit 2c56846 into steipete:main Jul 4, 2026
10 checks passed
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. 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.

2 participants