Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Remove V1 enabled flag and agents from frontend (#13871)

Tim O'Farrell50f1d332ccb4
diff --git a/frontend/__tests__/routes/llm-settings.test.tsx b/frontend/__tests__/routes/llm-settings.test.tsx
index 1d3c08aa91..57be79a796 100644
--- a/frontend/__tests__/routes/llm-settings.test.tsx
+++ b/frontend/__tests__/routes/llm-settings.test.tsx
@@ -285,15 +285,11 @@ describe("Content", () => {
});
it("should render the advanced form if the switch is toggled", async () => {
- // Use OSS mode and V0 (v1_enabled: false) so agent-input is visible
+ // V1 is always enabled, so no agent-input in the form
mockUseConfig.mockReturnValue({
data: { app_mode: "oss" },
isLoading: false,
});
- vi.spyOn(SettingsService, "getSettings").mockResolvedValue({
- ...MOCK_DEFAULT_USER_SETTINGS,
- v1_enabled: false,
- });
renderLlmSettingsScreen();
await screen.findByTestId("llm-settings-screen");
@@ -318,7 +314,6 @@ describe("Content", () => {
within(advancedForm).getByTestId("base-url-input");
within(advancedForm).getByTestId("llm-api-key-input");
within(advancedForm).getByTestId("llm-api-key-help-anchor-advanced");
- within(advancedForm).getByTestId("agent-input");
within(advancedForm).getByTestId("enable-memory-condenser-switch");
await userEvent.click(advancedSwitch);
@@ -329,15 +324,11 @@ describe("Content", () => {
});
it("should render the default advanced settings", async () => {
- // Use OSS mode and V0 (v1_enabled: false) so agent-input is visible
+ // V1 is always enabled, so no agent-input in the form
mockUseConfig.mockReturnValue({
data: { app_mode: "oss" },
isLoading: false,
});
- vi.spyOn(SettingsService, "getSettings").mockResolvedValue({
- ...MOCK_DEFAULT_USER_SETTINGS,
- v1_enabled: false,
- });
renderLlmSettingsScreen();
await screen.findByTestId("llm-settings-screen");
@@ -350,14 +341,12 @@ describe("Content", () => {
const model = screen.getByTestId("llm-custom-model-input");
const baseUrl = screen.getByTestId("base-url-input");
const apiKey = screen.getByTestId("llm-api-key-input");
- const agent = screen.getByTestId("agent-input");
const condensor = screen.getByTestId("enable-memory-condenser-switch");
expect(model).toHaveValue("openhands/claude-opus-4-5-20251101");
expect(baseUrl).toHaveValue("");
expect(apiKey).toHaveValue("");
expect(apiKey).toHaveProperty("placeholder", "");
- expect(agent).toHaveValue("CodeActAgent");
expect(condensor).toBeChecked();
});
@@ -378,7 +367,6 @@ describe("Content", () => {
});
it("should render existing advanced settings correctly", async () => {
- // Use OSS mode and V0 (v1_enabled: false) so agent-input is visible
mockUseConfig.mockReturnValue({
data: { app_mode: "oss" },
isLoading: false,
@@ -390,11 +378,9 @@ describe("Content", () => {
llm_model: "openai/gpt-4o",
llm_base_url: "https://api.openai.com/v1/chat/completions",
llm_api_key_set: true,
- agent: "CoActAgent",
confirmation_mode: true,
enable_default_condenser: false,
security_analyzer: "none",
- v1_enabled: false,
});
renderLlmSettingsScreen();
@@ -403,7 +389,6 @@ describe("Content", () => {
const model = screen.getByTestId("llm-custom-model-input");
const baseUrl = screen.getByTestId("base-url-input");
const apiKey = screen.getByTestId("llm-api-key-input");
- const agent = screen.getByTestId("agent-input");
const confirmation = screen.getByTestId(
"enable-confirmation-mode-switch",
);
@@ -417,89 +402,48 @@ describe("Content", () => {
);
expect(apiKey).toHaveValue("");
expect(apiKey).toHaveProperty("placeholder", "<hidden>");
- expect(agent).toHaveValue("CoActAgent");
expect(confirmation).toBeChecked();
expect(condensor).not.toBeChecked();
expect(securityAnalyzer).toHaveValue("SETTINGS$SECURITY_ANALYZER_NONE");
});
});
- it("should omit invariant and custom analyzers when V1 is enabled", async () => {
- const getSettingsSpy = vi.spyOn(SettingsService, "getSettings");
- getSettingsSpy.mockResolvedValue({
- ...MOCK_DEFAULT_USER_SETTINGS,
- confirmation_mode: true,
- security_analyzer: "llm",
- v1_enabled: true,
- });
-
- const getSecurityAnalyzersSpy = vi.spyOn(
- OptionService,
- "getSecurityAnalyzers",
- );
- getSecurityAnalyzersSpy.mockResolvedValue([
- "llm",
- "none",
- "invariant",
- "custom",
- ]);
-
- renderLlmSettingsScreen();
- await screen.findByTestId("llm-settings-screen");
-
- const advancedSwitch = screen.getByTestId("advanced-settings-switch");
- await userEvent.click(advancedSwitch);
-
- const securityAnalyzer = await screen.findByTestId(
- "security-analyzer-input",
- );
- await userEvent.click(securityAnalyzer);
-
- // Only llm + none should be available when V1 is enabled
- screen.getByText("SETTINGS$SECURITY_ANALYZER_LLM_DEFAULT");
- screen.getByText("SETTINGS$SECURITY_ANALYZER_NONE");
- expect(
- screen.queryByText("SETTINGS$SECURITY_ANALYZER_INVARIANT"),
- ).not.toBeInTheDocument();
- expect(screen.queryByText("custom")).not.toBeInTheDocument();
+ it("should show custom security analyzers", async () => {
+ // Mock the config to enable security analyzer functionality
+ mockUseConfig.mockReturnValue({
+ data: { app_mode: "saas" },
+ isLoading: false,
+ });
+ const getSettingsSpy = vi.spyOn(SettingsService, "getSettings");
+ getSettingsSpy.mockResolvedValue({
+ ...MOCK_DEFAULT_USER_SETTINGS,
+ confirmation_mode: true,
+ security_analyzer: "llm",
});
- it("should include invariant analyzer option when V1 is disabled", async () => {
- const getSettingsSpy = vi.spyOn(SettingsService, "getSettings");
- getSettingsSpy.mockResolvedValue({
- ...MOCK_DEFAULT_USER_SETTINGS,
- confirmation_mode: true,
- security_analyzer: "llm",
- v1_enabled: false,
- });
-
- const getSecurityAnalyzersSpy = vi.spyOn(
- OptionService,
- "getSecurityAnalyzers",
- );
- getSecurityAnalyzersSpy.mockResolvedValue(["llm", "none", "invariant"]);
+ const getSecurityAnalyzersSpy = vi.spyOn(
+ OptionService,
+ "getSecurityAnalyzers",
+ );
+ // Only custom analyzer (not invariant which is filtered out)
+ getSecurityAnalyzersSpy.mockResolvedValue(["llm", "none", "custom"]);
- renderLlmSettingsScreen();
- await screen.findByTestId("llm-settings-screen");
+ renderLlmSettingsScreen();
+ await screen.findByTestId("llm-settings-screen");
- const advancedSwitch = screen.getByTestId("advanced-settings-switch");
- await userEvent.click(advancedSwitch);
+ const advancedSwitch = screen.getByTestId("advanced-settings-switch");
+ await userEvent.click(advancedSwitch);
- const securityAnalyzer = await screen.findByTestId(
- "security-analyzer-input",
- );
- await userEvent.click(securityAnalyzer);
+ const securityAnalyzer = await screen.findByTestId(
+ "security-analyzer-input",
+ );
+ await userEvent.click(securityAnalyzer);
- expect(
- screen.getByText("SETTINGS$SECURITY_ANALYZER_LLM_DEFAULT"),
- ).toBeInTheDocument();
- expect(
- screen.getByText("SETTINGS$SECURITY_ANALYZER_NONE"),
- ).toBeInTheDocument();
- expect(
- screen.getByText("SETTINGS$SECURITY_ANALYZER_INVARIANT"),
- ).toBeInTheDocument();
- });
+ // Custom analyzers should be available, but invariant is filtered out
+ screen.getByText("SETTINGS$SECURITY_ANALYZER_LLM_DEFAULT");
+ screen.getByText("SETTINGS$SECURITY_ANALYZER_NONE");
+ expect(screen.getByText("custom")).toBeInTheDocument();
+ });
});
it.todo("should render an indicator if the llm api key is set");
@@ -747,15 +691,11 @@ describe("Form submission", () => {
});
it("should submit the advanced form with the correct values", async () => {
- // Use OSS mode and V0 (v1_enabled: false) so agent-input is visible
+ // V1 is always enabled, so no agent-input in the form
mockUseConfig.mockReturnValue({
data: { app_mode: "oss" },
isLoading: false,
});
- vi.spyOn(SettingsService, "getSettings").mockResolvedValue({
- ...MOCK_DEFAULT_USER_SETTINGS,
- v1_enabled: false,
- });
const saveSettingsSpy = vi.spyOn(SettingsService, "saveSettings");
@@ -768,7 +708,6 @@ describe("Form submission", () => {
const model = screen.getByTestId("llm-custom-model-input");
const baseUrl = screen.getByTestId("base-url-input");
const apiKey = screen.getByTestId("llm-api-key-input");
- const agent = screen.getByTestId("agent-input");
const confirmation = screen.getByTestId("enable-confirmation-mode-switch");
const condensor = screen.getByTestId("enable-memory-condenser-switch");
@@ -792,12 +731,6 @@ describe("Form submission", () => {
await userEvent.click(condensor);
expect(condensor).not.toBeChecked();
- // select agent
- await userEvent.click(agent);
- const agentOption = screen.getByText("CoActAgent");
- await userEvent.click(agentOption);
- expect(agent).toHaveValue("CoActAgent");
-
// select security analyzer
const securityAnalyzer = screen.getByTestId("security-analyzer-input");
await userEvent.click(securityAnalyzer);
@@ -813,7 +746,6 @@ describe("Form submission", () => {
expect.objectContaining({
llm_model: "openai/gpt-4o",
llm_base_url: "https://api.openai.com/v1/chat/completions",
- agent: "CoActAgent",
confirmation_mode: true,
enable_default_condenser: false,
security_analyzer: null,
@@ -865,7 +797,7 @@ describe("Form submission", () => {
});
it("should disable the button if there are no changes in the advanced form", async () => {
- // Use OSS mode and V0 (v1_enabled: false) so agent-input is visible
+ // V1 is always enabled, so no agent-input in the form
mockUseConfig.mockReturnValue({
data: { app_mode: "oss" },
isLoading: false,
@@ -878,7 +810,6 @@ describe("Form submission", () => {
llm_base_url: "https://api.openai.com/v1/chat/completions",
llm_api_key_set: true,
confirmation_mode: true,
- v1_enabled: false,
});
renderLlmSettingsScreen();
@@ -891,7 +822,6 @@ describe("Form submission", () => {
const model = await screen.findByTestId("llm-custom-model-input");
const baseUrl = await screen.findByTestId("base-url-input");
const apiKey = await screen.findByTestId("llm-api-key-input");
- const agent = await screen.findByTestId("agent-input");
const condensor = await screen.findByTestId(
"enable-memory-condenser-switch",
);
@@ -940,21 +870,6 @@ describe("Form submission", () => {
expect(apiKey).toHaveValue("");
expect(submitButton).toBeDisabled();
- // set agent
- await userEvent.clear(agent);
- await userEvent.type(agent, "test-agent");
- expect(agent).toHaveValue("test-agent");
- expect(submitButton).not.toBeDisabled();
-
- // reset agent
- await userEvent.clear(agent);
- expect(agent).toHaveValue("");
- expect(submitButton).toBeDisabled();
-
- await userEvent.type(agent, "CodeActAgent");
- expect(agent).toHaveValue("CodeActAgent");
- expect(submitButton).toBeDisabled();
-
// toggle confirmation mode
await userEvent.click(confirmation);
expect(confirmation).not.toBeChecked();
diff --git a/frontend/src/api/option-service/option-service.api.ts b/frontend/src/api/option-service/option-service.api.ts
index fc14c301fa..89651f8ad6 100644
--- a/frontend/src/api/option-service/option-service.api.ts
+++ b/frontend/src/api/option-service/option-service.api.ts
@@ -16,15 +16,6 @@ class OptionService {
return data;
}
- /**
- * Retrieve the list of agents available
- * @returns List of agents available
- */
- static async getAgents(): Promise<string[]> {
- const { data } = await openHands.get<string[]>("/api/options/agents");
- return data;
- }
-
/**
* Retrieve the list of security analyzers available
* @returns List of security analyzers available
diff --git a/frontend/src/hooks/query/use-ai-config-options.ts b/frontend/src/hooks/query/use-ai-config-options.ts
index 86ea0c6179..2b7119b4e6 100644
--- a/frontend/src/hooks/query/use-ai-config-options.ts
+++ b/frontend/src/hooks/query/use-ai-config-options.ts
@@ -8,7 +8,6 @@ const fetchAiConfigOptions = async () => {
verifiedModels: modelsResponse.verified_models,
verifiedProviders: modelsResponse.verified_providers,
defaultModel: modelsResponse.default_model,
- agents: await OptionService.getAgents(),
securityAnalyzers: await OptionService.getSecurityAnalyzers(),
};
};
diff --git a/frontend/src/routes/llm-settings.tsx b/frontend/src/routes/llm-settings.tsx
index e24f918b98..e4a615bd8a 100644
--- a/frontend/src/routes/llm-settings.tsx
+++ b/frontend/src/routes/llm-settings.tsx
@@ -161,9 +161,6 @@ function LlmSettingsScreen() {
const shouldUseOpenHandsKey = isOpenHandsProvider() && isSaasMode;
- // Determine if we should hide the agent dropdown when V1 conversation API is enabled
- const isV1Enabled = settings?.v1_enabled;
-
React.useEffect(() => {
const determineWhetherToToggleAdvancedSettings = () => {
if (resources && settings) {
@@ -406,14 +403,6 @@ function LlmSettingsScreen() {
}));
};
- const handleAgentIsDirty = (agent: string) => {
- const agentIsDirty = agent !== settings?.agent && agent !== "";
- setDirtyInputs((prev) => ({
- ...prev,
- agent: agentIsDirty,
- }));
- };
-
const handleConfirmationModeIsDirty = (isToggled: boolean) => {
const confirmationModeIsDirty = isToggled !== settings?.confirmation_mode;
setDirtyInputs((prev) => ({
@@ -482,18 +471,6 @@ function LlmSettingsScreen() {
label: t(I18nKey.SETTINGS$SECURITY_ANALYZER_NONE),
});
- if (isV1Enabled) {
- return orderedItems;
- }
-
- // Add Invariant analyzer third
- if (analyzers.includes("invariant")) {
- orderedItems.push({
- key: "invariant",
- label: t(I18nKey.SETTINGS$SECURITY_ANALYZER_INVARIANT),
- });
- }
-
// Add any other analyzers that might exist
analyzers.forEach((analyzer) => {
if (!["llm", "invariant", "none"].includes(analyzer)) {
@@ -678,25 +655,6 @@ function LlmSettingsScreen() {
linkText={t(I18nKey.SETTINGS$SEARCH_API_KEY_INSTRUCTIONS)}
href="https://tavily.com/"
/>
-
- {!isV1Enabled && (
- <SettingsDropdownInput
- testId="agent-input"
- name="agent-input"
- label={t(I18nKey.SETTINGS$AGENT)}
- items={
- resources?.agents.map((agent) => ({
- key: agent,
- label: agent, // TODO: Add i18n support for agent names
- })) || []
- }
- defaultSelectedKey={settings.agent}
- isClearable={false}
- onInputChange={handleAgentIsDirty}
- isDisabled={isReadOnly}
- wrapperClassName="w-full max-w-[680px]"
- />
- )}
</>
)}