GeezerVison is showing github.com — feat(usage): show fresh account limits from the sidebar · Issue #14 · mesura-hq/mesura-code
feat(usage): show fresh account limits from the sidebar #14DescriptionProblem
Mesura Code reports local token and cost analytics, but it does not show the rolling subscription limits that determine whether Claude or Codex can continue working. The QML Symmetria IDE already keeps these limits visible through a compact status indicator and an expanded panel. Mesura needs the same operational signal without filling the interface with permanent percentages.
T3 Code PR #5739: feat(usage): show 5h/weekly rate limits on the usage page and sidebar hover and PR #7133: fix(usage): attribute account limits per provider instance remain open. Use them as source material. Do not make this issue depend on either PR merging.
Locked product behavior
- Add one account-limits symbol to the sidebar footer. Do not render persistent percentages beside it.
- Hovering the symbol shows the read-only account-limits panel.
- Holding the
usage.peek keybinding shows the same panel from any desktop surface.
- The default binding is
alt+u. Releasing either key, losing window focus, or hiding the document closes the transient panel. Ignore keyboard repeat.
- Clicking the symbol pins the read-only panel for keyboard and pointer access in the MVP. Issue feat(usage): configure visible account-limit meters on the Usage page #13:
feat(usage): configure visible account-limit meters from the sidebar indicator owns the later configuration surface.
- On touch clients, tapping is the accessible equivalent of pinning because hover and held keyboard input do not exist.
- GPT-5.3-Codex-Spark is hidden by default. Keep its normalized data so issue feat(usage): configure visible account-limit meters on the Usage page #13 can expose it without another provider fetch or contract migration.
- The panel renders provider instances and environments honestly. One account must never overwrite another account.
MVP scope
Server authority
Add an AccountLimitsService under the server usage domain. It owns:
- One cached snapshot per environment-local provider instance.
- A dynamic array of limit windows. Do not encode 5-hour, weekly, Fable, Spark, OpenCode, or Kimi as fixed contract fields.
- Last observation time, last successful refresh time, source, and non-secret error state.
- Atomic persistence below the server state directory. Persist percentages, reset times, plan metadata, and instance attribution only. Never persist provider tokens in this cache.
- Freshest-wins ordering per provider instance. A failed observation never replaces the last successful snapshot.
- Immediate refresh on server start, a 60-second stale check, and a five-minute freshness target.
- Single-flight refresh per provider instance and bounded provider-fetch concurrency.
- Passive ingestion of rate-limit events from running sessions. Passive events reset the stale clock and suppress unnecessary polls.
- A read RPC and a separate explicit refresh RPC. Reading state must not start provider processes.
Provider boundary
Keep provider-specific behavior at a fetcher or adapter boundary:
- Claude: prefer an existing supported SDK control method if it can run without an active session. Otherwise use the OAuth usage endpoint proven by Symmetria IDE. Read credentials fresh for each request. Do not refresh credentials. Refuse redirects, bound the request with a timeout, and never log the token.
- Codex: call
account/rateLimits/read through the existing app-server transport. Reuse existing process and protocol helpers rather than implement a second JSON-RPC client.
- Unknown or unsupported providers return no snapshot and do not fail the service.
- The contract and renderer must accept future OpenCode and Kimi readers without provider-specific UI branches.
Contract
Define additive account-limit contracts with:
providerInstanceId and provider driver identity.
- Dynamic windows with stable id, label, used percentage, reset time, duration, and optional scope metadata.
- Snapshot source and timestamps.
- Error and freshness state that cannot contain credentials or raw provider payloads.
- A contract version for safe mixed-client behavior.
Remote clients read only through the authenticated server RPC. They never read provider credentials, provider transcript files, or SQLite directly.
Web and desktop client
- Add a provider-neutral account-limits state selector.
- Reuse existing provider-instance names, environment labels, and
ProviderInstanceIcon.
- Add a new sidebar-footer symbol. Keep the existing Usage analytics navigation separate.
- Render the panel from snapshot data. Do not hardcode a Claude/Codex row order.
- Hide secondary meters such as Spark through a presentation filter, not server normalization.
- Use warning tones at documented thresholds. Show stale age and errors without removing the last valid values.
- Support hover, focus, pinned click, outside click,
Escape, and the held usage.peek command.
- Register
usage.peek in the existing keybinding contract and Settings UI with default alt+u.
- Capture the held command before terminal input when it is configured globally. Prevent the keystroke from reaching the terminal.
Mobile
The sidebar indicator is a desktop and web surface. Keep the new contracts forward-compatible with mobile. Do not block this MVP on a mobile limits screen. A later mobile surface must use the same server snapshots.
Explicitly deferred
Deterministic acceptance
Pure normalization
- Claude full snapshots, single-window updates, reset windows, Fable, unknown future windows, credits metadata, malformed payloads, and redirects/errors.
- Codex primary and secondary windows, live camelCase payloads, transcript snake_case payloads if retained as fallback, Spark, unknown durations, and malformed payloads.
- Percent clamping and deterministic window order.
Service
- Startup load and immediate stale refresh.
- Five-minute TTL and 60-second checks without sleeps; use Effect test clocks.
- Passive events suppress polls.
- Manual refresh ignores TTL and coalesces with an in-flight refresh.
- Older observations cannot roll back state.
- Failed refresh preserves valid values and records a safe error.
- Atomic persistence survives concurrent provider updates.
- Several instances of one provider stay independent.
- Deleted, disabled, or reconfigured provider instances cannot leak or misattribute snapshots.
- Shutdown cancels or detaches provider work without leaking processes.
Client
- Symbol renders without percentages.
- Hover and focus show the panel.
Alt+U keydown shows it; keyup, blur, and visibility loss close it.
- Repeated keydown does not toggle or duplicate work.
- Click pins; outside click and
Escape close.
- Spark data remains present but does not render by default.
- Several accounts and environments have distinct captions.
- Stale and error states retain the last valid readings.
- Collapsed sidebar and narrow layouts remain usable.
Verification gate
- Run focused server, contract, shared, and web tests only. Do not run the repository-wide suite.
- Run scoped typecheck, lint, and format checks for touched packages.
- Inspect the upstream conflict rate before editing existing high-churn files. Prefer new files plus thin integration points.
- After implementation, request permission for one integrated Mesura desktop/web pass with real Claude and Codex accounts. Verify idle refresh, hover, held
Alt+U, pinning, stale state, and multi-account attribution.
- Record which web, desktop, mobile, provider, contract, and connection-mode surfaces apply before completion.
Upstream references
ActivityCaceresCallieri commented on Aug 22, 2026 CollaboratorAuthor More actions Locked MVP corrections from the approved design interview:
- The account-limits symbol stays visually subtle at every percentage. The MVP does not add severity colors.
- Clicking the account-limits symbol does nothing in the MVP. It does not pin, navigate, focus, or open configuration.
- The existing Usage page remains unchanged and is outside this MVP.
- Hover and the held
Alt+U command are the only MVP display interactions.
The builder must follow .factory/account-limits-plan/intent.md and the mechanically validated plan.md; these corrections supersede the earlier click-to-pin wording in the issue body. CaceresCallieri commented on Aug 22, 2026 CollaboratorAuthor More actions Revised locked MVP direction after reviewing the existing sidebar footer:
- Reuse the existing Usage analytics button. Do not add a fourth footer symbol.
- Hovering that button or holding
Alt+U shows the transient account-limits panel.
- Clicking the button keeps its current navigation to
/usage. It is not inert and does not pin the panel.
- The Usage page itself stays unchanged in this MVP. Future visible-meter configuration moves to issue feat(usage): configure visible account-limit meters on the Usage page #13:
feat(usage): configure visible account-limit meters on the Usage page.
This comment supersedes the earlier correction that said the MVP click does nothing.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|