diff --git a/apps/web/src/components/chat/HeaderActions.test.tsx b/apps/web/src/components/chat/HeaderActions.test.tsx index ee0de270f..07a260422 100644 --- a/apps/web/src/components/chat/HeaderActions.test.tsx +++ b/apps/web/src/components/chat/HeaderActions.test.tsx @@ -120,7 +120,9 @@ vi.mock("@/stores/diffStore", async (importOriginal) => { }); vi.mock("./OpenInAppButton", () => ({ - OpenInAppButton: () =>
, + OpenInAppButton: ({ dirPath }: { dirPath: string | null }) => ( + + ), })); vi.mock("./CreatePrDialog", () => ({ @@ -545,6 +547,27 @@ describe("HeaderActions - consolidated header", () => { expect(icon.querySelector('path[d="M12 12H3.75M12 12L19.5 19.5M12 12L19.5 4.5"]')).toBeInTheDocument(); }); + it("does not fall back to the workspace checkout for a worktree thread without a worktree path", () => { + renderHeaderActions(makeThread({ mode: "worktree", worktree_path: null })); + + expect(screen.getByTestId("open-in-app")).toHaveAttribute("data-dir-path", ""); + expect(screen.getByTestId("thread-overview-local-path")).toHaveTextContent("Unavailable"); + expect(screen.getByTestId("thread-overview-local-path")).not.toHaveTextContent("/test"); + }); + + it("opens the workspace checkout for a direct thread", () => { + renderHeaderActions(makeThread({ mode: "direct", worktree_path: null })); + + expect(screen.getByTestId("open-in-app")).toHaveAttribute("data-dir-path", "/test"); + expect(screen.getByTestId("thread-overview-local-path")).toHaveTextContent("/test"); + }); + + it("opens the thread worktree for a worktree thread", () => { + renderHeaderActions(makeThread({ mode: "worktree", worktree_path: "/repo/worktrees/feat-x" })); + + expect(screen.getByTestId("open-in-app")).toHaveAttribute("data-dir-path", "/repo/worktrees/feat-x"); + }); + it("keeps older cached recap visible and exposes coverage times through the affordance", async () => { const messages = [ createMockMessage({ diff --git a/apps/web/src/components/chat/HeaderActions.tsx b/apps/web/src/components/chat/HeaderActions.tsx index 6cb12ca39..dfd37476a 100644 --- a/apps/web/src/components/chat/HeaderActions.tsx +++ b/apps/web/src/components/chat/HeaderActions.tsx @@ -4,6 +4,7 @@ import { OpenInAppButton } from "./OpenInAppButton"; import { ThreadOverview } from "./ThreadOverview"; import { useDiffStore } from "@/stores/diffStore"; import { useWorkspaceStore } from "@/features/projects/state/workspaceStore"; +import { resolveThreadDirPath } from "@/lib/worktree"; import { toggleRightPanelAdaptive } from "@/lib/right-panel-layout"; import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; @@ -48,7 +49,7 @@ export function HeaderActions({ thread, threadPaneWidth }: HeaderActionsProps) {