Skip to content

Commit f56b161

Browse files
fix(dashboard): widen model pickers + remove combined cache view
Two cosmetic fixes: 1. Model select pickers were too narrow. .model-select had no width and a tight 400px cap, so the 'Add fallback model' picker (a flex item) shrank to its content and the dropdown options wrapped. Now width:100% so both the primary and fallback pickers fill their column. 2. Remove the combined/'Show all' cache view entirely. The Cache Diagnostics page could deselect to a merged-across-all-sessions chart/list, which the combined numbers made confusing. A session is now always selected: removed the 'Show all' button, made card clicks select-only (clicking the active card is a no-op), and on a harness-filter change that orphans the selection we re-select the top filtered card instead of clearing. Dropped the now-dead merge branch in filteredEvents and the orphaned isSubagent helper + subagentIds signal. Gate: dashboard frontend 29/0, tsc + biome clean, build clean. Co-authored-by: Alfonso [Magic Context] <288211368+alfonso-magic-context@users.noreply.github.com>
1 parent 8513d68 commit f56b161

3 files changed

Lines changed: 26 additions & 49 deletions

File tree

packages/dashboard/src/components/CacheDiagnostics/CacheDiagnostics.tsx

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export default function CacheDiagnostics() {
4747
);
4848
const [harnessFilter, setHarnessFilter] = createSignal<HarnessFilter>("all");
4949
const [hideSubagents, setHideSubagents] = createSignal(true);
50-
const [subagentIds, setSubagentIds] = createSignal<Set<string>>(new Set());
5150
const [expandedTurns, setExpandedTurns] = createSignal<Set<string>>(new Set());
5251
// Window size = how many recent events to keep per session (the picker). Drives
5352
// both the per-session card stats and the selected session's chart/list.
@@ -121,14 +120,11 @@ export default function CacheDiagnostics() {
121120
const applySessionMeta = (sessions: SessionRow[]) => {
122121
cachedSessions = sessions;
123122
const names: Record<string, string> = {};
124-
const subs = new Set<string>();
125123
for (const s of sessions) {
126124
const key = windowKey(s.harness, s.session_id);
127125
if (s.title) names[key] = s.title;
128-
if (s.is_subagent) subs.add(key);
129126
}
130127
setSessionNames(names);
131-
setSubagentIds(subs);
132128
};
133129

134130
// The recent sessions we keep windows for: top-N by activity, non-subagent
@@ -285,9 +281,6 @@ export default function CacheDiagnostics() {
285281
}
286282
};
287283

288-
const isSubagent = (harness: Harness, sessionId: string) =>
289-
subagentIds().has(`${harness}:${sessionId}`);
290-
291284
// Cards: per-session stats aggregated over each session's OWN window (never a
292285
// shared global pool), ordered by the session table's recency. Reading
293286
// windowsVersion() makes this re-run when any window changes.
@@ -329,24 +322,17 @@ export default function CacheDiagnostics() {
329322
return rows.slice(0, visibleCardCount());
330323
};
331324

332-
// Chart/list events: the selected session's window, or — when nothing is
333-
// selected ("Show all") — every recent window merged (filtered). Reading
334-
// windowsVersion() ties the downstream memos to window mutations.
325+
// Chart/list events: the selected session's window. There is no combined /
326+
// merged "all sessions" view: a session is always selected (cards select,
327+
// never deselect), so an empty result only occurs in the brief pre-selection
328+
// window on cold start. Reading windowsVersion() ties the downstream memos to
329+
// window mutations.
335330
const filteredEvents = () => {
336331
windowsVersion();
337332
const selected = selectedSession();
338-
if (selected) {
339-
const win = cachedWindows.get(windowKey(selected.harness, selected.sessionId));
340-
return win ? win.events : [];
341-
}
342-
const harness = harnessFilter();
343-
const all: DbCacheEvent[] = [];
344-
for (const win of cachedWindows.values()) {
345-
if (harness !== "all" && win.harness !== harness) continue;
346-
if (hideSubagents() && isSubagent(win.harness, win.sessionId)) continue;
347-
all.push(...win.events);
348-
}
349-
return all;
333+
if (!selected) return [];
334+
const win = cachedWindows.get(windowKey(selected.harness, selected.sessionId));
335+
return win ? win.events : [];
350336
};
351337

352338
// Ordering used for worst-severity promotion across multi-step turns.
@@ -493,10 +479,16 @@ export default function CacheDiagnostics() {
493479
<FilterSelect
494480
value={harnessFilter()}
495481
onChange={(value) => {
496-
setHarnessFilter(value as HarnessFilter);
497-
// Clear the selection → Lane B switches to the global recent
498-
// window (selectSession triggers the event refetch).
499-
selectSession(null);
482+
const harness = value as HarnessFilter;
483+
setHarnessFilter(harness);
484+
// Keep a session selected (no combined view): if the current
485+
// selection no longer matches the harness filter, re-select the
486+
// top card of the filtered set.
487+
const sel = selectedSession();
488+
if (sel && harness !== "all" && sel.harness !== harness) {
489+
const top = filteredStats()[0];
490+
selectSession(top ? { harness: top.harness, sessionId: top.session_id } : null);
491+
}
500492
}}
501493
placeholder="Harness"
502494
options={[
@@ -546,20 +538,6 @@ export default function CacheDiagnostics() {
546538
style={{ "font-size": "11px", color: "var(--text-secondary)", "margin-bottom": "8px" }}
547539
>
548540
Recent Sessions
549-
<Show when={selectedSession()}>
550-
<span> · </span>
551-
<button
552-
type="button"
553-
class="btn sm"
554-
style={{ padding: "1px 6px", "font-size": "10px", "margin-left": "4px" }}
555-
onClick={() => {
556-
// Clear the selection → Lane B shows the global recent window.
557-
selectSession(null);
558-
}}
559-
>
560-
Show all
561-
</button>
562-
</Show>
563541
</div>
564542
<div
565543
ref={measureCardRow}
@@ -588,13 +566,12 @@ export default function CacheDiagnostics() {
588566
"text-align": "left",
589567
}}
590568
onClick={() => {
591-
// Toggle selection. selectSession refetches Lane B for the
592-
// new scope (the selected session, or the global recent
593-
// window when cleared) — no separate global-load path.
594-
const next = isActive()
595-
? null
596-
: { harness: stat.harness, sessionId: stat.session_id };
597-
selectSession(next);
569+
// Select-only: clicking a card focuses that session's
570+
// window. Clicking the already-active card is a no-op
571+
// (there is no combined/merged view to toggle back to).
572+
if (!isActive()) {
573+
selectSession({ harness: stat.harness, sessionId: stat.session_id });
574+
}
598575
}}
599576
>
600577
<div

packages/dashboard/src/lib/cache-format.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe("normalizeEstimatedContextLimits", () => {
6363
expect(out).toBe(events);
6464
});
6565

66-
it("collapses each session to its OWN max in a merged (Show all) view", () => {
66+
it("collapses each session to its OWN max (per session_id, not cross-session)", () => {
6767
const events = [
6868
ev({
6969
message_id: "a",

packages/dashboard/src/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2375,7 +2375,7 @@ select.config-input {
23752375
/* Custom searchable model select */
23762376
.model-select {
23772377
position: relative;
2378-
max-width: 400px;
2378+
width: 100%;
23792379
}
23802380

23812381
.model-select-trigger {

0 commit comments

Comments
 (0)