Support pending status in sidebar v2

This commit is contained in:
Theo Browne committed 2026-07-22 04:54:17 -07:00
1 parent f8ab580cf1
commit 3e89cb21cd
2 files changed
+21 -3

No files matched your search

+15 -1
View File
@@ -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({
+6 -2
View File
@@ -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") {