feat(web): Labs toggle keeps 5h, weekly, and context limits in view #26859
Mergedt3dotgg(GitHub profile, opens in a new tab)merged 4 commits into
main fromrefs/pull/26859/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/chat/ThreadDetailsUsage.tsx lines 55 to 57OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +37,21 @@37+38+/**39+ * Labs readout of the selected provider's limit windows and the thread's context window.40+ * Every row reads as room left, so a longer bar always means more headroom.41+ */42+export function ThreadDetailsUsage({43+ providerInstanceId,44+ providers,45+ sources,46+ contextWindow,47+}: ThreadDetailsUsageInput) {48+ const nowMinute = useNowMinute();49+ const now = Date.parse(`${nowMinute}:00Z`);50+ const report =51+ providerInstanceId !== null52+ ? collectProviderUsageLimits(providerInstanceId, providers, sources, now)53+ : null;54+ // The report spans every account of the driver; prefer the one this thread runs on.55+ const account =56+ report?.accounts.find((entry) => entry.instanceId === providerInstanceId) ??57+ report?.accounts[0];
- apps/web/src/components/chat/ThreadDetailsUsage.tsx line 55OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +35,21 @@35+ readonly contextWindow: ContextWindowSnapshot | null;36+}37+38+/**39+ * Labs readout of the selected provider's limit windows and the thread's context window.40+ * Every row reads as room left, so a longer bar always means more headroom.41+ */42+export function ThreadDetailsUsage({43+ providerInstanceId,44+ providers,45+ sources,46+ contextWindow,47+}: ThreadDetailsUsageInput) {48+ const nowMinute = useNowMinute();49+ const now = Date.parse(`${nowMinute}:00Z`);50+ const report =51+ providerInstanceId !== null52+ ? collectProviderUsageLimits(providerInstanceId, providers, sources, now)53+ : 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);apps/web/src/components/ChatView.tsx line 3779Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -3770,3 +3773,7 @@37703773 onAddProjectScript={saveProjectScriptStable}37713774 onUpdateProjectScript={updateProjectScriptStable}37723775 onDeleteProjectScript={deleteProjectScriptStable}3776+ usage={3777+ threadDetailsUsageEnabled3778+ ? {3779+ providerInstanceId: activeProviderInstanceId,docs/user/usage.md lines 120 to 121OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -116,3 +116,6 @@116116 closes when you dismiss it or send your next message. It uses the same snapshot as **Usage → Limits**, so it does not run the agent or refresh117117 anything. The command is offered only for providers that appear under **Usage → Limits**.118118119+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's121+limit windows and in the thread's context window. Hover a row to see when it resets, your pace, or
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed