From eb70c1fcc54de40b65e9aee5c514b725b802e192 Mon Sep 17 00:00:00 2001 From: Nam Rodriguez Date: Wed, 11 Nov 2026 18:29:06 -0500 Subject: [PATCH 1/2] Run page and Reliability say when a run ended on red CI or with work left The run badge reads "CI failing" when the pull request is held on a failing check, and "Stopped, not finished" when the run stopped with planned work left, instead of "PR held" or "Waiting on you". The Reliability tab shows runs that ended done with red CI or after a stop (ci.ended_wrong), which should stay at zero. --- dashboard/e2e/analytics.spec.ts | 21 ++++++++++++-- dashboard/e2e/run-draft-hold.spec.ts | 37 +++++++++++++++++++++++++ dashboard/src/app/analytics/page.tsx | 23 +++++++++++++++ dashboard/src/app/runs/detail/page.tsx | 3 +- dashboard/src/components/run-status.tsx | 21 +++++++++++++- dashboard/src/lib/api.ts | 7 +++++ 6 files changed, 108 insertions(+), 4 deletions(-) diff --git a/dashboard/e2e/analytics.spec.ts b/dashboard/e2e/analytics.spec.ts index 5f301347..ea83fddb 100644 --- a/dashboard/e2e/analytics.spec.ts +++ b/dashboard/e2e/analytics.spec.ts @@ -149,7 +149,7 @@ function analytics(period: string, repo: string | null, deployState: DeployState }; } -interface Backend { calls: string[]; fail: boolean; empty: boolean; oldServer: boolean; estimated: number; recovered: number; deliveries?: "ok" | "refused"; deployState?: DeployState; noAccess?: string[]; sourceNote?: string | null; notRead?: { repo: string; reason: string }[]; progress?: { read: number; total: number; resumes_at?: string | null } | null } +interface Backend { endedWrong?: boolean; calls: string[]; fail: boolean; empty: boolean; oldServer: boolean; estimated: number; recovered: number; deliveries?: "ok" | "refused"; deployState?: DeployState; noAccess?: string[]; sourceNote?: string | null; notRead?: { repo: string; reason: string }[]; progress?: { read: number; total: number; resumes_at?: string | null } | null } async function mockApi(page: Page, init: Partial = {}): Promise { const db: Backend = { calls: [], fail: false, empty: false, oldServer: false, estimated: 0, recovered: 0, ...init }; @@ -174,7 +174,10 @@ async function mockApi(page: Page, init: Partial = {}): Promise [k, typeof (SUMMARY as Record)[k] === "number" ? 0 : null])); return json(route, { ...body, summary: zero, previous: zero, reviews: { ...body.reviews, posted: 0 }, lookups: { ...body.lookups, total: 0 } }); @@ -317,6 +320,20 @@ test("where it struggles places every red CI run in one outcome, base-branch fai await shot(page, "analytics-ci-outcomes"); }); +test("runs that ended done with red CI or after a stop are counted, so a regression shows", async ({ page }) => { + await mockApi(page); + await page.goto("/analytics?tab=reliability"); + await expect(page.getByTestId("ci-line")).toBeVisible(); + await expect(page.getByTestId("ended-wrong")).toHaveCount(0); + await page.unrouteAll({ behavior: "ignoreErrors" }); + await mockApi(page, { endedWrong: true }); + await page.goto("/analytics?tab=reliability"); + const line = page.getByTestId("ended-wrong"); + await expect(line).toContainText("1 run ended done with its CI still red"); + await expect(line).toContainText("2 runs ended done after stopping with work left"); + await expect(line.getByRole("link", { name: "newest" }).first()).toHaveAttribute("href", /\/runs\/detail\/?\?id=01RUNREDDONE0000000000000A$/); +}); + test("period and repository filters reload, and a chart can be read as a table", async ({ page }) => { const db = await mockApi(page); await page.goto("/analytics"); diff --git a/dashboard/e2e/run-draft-hold.spec.ts b/dashboard/e2e/run-draft-hold.spec.ts index 93fb715a..f809082c 100644 --- a/dashboard/e2e/run-draft-hold.spec.ts +++ b/dashboard/e2e/run-draft-hold.spec.ts @@ -150,6 +150,43 @@ test("a held run that also asked something shows its questions, not only the hol await expect(outcome.getByTestId("run-question")).toContainText("Should the limit apply to signed-in people too?"); }); +test("a run whose pull request's CI fails reads CI failing, with the check and the error, never Done", async ({ page }) => { + const ci = { + what: "CI is failing on this head: `Deploy Preview`", + todo: "Fix the failing checks on this branch (Coderhelm decides again on the push), or re-run them if the failure isn't the change's; the pull request leaves draft once CI is green.", + }; + await mockApi(page, run({ + waiting_on: { + action: "Review pull request #318", + detail: "CI is failing: Deploy Preview: Error: expect(received).toBeLessThanOrEqual(expected). Coderhelm made 3 fix attempt(s) without getting it green. The pull request stays a draft until CI passes", + url: "https://github.com/your-team/web/pull/318", + since: iso(5), + }, + draft_hold: { kind: "held", summary: `Finished, but pull request #318 stays a draft: ${ci.what}.`, reasons: [ci], pr_number: 318, since: iso(5) }, + })); + await page.goto("/runs/detail?id=01RUNHOLD"); + await expect(page.getByTestId("page-header").getByText("CI failing", { exact: true })).toBeVisible(); + await expect(page.getByTestId("page-header").getByText("Done", { exact: true })).toHaveCount(0); + await expect(page.getByTestId("draft-hold-reasons")).toContainText("CI is failing on this head: Deploy Preview"); + await expect(page.getByTestId("run-outcome")).toHaveAttribute("data-tone", "waiting"); + await noSideways(page); + await shot(page, "run-ci-failing"); +}); + +test("a run stopped with planned work left reads Stopped, not finished", async ({ page }) => { + await mockApi(page, run({ + waiting_on: { + action: "Review pull request #318", + detail: "Stopped: steps 2 and 3 made no progress. The branch stayed at a8c8814 and the run was stuck at the implement work (planned tasks) while working on task 8 of 8.", + url: "https://github.com/your-team/web/pull/318", + since: iso(5), + }, + draft_hold: null, + })); + await page.goto("/runs/detail?id=01RUNHOLD"); + await expect(page.getByTestId("page-header").getByText("Stopped, not finished", { exact: true })).toBeVisible(); +}); + test("a run with no hold still reads as before", async ({ page }) => { await mockApi(page, run({ status: "completed", waiting_on: null, draft_hold: null })); await page.goto("/runs/detail?id=01RUNHOLD"); diff --git a/dashboard/src/app/analytics/page.tsx b/dashboard/src/app/analytics/page.tsx index 232c8806..1ab1027e 100644 --- a/dashboard/src/app/analytics/page.tsx +++ b/dashboard/src/app/analytics/page.tsx @@ -330,6 +330,29 @@ function Body({ data, loading, stats, tab }: { data: Analytics; loading: boolean

)} {data.ci.outcomes && } + {!!((data.ci.ended_wrong?.completed_with_red_ci ?? 0) + (data.ci.ended_wrong?.completed_after_stop ?? 0)) && ( +

+ {(data.ci.ended_wrong?.completed_with_red_ci ?? 0) > 0 && ( + <> + {plural(data.ci.ended_wrong?.completed_with_red_ci ?? 0, "run")} ended done with its CI still red + {data.ci.ended_wrong?.completed_red_runs?.[0] && ( + <> (newest) + )} + .{" "} + + )} + {(data.ci.ended_wrong?.completed_after_stop ?? 0) > 0 && ( + <> + {plural(data.ci.ended_wrong?.completed_after_stop ?? 0, "run")} ended done after stopping with work left + {data.ci.ended_wrong?.completed_after_stop_runs?.[0] && ( + <> (newest) + )} + .{" "} + + )} + Neither should happen: tell Coderhelm support. +

+ )} {!!data.loops_stopped?.total && } {!!data.waiting?.total && } diff --git a/dashboard/src/app/runs/detail/page.tsx b/dashboard/src/app/runs/detail/page.tsx index 42b48110..d1c4065d 100644 --- a/dashboard/src/app/runs/detail/page.tsx +++ b/dashboard/src/app/runs/detail/page.tsx @@ -13,7 +13,7 @@ import { Callout } from "@/components/callout"; import { InlineMarkdown, Markdown } from "@/components/markdown"; import { buttonClass, dangerButton, focusRing, fullWidthOnPhone, primaryButton, secondaryButton } from "@/components/ui"; import { Page, PageHeader, SectionHeading } from "@/components/page"; -import { RunStatusBadge, runCanClose, runCloseIsLikely, runIsLive, runStatusLabel } from "@/components/run-status"; +import { RunStatusBadge, runCanClose, runCloseIsLikely, runHeldOn, runIsLive, runStatusLabel } from "@/components/run-status"; import { CloseRunDialog } from "@/components/close-run-dialog"; import { Chip, Time, formatDuration as sharedDuration, formatMs } from "@/components/list"; import { usePaletteActions, type PageAction } from "@/components/command-palette"; @@ -1050,6 +1050,7 @@ function RunDetailInner() { status={run.status} draftHold={hold?.kind} waitingOn={!run.questions?.length && !!run.waiting_on?.action} + heldOn={run.status === "needs_input" || hold ? runHeldOn([...(hold?.reasons ?? []).map((r) => r.what), run.status === "needs_input" ? run.waiting_on?.detail : null]) : null} unfinishedRound={!!run.round_incomplete && ["completed", "success"].includes(run.status)} /> } diff --git a/dashboard/src/components/run-status.tsx b/dashboard/src/components/run-status.tsx index 918dd9dc..b65e9936 100644 --- a/dashboard/src/components/run-status.tsx +++ b/dashboard/src/components/run-status.tsx @@ -77,14 +77,27 @@ const UNFINISHED_ROUND: RunLook = { label: "PR open, fix unfinished", tone: "att const DRAFT_HELD: RunLook = { label: "PR held", tone: "waiting", group: "waiting" }; /** The same, when GitHub refused every try to mark it ready. */ const DRAFT_NOT_MARKED: RunLook = { label: "PR held", tone: "attention", group: "waiting" }; +/** The pull request is held because its CI fails: named so, never "Done". */ +const CI_FAILING: RunLook = { label: "CI failing", tone: "attention", group: "waiting" }; +/** The run stopped before its planned work was done; its draft says what is left. */ +const STOPPED_UNFINISHED: RunLook = { label: "Stopped, not finished", tone: "attention", group: "waiting" }; /** Waiting on a person for something that isn't a question (`waiting_on`): reviewing the pull request, say. */ const WAITING_ON_YOU: RunLook = { label: "Waiting on you", tone: "waiting", group: "waiting" }; +/** What a run that needs a person is held on, from its hold reasons and its wait: CI failing, or work left unfinished. */ +export function runHeldOn(whats: (string | null | undefined)[]): "ci_failing" | "unfinished" | null { + const w = whats.map((s) => (s ?? "").trim()); + if (w.some((s) => s.startsWith("CI is failing"))) return "ci_failing"; + if (w.some((s) => s.startsWith("Planned work is not done") || s.startsWith("Stopped:"))) return "unfinished"; + return null; +} + export function RunStatusBadge({ status, unfinishedRound, draftHold, waitingOn, + heldOn, }: { status: string | null | undefined; unfinishedRound?: boolean; @@ -92,8 +105,14 @@ export function RunStatusBadge({ draftHold?: string | null; /** A `needs_input` run waits for a named action, not an answer. */ waitingOn?: boolean; + /** What holds it, when that is CI failing or unfinished work (`runHeldOn`). */ + heldOn?: "ci_failing" | "unfinished" | null; }) { - const look = draftHold + const look = heldOn === "ci_failing" + ? CI_FAILING + : heldOn === "unfinished" + ? STOPPED_UNFINISHED + : draftHold ? draftHold === "failed" ? DRAFT_NOT_MARKED : DRAFT_HELD diff --git a/dashboard/src/lib/api.ts b/dashboard/src/lib/api.ts index b9d03770..4b04cbd9 100644 --- a/dashboard/src/lib/api.ts +++ b/dashboard/src/lib/api.ts @@ -3801,6 +3801,13 @@ export interface Analytics { outcomes?: AnalyticsCiOutcomes; /** Why Coderhelm left a red PR to a person, most common first. */ gave_up_reasons?: { reason: string; count: number }[]; + /** Runs that ended in a state Coderhelm must never leave (both should be zero). Missing from older backends. */ + ended_wrong?: { + completed_with_red_ci: number; + completed_red_runs: string[]; + completed_after_stop: number; + completed_after_stop_runs: string[]; + }; }; /** Runs the run guard ended for making no progress. Missing from older backends. */ loops_stopped?: { total: number; reasons: { reason: string; count: number }[] }; From fd5ac31289faeb462333589d75bfb7caff19433e Mon Sep 17 00:00:00 2001 From: Nam Rodriguez Date: Wed, 11 Nov 2026 19:46:01 -0500 Subject: [PATCH 2/2] Settings menu test matches Integrations by its start and address The Integrations link's name gains "Needs attention: ..." once the integrations' status arrives. The member test on the AWS page matched the exact name, so it passed only while the status was still loading (2 of 15 runs failed on the static build). It now matches like the admin test above it. --- dashboard/e2e/integrations-page.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dashboard/e2e/integrations-page.spec.ts b/dashboard/e2e/integrations-page.spec.ts index f58eb7e9..d2f4a18e 100644 --- a/dashboard/e2e/integrations-page.spec.ts +++ b/dashboard/e2e/integrations-page.spec.ts @@ -489,7 +489,11 @@ test("on the AWS page members see Integrations lit, and no AWS item", async ({ p await mockApi(page, { role: "member" }); await page.goto("/settings/integrations/aws"); const nav = page.getByRole("navigation", { name: "Settings" }); - await expect(nav.getByRole("link", { name: "Integrations", exact: true })).toHaveAttribute("aria-current", "page"); + // The link's name gains "Needs attention: ..." once the integrations' status + // arrives, so it is matched by its start and its address, never the exact name. + const integrations = nav.getByRole("link", { name: /^Integrations/ }); + await expect(integrations).toHaveAttribute("href", /\/settings\/integrations\/?$/); + await expect(integrations).toHaveAttribute("aria-current", "page"); await expect(nav.getByRole("link", { name: "AWS" })).toHaveCount(0); await expect(nav.getByRole("link", { name: "Data sources" })).toHaveCount(0); });