@@ -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 ) ;
0 commit comments