From 2c4887a3ee146ac4abaa19cf34a0a08d2e402764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Salavisa?= Date: Thu, 18 Jun 2026 19:15:59 +0100 Subject: [PATCH] fix(web): suppress kanban spinner for TODO tasks (#1399) * fix(web): suppress kanban spinner for TODO tasks A task moved back into TODO can still carry an active primary session state (CREATED/STARTING/RUNNING). The kanban card was painting the blue running-spinner in that case, making queued tasks look like they were executing. Add an explicit TODO guard at the top of shouldShowTaskRunningSpinner so the queued column never shows the spinner, regardless of the session-state desync. Existing decoupling for IN_PROGRESS/REVIEW/etc. is untouched. Co-Authored-By: Claude Opus 4.7 * test: clarify spinner test description excludes TODO Greptile flagged that "returns true when any task state has an actively running primary session" overstates the invariant now that TODO short-circuits to false. Reword to "non-TODO task states" so the description matches behavior. * ci: retrigger after artifact expiry --------- Co-authored-by: Kandev Agent Co-authored-by: Claude Opus 4.7 --- apps/web/lib/ui/state-icons.test.tsx | 14 +++++++++++++- apps/web/lib/ui/state-icons.tsx | 5 +++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/web/lib/ui/state-icons.test.tsx b/apps/web/lib/ui/state-icons.test.tsx index c37ef566ed..2e7a8693ed 100644 --- a/apps/web/lib/ui/state-icons.test.tsx +++ b/apps/web/lib/ui/state-icons.test.tsx @@ -31,7 +31,7 @@ describe("shouldShowTaskRunningSpinner", () => { expect(shouldShowTaskRunningSpinner("TODO")).toBe(false); }); - it("returns true when any task state has an actively running primary session", () => { + it("returns true for non-TODO task states with an actively running primary session", () => { expect(shouldShowTaskRunningSpinner("REVIEW", "RUNNING")).toBe(true); expect(shouldShowTaskRunningSpinner("COMPLETED", "RUNNING")).toBe(true); expect(shouldShowTaskRunningSpinner("FAILED", "RUNNING")).toBe(true); @@ -71,4 +71,16 @@ describe("shouldShowTaskRunningSpinner", () => { expect(shouldShowTaskRunningSpinner("IN_PROGRESS", "WAITING_FOR_INPUT")).toBe(false); expect(shouldShowTaskRunningSpinner("IN_PROGRESS", "IDLE")).toBe(false); }); + + it("suppresses the spinner for TODO regardless of primary session state", () => { + // TODO is the queued/not-started column. A stale primary session state + // (e.g. task moved back from IN_PROGRESS with the session still alive) + // must not paint the running spinner on the kanban card. + expect(shouldShowTaskRunningSpinner("TODO", "RUNNING")).toBe(false); + expect(shouldShowTaskRunningSpinner("TODO", "STARTING")).toBe(false); + expect(shouldShowTaskRunningSpinner("TODO", "CREATED")).toBe(false); + expect(shouldShowTaskRunningSpinner("TODO", "COMPLETED")).toBe(false); + expect(shouldShowTaskRunningSpinner("TODO", "WAITING_FOR_INPUT")).toBe(false); + expect(shouldShowTaskRunningSpinner("TODO", "IDLE")).toBe(false); + }); }); diff --git a/apps/web/lib/ui/state-icons.tsx b/apps/web/lib/ui/state-icons.tsx index 303f4021e9..0bc1346fe0 100644 --- a/apps/web/lib/ui/state-icons.tsx +++ b/apps/web/lib/ui/state-icons.tsx @@ -92,11 +92,16 @@ const ACTIVE_SESSION_STATES: ReadonlySet = new Set([ * When no primary session is attached yet (task just created / scheduling), * we still show the spinner so users see the imminent work; otherwise we * require an active session state. + * + * Exception: `TODO` is the queued/not-started column. Any active session + * state reported there is stale (task moved back from IN_PROGRESS, session + * still alive) or transient, and the spinner would mislead — suppress it. */ export function shouldShowTaskRunningSpinner( taskState?: TaskState, primarySessionState?: string | null, ): boolean { + if (taskState === "TODO") return false; if (primarySessionState) return ACTIVE_SESSION_STATES.has(primarySessionState); return taskState === "IN_PROGRESS" || taskState === "SCHEDULING"; }