Skip to content
Python

fix(observability): Heaviest turns columns rebalanced at desktop widths (T3-5)

Devika Vermae0e750d6dcfd
diff --git a/surfaces/gui/src/components/UsagePage.test.tsx b/surfaces/gui/src/components/UsagePage.test.tsx
index 78f4ba4e..47ebfc0c 100644
--- a/surfaces/gui/src/components/UsagePage.test.tsx
+++ b/surfaces/gui/src/components/UsagePage.test.tsx
@@ -2,7 +2,7 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import i18n from "i18next";
-import { ApproverStripView, coworkerChoices, coworkerTable, loadUsage, RatingsCard, UsageBody, type UsageData } from "./UsagePage";
+import { ApproverStripView, coworkerChoices, coworkerTable, loadUsage, RatingsCard, shortModel, UsageBody, type UsageData } from "./UsagePage";
import type { UsageRollup } from "../api";
afterEach(cleanup);
@@ -77,6 +77,12 @@ describe("UsageBody", () => {
expect(table.className).toContain("p3-heavy");
expect(table.querySelectorAll("col")).toHaveLength(7);
expect(screen.getByTestId("usage-heavy-model").getAttribute("title")).toBe(long);
+ expect(screen.getByTestId("usage-heavy-model").textContent).toBe("a-very-long-model-name-v4-pro");
+ // the turn number is its own piece, so the title is cut before it, never the number
+ expect(screen.getByTestId("usage-heavy-turn").textContent).toContain("turn 5");
+ // a short header, the long one on hover
+ const th = [...table.querySelectorAll("th")].find((x) => x.textContent === "Active time")!;
+ expect(th.getAttribute("title")).toBe("Time without waiting");
const issues = screen.getByTestId("usage-heavy-issues");
expect(issues.querySelectorAll(".steps-badge")).toHaveLength(2);
expect(issues.textContent).toContain("+2");
@@ -115,6 +121,16 @@ describe("UsageBody", () => {
});
});
+describe("shortModel (T3-5)", () => {
+ it("drops the provider and the lab, keeps a size tag", () => {
+ expect(shortModel("openrouter:deepseek/deepseek-v4-pro")).toBe("deepseek-v4-pro");
+ expect(shortModel("openrouter:z-ai/glm-5.3")).toBe("glm-5.3");
+ expect(shortModel("openai:gpt-5.6-sol")).toBe("gpt-5.6-sol");
+ expect(shortModel("ollama:qwen3:0.6b")).toBe("qwen3:0.6b");
+ expect(shortModel("model-x")).toBe("model-x");
+ });
+});
+
describe("ApproverStripView", () => {
it("counts under 10 checks and says when shadow checks are in the tokens", () => {
const ap = { checks: 1, allowed: 1, asked: 0, blocked: 0, could_not_run: 0, median_ms: 1000, overridden: 0,
diff --git a/surfaces/gui/src/components/UsagePage.tsx b/surfaces/gui/src/components/UsagePage.tsx
index e3e50547..43ebc0f2 100644
--- a/surfaces/gui/src/components/UsagePage.tsx
+++ b/surfaces/gui/src/components/UsagePage.tsx
@@ -273,27 +273,31 @@ export function UsageBody({ data, period, t, onOpenTurn, onOpenPersona, picked =
// their cell (full text on hover) and the table never grows past its card.
<table className="p3-t p3-heavy" data-testid="usage-heaviest">
<colgroup>
- <col style={{ width: "27%" }} /><col style={{ width: "14%" }} /><col style={{ width: "18%" }} />
- <col style={{ width: "9%" }} /><col style={{ width: "9%" }} /><col style={{ width: "16%" }} /><col style={{ width: "7%" }} />
+ <col style={{ width: "25%" }} /><col style={{ width: "12%" }} /><col style={{ width: "16%" }} />
+ <col style={{ width: "8%" }} /><col style={{ width: "8%" }} /><col style={{ width: "25%" }} /><col style={{ width: "6%" }} />
</colgroup>
<thead><tr><th>{t("p3.usage.session")}</th><th>{t("p3.usage.coworker")}</th><th>{t("p3.usage.model")}</th>
- <th className="n">{t("p3.usage.tokens")}</th><th className="n">{t("p3.usage.active_time")}</th><th>{t("p3.usage.issues")}</th><th></th></tr></thead>
+ <th className="n">{t("p3.usage.tokens")}</th>
+ <th className="n" title={t("p3.usage.active_time")}>{t("p3.usage.active_time_short")}</th>
+ <th>{t("p3.usage.issues")}</th><th></th></tr></thead>
<tbody>
{data.heavy.map((h) => {
const title = h.session_deleted ? t("p3.usage.deleted_session") : (h.title || h.session_id);
const turn = h.seq != null ? t("p3.usage.turn_n", { n: h.seq }) : "";
const who = (h.persona_id && names[h.persona_id]) || h.persona_id || "—";
const models = h.model_ids.join(", ") || "—";
+ const shortModels = h.model_ids.map(shortModel).join(", ") || "—";
const issues = h.checks.map((c) => t(`steps.issues.title.${c}`, { defaultValue: c }));
return (
<tr key={h.turn_id}>
- <td><span className="p3-cut" title={turn ? `${title} · ${turn}` : title}>
- {h.session_deleted ? <span className="text-faint">{title}</span> : title}
- {turn && <span className="text-faint"> · {turn}</span>}</span></td>
+ <td><span className="p3-titleturn" title={turn ? `${title} · ${turn}` : title}>
+ {/* the title is cut, never the turn number after it */}
+ <span className={"p3-cut" + (h.session_deleted ? " text-faint" : "")}>{title}</span>
+ {turn && <span className="text-faint p3-keep" data-testid="usage-heavy-turn">&nbsp;· {turn}</span>}</span></td>
<td><span className="p3-cut" title={who}>{who}</span></td>
- <td><span className="p3-cut font-mono" title={models} data-testid="usage-heavy-model">{models}</span></td>
+ <td><span className="p3-cut font-mono" title={models} data-testid="usage-heavy-model">{shortModels}</span></td>
<td className="n">{(h.at_least ? "≥ " : "") + formatTokens(h.total)}</td>
- <td className="n">{h.found_open ? <span className="text-faint">{t("p3.usage.found_open")}</span> : formatDuration(h.active_ms)}</td>
+ <td className="n">{h.found_open ? <span className="text-faint p3-wrap">{t("p3.usage.found_open")}</span> : formatDuration(h.active_ms)}</td>
<td>{issues.length > 0 && (
<span className="p3-badges" title={issues.join(", ")} data-testid="usage-heavy-issues">
<span className="steps-badge warn">{issues[0]}</span>
@@ -330,6 +334,15 @@ export function UsageBody({ data, period, t, onOpenTurn, onOpenPersona, picked =
);
}
+/** The model's own name without its provider and lab ("openrouter:deepseek/deepseek-v4-pro"
+ * → "deepseek-v4-pro"); the cell's hover keeps the full id (T3-5). */
+export function shortModel(id: string): string {
+ if (id.includes("/")) return id.slice(id.lastIndexOf("/") + 1);
+ // only the provider prefix goes: "ollama:qwen3:0.6b" keeps its size tag
+ const i = id.indexOf(":");
+ return i >= 0 ? id.slice(i + 1) : id;
+}
+
type ChartRow = { label: string; values: Record<string, number>; total: number };
function Bars({ rows, max, series, t, small, testid }: { rows: ChartRow[]; max: number; series: readonly string[]; t: T; small?: boolean; testid: string }) {
@@ -430,9 +443,9 @@ export function RatingsCard({ r, names, t, onOpenTurn }: {
const reasons = d.reasons.map(reasonLabel).join(", ");
return (
<tr key={d.turn_id}>
- <td><span className="p3-cut" title={turn ? `${title} · ${turn}` : title}>
- {d.session_deleted ? <span className="text-faint">{title}</span> : title}
- {turn && <span className="text-faint"> · {turn}</span>}</span></td>
+ <td><span className="p3-titleturn" title={turn ? `${title} · ${turn}` : title}>
+ <span className={"p3-cut" + (d.session_deleted ? " text-faint" : "")}>{title}</span>
+ {turn && <span className="text-faint p3-keep">&nbsp;· {turn}</span>}</span></td>
<td><span className="p3-cut" title={who}>{who}</span></td>
<td><span className="p3-cut" title={reasons}>{reasons || <span className="text-faint">—</span>}</span></td>
<td><span className="p3-cut" title={d.note || ""} data-testid="usage-ratings-note">{d.note || <span className="text-faint">—</span>}</span></td>
diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.json
index 3f40a531..bf51e211 100644
--- a/surfaces/gui/src/locales/en.json
+++ b/surfaces/gui/src/locales/en.json
@@ -3955,6 +3955,7 @@
"session": "Session",
"model": "Model",
"active_time": "Time without waiting",
+ "active_time_short": "Active time",
"issues": "Issues",
"turn_n": "turn {{n}}",
"deleted_session": "deleted session",
diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.json
index fc2f8e1f..3f5f0ee6 100644
--- a/surfaces/gui/src/locales/zh.json
+++ b/surfaces/gui/src/locales/zh.json
@@ -3896,6 +3896,7 @@
"session": "会话",
"model": "模型",
"active_time": "不含等待的时长",
+ "active_time_short": "活跃时长",
"issues": "问题",
"turn_n": "第 {{n}} 轮",
"deleted_session": "已删除的会话",
diff --git a/surfaces/gui/src/styles.css b/surfaces/gui/src/styles.css
index 7381c4aa..5b597039 100644
--- a/surfaces/gui/src/styles.css
+++ b/surfaces/gui/src/styles.css
@@ -2643,6 +2643,13 @@ html[data-theme="dark"] { --bar-model:#4c8dff; --bar-tool:#3fb8ad; --bar-wait:#3
.p3-heavy td { overflow:hidden; }
.p3-cut { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.p3-badges { display:flex; flex-wrap:nowrap; gap:3px; min-width:0; }
+.p3-heavy th { white-space:normal; overflow-wrap:anywhere; vertical-align:bottom; }
+.p3-titleturn { display:flex; min-width:0; white-space:nowrap; }
+.p3-titleturn .p3-cut { flex:0 1 auto; min-width:0; }
+.p3-keep { flex:0 0 auto; }
+/* a right-aligned number column and the left-aligned Issues column need air between them */
+.p3-heavy th:nth-child(6), .p3-heavy td:nth-child(6) { padding-left:16px; }
+.p3-heavy td.n .p3-wrap { white-space:normal; }
.p3-badges .steps-badge:first-child { flex:0 1 auto; }
.p3-badges .steps-badge + .steps-badge { flex:0 0 auto; }
.p3-trunc { max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }