Skip to content

Show when usage limits reset, as separate preferences - #108

Merged
eilonwy06 merged 2 commits into
eilonwy06:masterfrom
jmoraleda:usage-reset-times
Sep 4, 2026
Merged

Show when usage limits reset, as separate preferences#108
eilonwy06 merged 2 commits into
eilonwy06:masterfrom
jmoraleda:usage-reset-times

Conversation

@jmoraleda

Copy link
Copy Markdown
Contributor

Splits "show reset time" out as its own preference for each usage meter (5-hour session and weekly), shown next to the existing limit percentage.

Shows when each usage limit recovers, not just how full it is.

jmoraleda and others added 2 commits September 4, 2026 22:10
The Claude Code view's Session/Weekly meters only showed a reset time
when the /usage probe happened to inherit one from an earlier Terminal
statusLine snapshot in the same process — otherwise it stayed blank,
even though a real epoch was already arriving on the CLI's
rate_limit_event stream. That data was wired only to the transient
usage-warning banner (controls.js), never to ClaudeStatusStore, the
process-wide cache both views' status bars read from.

ClaudeStatusStore now has a second producer, acceptRateLimitEvent,
feeding just the reset epoch (never a percentage — the event's
utilization field's unit is unverified) into the same per-window merge
the CLI statusLine already uses. This required fixing mergeWindow,
which previously discarded any window fragment lacking a percentage
outright, dropping a reset-only update on the floor before its
existing "inherit a missing reset from prev" logic ever ran. It now
also inherits a missing *percentage* the same way, and keeps a
reset-only fragment around (invisible until paired) instead of
dropping it, so two rate-limit events landing before the next /usage
probe don't erase each other's epoch.

Terminal doesn't need this: its statusLine already carries resets_at
directly and drives the bar without a proxy event. Mechanism differs,
outcome converges on the shared ClaudeStatusStore/ClaudeStatusBar both
views already use.

Adds PREF_STATUSLINE_SHOW_RESETS (default on, shared — not view-scoped,
since the store and bar widget are shared) as the "whether" the user
asked for; "when" (e.g. only near reset, or above a usage threshold) is
left for a follow-up since it's a separate design decision.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Session and Weekly already have independent "show this meter" prefs
(PREF_STATUSLINE_SHOW_SESSION_5H / _WEEKLY); the reset-time toggle
added in the previous commit was a single combined switch, which
didn't match that existing granularity. Replaced it with
PREF_STATUSLINE_SHOW_SESSION_5H_RESET and _WEEKLY_RESET (both default
on), each listed on the preference page directly under its own
meter's checkbox so the page order matches render order.

buildSegments' width-reservation fallback (drop reset text before
dropping whole segments when the bar is too narrow) still applies
per-layout-attempt, now via a forceNoResets override rather than a
single withResets flag, since each meter now decides independently
whether it wants a reset shown in the first place.

The on-hover tooltip is intentionally left alone: it still reports a
meter's reset time even when its inline "(resets in ...)" text is
hidden, since the preference is a space-saving toggle for the
always-visible text, not a "never tell me this" switch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@eilonwy06
eilonwy06 merged commit e6bb610 into eilonwy06:master Sep 4, 2026
@jmoraleda
jmoraleda deleted the usage-reset-times branch September 5, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants