From b2d2027c283dce507dc4cc4b1766308707d1fe68 Mon Sep 17 00:00:00 2001
From: Badcuban <108198679+badcuban@users.noreply.github.com>
Date: Mon, 23 Nov 2026 10:41:22 -0500
Subject: [PATCH] feat(web): hover the pace line on usage bars to see how much
of the window has passed
The pace line on usage bars was a 2px tick you couldn't hover, and the
provider Usage tab in Settings didn't draw it at all.
The shared usage presentation now carries a `paceDetail` ("55% of the week
has passed") next to `elapsedPercent`. UsagePaceMark wraps the tick in a
wider hover area with a tooltip showing that text, and the bar's accessible
name uses the same words. The Settings Usage tab bars now draw the pace mark
too. The app guide's usage topic mentions both.
---
apps/server/src/guide/topics.ts | 2 +-
.../src/components/ProviderUsageDashboard.tsx | 11 ++++-
.../chat/ContextWindowMeter.browser.tsx | 14 ++++--
.../components/chat/ContextWindowMeter.tsx | 8 +--
.../src/components/usage/UsagePaceMark.tsx | 49 +++++++++++++------
apps/web/src/components/usage/UsageView.tsx | 8 ++-
.../src/components/usage/usageView.logic.ts | 6 ++-
apps/web/src/lib/providerUsage.test.ts | 16 ++++++
apps/web/src/lib/providerUsage.ts | 37 +++++++++++++-
9 files changed, 122 insertions(+), 29 deletions(-)
diff --git a/apps/server/src/guide/topics.ts b/apps/server/src/guide/topics.ts
index f79bed20a..9a20ffa9f 100644
--- a/apps/server/src/guide/topics.ts
+++ b/apps/server/src/guide/topics.ts
@@ -313,7 +313,7 @@ While this computer is asleep or Threadlines is closed, assistants are told it's
Claude's models come from Claude Code itself, so a new one shows up without a Threadlines update. A model Threadlines has no settings of its own for starts on Default reasoning: no level is sent and Claude Code picks one. When Claude Code stops listing a model, the picker stops offering it, but a thread, room agent or setting already on it keeps it.
-How much of each plan you've used is on {place:usage}. The ring beside the composer's send button shows the same limits when you hover or tap it; a short upright tick on each bar marks how much of that limit's window has passed, so a bar filled past its tick is on track to run out before the reset, and its line says "ahead of pace" once it is clearly past. Clicking a limit there opens {place:usage}.
+How much of each plan you've used is on {place:usage}. The ring beside the composer's send button shows the same limits when you hover or tap it; a short upright tick on each bar marks how much of that limit's window has passed (hover the tick for the exact share, "55% of the week has passed"), so a bar filled past its tick is on track to run out before the reset, and its line says "ahead of pace" once it is clearly past. The same ticks show on a provider's Usage tab in Settings › Providers. Clicking a limit there opens {place:usage}.
An agent's row that says Can't start means its program is on this computer but fails to launch, usually because an update stopped partway. It is not a sign-in problem: the sign-in is still saved. The row has Reinstall when Threadlines can put that same copy back: with npm, bun or Homebrew for a copy they installed, or with the agent's own installer for a copy sitting where that installer puts it (Claude, OpenCode, Cursor, fx, Muse Code, and Codex on Windows). For Pi it reinstalls an npm copy, or installs Threadlines' own copy of Pi. There is no Reinstall for a copy from pnpm, Scoop, winget or Nix, for one at a custom path, or for Grok from xAI's installer (it would switch the release channel); reinstall those the way they were installed. An update that leaves an agent unable to start runs that reinstall once on its own before reporting. Community agents are installed by Threadlines itself and have Install again instead. Antigravity is downloaded and checked by Threadlines, so it isn't covered.
diff --git a/apps/web/src/components/ProviderUsageDashboard.tsx b/apps/web/src/components/ProviderUsageDashboard.tsx
index 44713a650..092c65724 100644
--- a/apps/web/src/components/ProviderUsageDashboard.tsx
+++ b/apps/web/src/components/ProviderUsageDashboard.tsx
@@ -16,6 +16,7 @@ import { Button } from "./ui/button";
import { SegmentedControl, SegmentedControlItem } from "./ui/segmented-control";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
import { ProviderExternalResetsButton } from "./ProviderRateLimitResetCredit";
+import { UsagePaceMark, usagePaceLabel } from "./usage/UsagePaceMark";
type TokenActivityMode = "daily" | "weekly" | "cumulative";
type TokenActivityRange = "13-weeks" | "1-year";
@@ -448,16 +449,22 @@ function UsageLimitBar(props: {
+ {props.window.elapsedPercent !== undefined && props.window.paceDetail !== undefined ? (
+
+ ) : null}
);
diff --git a/apps/web/src/components/chat/ContextWindowMeter.browser.tsx b/apps/web/src/components/chat/ContextWindowMeter.browser.tsx
index 8037c6ac4..052380c6e 100644
--- a/apps/web/src/components/chat/ContextWindowMeter.browser.tsx
+++ b/apps/web/src/components/chat/ContextWindowMeter.browser.tsx
@@ -1,6 +1,6 @@
import "../../index.css";
-import { page } from "vite-plus/test/browser";
+import { page, userEvent } from "vite-plus/test/browser";
import { describe, expect, it, vi } from "vite-plus/test";
import { render } from "vitest-browser-react";
@@ -121,7 +121,9 @@ describe("ContextWindowMeter", () => {
accountUsage={{
...TEST_ACCOUNT_USAGE,
windows: TEST_ACCOUNT_USAGE.windows.map((window) =>
- window.key === "secondary" ? { ...window, elapsedPercent: 14.3 } : window,
+ window.key === "secondary"
+ ? { ...window, elapsedPercent: 14.3, paceDetail: "14% of the week has passed" }
+ : window,
),
}}
onOpenUsage={openUsage}
@@ -135,7 +137,13 @@ describe("ContextWindowMeter", () => {
expect(paceMarks).toHaveLength(1);
expect(paceMarks[0]?.style.left).toBe("14.3%");
- await page.getByRole("button", { name: /Weekly 36% used, 14% of the window passed/ }).click();
+ // Hovering the mark says what it measures.
+ await userEvent.hover(paceMarks[0]!);
+ await expect.element(page.getByText("14% of the week has passed")).toBeVisible();
+
+ await page
+ .getByRole("button", { name: /Weekly 36% used, 14% of the week has passed/ })
+ .click();
expect(openUsage).toHaveBeenCalledTimes(1);
// The row closes the popover. Checked on the meter's own state: the popup
// leaves the page only after its fade-out, which needs frames a busy CI
diff --git a/apps/web/src/components/chat/ContextWindowMeter.tsx b/apps/web/src/components/chat/ContextWindowMeter.tsx
index 2eef4df46..26719cc88 100644
--- a/apps/web/src/components/chat/ContextWindowMeter.tsx
+++ b/apps/web/src/components/chat/ContextWindowMeter.tsx
@@ -37,10 +37,11 @@ function AccountUsageBar(props: {
usedPercent: number;
warning: boolean;
elapsedPercent?: number | undefined;
+ paceDetail?: string | undefined;
onOpen?: (() => void) | undefined;
}) {
const meterColor = usageMeterColor(props.usedPercent, props.warning);
- const meterLabel = `${props.usageLabel} ${props.rowLabel} ${props.usedPercent}% used${usagePaceLabel(props.elapsedPercent)}`;
+ const meterLabel = `${props.usageLabel} ${props.rowLabel} ${props.usedPercent}% used${usagePaceLabel(props.paceDetail)}`;
const content = (
<>
@@ -62,8 +63,8 @@ function AccountUsageBar(props: {
)}
style={{ width: `${props.usedPercent}%`, backgroundColor: meterColor }}
/>
- {props.elapsedPercent !== undefined ? (
-
+ {props.elapsedPercent !== undefined && props.paceDetail !== undefined ? (
+
) : null}
>
@@ -582,6 +583,7 @@ export function ContextWindowMeter(props: {
usedPercent={window.usedPercent}
warning={window.warning}
elapsedPercent={window.elapsedPercent}
+ paceDetail={window.paceDetail}
onOpen={openUsage}
/>
))}
diff --git a/apps/web/src/components/usage/UsagePaceMark.tsx b/apps/web/src/components/usage/UsagePaceMark.tsx
index 8d8426679..ca68a6c0d 100644
--- a/apps/web/src/components/usage/UsagePaceMark.tsx
+++ b/apps/web/src/components/usage/UsagePaceMark.tsx
@@ -1,28 +1,47 @@
import { cn } from "~/lib/utils";
+import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
/**
* The pace mark on a usage bar: a short upright tick at how much of the
* window has passed. Usage that stops left of it lasts until the reset. Put it
* inside the bar's track, which needs `relative` and must not clip it.
+ *
+ * Hovering the tick says how much of the window has passed (`detail`, from the
+ * shared usage presentation). The hover area is wider than the tick so it can
+ * be found; keyboard and screen reader users get the same words from the
+ * bar's accessible name (`usagePaceLabel`).
*/
-export function UsagePaceMark(props: { elapsedPercent: number; className?: string }) {
+export function UsagePaceMark(props: {
+ elapsedPercent: number;
+ detail: string;
+ className?: string;
+}) {
const left = Math.max(0, Math.min(100, props.elapsedPercent));
return (
-
+
+
+ }
+ >
+
+
+
+ {props.detail}
+ Usage left of this line lasts until the reset
+
+
);
}
-/** "12% used, 5% of the window passed", for a usage bar's accessible name. */
-export function usagePaceLabel(elapsedPercent: number | undefined): string {
- return elapsedPercent === undefined
- ? ""
- : `, ${Math.round(elapsedPercent)}% of the window passed`;
+/** ", 44% of the week has passed", for a usage bar's accessible name. */
+export function usagePaceLabel(detail: string | undefined): string {
+ return detail === undefined ? "" : `, ${detail}`;
}
diff --git a/apps/web/src/components/usage/UsageView.tsx b/apps/web/src/components/usage/UsageView.tsx
index 896d37da3..823454909 100644
--- a/apps/web/src/components/usage/UsageView.tsx
+++ b/apps/web/src/components/usage/UsageView.tsx
@@ -471,8 +471,12 @@ function UsagePlanLimits({
usageMeterColor(meter.usedPercent, meter.warning) ?? fill,
}}
/>
- {meter.elapsedPercent !== undefined ? (
-
+ {meter.elapsedPercent !== undefined && meter.paceDetail !== undefined ? (
+
) : null}
diff --git a/apps/web/src/components/usage/usageView.logic.ts b/apps/web/src/components/usage/usageView.logic.ts
index 986b5472a..79506493c 100644
--- a/apps/web/src/components/usage/usageView.logic.ts
+++ b/apps/web/src/components/usage/usageView.logic.ts
@@ -989,6 +989,8 @@ export interface UsagePlanLimitMeter {
readonly reachedLimit: boolean;
/** How much of the window has passed, for the pace mark; see the shared presentation. */
readonly elapsedPercent?: number;
+ /** The pace mark's hover text, set with `elapsedPercent`. */
+ readonly paceDetail?: string;
}
export interface UsagePlanLimitRow {
@@ -1033,7 +1035,9 @@ export function buildUsagePlanLimitRows(
usedPercent: window.usedPercent,
warning: window.warning,
reachedLimit: window.reachedLimit,
- ...(window.elapsedPercent !== undefined ? { elapsedPercent: window.elapsedPercent } : {}),
+ ...(window.elapsedPercent !== undefined && window.paceDetail !== undefined
+ ? { elapsedPercent: window.elapsedPercent, paceDetail: window.paceDetail }
+ : {}),
}));
if (presentation.spendControl) {
meters.push({
diff --git a/apps/web/src/lib/providerUsage.test.ts b/apps/web/src/lib/providerUsage.test.ts
index 97162e1b2..4dd9de68f 100644
--- a/apps/web/src/lib/providerUsage.test.ts
+++ b/apps/web/src/lib/providerUsage.test.ts
@@ -65,6 +65,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 80,
+ paceDetail: "80% of the 5-hour window has passed",
},
],
});
@@ -113,6 +114,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 80,
+ paceDetail: "80% of the 5-hour window has passed",
},
{
key: "secondary",
@@ -123,6 +125,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 0,
+ paceDetail: "0% of the week has passed",
},
],
});
@@ -336,6 +339,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 80,
+ paceDetail: "80% of the 5-hour window has passed",
},
],
});
@@ -418,6 +422,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 49.3,
+ paceDetail: "49% of the 5-hour window has passed",
},
{
key: "secondary",
@@ -428,6 +433,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 0,
+ paceDetail: "0% of the week has passed",
},
],
});
@@ -478,6 +484,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 49.3,
+ paceDetail: "49% of the 5-hour window has passed",
},
{
key: "secondary",
@@ -488,6 +495,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 0,
+ paceDetail: "0% of the week has passed",
},
{
key: "scoped-0",
@@ -499,6 +507,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: true,
elapsedPercent: 0,
+ paceDetail: "0% of the week has passed",
scope: { name: "Fable", period: "Weekly", resetDetail: "resets in 7d" },
},
]);
@@ -554,6 +563,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: true,
warning: true,
elapsedPercent: 0,
+ paceDetail: "0% of the week has passed",
scope: { name: "Fable", period: "Weekly", resetDetail: "resets in 7d" },
},
]);
@@ -598,6 +608,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: true,
warning: true,
elapsedPercent: 33.3,
+ paceDetail: "33% of the 5-hour window has passed",
},
{
key: "secondary",
@@ -608,6 +619,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 78.7,
+ paceDetail: "79% of the week has passed",
},
],
});
@@ -657,6 +669,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: true,
warning: true,
elapsedPercent: 33.3,
+ paceDetail: "33% of the 5-hour window has passed",
},
{
key: "secondary",
@@ -667,6 +680,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 78.7,
+ paceDetail: "79% of the week has passed",
},
],
});
@@ -716,6 +730,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: false,
warning: false,
elapsedPercent: 33.3,
+ paceDetail: "33% of the 5-hour window has passed",
},
{
key: "secondary",
@@ -726,6 +741,7 @@ describe("deriveProviderAccountUsagePresentation", () => {
reachedLimit: true,
warning: true,
elapsedPercent: 78.7,
+ paceDetail: "79% of the week has passed",
},
],
});
diff --git a/apps/web/src/lib/providerUsage.ts b/apps/web/src/lib/providerUsage.ts
index 6b7ff8138..a263e9d44 100644
--- a/apps/web/src/lib/providerUsage.ts
+++ b/apps/web/src/lib/providerUsage.ts
@@ -34,6 +34,11 @@ export interface ProviderAccountUsageWindowPresentation {
* resets.
*/
readonly elapsedPercent?: number;
+ /**
+ * The pace mark's hover text, "44% of the week has passed". Set exactly
+ * when `elapsedPercent` is.
+ */
+ readonly paceDetail?: string;
/**
* Set on a window that caps one model, not the whole account (Claude's
* per-model weekly limits): the name the provider gives it ("Fable"), its
@@ -250,6 +255,34 @@ export function usageWindowElapsedPercent(
return Math.round((1 - remainingMs / durationMs) * 1000) / 10;
}
+/** "the week", "the day", "the 5-hour window": the span a pace mark measures. */
+function formatUsageWindowSpan(minutes: number): string {
+ if (minutes === 10_080) return "the week";
+ if (minutes === 1_440) return "the day";
+ if (minutes % 1_440 === 0) return `the ${minutes / 1_440}-day window`;
+ if (minutes % 60 === 0) return `the ${minutes / 60}-hour window`;
+ return `the ${minutes}-minute window`;
+}
+
+/** "44% of the week has passed", for the pace mark's hover text. */
+function formatUsagePaceDetail(
+ window: Pick,
+ elapsedPercent: number | undefined,
+): string | null {
+ const minutes = window.windowDurationMins;
+ if (elapsedPercent === undefined || minutes === undefined) return null;
+ return `${Math.round(elapsedPercent)}% of ${formatUsageWindowSpan(minutes)} has passed`;
+}
+
+/** The pace fields of a window presentation: both or neither. */
+function usagePaceFields(
+ window: Pick,
+ elapsedPercent: number | undefined,
+): Pick {
+ const paceDetail = formatUsagePaceDetail(window, elapsedPercent);
+ return elapsedPercent !== undefined && paceDetail !== null ? { elapsedPercent, paceDetail } : {};
+}
+
/**
* How far usage may run past the pace mark before the detail says so, in
* percentage points. Keeps a bar sitting on its mark, or one early in its
@@ -453,7 +486,7 @@ function formatUsageWindowPresentation(
remainingPercent,
reachedLimit: windowReachedLimit,
warning: windowReachedLimit || usedPercent >= USAGE_WARNING_THRESHOLD_PERCENT,
- ...(elapsedPercent !== undefined ? { elapsedPercent } : {}),
+ ...usagePaceFields(window, elapsedPercent),
};
}
@@ -493,7 +526,7 @@ function formatScopedUsageWindowPresentation(
remainingPercent,
reachedLimit,
warning: reachedLimit || severityWarning || usedPercent >= USAGE_WARNING_THRESHOLD_PERCENT,
- ...(elapsedPercent !== undefined ? { elapsedPercent } : {}),
+ ...usagePaceFields(window, elapsedPercent),
scope: { name: window.scopeLabel, period: durationLabel || null, resetDetail },
};
}