Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 37 additions & 15 deletions apps/web/src/components/Sidebar.logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,22 +526,44 @@ describe("resolveThreadStatusPill", () => {
});

it("shows failed, not completed, when the unseen run failed", () => {
expect(
resolveThreadStatusPill({
thread: {
...baseThread,
interactionMode: "default",
latestRun: { ...makeLatestRun(), status: "failed" },
lastVisitedAt: "2026-03-09T10:04:00.000Z",
runtime: {
...baseThread.runtime,
status: "failed",
activeRunId: null,
lastError: "Provider turn failed.",
},
const failed = {
...baseThread,
interactionMode: "default" as const,
latestRun: { ...makeLatestRun(), status: "failed" as const },
lastVisitedAt: "2026-03-09T10:04:00.000Z",
runtime: {
...baseThread.runtime,
status: "failed" as const,
activeRunId: null,
lastError: "Provider turn failed.",
},
};
expect(resolveThreadStatusPill({ thread: failed })).toMatchObject({
label: "Failed",
pulse: false,
});
// The failure sends the thread to the inbox, so its pill must not say it is still waiting.
const watching = {
...failed,
pendingBackgroundTasks: [
{
taskId: "pr-watch",
description: "Watching pull request #7",
kind: "monitor" as const,
awaited: true as const,
},
}),
).toMatchObject({ label: "Failed", pulse: false });
],
};
expect(isSidebarThreadWorking(watching)).toBe(false);
expect(resolveThreadStatusPill({ thread: watching })).toMatchObject({ label: "Failed" });
// A run blocked on another thread is still waiting, as its sidebar row says.
const blocked = {
...watching,
runtime: { ...failed.runtime, status: "running" as const },
blockedOnThreadWait: true,
};
expect(resolveSidebarThreadStatus(blocked)).toBe("waiting");
expect(resolveThreadStatusPill({ thread: blocked })).toMatchObject({ label: "Waiting" });
});

it("shows failed, not plan ready, when a plan run proposed a plan and then failed", () => {
Expand Down
21 changes: 10 additions & 11 deletions apps/web/src/components/Sidebar.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1244,18 +1244,15 @@ export function resolveThreadStatusPill(input: {
};
}

if (
(thread.runtime?.status === "running" && thread.blockedOnThreadWait === true) ||
backgroundWorkHoldsCompletion(thread.pendingBackgroundTasks ?? [])
) {
return {
label: msg("Waiting"),
colorClass: "text-sidebar-muted-foreground",
dotClass: "bg-sidebar-muted-foreground",
pulse: false,
};
}
const waiting = {
label: msg("Waiting"),
colorClass: "text-sidebar-muted-foreground",
dotClass: "bg-sidebar-muted-foreground",
pulse: false,
};
if (thread.runtime?.status === "running" && thread.blockedOnThreadWait === true) return waiting;

// A failed run goes to the inbox even while background work holds the thread.
if (hasUnseenRunFailure(thread)) {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
return {
label: msg("Failed"),
Expand All @@ -1265,6 +1262,8 @@ export function resolveThreadStatusPill(input: {
};
}

if (backgroundWorkHoldsCompletion(thread.pendingBackgroundTasks ?? [])) return waiting;

const hasPlanReadyPrompt =
!thread.hasPendingUserInput &&
thread.interactionMode === "plan" &&
Expand Down
Loading