Skip to content

Commit b3041a8

Browse files
shivamhwpclaudemaria-rcks
authored
fix(web): show Setting up during worktree setup (pingdotgg#28832)
Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: maria-rcks <[email protected]>
1 parent cda8842 commit b3041a8

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

‎apps/web/src/components/Sidebar.logic.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,13 @@ describe("resolveSidebarThreadStatus", () => {
286286
).toBe(false);
287287
});
288288

289-
it("reports failed only while the latest run failed", () => {
289+
it("reports worktree setup as preparing, and failed only while the latest run failed", () => {
290+
expect(
291+
resolveSidebarThreadStatus({
292+
...idle,
293+
runtime: { ...runtime, status: "preparing" as const },
294+
}),
295+
).toBe("preparing");
290296
expect(
291297
resolveSidebarThreadStatus({
292298
...idle,

‎apps/web/src/components/Sidebar.logic.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,7 @@ export type SidebarThreadStatus =
841841
| "approval"
842842
| "input"
843843
| "request"
844+
| "preparing"
844845
| "working"
845846
| "waiting"
846847
| "failed"
@@ -862,7 +863,9 @@ export function shouldRecedeSidebarThread(input: {
862863
) {
863864
return false;
864865
}
865-
if (input.status === "working" || input.status === "waiting") return true;
866+
if (input.status === "preparing" || input.status === "working" || input.status === "waiting") {
867+
return true;
868+
}
866869
if (input.status === "ready" || input.status === "approval") {
867870
return !input.isUnread && !input.isWoke;
868871
}
@@ -893,9 +896,12 @@ export function resolveSidebarThreadStatus(thread: SidebarThreadStatusInput): Si
893896
if (thread.runtime?.status === "running" && thread.blockedOnThreadWait === true) {
894897
return "waiting";
895898
}
899+
if (thread.runtime?.status === "preparing") {
900+
return "preparing";
901+
}
896902
if (
897903
thread.runtime !== null &&
898-
["preparing", "queued", "starting", "running", "waiting"].includes(thread.runtime.status)
904+
["queued", "starting", "running", "waiting"].includes(thread.runtime.status)
899905
) {
900906
return "working";
901907
}
@@ -930,7 +936,7 @@ export function resolveSidebarFolderDot(
930936
(thread) => resolveSidebarThreadStatus(thread) === "ready" && hasUnseenCompletion(thread),
931937
);
932938
if (hasUnread) return "unread";
933-
if (statuses.has("working")) return "working";
939+
if (statuses.has("working") || statuses.has("preparing")) return "working";
934940
return null;
935941
}
936942

‎apps/web/src/components/sidebar/SidebarThreadRow.tsx‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,14 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
722722
isSelected,
723723
});
724724
const topStatus =
725-
status === "working"
725+
status === "preparing" || status === "working"
726726
? {
727-
label: thread.goal?.status === "active" ? "Goal" : "Working",
727+
label:
728+
status === "preparing"
729+
? "Setting up"
730+
: thread.goal?.status === "active"
731+
? "Goal"
732+
: "Working",
728733
icon: "working" as const,
729734
className: "text-info-foreground",
730735
}
@@ -958,7 +963,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
958963
? "text-sidebar-muted-foreground/75 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
959964
: "bg-transparent text-sidebar-foreground hover:bg-sidebar-row-hover",
960965
shouldRecede &&
961-
status === "working" &&
966+
(status === "preparing" || status === "working") &&
962967
"opacity-70 transition-opacity hover:opacity-100 focus-within:opacity-100 motion-reduce:transition-none",
963968
isFileDragOver && "ring-1 ring-inset ring-primary/70",
964969
isFileDragOver && !props.isActive && !isSelected && "bg-sidebar-row-hover",
@@ -1496,7 +1501,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
14961501
BackgroundThreadAnnouncer and the open thread's
14971502
timeline speak status changes instead. */}
14981503
{topStatus.label}
1499-
{status === "working" ? (
1504+
{status === "preparing" || status === "working" ? (
15001505
<span aria-hidden>
15011506
<WorkingDuration startedAt={resolveWorkingStartedAt(thread)} />
15021507
</span>

0 commit comments

Comments
 (0)