From 3e89cb21cdfbe6153c86be8a9fdee7b8e13f1f38 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Wed, 22 Jul 2026 04:54:17 -0700 Subject: [PATCH] Support pending status in sidebar v2 --- apps/web/src/components/Sidebar.logic.test.ts | 16 +++++++++++++++- apps/web/src/components/Sidebar.logic.ts | 8 ++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/Sidebar.logic.test.ts b/apps/web/src/components/Sidebar.logic.test.ts index 6f7c1bcdbd..04f965c80c 100644 --- a/apps/web/src/components/Sidebar.logic.test.ts +++ b/apps/web/src/components/Sidebar.logic.test.ts @@ -648,7 +648,11 @@ describe("resolveSidebarV2Status", () => { updatedAt: "2026-03-09T10:00:00.000Z", }; - const idle = { hasPendingApprovals: false, hasPendingUserInput: false }; + const idle = { + hasPendingApprovals: false, + hasPendingTurnStart: false, + hasPendingUserInput: false, + }; it("prioritizes approval over a running session", () => { expect(resolveSidebarV2Status({ ...idle, hasPendingApprovals: true, session })).toBe( @@ -678,6 +682,16 @@ describe("resolveSidebarV2Status", () => { ).toBe("working"); }); + it("reports working while a turn start is pending without a session", () => { + expect( + resolveSidebarV2Status({ + ...idle, + hasPendingTurnStart: true, + session: null, + }), + ).toBe("working"); + }); + it("reports failed only while the session status is error", () => { expect( resolveSidebarV2Status({ diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts index 4cf47aa784..f4fbf561ec 100644 --- a/apps/web/src/components/Sidebar.logic.ts +++ b/apps/web/src/components/Sidebar.logic.ts @@ -429,7 +429,7 @@ export type SidebarV2Status = "approval" | "input" | "working" | "failed" | "rea type SidebarV2StatusInput = Pick< SidebarThreadSummary, - "hasPendingApprovals" | "hasPendingUserInput" | "session" + "hasPendingApprovals" | "hasPendingTurnStart" | "hasPendingUserInput" | "session" >; export function resolveSidebarV2Status(thread: SidebarV2StatusInput): SidebarV2Status { @@ -439,7 +439,11 @@ export function resolveSidebarV2Status(thread: SidebarV2StatusInput): SidebarV2S if (thread.hasPendingUserInput) { return "input"; } - if (thread.session?.status === "running" || thread.session?.status === "starting") { + if ( + thread.session?.status === "running" || + thread.session?.status === "starting" || + thread.hasPendingTurnStart === true + ) { return "working"; } if (thread.session?.status === "error") {