Skip to content

feat(web,mobile): snooze a thread until provider limits reset - #9012

Open
vitalyiegorov wants to merge 5 commits into
pingdotgg:mainfrom
vitalyiegorov:feat/snooze-until-limit-reset
Open

feat(web,mobile): snooze a thread until provider limits reset#9012
vitalyiegorov wants to merge 5 commits into
pingdotgg:mainfrom
vitalyiegorov:feat/snooze-until-limit-reset

Conversation

@vitalyiegorov

@vitalyiegorov vitalyiegorov commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What Changed

When the provider instance behind a thread reports an exhausted usage window, the thread offers to snooze itself until the limits reset (one minute past the reset, so clock skew cannot wake it early). One behaviour, two entry points:

  • Composer notice: "Usage limit reached · Limits reset 1:51 PM" with a one-tap Snooze until 1:52 PM. Dismissible per reset; the button disables while snooze is temporarily blocked (pending approval, queued turn start) but the reset time still shows.
  • Snooze menus: the same wake time leads every thread snooze menu as Until limits reset while the limit is in force — the sidebar row popover, the row context menu, the chat-header menu, and the mobile row menu.

Snoozing is the existing thread snooze end to end: visibility-only, "Wake now" from the parked banner, nothing auto-resumes. Implements the proposal in #8920.

Client-only. #9507 already normalizes provider rate limits into ServerProvider.usageLimits and streams that snapshot to every client, so the reset is read straight off it:

  • packages/shared/src/usageLimits.tsexhaustedUntil(limits, now): the latest future reset among the account-wide windows at 100% (five_hour, seven_day, primary, secondary). Claude's model-scoped seven_day_<model> buckets limit one model, not the account, and are skipped.
  • packages/client-runtime/src/state/threadSettled.tsusageLimitSnoozePreset(resetsAt, now), the one preset both entry points render; resolveSnoozePresets prepends it when given limitsResetAt.
  • Web: ChatView.tsx renders the notice from that preset; the sidebar popover, row menu, and header menu pass the thread's provider snapshot into the existing preset resolution. entities.ts gains a readThreadProviderSnapshot reader for the header menu.
  • Mobile: the two thread lists already look the provider up per thread and now pass its reset into the row's snooze menu.
  • docs/user/composer.md — one paragraph.

No contract, server, adapter, or migration change. Cursor, Grok, OpenCode and Antigravity publish no usage windows, so no offer there. Codex "workspace out of credits" exhausts no window, so no offer either. The bulk multi-select snooze omits the preset because selected threads can sit on different accounts, and the mobile thread screen has no snooze menu to extend.

Why

Hitting a limit mid-turn leaves a thread that looks like live work, and the reset time is the user's to remember. The Limits tab already shows the reset; this puts it on the thread that hit it, in the notice and in the menu the user already reaches for, with the one action that makes sense. It is the smallest change that turns the dead wait into a scheduled return without preempting the auto-resume discussion (#8401, #8577, #6796).

UI Changes

Captured against a Codex instance whose session window reports 100% used with a reset 3h20m out.

Composer notice — before, the limit is a plain line in the work log; after, the notice with the one-tap offer:

Before: bare session limit line After: Usage limit reached, Limits reset 1:51 PM, Snooze until 1:52 PM

Sidebar row snooze menu — before and after, same thread, same moment:

Before After
Before: the five preset rows After: Until limits reset 1:52 PM leads the menu

After tapping either, the thread parks with the existing banner and wake path:

Thread snoozed with Wake now

No motion or timing changes, so no video.

Verification

  • vp test run on usageLimits.test.ts, threadSnoozed.test.ts, Sidebar.snooze.test.ts, threadActionMenu.logic.test.ts, threadListV2.test.ts — 121 tests pass, including: latest reset wins across two exhausted windows; a model-scoped bucket at 100% yields nothing; 99% or a past reset yields nothing; the preset leads the menu only while the reset is ahead; the menu's wake time is the preset's; a mobile snooze:limits-reset selection resolves.
  • Typecheck clean in packages/client-runtime, apps/web, apps/mobile; lint and format clean on the touched files.
  • Integrated pass in the web client against a fake Codex app-server that reports the exhausted window (screenshots above).

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes (no motion added)
Earlier revisions

Until b6ca359 this PR carried its own reset time from the adapters through a typed limitResetsAt, a thread.session.rate-limit-set command, a session column and migration, and ingestion rules; #9507 landed the same normalization on the provider snapshot, so all of that was dropped. 868f239 folded the menu entry point in and trimmed the notice to the shared preset (no separate offer helper, toast, tooltip, or in-flight state).


Built by Claude Fable 5.1 in Claude Code.

🤖 Generated with Claude Code

Note

Add 'snooze until provider limits reset' option on web and mobile

  • Adds shared exhaustedUntil in usageLimits.ts to find the latest future reset among exhausted account-wide provider windows, ignoring model-scoped limits
  • Adds shared usageLimitSnoozePreset and extends resolveSnoozePresets in threadSettled.ts to prepend a preset that wakes one minute after the reset, formatted as local time or weekday+time
  • Web: ChatView.tsx shows a composer banner with reset-time text and a snooze action when the active thread's provider is exhausted; Sidebar.tsx and useThreadActionMenu.ts prepend the reset preset in popover and context menus
  • Mobile: HomeScreen.tsx, ThreadNavigationSidebar.tsx, and thread-list-v2-items.tsx pass the provider's reset time into snooze menu construction
  • Fixes snoozeWakeDescription in Sidebar.snooze.ts to use local calendar-day boundaries instead of fixed 24-hour buckets, correcting day classification across daylight-saving transitions
  • Behavioral Change: snoozeWakeDescription now rounds day-difference between local start-of-day values rather than flooring elapsed time; wake labels near DST transitions may shift by one day compared to the old calculation

Macroscope summarized 860bf64.

Summary by CodeRabbit

  • New Features

    • Added usage-limit reset notices in the web app, including reset times and an option to snooze threads until limits reset.
    • Added an “Until limits reset” snooze option to web and mobile thread menus while provider limits are active.
    • Snooze labels now reflect the reset date and time, including cross-day resets.
  • Documentation

    • Documented usage-limit notifications and snoozing behavior, including availability conditions and timing.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 1, 2026
Comment thread apps/server/src/orchestration/decider.ts Outdated
Comment thread apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This cross-platform feature adds a usage-limit banner and provider-aware snooze behavior across shared runtime, web, and mobile production paths. An unresolved medium-severity issue can leave the web menu offering an expired reset option, so the resulting behavior merits human review.

Not approved because:

  • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

Comment thread apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts Outdated
Comment thread apps/web/src/components/ChatView.tsx Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts Outdated
Comment thread apps/web/src/components/ChatView.tsx Outdated
Comment thread apps/server/src/provider/Layers/CodexAdapter.ts Outdated
Comment thread apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts Outdated
Comment thread packages/client-runtime/src/state/threadSettled.ts Outdated
@vitalyiegorov
vitalyiegorov force-pushed the feat/snooze-until-limit-reset branch 2 times, most recently from 5d2fbbc to b6ca359 Compare September 5, 2026 03:42
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. and removed vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Sep 5, 2026
@vitalyiegorov vitalyiegorov changed the title feat: snooze a thread until provider limits reset feat(web): snooze a thread until provider limits reset Sep 5, 2026
@vitalyiegorov

Copy link
Copy Markdown
Contributor Author

Rewritten on top of today's main as a single client-only commit (b6ca359). #9507 now publishes each provider's usage windows with reset times on the provider snapshot, so the contract field, thread.session.rate-limit-set command, migration, ingestion, and adapter changes from the earlier revision are gone; the notice reads the reset off that snapshot. The UI and copy are unchanged. 23 files / +1116 −19 became 6 files / +344 −2.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b6ca359. Configure here.

Comment thread packages/shared/src/usageLimits.ts
@vitalyiegorov
vitalyiegorov force-pushed the feat/snooze-until-limit-reset branch 2 times, most recently from 0e5e201 to 8e1cb7f Compare September 5, 2026 04:17
Comment thread packages/shared/src/usageLimits.ts
@vitalyiegorov
vitalyiegorov force-pushed the feat/snooze-until-limit-reset branch from 8e1cb7f to 868f239 Compare September 5, 2026 08:33
@vitalyiegorov vitalyiegorov changed the title feat(web): snooze a thread until provider limits reset feat(web,mobile): snooze a thread until provider limits reset Sep 5, 2026
Comment thread apps/web/src/components/Sidebar.snooze.ts
Comment thread apps/web/src/components/ChatView.tsx Outdated
@vitalyiegorov
vitalyiegorov force-pushed the feat/snooze-until-limit-reset branch 2 times, most recently from 3cc31db to 8d7f655 Compare September 5, 2026 10:01
@vitalyiegorov
vitalyiegorov force-pushed the feat/snooze-until-limit-reset branch from 8d7f655 to 7d79b2f Compare September 6, 2026 03:54
@cursor

cursor Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@vitalyiegorov
vitalyiegorov force-pushed the feat/snooze-until-limit-reset branch 2 times, most recently from 69e8587 to c80dc21 Compare September 6, 2026 16:15
When the provider instance behind a thread reports an exhausted usage
window, the composer shows the reset time and offers to snooze the thread
until a minute past it. Derived on the client from the provider snapshot
that pingdotgg#9507 already publishes, so no contract, server, or migration change.

Built with Claude Fable 5.1 in Claude Code.
The banner's "snooze until limits reset" now also leads every thread
snooze menu while the limit is in force, built from the same preset so
the two entry points can never disagree on the wake time.
The banner now builds its offer from the same preset the menus use, and
loses its own toast, tooltip and in-flight state: the parked-thread
banner that replaces it already offers Wake now.
A DST day is 23 or 25 hours long, so dividing elapsed time since midnight
by a fixed day filed a wake just past midnight on the wrong day.
Ghost button, and the shared Tooltip primitive for the disabled reason,
mirroring the resume-compaction action in the same stack.
@vitalyiegorov
vitalyiegorov force-pushed the feat/snooze-until-limit-reset branch from c80dc21 to 860bf64 Compare September 7, 2026 05:18
[open, timestampFormat],
() =>
open
? resolveSnoozePresets(new Date(), timestampFormat, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium components/Sidebar.tsx:447

The open snooze menu keeps showing limits-reset after limitsResetAt passes, and clicking it then calls onSnooze with a past snoozedUntil, resulting in an immediate/no-op wake instead of a valid snooze. useMemo only recomputes when open, timestampFormat, or usageLimits changes; add a time-based refresh or revalidate the preset at click time.

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/Sidebar.tsx around line 447:

The open snooze menu keeps showing `limits-reset` after `limitsResetAt` passes, and clicking it then calls `onSnooze` with a past `snoozedUntil`, resulting in an immediate/no-op wake instead of a valid snooze. `useMemo` only recomputes when `open`, `timestampFormat`, or `usageLimits` changes; add a time-based refresh or revalidate the preset at click time.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 951b3846-b241-4234-89c2-155466b95e1a

📥 Commits

Reviewing files that changed from the base of the PR and between 6abdf37 and 860bf64.

📒 Files selected for processing (16)
  • apps/mobile/src/features/home/HomeScreen.tsx
  • apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
  • apps/mobile/src/features/threads/thread-list-v2-items.tsx
  • apps/mobile/src/features/threads/threadListV2.test.ts
  • apps/mobile/src/features/threads/threadListV2.ts
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/Sidebar.snooze.test.ts
  • apps/web/src/components/Sidebar.snooze.ts
  • apps/web/src/components/Sidebar.tsx
  • apps/web/src/hooks/useThreadActionMenu.ts
  • apps/web/src/state/entities.ts
  • docs/user/composer.md
  • packages/client-runtime/src/state/threadSettled.ts
  • packages/client-runtime/src/state/threadSnoozed.test.ts
  • packages/shared/src/usageLimits.test.ts
  • packages/shared/src/usageLimits.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The change adds usage-limit reset detection and a limits-reset snooze preset. Web and mobile thread interfaces now expose the preset, while web displays a dismissible reset warning banner. Tests and composer documentation cover the new behavior.

Changes

Usage-limit snooze

Layer / File(s) Summary
Shared usage-limit and snooze preset contract
packages/shared/src/usageLimits.ts, packages/client-runtime/src/state/threadSettled.ts, packages/client-runtime/src/state/threadSnoozed.test.ts, packages/shared/src/usageLimits.test.ts
The runtime identifies future account-wide reset times and creates a one-minute-after-reset limits-reset preset. Tests cover valid, invalid, past, and scoped usage windows.
Web provider and snooze-menu wiring
apps/web/src/state/entities.ts, apps/web/src/components/Sidebar.tsx, apps/web/src/components/Sidebar.snooze.ts, apps/web/src/hooks/useThreadActionMenu.ts, apps/web/src/components/Sidebar.snooze.test.ts
Web snooze controls resolve provider usage limits and pass reset timestamps into preset resolution. Wake labels handle local calendar days and daylight-saving transitions.
Web usage-limit banner and snooze action
apps/web/src/components/ChatView.tsx, docs/user/composer.md
ChatView displays a per-thread reset warning, supports dismissal and eligible snoozing, and reports snooze failures. Composer documentation describes the behavior and availability constraints.
Mobile thread-list integration
apps/mobile/src/features/home/HomeScreen.tsx, apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx, apps/mobile/src/features/threads/thread-list-v2-items.tsx, apps/mobile/src/features/threads/threadListV2.ts
Mobile thread rows resolve provider data once and pass the provider driver and usage-limit reset timestamp through snooze preset resolution and menu selection. Tests cover the new selection event.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 860bf

This change adds client-side usage-limit reset snoozing across web and mobile, with reset validation and focused tests. No merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant ChatView
  participant ProviderUsageLimits
  participant SnoozePresetResolver
  participant ThreadAction
  ChatView->>ProviderUsageLimits: calculate exhaustedUntil
  ProviderUsageLimits-->>ChatView: return limitsResetAt
  ChatView->>SnoozePresetResolver: resolve limits-reset preset
  SnoozePresetResolver-->>ChatView: return wake time
  ChatView->>ThreadAction: snooze thread until wake time
Loading

Suggested reviewers: t3dotgg, juliusmarminge

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 15 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a snooze option until provider usage limits reset for web and mobile.
Description check ✅ Passed The description is complete and follows the template. It explains what changed and why, documents the UI changes with before-and-after screenshots, includes verification details, and completes the che…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 15 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant