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 <noreply@anthropic.com>

* 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 <agent@kandev.dev>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
João Salavisa
2026-06-18 19:15:59 +01:00
committed by GitHub
parent aee1846cd5
commit 2c4887a3ee
2 changed files with 18 additions and 1 deletions
+13 -1
View File
@@ -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);
});
});
+5
View File
@@ -92,11 +92,16 @@ const ACTIVE_SESSION_STATES: ReadonlySet<string> = new Set<TaskSessionState>([
* 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";
}