- Call the SDK usage method through the query object; an extracted
reference loses its receiver and the catch made that failure silent.
- Treat a backwards wall-clock step as an expired throttle.
- Pick the codex transcript snapshot by its own timestamp, not file mtime.
- Per-provider loading state: a provider without a snapshot shows Loading
while any environment is still answering, not 'No limit data yet'.
- The usage page refresh button now refreshes the limits cache too.
Co-Authored-By: Claude Fable 5 <[email protected]>
Drop the fixed column widths (nowrap instead) and the redundant countdown
suffix; the reset line is just 'resets 8/15 13:34'.
Co-Authored-By: Claude Fable 5 <[email protected]>
Every percentage now reads 'N% used' in both the hover card and the page
strip. Drop plan text, the hover footer, and the freshness caption unless
the snapshot is actually stale (>15m). 24h times, m/d dates.
Co-Authored-By: Claude Fable 5 <[email protected]>
The one-permit lock now covers the ordering guard, the map write, and the
persist for both the event ingest and the transcript seed, instead of only
the file write. Two concurrent mutations could previously both pass their
guard against the same prior snapshot and land in either order.
Co-Authored-By: Claude Fable 5 <[email protected]>
Atomic rename prevented torn JSON but not ordering: a slow earlier persist
could land after a newer one and drop a provider snapshot from the file.
The encode now runs inside a one-permit semaphore, so the last writer
always persists the latest map.
Co-Authored-By: Claude Fable 5 <[email protected]>
Concurrent persists (ingestion worker vs the RPC-path transcript seed)
could interleave writes and corrupt account-limits.json, silently dropping
the Claude snapshot on restart. Reuse writeFileStringAtomically. Also raise
the transcript scan cap from 8 to 32 files so a run of Spark-only or
abandoned sessions cannot mask an older main-meter snapshot.
Co-Authored-By: Claude Fable 5 <[email protected]>
Both provider adapters already emitted account.rate-limits.updated events,
but the payload was typed unknown and nothing consumed them. This adds an
AccountLimitsService that caches one normalized snapshot per provider, fed
passively from those events, seeded for Codex from the rate_limits objects
its transcripts already carry, and persisted across restarts (Claude limits
never hit disk). The Claude adapter now also pulls the full window set (5h,
weekly, Fable) through the SDK usage control request, throttled, since the
streamed event only names the binding window.
Exposed via server.getAccountLimits and rendered as a Limits strip on the
usage page plus a hover card on the sidebar Usage button. Windows render
dynamically, so Codex's paused 5-hour window reappears on its own when the
API ships it again. Spark and the opus/sonnet scoped weeklies are hidden.
Co-Authored-By: Claude Fable 5 <[email protected]>