Skip to content

Commit 3a0884c

Browse files
t3dotggclaude
andcommitted
fix(web): usage readout keeps limits for instances that share a login
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent e2b58e2 commit 3a0884c

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎apps/web/src/components/chat/ThreadDetailsUsage.tsx‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ export function ThreadDetailsUsage({
5151
providerInstanceId !== null
5252
? collectProviderUsageLimits(providerInstanceId, providers, sources, now)
5353
: null;
54-
// Match the thread's own instance only; any other entry may be a different login or workspace.
55-
const account = report?.accounts.find((entry) => entry.instanceId === providerInstanceId);
56-
const notice = account ? limitsNotice(account.limits) : null;
57-
if (!account && !contextWindow) return null;
54+
// Only this instance's data: the report keeps one instance per login, and any other entry may be
55+
// a different login or workspace, so fall back to the instance's own snapshot.
56+
const limits =
57+
report?.accounts.find((entry) => entry.instanceId === providerInstanceId)?.limits ??
58+
providers.find((provider) => provider.instanceId === providerInstanceId)?.usageLimits;
59+
const notice = limits ? limitsNotice(limits) : null;
60+
if (!limits && !contextWindow) return null;
5861

5962
return (
6063
<ThreadDetailsSection
@@ -71,12 +74,10 @@ export function ThreadDetailsUsage({
7174
tooltip={<span className="text-foreground">{notice}</span>}
7275
/>
7376
) : null}
74-
{account && !notice
75-
? account.limits.windows.map((window) => (
76-
<LimitRow key={window.id} window={window} now={now} />
77-
))
77+
{limits && !notice
78+
? limits.windows.map((window) => <LimitRow key={window.id} window={window} now={now} />)
7879
: null}
79-
{contextWindow ? <ContextRow usage={contextWindow} spaced={account !== undefined} /> : null}
80+
{contextWindow ? <ContextRow usage={contextWindow} spaced={limits !== undefined} /> : null}
8081
</div>
8182
</ThreadDetailsSection>
8283
);

‎docs/user/usage.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ closes when you dismiss it or send your next message. It uses the same snapshot
117117
anything. The command is offered only for providers that appear under **Usage → Limits**.
118118

119119
To keep them in view, turn on **Settings → Labs → Usage in thread details** on web and desktop.
120-
The bottom of the thread details card then shows how much is left in each of the current model's
121-
limit windows and in the thread's context window. Hover a row to see when it resets, your pace, or
120+
The bottom of the thread details card then shows how much is left in each limit window of the
121+
current provider account and in the thread's context window. Some windows, such as a weekly Opus
122+
limit, count only one model. Hover a row to see when it resets, your pace, or
122123
the token count.
123124

124125
OpenCode Go reports its session, weekly, and monthly allowance when OpenCode runs locally in

0 commit comments

Comments
 (0)