diff --git a/packages/app/src/screens/workspace/workspace-screen.tsx b/packages/app/src/screens/workspace/workspace-screen.tsx
index 80485722d..305b0f4e5 100644
--- a/packages/app/src/screens/workspace/workspace-screen.tsx
+++ b/packages/app/src/screens/workspace/workspace-screen.tsx
@@ -66,7 +66,7 @@ import {
} from "@/utils/workspace-tab-identity";
import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
import { useProvidersSnapshot } from "@/hooks/use-providers-snapshot";
-import { useWorkspaceSetupStore } from "@/stores/workspace-setup-store";
+import { shouldShowWorkspaceSetup, useWorkspaceSetupStore } from "@/stores/workspace-setup-store";
import { useWorkspace } from "@/stores/session-store-hooks";
import { useWorkspaceTerminalSessionRetention } from "@/terminal/hooks/use-workspace-terminal-session-retention";
import {
@@ -976,6 +976,7 @@ function WorkspaceScreenContent({
const workspaceSetupSnapshot = useWorkspaceSetupStore((state) =>
persistenceKey ? (state.snapshots[persistenceKey] ?? null) : null,
);
+ const showWorkspaceSetup = shouldShowWorkspaceSetup(workspaceSetupSnapshot);
const uiTabs = useMemo(
() => (workspaceLayout ? collectAllTabs(workspaceLayout.root) : EMPTY_UI_TABS),
[workspaceLayout],
@@ -1229,7 +1230,7 @@ function WorkspaceScreenContent({
if (!persistenceKey) {
return;
}
- if (!workspaceSetupSnapshot) {
+ if (!workspaceSetupSnapshot || !showWorkspaceSetup) {
if (autoOpenedSetupTabWorkspaceRef.current === persistenceKey) {
autoOpenedSetupTabWorkspaceRef.current = null;
}
@@ -1271,6 +1272,7 @@ function WorkspaceScreenContent({
normalizedWorkspaceId,
openWorkspaceTabInBackground,
persistenceKey,
+ showWorkspaceSetup,
workspaceSetupSnapshot,
]);
@@ -2258,14 +2260,18 @@ function WorkspaceScreenContent({
Copy branch name
) : null}
-
- }
- onSelect={handleOpenSetupTab}
- >
- Show setup
-
+ {showWorkspaceSetup ? (
+ <>
+
+ }
+ onSelect={handleOpenSetupTab}
+ >
+ Show setup
+
+ >
+ ) : null}
diff --git a/packages/app/src/stores/workspace-setup-store.test.ts b/packages/app/src/stores/workspace-setup-store.test.ts
index 59f04350c..d0fdd13fe 100644
--- a/packages/app/src/stores/workspace-setup-store.test.ts
+++ b/packages/app/src/stores/workspace-setup-store.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "vitest";
-import { useWorkspaceSetupStore } from "./workspace-setup-store";
+import { shouldShowWorkspaceSetup, useWorkspaceSetupStore } from "./workspace-setup-store";
describe("workspace-setup-store", () => {
beforeEach(() => {
@@ -38,4 +38,65 @@ describe("workspace-setup-store", () => {
expect(useWorkspaceSetupStore.getState().pendingWorkspaceSetup).toBeNull();
});
+
+ it("hides empty successful setup snapshots", () => {
+ expect(
+ shouldShowWorkspaceSetup({
+ workspaceId: "workspace-1",
+ status: "completed",
+ detail: {
+ type: "worktree_setup",
+ worktreePath: "/Users/test/project",
+ branchName: "main",
+ log: "",
+ commands: [],
+ },
+ error: null,
+ updatedAt: Date.now(),
+ }),
+ ).toBe(false);
+ });
+
+ it("shows setup snapshots with commands or errors", () => {
+ expect(
+ shouldShowWorkspaceSetup({
+ workspaceId: "workspace-1",
+ status: "completed",
+ detail: {
+ type: "worktree_setup",
+ worktreePath: "/Users/test/project",
+ branchName: "main",
+ log: "done\n",
+ commands: [
+ {
+ index: 1,
+ command: "npm install",
+ cwd: "/Users/test/project",
+ log: "done\n",
+ status: "completed",
+ exitCode: 0,
+ },
+ ],
+ },
+ error: null,
+ updatedAt: Date.now(),
+ }),
+ ).toBe(true);
+
+ expect(
+ shouldShowWorkspaceSetup({
+ workspaceId: "workspace-1",
+ status: "failed",
+ detail: {
+ type: "worktree_setup",
+ worktreePath: "/Users/test/project",
+ branchName: "main",
+ log: "",
+ commands: [],
+ },
+ error: "Failed to parse paseo.json",
+ updatedAt: Date.now(),
+ }),
+ ).toBe(true);
+ });
});
diff --git a/packages/app/src/stores/workspace-setup-store.ts b/packages/app/src/stores/workspace-setup-store.ts
index 6ca4763d2..a190c39d6 100644
--- a/packages/app/src/stores/workspace-setup-store.ts
+++ b/packages/app/src/stores/workspace-setup-store.ts
@@ -23,6 +23,13 @@ export interface WorkspaceSetupSnapshot extends WorkspaceSetupProgressPayload {
updatedAt: number;
}
+export function shouldShowWorkspaceSetup(snapshot: WorkspaceSetupSnapshot | null): boolean {
+ if (!snapshot) {
+ return false;
+ }
+ return snapshot.error !== null || snapshot.detail.commands.length > 0;
+}
+
interface WorkspaceSetupStoreState {
pendingWorkspaceSetup: PendingWorkspaceSetup | null;
snapshots: Record;