Skip to content
TypeScript

fix(web): show Setting up during worktree setup (#28832)

shivamb3041a8cb9e6
diff --git a/apps/web/src/components/Sidebar.logic.test.ts b/apps/web/src/components/Sidebar.logic.test.ts
index 3e2e8be2ce1..574ae3b4021 100644
--- a/apps/web/src/components/Sidebar.logic.test.ts
+++ b/apps/web/src/components/Sidebar.logic.test.ts
@@ -286,7 +286,13 @@ describe("resolveSidebarThreadStatus", () => {
).toBe(false);
});
- it("reports failed only while the latest run failed", () => {
+ it("reports worktree setup as preparing, and failed only while the latest run failed", () => {
+ expect(
+ resolveSidebarThreadStatus({
+ ...idle,
+ runtime: { ...runtime, status: "preparing" as const },
+ }),
+ ).toBe("preparing");
expect(
resolveSidebarThreadStatus({
...idle,
diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts
index c20789e2a91..5af89dd0224 100644
--- a/apps/web/src/components/Sidebar.logic.ts
+++ b/apps/web/src/components/Sidebar.logic.ts
@@ -841,6 +841,7 @@ export type SidebarThreadStatus =
| "approval"
| "input"
| "request"
+ | "preparing"
| "working"
| "waiting"
| "failed"
@@ -862,7 +863,9 @@ export function shouldRecedeSidebarThread(input: {
) {
return false;
}
- if (input.status === "working" || input.status === "waiting") return true;
+ if (input.status === "preparing" || input.status === "working" || input.status === "waiting") {
+ return true;
+ }
if (input.status === "ready" || input.status === "approval") {
return !input.isUnread && !input.isWoke;
}
@@ -893,9 +896,12 @@ export function resolveSidebarThreadStatus(thread: SidebarThreadStatusInput): Si
if (thread.runtime?.status === "running" && thread.blockedOnThreadWait === true) {
return "waiting";
}
+ if (thread.runtime?.status === "preparing") {
+ return "preparing";
+ }
if (
thread.runtime !== null &&
- ["preparing", "queued", "starting", "running", "waiting"].includes(thread.runtime.status)
+ ["queued", "starting", "running", "waiting"].includes(thread.runtime.status)
) {
return "working";
}
@@ -930,7 +936,7 @@ export function resolveSidebarFolderDot(
(thread) => resolveSidebarThreadStatus(thread) === "ready" && hasUnseenCompletion(thread),
);
if (hasUnread) return "unread";
- if (statuses.has("working")) return "working";
+ if (statuses.has("working") || statuses.has("preparing")) return "working";
return null;
}
diff --git a/apps/web/src/components/sidebar/SidebarThreadRow.tsx b/apps/web/src/components/sidebar/SidebarThreadRow.tsx
index ed3a8276be8..7c9cc93f2b3 100644
--- a/apps/web/src/components/sidebar/SidebarThreadRow.tsx
+++ b/apps/web/src/components/sidebar/SidebarThreadRow.tsx
@@ -722,9 +722,14 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
isSelected,
});
const topStatus =
- status === "working"
+ status === "preparing" || status === "working"
? {
- label: thread.goal?.status === "active" ? "Goal" : "Working",
+ label:
+ status === "preparing"
+ ? "Setting up"
+ : thread.goal?.status === "active"
+ ? "Goal"
+ : "Working",
icon: "working" as const,
className: "text-info-foreground",
}
@@ -958,7 +963,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
? "text-sidebar-muted-foreground/75 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
: "bg-transparent text-sidebar-foreground hover:bg-sidebar-row-hover",
shouldRecede &&
- status === "working" &&
+ (status === "preparing" || status === "working") &&
"opacity-70 transition-opacity hover:opacity-100 focus-within:opacity-100 motion-reduce:transition-none",
isFileDragOver && "ring-1 ring-inset ring-primary/70",
isFileDragOver && !props.isActive && !isSelected && "bg-sidebar-row-hover",
@@ -1496,7 +1501,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
BackgroundThreadAnnouncer and the open thread's
timeline speak status changes instead. */}
{topStatus.label}
- {status === "working" ? (
+ {status === "preparing" || status === "working" ? (
<span aria-hidden>
<WorkingDuration startedAt={resolveWorkingStartedAt(thread)} />
</span>