π OpenHands: AI-Driven Development
fix: hide Planner tab on local backends (#861)
Hiep Lea00ebe44f30c
diff --git a/__tests__/components/features/conversation/conversation-tabs-context-menu.test.tsx b/__tests__/components/features/conversation/conversation-tabs-context-menu.test.tsxindex 73088e2893..29e8bde626 100644--- a/__tests__/components/features/conversation/conversation-tabs-context-menu.test.tsx+++ b/__tests__/components/features/conversation/conversation-tabs-context-menu.test.tsx@@ -58,15 +58,13 @@ describe("ConversationTabsContextMenu", () => {it("should render all default tabs when open", () => {render(<ConversationTabsContextMenu isOpen={true} onClose={vi.fn()} />);- const expectedTabs = [- "COMMON$PLANNER",- "COMMON$FILES",- "COMMON$TERMINAL",- "COMMON$BROWSER",- ];+ const expectedTabs = ["COMMON$FILES", "COMMON$TERMINAL", "COMMON$BROWSER"];for (const tab of expectedTabs) {expect(screen.getByText(tab)).toBeInTheDocument();}++ // Planner is cloud-only; on the default (local) backend it is hidden.+ expect(screen.queryByText("COMMON$PLANNER")).not.toBeInTheDocument();});it("should show the Code entry when the active backend is cloud", () => {@@ -87,6 +85,24 @@ describe("ConversationTabsContextMenu", () => {expect(screen.getByText("COMMON$CODE")).toBeInTheDocument();});+ it("should show the Planner entry when the active backend is cloud", () => {+ seedActiveBackend({+ id: "cloud-test",+ name: "Cloud Test",+ host: "https://app.example.com",+ apiKey: "secret",+ kind: "cloud",+ });++ render(+ <ActiveBackendProvider>+ <ConversationTabsContextMenu isOpen={true} onClose={vi.fn()} />+ </ActiveBackendProvider>,+ );++ expect(screen.getByText("COMMON$PLANNER")).toBeInTheDocument();+ });+it("should open a tab from the label button without changing pin state", async () => {const user = userEvent.setup();@@ -130,13 +146,13 @@ describe("ConversationTabsContextMenu", () => {const storeState = useConversationStore.getState();expect(storeState.hasRightPanelToggled).toBe(true);- expect(storeState.selectedTab).toBe("planner");+ expect(storeState.selectedTab).toBe("terminal");const storedState = JSON.parse(localStorage.getItem(`conversation-state-${CONVERSATION_ID}`)!,);expect(storedState.unpinnedTabs).toContain("files");- expect(storedState.selectedTab).toBe("planner");+ expect(storedState.selectedTab).toBe("terminal");});it("should not close the right panel when unpinning a non-active tab", async () => {diff --git a/__tests__/components/features/conversation/conversation-tabs.test.tsx b/__tests__/components/features/conversation/conversation-tabs.test.tsxindex e59ec330dd..4038ea31e0 100644--- a/__tests__/components/features/conversation/conversation-tabs.test.tsx+++ b/__tests__/components/features/conversation/conversation-tabs.test.tsx@@ -315,6 +315,15 @@ describe("ConversationTabs localStorage behavior", () => {it("shows an unpinned tab in the bar while it is selected", () => {mockConversationId = REAL_CONVERSATION_ID;+ // Planner is cloud-only, so a cloud backend is required to exercise+ // the unpinned-while-selected logic against the planner tab.+ seedActiveBackend({+ id: "cloud-test",+ name: "Cloud Test",+ host: "https://app.example.com",+ apiKey: "secret",+ kind: "cloud",+ });seedConversationState(REAL_CONVERSATION_ID, {selectedTab: "planner",unpinnedTabs: ["planner"],@@ -336,6 +345,15 @@ describe("ConversationTabs localStorage behavior", () => {it("hides an unpinned tab from the bar once another tab is selected", () => {mockConversationId = REAL_CONVERSATION_ID;+ // Cloud backend so the planner tab would be eligible β it stays+ // hidden here because it is unpinned and not the selected tab.+ seedActiveBackend({+ id: "cloud-test",+ name: "Cloud Test",+ host: "https://app.example.com",+ apiKey: "secret",+ kind: "cloud",+ });seedConversationState(REAL_CONVERSATION_ID, {selectedTab: "files",unpinnedTabs: ["planner"],@@ -477,6 +495,54 @@ describe("ConversationTabs localStorage behavior", () => {});});+ describe("planner tab visibility by backend kind", () => {+ beforeEach(() => {+ mockConversationId = REAL_CONVERSATION_ID;+ });++ it("should hide the planner tab when the active backend is local", () => {+ // Arrange+ seedActiveBackend({+ id: "local-test",+ name: "Local Test",+ host: "http://localhost:8000",+ apiKey: "",+ kind: "local",+ });++ // Act+ render(<ConversationTabs />, {+ wrapper: createWrapper(REAL_CONVERSATION_ID),+ });++ // Assert+ expect(+ screen.queryByTestId("conversation-tab-planner"),+ ).not.toBeInTheDocument();+ });++ it("should show the planner tab when the active backend is cloud", () => {+ // Arrange+ seedActiveBackend({+ id: "cloud-test",+ name: "Cloud Test",+ host: "https://app.example.com",+ apiKey: "secret",+ kind: "cloud",+ });++ // Act+ render(<ConversationTabs />, {+ wrapper: createWrapper(REAL_CONVERSATION_ID),+ });++ // Assert+ expect(+ screen.getByTestId("conversation-tab-planner"),+ ).toBeInTheDocument();+ });+ });+describe("ellipsis context menu", () => {beforeEach(() => {mockConversationId = REAL_CONVERSATION_ID;diff --git a/src/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.tsx b/src/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.tsxindex 9209eba468..425580933d 100644--- a/src/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.tsx+++ b/src/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.tsx@@ -73,7 +73,8 @@ export function ConversationTabsContextMenu({}const visibleTabConfig = tabConfig.filter(- ({ tab }) => tab !== "vscode" || backend.kind === "cloud",+ ({ tab }) =>+ (tab !== "vscode" && tab !== "planner") || backend.kind === "cloud",);if (!isOpen) return null;diff --git a/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx b/src/components/features/conversation/conversation-tabs/conversation-tabs.tsxindex 76c37de8a2..640cb19fb6 100644--- a/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx+++ b/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx@@ -144,9 +144,11 @@ export function ConversationTabs({// Pinned tabs always show in the bar. Unpinned tabs stay hidden unless the// user has that tab selected β then it appears while active so the bar- // matches the open panel. Hide VS Code on local backends (cloud-only URL).+ // matches the open panel. Hide VS Code and Planner on local backends β+ // both are cloud-only (the planning agent isn't supported locally).const visibleTabs = tabs.filter((tab) => {if (tab.tabValue === "vscode" && backend.kind !== "cloud") return false;+ if (tab.tabValue === "planner" && backend.kind !== "cloud") return false;if (!persistedState.unpinnedTabs.includes(tab.tabValue)) return true;return selectedTab === tab.tabValue;});