From 41eafc4476bf709628f33abbb4771f0bcc676f82 Mon Sep 17 00:00:00 2001 From: Paul Itoi <814886+pitoi@users.noreply.github.com> Date: Mon, 31 Aug 2026 02:08:14 +0000 Subject: [PATCH] [Jamie] Stop Consolidated Report runs from appearing in the Legal Benchmarks Runs tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem The Legal Benchmarks "Runs" tab for a task shows `LEGAL_BENCHMARK_CONSOLIDATED` runs (cross-run Consolidated Report comparisons, a separate Stakwork workflow) mixed in with the task's actual `LEGAL_BENCHMARK_RUNNER` runs (workflow 57179). ## Root cause `src/hooks/useLegalBenchmarkRunList.ts` tags fetched Consolidated Report rows with the same `"recursion"` `runType` used for genuine recursion/eval rows. A code comment claims this tag keeps them "invisible" in the Runs tab table, but `src/components/legal/BenchmarkRunsHistory.tsx`'s `secondaryRows` filter is a deny-list (`runType !== "manual"`) that does not actually exclude them — so they render. ## Fix - Tag Consolidated Report rows with a new, distinct `"consolidated"` runType instead of reusing `"recursion"`. - Keep fetching/merging them (still needed so the Recursion tab gets live Pusher updates for in-flight/completed consolidated-report generation after a page refresh). - Change `BenchmarkRunsHistory.tsx`'s `secondaryRows` filter from a deny-list to an explicit allow-list (`runType === "recursion"`), so only genuine eval/recursion rows land in the table's secondary rows, and the new `"consolidated"` tag is excluded by construction. ## Scope Client-side/UI only — no API route, Prisma schema, or dispatch/webhook changes. --- src/components/legal/BenchmarkRunsHistory.tsx | 9 ++++- src/components/legal/RecursionBox.tsx | 9 +++-- src/hooks/useLegalBenchmarkRunList.ts | 34 ++++++++++++------- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/components/legal/BenchmarkRunsHistory.tsx b/src/components/legal/BenchmarkRunsHistory.tsx index b254c6ef3d..5da3a67676 100644 --- a/src/components/legal/BenchmarkRunsHistory.tsx +++ b/src/components/legal/BenchmarkRunsHistory.tsx @@ -313,7 +313,14 @@ export function BenchmarkRunsHistory({ () => runs.filter( (r) => - r.runType !== "manual" && + // Allow-list, not deny-list: only "recursion"-tagged rows (the + // LEGAL_BENCHMARK_EVAL / LEGAL_BENCHMARK_RECURSION loop) surface + // here. "manual" rows have their own path via manualRuns/manualRows, + // and "consolidated" rows (LEGAL_BENCHMARK_CONSOLIDATED) are + // excluded from both — they never render as their own row in this + // table, even though they still flow through the hook's merged + // `runs` list for the Recursion tab's Pusher-driven status tracking. + r.runType === "recursion" && (!selectedTask || r.taskSlug === selectedTask.slug), ), [runs, selectedTask], diff --git a/src/components/legal/RecursionBox.tsx b/src/components/legal/RecursionBox.tsx index 04d92fdf90..d012c2b163 100644 --- a/src/components/legal/RecursionBox.tsx +++ b/src/components/legal/RecursionBox.tsx @@ -393,13 +393,18 @@ function RecursionCard({ entry, refetch, allRuns }: RecursionCardProps) { // `allRuns` is lifted from RecursionTab (via RecursionList) so the whole tab // shares one fetch-and-poll loop instead of one per card. - // Find the most recent CONSOLIDATED run for this taskSlug. + // Find the most recent CONSOLIDATED run for this taskSlug. Consolidated + // rows are tagged "consolidated" (distinct from the "recursion" loop tag) + // by useLegalBenchmarkRunList specifically so they stay invisible in the + // Runs tab table — but this card still needs to find them here, in the + // same merged `allRuns` list, to seed in-flight/completed status after a + // page refresh. const existingConsolidated = useMemo(() => { return (allRuns ?? []) .filter( (r) => r.taskSlug === entry.id && - r.runType === "recursion" && + r.runType === "consolidated" && (r.status === WorkflowStatus.PENDING || r.status === WorkflowStatus.IN_PROGRESS) && !r.hasReport, diff --git a/src/hooks/useLegalBenchmarkRunList.ts b/src/hooks/useLegalBenchmarkRunList.ts index 5cbee35a0d..6147e373d3 100644 --- a/src/hooks/useLegalBenchmarkRunList.ts +++ b/src/hooks/useLegalBenchmarkRunList.ts @@ -8,16 +8,23 @@ import { getWorkspaceChannelName, PUSHER_EVENTS } from "@/lib/pusher"; /** * Display name per StakworkRun pipeline: - * - "manual" — LEGAL_BENCHMARK_RUNNER: a human clicked Run; scored - * - "recursion" — the automated loop, covering BOTH cron pipelines: - * LEGAL_BENCHMARK_EVAL (failure analysis; writes cause - * annotations onto the source run) and - * LEGAL_BENCHMARK_RECURSION (the fix-proposal step). - * Analysis is an internal stage of the loop, not a category - * an operator distinguishes — neither pipeline ever scores; - * re-scored attempts land graph-side (Recursion tab). + * - "manual" — LEGAL_BENCHMARK_RUNNER: a human clicked Run; scored + * - "recursion" — the automated loop, covering BOTH cron pipelines: + * LEGAL_BENCHMARK_EVAL (failure analysis; writes cause + * annotations onto the source run) and + * LEGAL_BENCHMARK_RECURSION (the fix-proposal step). + * Analysis is an internal stage of the loop, not a category + * an operator distinguishes — neither pipeline ever scores; + * re-scored attempts land graph-side (Recursion tab). + * - "consolidated" — LEGAL_BENCHMARK_CONSOLIDATED: the cross-run "Consolidated + * Report" comparison. Tagged distinctly from "recursion" so + * BenchmarkRunsHistory's allow-list filter excludes it from + * the Runs tab table entirely, while still flowing through + * this hook's merged `runs` list/Pusher subscription so the + * Recursion tab's RecursionCard can seed in-flight/completed + * consolidated-report status after a page refresh. */ -export type BenchmarkRunType = "manual" | "recursion"; +export type BenchmarkRunType = "manual" | "recursion" | "consolidated"; export interface BenchmarkRunListRow { id: string; @@ -227,9 +234,12 @@ export function useLegalBenchmarkRunList( // CONSOLIDATED rows are merged so Pusher updates for them flow through // the existing channel subscription without new polling logic, enabling // RecursionCard to surface in-flight / completed consolidated report - // status after a page refresh. They are not surfaced in the Runs tab - // table — the runType tag keeps them invisible there. - ...rawConsolidatedRows.map((r) => mapSecondary(r, "recursion")), + // status after a page refresh. They are tagged "consolidated" — a tag + // distinct from "recursion" — specifically so BenchmarkRunsHistory's + // allow-list filter excludes them from ever rendering as their own row + // in the Runs tab table, while remaining in this merged list (and thus + // reachable by RecursionCard/allRuns) for the Recursion tab's seeding. + ...rawConsolidatedRows.map((r) => mapSecondary(r, "consolidated")), ].sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()); runsRef.current = merged;