π OpenHands: AI-Driven Development
feat: temporarily disable planning agent UI and drop /new from slash menu (#126)
Hiep Lec3433d9a5843
diff --git a/__tests__/components/features/chat/components/chat-input-actions.test.tsx b/__tests__/components/features/chat/components/chat-input-actions.test.tsxnew file mode 100644index 0000000000..b122b90700--- /dev/null+++ b/__tests__/components/features/chat/components/chat-input-actions.test.tsx@@ -0,0 +1,42 @@+import React from "react";+import { screen } from "@testing-library/react";+import { describe, it, expect, vi } from "vitest";+import { renderWithProviders } from "test-utils";++vi.mock("#/components/features/controls/agent-status", () => ({+ AgentStatus: () => <div data-testid="agent-status-stub" />,+}));++vi.mock("#/components/features/controls/tools", () => ({+ Tools: () => <div data-testid="tools-stub" />,+}));++// Sentinel: this stub only renders if a future change re-imports+// ChangeAgentButton in ChatInputActions, which would fail the assertion below.+vi.mock("#/components/features/chat/change-agent-button", () => ({+ ChangeAgentButton: () => <div data-testid="change-agent-button-stub" />,+}));++// Mock the underlying mutation service module that the pause/resume hooks call.+vi.mock("#/hooks/mutation/conversation-mutation-utils", () => ({+ pauseV1Conversation: vi.fn(),+ resumeV1Conversation: vi.fn(),+ askV1Agent: vi.fn(),+ updateConversationExecutionStatusInCache: vi.fn(),+ invalidateConversationQueries: vi.fn(),+}));++// eslint-disable-next-line import/first+import { ChatInputActions } from "#/components/features/chat/components/chat-input-actions";++describe("ChatInputActions", () => {+ it("does not render the Change Agent button while the planning agent feature is disabled", () => {+ // Arrange + Act+ renderWithProviders(<ChatInputActions disabled={false} />);++ // Assert+ expect(+ screen.queryByTestId("change-agent-button-stub"),+ ).not.toBeInTheDocument();+ });+});diff --git a/__tests__/hooks/chat/use-slash-command.test.ts b/__tests__/hooks/chat/use-slash-command.test.tsindex eed35b550b..320bece72f 100644--- a/__tests__/hooks/chat/use-slash-command.test.ts+++ b/__tests__/hooks/chat/use-slash-command.test.ts@@ -39,16 +39,19 @@ describe("useSlashCommand", () => {mockConversation.data = undefined;});- it("includes /new built-in command for V1 conversations", () => {+ it("excludes /new from the built-in commands while the planning agent is disabled", () => {+ // ArrangemockConversation.data = { conversation_version: "V1" };mockSkills.isLoading = false;mockSkills.data = [makeSkill("code-search", ["/code-search"])];+ // Actconst ref = makeChatInputRef();const { result } = renderHook(() => useSlashCommand(ref));+ // Assertconst commands = result.current.filteredItems.map((i) => i.command);- expect(commands).toContain("/new");- expect(commands).toContain("/code-search");+ expect(commands).not.toContain("/new");+ expect(commands).toEqual(expect.arrayContaining(["/btw", "/code-search"]));});});diff --git a/src/components/features/chat/components/chat-input-actions.tsx b/src/components/features/chat/components/chat-input-actions.tsxindex 59bd615cee..0eebf962f5 100644--- a/src/components/features/chat/components/chat-input-actions.tsx+++ b/src/components/features/chat/components/chat-input-actions.tsx@@ -4,7 +4,6 @@ import { useUnifiedPauseConversation } from "#/hooks/mutation/use-unified-stop-cimport { useConversationId } from "#/hooks/use-conversation-id";import { useV1PauseConversation } from "#/hooks/mutation/use-v1-pause-conversation";import { useV1ResumeConversation } from "#/hooks/mutation/use-v1-resume-conversation";-import { ChangeAgentButton } from "../change-agent-button";interface ChatInputActionsProps {disabled: boolean;@@ -35,7 +34,6 @@ export function ChatInputActions({ disabled }: ChatInputActionsProps) {<div className="flex items-center gap-1"><div className="flex items-center gap-4"><Tools />- <ChangeAgentButton /></div></div><AgentStatusdiff --git a/src/utils/constants.ts b/src/utils/constants.tsindex 8eb6825730..84a243a12e 100644--- a/src/utils/constants.ts+++ b/src/utils/constants.ts@@ -76,15 +76,6 @@ export const BTW_COMMAND = "/btw";/** Built-in slash commands surfaced in the menu for V1 conversations. */export const BUILT_IN_COMMANDS: SlashCommandItem[] = [- {- skill: {- name: "new",- type: "agentskills",- content: "Creates a new conversation using the same runtime",- triggers: ["/new"],- },- command: "/new",- },{skill: {name: "btw",