Skip to content

feat(web): show usage limits as used or left - #26284

Open
abhaymettu wants to merge 2 commits into
pingdotgg:mainfrom
abhaymettu:up/usage-display
Open

abhaymettu wants to merge 2 commits into
pingdotgg:mainfrom
abhaymettu:up/usage-display

Conversation

@abhaymettu

@abhaymettu abhaymettu commented Oct 28, 2026 •

Copy link
Copy Markdown

Problem

Subscription limits always show the share left, such as "62% left". Some people track what they have spent instead,
as in "I've used 38% of my week", and they have to subtract every number in their head. Time format already offers a
12-hour or 24-hour choice. Usage limits have no equivalent.

Change

  • Settings > Threads > Usage limits gets Show usage as, with the options Left and Used. Left is the
    default and keeps the current readout.
  • The new client setting usageDisplay: "remaining" | "used" decodes to "remaining" when it is missing.
  • One pure function, usageReadout(display, remainingPercent, windowLeftPercent), feeds every readout: the percent,
    its label and word, the bar fill, the even-pace mark, and the mark's text. It takes the numbers that the shared
    helpers already compute. With Left, the output matches main. With Used, it is the exact complement.
  • The composer limits banner, the Usage page pool cards, the per-account bars and legend, and the segment popover all
    read it.
  • Bars fill from the start in both modes. With Used, the pace mark moves to the share of the window that has passed,
    so a fill past the mark still means ahead of pace. The pace wording does not change.
  • Refill hatching sits on the empty end of the bar with Left, and on the tail of the fill with Used (refillSpan). On
    the fill, the stripes draw in the background colour so they stay visible. The restore amount reads "+19%" with Left
    and "−19%" with Used.
  • The row is searchable, has its own reset button, and is part of the restore-defaults list.

Scope and approval

There is no prior discussion. I think this fits the route for a focused configuration option for an established
capability.

  • The capability that exists. Subscription limit readouts in the composer banner and on the Usage page.
  • What the option controls. Whether those readouts show the share left or the share used. The data, the polling,
    the pace calculation and the layout do not change.
  • Why it stays inside that capability. The default is Left, and with Left every readout is unchanged. The
    setting is client-only, like timestampFormat. Web and desktop share the code. The mobile app has its own readouts
    and does not read client settings, so it is unchanged. The server is not involved.

Out of scope: layout changes to the pooled bars, such as account labels above the bar. That is a separate problem.

Verification

  • Focused tests pass. apps/web usageReadout.test.ts (7 tests) checks literal strings and positions for both
    modes, a window with no clock, and refill spans. packages/contracts src/settings.test.ts (25 tests) covers the
    default decode, a patch decode, and the rejection of an unknown value.
  • The web unit suite passes (314 files, 4264 tests). tsc --noEmit is clean for contracts, web and desktop, and
    vp lint is clean on the touched paths.
  • Manual check on vp run dev --home-dir <tmp> --no-seed. The limits came from a local stand-in for a CLIProxyAPI
    hub, added as a usage limit source in server settings, which returned two Claude accounts on example.com. With
    Left, the Usage page matched main pixel for pixel, apart from the reset countdowns, which had moved by a minute.
    A segment's accessible label read "62% left, ..., 45% of the window left" on both. With Used, it read "38% used,
    ..., 55% of the window elapsed", the pool cards read "25% used" and "44% used", and the popover rows read "Used",
    "55% used by now" and "−19% of pool".
  • Not checked: a packaged desktop build, and Codex or Cursor limits. Every provider goes through the same readout
    code.

Usage page, Limits, two Claude accounts. Before is main:

Before After, Left (default) After, Used
Dark usage-before-dark.png usage-after-left-dark.png usage-after-used-dark.png
Light usage-before-light.png usage-after-left-light.png usage-after-used-light.png

The segment popover with Used, and the settings row:

Popover, Used Setting, dark Setting, light
usage-after-used-popover-light.png usage-setting-dark.png usage-setting-light.png

Claude Opus 5.5 via Claude Code in T3 Code.

usageDisplay decodes to "remaining" when missing, so existing settings
files keep today's readout.
Settings > Threads > Usage limits gets a "Show usage as" choice. Every
limits readout now goes through usageReadout: the percent, its label,
the bar fill, the even-pace mark and its text, the refill hatching and
the restore amount all flip together. Used is the complement of left,
and the bar fills from the start in both modes. The mark moves to the
share of the window elapsed when showing used, so a fill past the mark
means ahead of pace there, and under pace when showing left. Refill
hatching sits on the tail of the fill when showing used, so it draws in
the background colour there.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T03:53:22.530529Z
We couldn’t complete this review. Comment @codex review to try again.
cf11115 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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 Oct 28, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at cf11115

Macroscope's review found this PR approvable — Adds a setting to show subscription limits as used or left, with matching bars and pace indicators. Existing default presentation and actual quota enforcement remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 49a9e80 and cf11115.

Files selected for processing: 9
  • apps/desktop/src/settings/DesktopClientSettings.test.ts
  • apps/web/src/components/settings/SettingsPanels.tsx
  • apps/web/src/components/settings/settingsSearch.ts
  • apps/web/src/components/usage/UsageLimits.tsx
  • apps/web/src/components/usage/UsageLimitsPooled.tsx
  • apps/web/src/components/usage/usageReadout.test.ts
  • apps/web/src/components/usage/usageReadout.ts
  • packages/contracts/src/settings.test.ts
  • packages/contracts/src/settings.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

The change adds a client setting to display subscription usage as either remaining or used. The Threads settings panel exposes the preference, and usage-limit components apply it to percentages, labels, pace indicators, and refill displays.

Changes: Usage display preference

Layer / File(s) Summary
Usage display setting contract
packages/contracts/src/settings.ts, packages/contracts/src/settings.test.ts
The client settings schema accepts “remaining” and “used,” defaults missing values to “remaining,” and includes the preference in patches. Tests cover the default and accepted and rejected values.
Threads preference controls
apps/web/src/components/settings/SettingsPanels.tsx, apps/web/src/components/settings/settingsSearch.ts, apps/desktop/src/settings/DesktopClientSettings.test.ts
The Threads panel offers “Left” and “Used,” supports restoring the default, and includes the setting in restore-defaults change detection. Settings search links to the Threads panel. The desktop test fixture sets the preference to “used.”
Usage readouts and displays
apps/web/src/components/usage/usageReadout.ts, apps/web/src/components/usage/usageReadout.test.ts, apps/web/src/components/usage/UsageLimits.tsx, apps/web/src/components/usage/UsageLimitsPooled.tsx
Shared helpers calculate display-aware readouts, restoration text, and refill spans. Usage components use them for percentages, labels, pace indicators, tooltips, and refill bars. Tests cover both display modes and cases without a refill or pace value.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Settings as ThreadsSettingsPanel
  participant Limits as UsageLimits
  participant Pooled as UsageLimitsPooled
  participant Readout as usageReadout
  Settings->>Limits: Configure usage display preference
  Limits->>Readout: Pass display and usage percentages
  Readout-->>Limits: Return display-aware readout
  Pooled->>Readout: Pass display and usage percentages
  Readout-->>Pooled: Return display-aware readout
Loading

Possibly related PRs

  • pingdotgg/t3code#25651: Adds the Threads settings page and places usage-limit controls there; this change adds the display preference to that same settings surface.

Suggested reviewers: juliusmarminge, maria-rcks

Merge Risk: Minimal · up to cf111

No merge-blocking issue was established.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title "feat(web): show usage limits as used or left" matches the main change: a new Settings > Threads option, "Show usage as", that switches subscription limit readouts between Left and Used. It …
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.
Description check Passed The description follows the template well. It has Problem, Change, Scope and approval, and Verification sections, with specific tests, manual checks, and before/after screenshots. The Scope and approv…
Full details: Title check

Explanation

The title "feat(web): show usage limits as used or left" matches the main change: a new Settings > Threads option, "Show usage as", that switches subscription limit readouts between Left and Used. It follows the conventional commit format the template asks for. It is specific and does not use vague terms.

Full details: Description check

Explanation

The description follows the template well. It has Problem, Change, Scope and approval, and Verification sections, with specific tests, manual checks, and before/after screenshots. The Scope and approval section lacks a linked issue or maintainer approval. It argues the change is a focused configuration option of an established capability, which the template allows. The template asks for a triaged issue or explicit approval, or for the author to explain why the exemption applies. The author explained the exemption, so the section is mostly complete. The description also names the model used, as the template requests. Remaining gaps: the author gives no maintainer approval, and the packaged desktop build and Codex/Cursor limits are not checked.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

This branch has not been deployed

No deployments
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:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant