🙌 OpenHands: AI-Driven Development
fix: remove ACP settings access gating (#1908)
simonrosenbergf4612aaafb85
diff --git a/__tests__/components/features/settings/settings-navigation.test.tsx b/__tests__/components/features/settings/settings-navigation.test.tsxindex 7c710bef5b..eec4226782 100644--- a/__tests__/components/features/settings/settings-navigation.test.tsx+++ b/__tests__/components/features/settings/settings-navigation.test.tsx@@ -6,35 +6,23 @@ import { MemoryRouter } from "react-router";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { SettingsNavigation } from "#/components/features/settings/settings-navigation";import { SettingsDesktopSidebar } from "#/components/features/settings/settings-desktop-sidebar";-import { SettingsMobileDrawer } from "#/components/features/settings/settings-mobile-drawer";+import { SettingsMobileHub } from "#/components/features/settings/settings-mobile-hub";import { OSS_NAV_ITEMS } from "#/constants/settings-nav";import { SettingsNavRenderedItem } from "#/hooks/use-settings-nav-items";import { ActiveBackendProvider } from "#/contexts/active-backend-context";-// HeroUI's Tooltip (the engine behind ``StyledTooltip``) only mounts-// its content when the trigger is interacted with via real-DOM events.-// jsdom + userEvent.hover doesn't reliably fire that, so we stub the-// wrapper to render its content eagerly — every test below can then-// assert "the tooltip would say X" by looking for X in the DOM.-vi.mock("#/components/shared/buttons/styled-tooltip", () => ({- StyledTooltip: ({- content,- children,- }: {- content: React.ReactNode;- children: React.ReactNode;- }) => (- <>- {children}- <span data-testid="styled-tooltip-content">{content}</span>- </>- ),-}));-const llmItem = OSS_NAV_ITEMS.find((item) => item.to === "/settings/llm")!;const condenserItem = OSS_NAV_ITEMS.find((item) => item.to === "/settings/condenser",)!;+const verificationItem = OSS_NAV_ITEMS.find(+ (item) => item.to === "/settings/verification",+)!;+const acpAccessibleItems: SettingsNavRenderedItem[] = [+ { type: "item", item: llmItem },+ { type: "item", item: condenserItem },+ { type: "item", item: verificationItem },+];const baseItems: SettingsNavRenderedItem[] = [{ type: "header", text: "SETTINGS$TITLE" as never },@@ -108,144 +96,22 @@ describe("SettingsNavigation", () => {expect(onCloseMobileMenu).toHaveBeenCalledTimes(1);});- it("renders disabled-by-ACP items as disabled in the desktop sidebar", () => {- // Regression guard: when ACP is active, the LLM and Condenser items- // come through with ``disabled: true`` from ``useSettingsNavItems``;- // both the mobile drawer (via SettingsNavLink) and the desktop- // sidebar (via SidebarNavLink) must propagate that. Earlier the- // desktop branch dropped it and the items stayed clickable.- renderSettingsNavigation(- <SettingsNavigation- isMobileMenuOpen={false}- onCloseMobileMenu={vi.fn()}- navigationItems={[- {- type: "item",- item: llmItem,- disabled: true,- disabledAgentName: "Claude Code",- },- {- type: "item",- item: condenserItem,- disabled: true,- disabledAgentName: "Claude Code",- },- ]}- />,- );-- const desktopNav = screen.getByTestId("settings-navbar-desktop");-- // SidebarNavLink renders disabled items as a non-link span with- // ``aria-disabled="true"`` and ``opacity-50`` styling.- const llmLink = within(desktopNav).getByTestId(- "sidebar-settings-/settings/llm",- );- const condenserLink = within(desktopNav).getByTestId(- "sidebar-settings-/settings/condenser",- );- expect(llmLink).toHaveAttribute("aria-disabled", "true");- expect(condenserLink).toHaveAttribute("aria-disabled", "true");- });-- it("keeps pointer events on disabled-by-ACP items so the hover tooltip can open", () => {- // Regression for the missing "Disabled while {agent} is active" tooltip- // on desktop: the disabled link used to also get ``pointer-events-none``,- // which stops HeroUI's pointer-driven Tooltip from ever firing — so the- // explanation never reached the user (reported on macOS desktop). A- // disabled item that HAS a reason must stay greyed (opacity-50) but keep- // receiving pointer events.- renderSettingsNavigation(- <SettingsNavigation- isMobileMenuOpen={false}- onCloseMobileMenu={vi.fn()}- navigationItems={[- {- type: "item",- item: llmItem,- disabled: true,- disabledAgentName: "Claude Code",- },- ]}- />,- );-- const desktopNav = screen.getByTestId("settings-navbar-desktop");- const llmLink = within(desktopNav).getByTestId(- "sidebar-settings-/settings/llm",- );- expect(llmLink).toHaveAttribute("aria-disabled", "true");- expect(llmLink.className).toContain("opacity-50");- expect(llmLink.className).not.toContain("pointer-events-none");- });-- it("leaves enabled items clickable in the desktop sidebar", () => {+ it("keeps ACP-accessible settings clickable in the desktop sidebar", () => {renderSettingsNavigation(<SettingsNavigationisMobileMenuOpen={false}onCloseMobileMenu={vi.fn()}- navigationItems={[{ type: "item", item: llmItem }]}+ navigationItems={acpAccessibleItems}/>,);const desktopNav = screen.getByTestId("settings-navbar-desktop");- const llmLink = within(desktopNav).getByTestId(- "sidebar-settings-/settings/llm",- );- expect(llmLink).not.toHaveAttribute("aria-disabled", "true");- });-- it("wraps disabled-by-ACP desktop items in the explanatory tooltip", () => {- // The mobile drawer already builds + shows this string ("Disabled- // while Claude Code is active"); the desktop sidebar used to just- // grey the item out with no explanation. SettingsDesktopSidebar- // now formats the i18n string and forwards it as ``disabledReason``- // to SidebarNavLink, which wraps the link in StyledTooltip when- // both flags are set.- renderSettingsNavigation(- <SettingsNavigation- isMobileMenuOpen={false}- onCloseMobileMenu={vi.fn()}- navigationItems={[- {- type: "item",- item: condenserItem,- disabled: true,- disabledAgentName: "Claude Code",- },- ]}- />,- );-- // The StyledTooltip mock above renders its ``content`` prop into a- // <span data-testid="styled-tooltip-content">…</span>. Its presence- // proves SidebarNavLink wrapped the link with the explanatory- // tooltip — i.e. ``disabledReason`` was forwarded. (We can't- // assert on the resolved string content because the test- // environment returns raw i18n keys without interpolation; the- // wiring itself is what we care about. The enabled-control test- // below verifies the wrap doesn't appear without the prop.)- const desktopNav = screen.getByTestId("settings-navbar-desktop");- expect(- within(desktopNav).queryByTestId("styled-tooltip-content"),- ).toBeInTheDocument();- });-- it("does not wrap enabled items in a tooltip on the desktop sidebar", () => {- renderSettingsNavigation(- <SettingsNavigation- isMobileMenuOpen={false}- onCloseMobileMenu={vi.fn()}- navigationItems={[{ type: "item", item: condenserItem }]}- />,- );- // No ``disabled`` + no ``disabledReason`` → SidebarNavLink returns- // the bare NavigationLink (no StyledTooltip wrap), so the mock's- // marker element doesn't appear at all.- const desktopNav = screen.getByTestId("settings-navbar-desktop");- expect(- within(desktopNav).queryByTestId("styled-tooltip-content"),- ).not.toBeInTheDocument();+ for (const item of [llmItem, condenserItem, verificationItem]) {+ const link = within(desktopNav).getByTestId(+ `sidebar-settings-${item.to}`,+ );+ expect(link).toHaveAttribute("href", item.to);+ expect(link).not.toHaveAttribute("aria-disabled");+ }});});@@ -276,33 +142,19 @@ describe("SettingsDesktopSidebar", () => {});});-describe("SettingsMobileDrawer", () => {- it("renders an ACP-disabled item as a non-interactive entry that keeps its label", () => {- // Arrange + Act+describe("SettingsMobileHub", () => {+ it("keeps ACP-accessible settings clickable in the mobile settings hub", () => {renderSettingsNavigation(- <SettingsMobileDrawer- isMobileMenuOpen- onCloseMobileMenu={vi.fn()}- navigationItems={[- {- type: "item",- item: llmItem,- disabled: true,- disabledAgentName: "Claude Code",- },- ]}- />,+ <SettingsMobileHub navigationItems={acpAccessibleItems} />,);- // Assert: the mobile drawer routes disabled items through SettingsNavLink,- // which renders a non-link span marked aria-disabled while still showing- // the item's label.- const disabledItem = screen.getByTestId(- "settings-nav-link-disabled-/settings/llm",- );- expect(disabledItem).toHaveAttribute("aria-disabled", "true");- expect(- within(disabledItem).getByText("SETTINGS$NAV_LLM"),- ).toBeInTheDocument();+ const mobileNav = screen.getByTestId("settings-mobile-hub");+ for (const item of [llmItem, condenserItem, verificationItem]) {+ const link = within(mobileNav).getByRole("link", {+ name: item.text,+ });+ expect(link).toHaveAttribute("href", item.to);+ expect(link).not.toHaveAttribute("aria-disabled");+ }});});diff --git a/__tests__/hooks/use-settings-nav-items.test.tsx b/__tests__/hooks/use-settings-nav-items.test.tsxindex 0c54f4e173..3cdde0732a 100644--- a/__tests__/hooks/use-settings-nav-items.test.tsx+++ b/__tests__/hooks/use-settings-nav-items.test.tsx@@ -12,9 +12,6 @@ const useActiveBackendMock = vi.fn<backend: { kind: "local" },orgId: null,}));-// The active AgentProfile now drives the ACP-disable derivation; default to-// "no active profile" so tests that set only `useSettings` exercise the-// settings fallback path.const useActiveAgentProfileMock = vi.fn<() => { activeProfile: { agent_kind: string; name: string } | null }>(() => ({ activeProfile: null }));@@ -55,10 +52,6 @@ const openHandsSettings = {agent_settings: { agent_kind: "openhands" },};-const acpClaudeCodeSettings = {- agent_settings: { agent_kind: "acp", acp_server: "claude-code" },-};-describe("useSettingsNavItems", () => {beforeEach(() => {vi.clearAllMocks();@@ -122,26 +115,6 @@ describe("useSettingsNavItems", () => {}});- it("derives the ACP-disable from the active agent profile, not global settings", () => {- useConfigMock.mockReturnValue({ data: createConfig() });- // Global settings still say OpenHands, but the active profile is ACP —- // the active profile wins (activate is pointer-only, #1571).- useSettingsMock.mockReturnValue({ data: openHandsSettings });- useActiveAgentProfileMock.mockReturnValue({- activeProfile: { agent_kind: "acp", name: "MyClaude" },- });-- const { result } = renderHook(() => useSettingsNavItems());- const condenser = result.current.find(- (r) => r.type === "item" && r.item.to === "/settings/condenser",- );- expect(condenser?.type).toBe("item");- if (condenser?.type === "item") {- expect(condenser.disabled).toBe(true);- expect(condenser.disabledAgentName).toBe("MyClaude");- }- });-it("filters hidden routes from the OSS settings items", () => {useConfigMock.mockReturnValue({data: createConfig({ hide_llm_settings: true }),@@ -171,9 +144,16 @@ describe("useSettingsNavItems", () => {expect(paths).not.toContain("/settings/mcp");});- it("disables Condenser but keeps LLM Profiles reachable when the active agent_kind is acp", () => {+ it("keeps every settings library enabled while an ACP profile is active", () => {useConfigMock.mockReturnValue({ data: createConfig() });- useSettingsMock.mockReturnValue({ data: acpClaudeCodeSettings });+ useSettingsMock.mockReturnValue({+ data: {+ agent_settings: { agent_kind: "acp", acp_server: "claude-code" },+ },+ });+ useActiveAgentProfileMock.mockReturnValue({+ activeProfile: { agent_kind: "acp", name: "MyClaude" },+ });const { result } = renderHook(() => useSettingsNavItems());const byPath = new Map(@@ -184,58 +164,16 @@ describe("useSettingsNavItems", () => {),);- const condenser = byPath.get("/settings/condenser");- expect(condenser?.type).toBe("item");- if (condenser?.type === "item") {- expect(condenser.disabled).toBe(true);- expect(condenser.disabledAgentName).toBe("Claude Code");- }-- // The LLM profile library stays reachable — an OpenHands agent profile- // can't be created without one.- const llm = byPath.get("/settings/llm");- expect(llm?.type).toBe("item");- if (llm?.type === "item") {- expect(llm.disabled).toBeUndefined();- }-- // Items without `disabledByAcp` stay enabled.- const secrets = byPath.get("/settings/secrets");- if (secrets?.type === "item") {- expect(secrets.disabled).toBeUndefined();- }-- // The agent-settings entry itself is not gated.- const agent = byPath.get("/settings/agent");- if (agent?.type === "item") {- expect(agent.disabled).toBeUndefined();- }- });-- it("falls back to 'ACP Agent' when the saved acp_server is unknown", () => {- useConfigMock.mockReturnValue({ data: createConfig() });- useSettingsMock.mockReturnValue({- data: { agent_settings: { agent_kind: "acp", acp_server: "custom" } },- });-- const { result } = renderHook(() => useSettingsNavItems());- const condenser = result.current.find(- (r) => r.type === "item" && r.item.to === "/settings/condenser",- );- expect(condenser?.type).toBe("item");- if (condenser?.type === "item") {- expect(condenser.disabledAgentName).toBe("ACP Agent");- }- });-- it("leaves all items enabled when agent_kind is openhands", () => {- useConfigMock.mockReturnValue({ data: createConfig() });-- const { result } = renderHook(() => useSettingsNavItems());- for (const rendered of result.current) {- if (rendered.type === "item") {- expect(rendered.disabled).toBeFalsy();- }+ for (const path of [+ "/settings/llm",+ "/settings/condenser",+ "/settings/verification",+ ]) {+ const renderedItem = byPath.get(path);+ expect(renderedItem).toEqual({+ type: "item",+ item: OSS_NAV_ITEMS.find((item) => item.to === path),+ });}});});diff --git a/__tests__/routes/mcp.test.tsx b/__tests__/routes/mcp.test.tsxindex 38f31f68d0..5457d7a5f2 100644--- a/__tests__/routes/mcp.test.tsx+++ b/__tests__/routes/mcp.test.tsx@@ -3,11 +3,6 @@ import * as mcpRoute from "#/routes/mcp";describe("mcp route", () => {it("does not gate the MCP page behind an ACP redirect", () => {- // ACP agents now forward ``mcp_config`` to their subprocess at session- // creation, so the MCP page is meaningful under ACP. Unlike /settings and- // /settings/condenser (which stay inert for ACP and keep their- // ``redirectIfAcpActive`` clientLoader), /mcp must NOT export a- // clientLoader that bounces ACP users away.expect("clientLoader" in mcpRoute).toBe(false);});});diff --git a/__tests__/routes/settings.test.tsx b/__tests__/routes/settings.test.tsxindex 56ca301a7d..4812e85e0d 100644--- a/__tests__/routes/settings.test.tsx+++ b/__tests__/routes/settings.test.tsx@@ -21,15 +21,6 @@ vi.mock("#/hooks/use-settings-nav-items", () => ({).map((item) => ({ type: "item", item })),}));-// The ACP route guard now reads the active agent profile first, falling back to-// settings. These tests drive the guard via `SettingsService`, so make the-// agent-profiles lookup unavailable to force that deterministic fallback.-vi.mock("#/api/agent-profiles-service/agent-profiles-service.api", () => ({- default: {- listProfiles: vi.fn().mockRejectedValue(new Error("no agent profiles")),- },-}));-describe("settings route", () => {beforeEach(() => {vi.restoreAllMocks();@@ -56,8 +47,6 @@ describe("settings route", () => {});it("prefers /settings/agents when LLM settings are visible", () => {- // /settings/agents wins unconditionally, so OpenHands users land- // there too and reach LLM via the left nav.expect(getFirstAvailablePath({hide_llm_settings: false,@@ -141,99 +130,56 @@ describe("settings route", () => {expect(screen.getByTestId("app-settings-screen")).toBeInTheDocument();});- it("redirects to /settings/agents when ACP is active and the path is disabled-by-ACP", async () => {- vi.spyOn(OptionService, "getConfig").mockResolvedValue({- feature_flags: {- hide_llm_settings: false,- hide_users_page: true,- },- providers_configured: [],- maintenance_start_time: null,- recaptcha_site_key: null,- faulty_models: [],- error_message: null,- updated_at: new Date().toISOString(),- });- vi.spyOn(SettingsService, "getSettings").mockResolvedValue({- ...MOCK_DEFAULT_USER_SETTINGS,- agent_settings: {- ...MOCK_DEFAULT_USER_SETTINGS.agent_settings,- agent_kind: "acp",- acp_server: "claude-code",- },- });-- const response = (await clientLoader({- request: new Request("http://localhost/settings/condenser"),- params: {},- context: {},- } as never)) as Response;-- expect(response.status).toBe(302);- expect(response.headers.get("Location")).toBe("/settings/agents");- });-- it("keeps /settings/llm reachable while ACP is active", async () => {- // The LLM page is the profile library, not the active agent's LLM.- // Gating it left ACP-onboarded users unable to create the LLM profile an- // OpenHands agent profile requires.- vi.spyOn(OptionService, "getConfig").mockResolvedValue({- feature_flags: {- hide_llm_settings: false,- hide_users_page: true,- },- providers_configured: [],- maintenance_start_time: null,- recaptcha_site_key: null,- faulty_models: [],- error_message: null,- updated_at: new Date().toISOString(),- });- vi.spyOn(SettingsService, "getSettings").mockResolvedValue({- ...MOCK_DEFAULT_USER_SETTINGS,- agent_settings: {- ...MOCK_DEFAULT_USER_SETTINGS.agent_settings,- agent_kind: "acp",- acp_server: "claude-code",- },- });-- const result = await clientLoader({- request: new Request("http://localhost/settings/llm"),- params: {},- context: {},- } as never);-- expect(result).toBeNull();- });-- it("does not redirect when the active agent is OpenHands", async () => {- vi.spyOn(OptionService, "getConfig").mockResolvedValue({- feature_flags: {- hide_llm_settings: false,- hide_users_page: true,- },- providers_configured: [],- maintenance_start_time: null,- recaptcha_site_key: null,- faulty_models: [],- error_message: null,- updated_at: new Date().toISOString(),- });- vi.spyOn(SettingsService, "getSettings").mockResolvedValue({- ...MOCK_DEFAULT_USER_SETTINGS,- agent_settings: {- ...MOCK_DEFAULT_USER_SETTINGS.agent_settings,- agent_kind: "openhands",- },- });-- const result = await clientLoader({- request: new Request("http://localhost/settings"),- params: {},- context: {},- } as never);-- expect(result).toBeNull();- });+ it.each(["/settings/llm", "/settings/condenser", "/settings/verification"])(+ "renders %s directly when ACP settings are active",+ async (path) => {+ vi.spyOn(OptionService, "getConfig").mockResolvedValue({+ feature_flags: {+ hide_llm_settings: false,+ hide_users_page: true,+ },+ providers_configured: [],+ maintenance_start_time: null,+ recaptcha_site_key: null,+ faulty_models: [],+ error_message: null,+ updated_at: new Date().toISOString(),+ });+ const settingsSpy = vi+ .spyOn(SettingsService, "getSettings")+ .mockResolvedValue({+ ...MOCK_DEFAULT_USER_SETTINGS,+ agent_settings: {+ ...MOCK_DEFAULT_USER_SETTINGS.agent_settings,+ agent_kind: "acp",+ acp_server: "claude-code",+ },+ });++ const RouterStub = createRoutesStub([+ {+ path: "/settings",+ Component: SettingsScreen,+ loader: clientLoader as never,+ children: [+ {+ path,+ Component: () => <div data-testid="direct-settings-page" />,+ },+ ],+ },+ ]);++ render(+ <QueryClientProvider client={new QueryClient()}>+ <ActiveBackendProvider>+ <RouterStub initialEntries={[path]} />+ </ActiveBackendProvider>+ </QueryClientProvider>,+ );++ expect(await screen.findByTestId("direct-settings-page")).toBeVisible();+ expect(settingsSpy).not.toHaveBeenCalled();+ },+ );});diff --git a/__tests__/utils/acp-route-guard.test.ts b/__tests__/utils/acp-route-guard.test.tsdeleted file mode 100644index 62b0338526..0000000000--- a/__tests__/utils/acp-route-guard.test.ts+++ /dev/null@@ -1,56 +0,0 @@-import { describe, it, expect, vi, afterEach } from "vitest";-import { redirectIfAcpActive } from "#/utils/acp-route-guard";-import { getQueryClient } from "#/query-client-config";--// `queryClient` (used by the guard) is a Proxy around the lazily-created-// singleton — spy on the real underlying client instance so vi.spyOn can find-// an actual own property to wrap.-const queryClient = getQueryClient();--describe("redirectIfAcpActive", () => {- afterEach(() => {- vi.restoreAllMocks();- });-- it("uses the shared no-retry policy for the agent-profiles fetch (#1571 review)", async () => {- // An older backend without /api/agent-profiles must fail this fast rather- // than sitting through the default exponential backoff on every settings- // navigation — the retry policy is shared with useAgentProfiles and the- // launch path in useCreateConversation so it can't drift between them.- const fetchQuerySpy = vi- .spyOn(queryClient, "fetchQuery")- .mockResolvedValueOnce({- profiles: [- {- id: "p1",- name: "default",- agent_kind: "openhands",- revision: 1,- llm_profile_ref: "gpt",- mcp_server_refs: null,- },- ],- active_agent_profile_id: "p1",- } as never);-- await redirectIfAcpActive();-- expect(fetchQuerySpy).toHaveBeenCalledTimes(1);- expect(fetchQuerySpy.mock.calls[0]?.[0]).toMatchObject({ retry: false });- });-- it("falls through to the settings fallback (default retry policy) when the profile list can't resolve isAcp", async () => {- const fetchQuerySpy = vi- .spyOn(queryClient, "fetchQuery")- .mockResolvedValueOnce({ profiles: [], active_agent_profile_id: null })- .mockResolvedValueOnce({ agent_settings: { agent_kind: "openhands" } });-- const result = await redirectIfAcpActive();-- expect(result).toBeNull();- expect(fetchQuerySpy).toHaveBeenCalledTimes(2);- // The settings fallback isn't part of the shared agent-profiles retry- // policy — it's a different (always-available) surface.- expect(fetchQuerySpy.mock.calls[1]?.[0]).not.toHaveProperty("retry");- });-});diff --git a/src/components/features/settings/settings-desktop-sidebar.tsx b/src/components/features/settings/settings-desktop-sidebar.tsxindex 5d36353561..6b3ffc4079 100644--- a/src/components/features/settings/settings-desktop-sidebar.tsx+++ b/src/components/features/settings/settings-desktop-sidebar.tsx@@ -47,21 +47,6 @@ export function SettingsDesktopSidebar({endtestId={`sidebar-settings-${renderedItem.item.to}`}icon={renderedItem.item.icon}- // Items marked ``disabledByAcp`` (LLM, Condenser, …) are greyed- // out and un-clickable while an ACP agent is active — those- // pages have nothing to configure while a separate sub-agent- // owns the LLM/condenser/MCP layers. The mobile drawer below- // already does this via ``SettingsNavLink``; do the same on- // desktop. The clientLoader-side redirect in ``routes/- // settings.tsx`` handles direct URL navigation.- disabled={renderedItem.disabled}- disabledReason={- renderedItem.disabled && renderedItem.disabledAgentName- ? t(I18nKey.SETTINGS$AGENT_DISABLED_TOOLTIP, {- agentName: renderedItem.disabledAgentName,- })- : undefined- }/>))}<IntegrationsSettingsLink />diff --git a/src/components/features/settings/settings-mobile-drawer.tsx b/src/components/features/settings/settings-mobile-drawer.tsxindex ad0e648801..c53e46ee2d 100644--- a/src/components/features/settings/settings-mobile-drawer.tsx+++ b/src/components/features/settings/settings-mobile-drawer.tsx@@ -85,8 +85,6 @@ export function SettingsMobileDrawer({key={renderedItem.item.to}item={renderedItem.item}onClick={onCloseMobileMenu}- disabled={renderedItem.disabled}- disabledAgentName={renderedItem.disabledAgentName}/>);})}diff --git a/src/components/features/settings/settings-nav-link.tsx b/src/components/features/settings/settings-nav-link.tsxindex 209866a4d1..d47f59e7fd 100644--- a/src/components/features/settings/settings-nav-link.tsx+++ b/src/components/features/settings/settings-nav-link.tsx@@ -9,46 +9,12 @@ import { navInteractiveTransitionClassName } from "#/components/features/sidebarinterface SettingsNavLinkProps {item: SettingsNavItem;onClick: () => void;- /** If true, render the item as a non-clickable, greyed-out span. */- disabled?: boolean;- /** When disabled, used to render the tooltip — e.g. "Disabled while Claude Code is active". */- disabledAgentName?: string;}-export function SettingsNavLink({- item,- onClick,- disabled,- disabledAgentName,-}: SettingsNavLinkProps) {+export function SettingsNavLink({ item, onClick }: SettingsNavLinkProps) {const { t } = useTranslation("openhands");const { to, icon, text } = item;- if (disabled) {- const tooltip = disabledAgentName- ? t(I18nKey.SETTINGS$AGENT_DISABLED_TOOLTIP, {- agentName: disabledAgentName,- })- : undefined;- return (- <span- data-testid={`settings-nav-link-disabled-${to}`}- title={tooltip}- aria-disabled="true"- className="group flex items-center gap-3 p-1 sm:px-3.5 sm:py-2 rounded opacity-40 cursor-not-allowed"- >- <Typography.Text className="flex h-5 w-5 shrink-0 items-center justify-center text-[#8C8C8C]">- {icon}- </Typography.Text>- <div className="min-w-0 flex-1 overflow-hidden">- <Typography.Text className="block truncate whitespace-nowrap text-[#8C8C8C]">- {t(text as I18nKey)}- </Typography.Text>- </div>- </span>- );- }-return (<NavigationLinkenddiff --git a/src/components/features/sidebar/sidebar-nav-link.tsx b/src/components/features/sidebar/sidebar-nav-link.tsxindex 4fcde6509b..d8a1fcc9b7 100644--- a/src/components/features/sidebar/sidebar-nav-link.tsx+++ b/src/components/features/sidebar/sidebar-nav-link.tsx@@ -33,15 +33,6 @@ interface SidebarNavLinkProps {icon?: React.ReactElement;collapsed?: boolean;hoverContent?: React.ReactNode;- /**- * Pre-formatted human-readable reason for the disabled state, shown- * as a hover tooltip. The component is i18n-agnostic — the caller- * formats the string (typically via ``t(SETTINGS$AGENT_DISABLED_TOOLTIP,- * { agentName })``) and passes it in. Only rendered when ``disabled``- * is also true. Mirrors the mobile ``SettingsNavLink`` tooltip so the- * disabled-state UX is consistent across surfaces.- */- disabledReason?: string;/*** When true, forces the active style regardless of the current path.* Useful for links that should appear active for multiple related routes@@ -60,7 +51,6 @@ export function SidebarNavLink({icon,collapsed = false,hoverContent,- disabledReason,forceActive = false,}: SidebarNavLinkProps) {const { currentPath } = useNavigation();@@ -90,8 +80,7 @@ export function SidebarNavLink({? SIDEBAR_ROW_INTERACTIVE_CLASS.active: SIDEBAR_ROW_INTERACTIVE_CLASS.idle),disabled && "opacity-50",- // HeroUI Tooltip is pointer-driven, so keep hover events for explanations.- disabled && !disabledReason && "pointer-events-none",+ disabled && "pointer-events-none",)}>{icon ? (@@ -107,20 +96,6 @@ export function SidebarNavLink({</NavigationLink>);- // Disabled-with-reason: wrap with a tooltip explaining *why* (e.g.- // "Disabled while Claude Code is active"). Mirrors the mobile- // ``SettingsNavLink`` UX so users get the same explanation on both- // surfaces. We use ``StyledTooltip`` regardless of the collapsed- // state — without it, desktop users see a greyed-out link with no- // hint about why their click didn't work.- if (disabled && disabledReason) {- return (- <StyledTooltip content={disabledReason} placement="right">- {link}- </StyledTooltip>- );- }-if (!collapsed) return link;return (diff --git a/src/constants/settings-nav.tsx b/src/constants/settings-nav.tsxindex 16548cb2a0..b0de883ae7 100644--- a/src/constants/settings-nav.tsx+++ b/src/constants/settings-nav.tsx@@ -10,14 +10,6 @@ export interface SettingsNavItem {text: string;/** Short grey subline under the page title (`settings.tsx`). */subtitle: string;- // When true, this item is greyed out (and its route redirects to- // ``/settings/agents``) while the active agent is ACP. The ACP sub-agent- // manages its own condenser, so these OpenHands-side surfaces have- // nothing useful to configure. Drives both the navigation disable in- // ``use-settings-nav-items.ts`` and the loader redirect in- // ``routes/settings.tsx`` from a single source. Never set it on a page- // that manages a profile *library* — those are not the active agent.- disabledByAcp?: boolean;}export const OSS_NAV_ITEMS: SettingsNavItem[] = [@@ -32,9 +24,6 @@ export const OSS_NAV_ITEMS: SettingsNavItem[] = [subtitle: "SETTINGS$PAGE_AGENT_PROFILES_SUBLINE",},{- // Not ``disabledByAcp``: this page manages the LLM *profile library*, and- // an OpenHands agent profile can't be created without one. Gating it left- // ACP-onboarded users with no way to define an OpenHands agent.icon: <CircuitIcon width={16} height={16} />,to: "/settings/llm",text: "SETTINGS$NAV_LLM",@@ -45,14 +34,12 @@ export const OSS_NAV_ITEMS: SettingsNavItem[] = [to: "/settings/condenser",text: "SETTINGS$NAV_CONDENSER",subtitle: "SETTINGS$PAGE_CONDENSER_SUBLINE",- disabledByAcp: true,},{icon: <Shield className="size-4" strokeWidth={2} aria-hidden />,to: "/settings/verification",text: "SETTINGS$NAV_VERIFICATION",subtitle: "SETTINGS$PAGE_VERIFICATION_SUBLINE",- disabledByAcp: true,},{icon: <AppWindow className="size-4" strokeWidth={2} aria-hidden />,diff --git a/src/hooks/mutation/use-create-conversation.ts b/src/hooks/mutation/use-create-conversation.tsindex 5296818d25..1d1122d16b 100644--- a/src/hooks/mutation/use-create-conversation.ts+++ b/src/hooks/mutation/use-create-conversation.ts@@ -105,11 +105,6 @@ export const useCreateConversation = () => {agentProfiles = await queryClient.ensureQueryData({queryKey: [...AGENT_PROFILES_QUERY_KEYS.all, backend.id, orgId],queryFn: AgentProfilesService.listProfiles,- // Shared with useAgentProfiles and redirectIfAcpActive so the retry- // policy for this surface can't drift between call sites (#1571- // review): a backend without it fails every one of these on every- // call, so degrade to the fallback immediately rather than sitting- // through the default exponential-backoff retries each time....AGENT_PROFILES_RETRY_OPTIONS,});} catch {diff --git a/src/hooks/query/query-keys.ts b/src/hooks/query/query-keys.tsindex 40c8a31727..3a16375265 100644--- a/src/hooks/query/query-keys.ts+++ b/src/hooks/query/query-keys.ts@@ -26,13 +26,7 @@ export const AGENT_PROFILES_QUERY_KEYS = {all: ["agent-profiles"] as const,} as const;-/**- * Shared retry policy for every `/api/agent-profiles` fetch (the launch path- * in `useCreateConversation`, `redirectIfAcpActive`'s route guard, and- * `useAgentProfiles`). An older backend without the surface fails every one- * of these on every call — `retry: false` degrades immediately instead of- * sitting through the default exponential backoff each time (#1571 review).- */+/** Fail fast when older backends lack the profile endpoint. */export const AGENT_PROFILES_RETRY_OPTIONS = {retry: false,} as const;diff --git a/src/hooks/use-settings-nav-items.ts b/src/hooks/use-settings-nav-items.tsindex cc36a6cdd0..c1ba0c3f50 100644--- a/src/hooks/use-settings-nav-items.ts+++ b/src/hooks/use-settings-nav-items.ts@@ -1,59 +1,25 @@import { useConfig } from "#/hooks/query/use-config";-import { useSettings } from "#/hooks/query/use-settings";import { OSS_NAV_ITEMS, SettingsNavItem } from "#/constants/settings-nav";-import { ACP_PROVIDERS } from "#/constants/acp-providers";import { isSettingsPageHidden } from "#/utils/settings-utils";import { I18nKey } from "#/i18n/declaration";import { useActiveBackend } from "#/contexts/active-backend-context";-import { useActiveAgentProfile } from "#/hooks/use-active-agent-profile";export type SettingsNavRenderedItem =| {type: "item";item: SettingsNavItem;- disabled?: boolean;- disabledAgentName?: string;}| { type: "header"; text: I18nKey }| { type: "divider" };export function useSettingsNavItems(): SettingsNavRenderedItem[] {const { data: config } = useConfig();- const { data: settings } = useSettings();const { backend } = useActiveBackend();const featureFlags = config?.feature_flags;- // The active AgentProfile is the source of truth for the current agent kind- // (activate is pointer-only and never writes agent_settings). Fall back to- // the global agent settings only while the profile list is loading, so the- // ACP-incompatible nav items (LLM/condenser/verification) don't briefly- // enable before the active profile resolves.- const agentSettings = settings?.agent_settings ?? null;- const { activeProfile } = useActiveAgentProfile();- const isAcpAgent =- (activeProfile?.agent_kind ?? agentSettings?.agent_kind) === "acp";- const acpServerKey =- typeof agentSettings?.acp_server === "string"- ? agentSettings.acp_server- : undefined;- // Name the active agent in the disabled-item tooltip: prefer the active- // profile's name, then the ACP provider display name, then a generic label.- const acpServerName = isAcpAgent- ? (activeProfile?.name ??- ACP_PROVIDERS.find(({ key }) => key === acpServerKey)?.display_name ??- "ACP Agent")- : undefined;-- // Agent profiles are available on both local and cloud backends — the cloud- // enterprise app-server exposes the same `/api/agent-profiles` surface- // (OpenHands #15060, epic #3730), so the nav item is no longer local-gated.return OSS_NAV_ITEMS.filter((item) => !isSettingsPageHidden(item.to, featureFlags),).map((item) => {- // Local backends present "LLM Profiles" as the section name + subtitle- // for the ``/settings`` entry; cloud backends keep the canonical "LLM".- // Apply the rename before the ACP disable check so the disabled tooltip- // still names the visible label, not a stale one.const renamedItem =item.to === "/settings"? {@@ -69,14 +35,6 @@ export function useSettingsNavItems(): SettingsNavRenderedItem[] {}: item;- if (isAcpAgent && item.disabledByAcp) {- return {- type: "item",- item: renamedItem,- disabled: true,- disabledAgentName: acpServerName,- };- }return { type: "item", item: renamedItem };});}diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex bb8292e573..39ba4c4459 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -5864,23 +5864,6 @@"uk": "Зберігаються як секрети та вводяться в агент під час виконання. Залиште поле порожнім, щоб зберегти наявне значення.","ca": "Desades com a secrets i injectades a l'agent en temps d'execució. Deixa un camp en blanc per conservar el valor existent."},- "SETTINGS$AGENT_DISABLED_TOOLTIP": {- "en": "Disabled while {{agentName}} is the active agent",- "ja": "{{agentName}}がアクティブなエージェントの間は無効です",- "zh-CN": "当 {{agentName}} 为活动代理时禁用",- "zh-TW": "當 {{agentName}} 為使用中代理時停用",- "ko-KR": "{{agentName}}이(가) 활성 에이전트인 동안 비활성화됩니다",- "no": "Deaktivert mens {{agentName}} er den aktive agenten",- "it": "Disabilitato finché {{agentName}} è l'agente attivo",- "pt": "Desativado enquanto {{agentName}} for o agente ativo",- "es": "Desactivado mientras {{agentName}} sea el agente activo",- "ar": "معطّل أثناء كون {{agentName}} هو الوكيل النشط",- "fr": "Désactivé tant que {{agentName}} est l'agent actif",- "tr": "{{agentName}} etkin aracıyken devre dışı",- "de": "Deaktiviert, solange {{agentName}} der aktive Agent ist",- "uk": "Вимкнено, поки {{agentName}} є активним агентом",- "ca": "Desactivat mentre {{agentName}} sigui l'agent actiu"- },"SETTINGS$NAV_VERIFICATION": {"en": "Verification","ja": "検証",diff --git a/src/routes/settings.tsx b/src/routes/settings.tsxindex 6d5393d181..402ac124a5 100644--- a/src/routes/settings.tsx+++ b/src/routes/settings.tsx@@ -10,12 +10,10 @@ import { QUERY_KEYS, CONFIG_CACHE_OPTIONS } from "#/hooks/query/query-keys";import { Typography } from "#/ui/typography";import { useBreakpoint } from "#/hooks/use-breakpoint";import { useSettingsNavItems } from "#/hooks/use-settings-nav-items";-import { OSS_NAV_ITEMS } from "#/constants/settings-nav";import {getFirstAvailablePath,isSettingsPageHidden,} from "#/utils/settings-utils";-import { redirectIfAcpActive } from "#/utils/acp-route-guard";import { SettingsSectionHeaderProvider } from "#/contexts/settings-section-header-context";export const clientLoader = async ({ request }: Route.ClientLoaderArgs) => {@@ -37,19 +35,6 @@ export const clientLoader = async ({ request }: Route.ClientLoaderArgs) => {}}- // ACP guard: the pages flagged ``disabledByAcp`` (LLM, Condenser, …)- // have no useful content while an external ACP subprocess drives- // conversations. Bounce them to ``/settings/agents``. Driven by the- // same ``disabledByAcp`` flag the nav hook uses for greying out, so- // the list of redirected paths and the greyed-out paths can never- // drift apart. See {@link redirectIfAcpActive} for why the redirect- // lives in the loader rather than a per-route ``useEffect``.- const currentNavItem = OSS_NAV_ITEMS.find((item) => item.to === pathname);- if (currentNavItem?.disabledByAcp) {- const acpRedirect = await redirectIfAcpActive();- if (acpRedirect) return acpRedirect;- }-return null;};diff --git a/src/utils/acp-route-guard.ts b/src/utils/acp-route-guard.tsdeleted file mode 100644index 157c39e4b5..0000000000--- a/src/utils/acp-route-guard.ts+++ /dev/null@@ -1,90 +0,0 @@-import { redirect } from "react-router";--import { getActiveBackend } from "#/api/backend-registry/active-store";-import { getSettingsQueryFn } from "#/hooks/query/use-settings";-import {- SETTINGS_QUERY_KEYS,- AGENT_PROFILES_QUERY_KEYS,- AGENT_PROFILES_RETRY_OPTIONS,-} from "#/hooks/query/query-keys";-import AgentProfilesService from "#/api/agent-profiles-service/agent-profiles-service.api";-import { queryClient } from "#/query-client-config";--/**- * Issue a ``redirect`` to ``/settings/agents`` when the personal settings- * say the active agent is ACP.- *- * The ACP sub-agent owns its own LLM and condenser, so the canvas-side- * surfaces that configure those concepts (``/settings``,- * ``/settings/condenser``) have nothing useful to do while ACP is active.- * (``/mcp`` is intentionally *not* guarded: ``mcp_config`` is forwarded- * to the ACP subprocess at session creation.) Doing the redirect in a- * ``clientLoader`` (instead of a per-route ``useEffect``) prevents the- * one-frame flash of the old content before the guard fires.- *- * ``staleTime: 0`` is intentional: the read drives a redirect, and a- * 5-minute stale tolerance would let a cross-tab agent-kind flip route- * the user to the wrong page until the cache caught up. PATCH /settings- * already invalidates this key, so the forced refetch only fires when- * something might actually have changed.- *- * Fall through silently on settings-fetch errors (unauthed, network,- * local agent-server not running) — better to render the page than- * redirect-loop on a missing payload.- *- * Cache key is aligned with {@link useSettings} so the loader and the- * in-render hook share a single cache entry rather than thrashing the- * same data through two different keys.- */-export async function redirectIfAcpActive() {- try {- const active = getActiveBackend();- // The active AgentProfile is the current agent (activate is pointer-only- // and never writes agent_settings), so it's the authoritative ACP signal.- // Fall back to the global agent settings when the profile list is- // unavailable (older backend, fetch error) so behavior degrades gracefully.- let isAcp: boolean | undefined;- try {- const profiles = await queryClient.fetchQuery({- queryKey: [- ...AGENT_PROFILES_QUERY_KEYS.all,- active.backend.id,- active.orgId,- ],- queryFn: AgentProfilesService.listProfiles,- staleTime: 0,- // A backend without the surface fails this on every settings- // navigation — degrade to the agent_settings fallback below- // immediately rather than sitting through the default backoff.- ...AGENT_PROFILES_RETRY_OPTIONS,- });- const activeId = profiles?.active_agent_profile_id ?? null;- const activeProfile = profiles?.profiles.find(- (profile) => profile.id != null && profile.id === activeId,- );- if (activeProfile) isAcp = activeProfile.agent_kind === "acp";- } catch {- // Agent profiles unavailable — fall back to settings below.- }-- if (isAcp === undefined) {- const personalSettings = await queryClient.fetchQuery({- queryKey: [- ...SETTINGS_QUERY_KEYS.byScope("personal"),- active.backend.id,- active.orgId,- ],- queryFn: () => getSettingsQueryFn("personal"),- staleTime: 0,- });- isAcp = personalSettings?.agent_settings?.agent_kind === "acp";- }-- if (isAcp) {- return redirect("/settings/agents");- }- } catch {- // Settings unfetchable — let the page render.- }- return null;-}diff --git a/tests/e2e/mock-llm/settings/mock-llm-model-switch.spec.ts b/tests/e2e/mock-llm/settings/mock-llm-model-switch.spec.tsindex 77756e1c8b..911da99a0d 100644--- a/tests/e2e/mock-llm/settings/mock-llm-model-switch.spec.ts+++ b/tests/e2e/mock-llm/settings/mock-llm-model-switch.spec.ts@@ -99,14 +99,12 @@ test.describe("mock-LLM /model slash command", () => {// Create profile B as the switch target through the Settings UI — it has// a different model name but the same mock LLM base_url so post-switch- // inference still works.- await routeSessionApiKey(page);- await page.goto("/settings/llm", { waitUntil: "domcontentloaded" });- await dismissAnalyticsModal(page);- await waitForTestId(page, "add-llm-profile");-+ // inference still works. ensureMockLLMProfile leaves this page ready.await deleteProfileIfExists(page, PROFILE_B_NAME);- await createProfileViaUI(page, { profileName: PROFILE_B_NAME, model: MODEL_B });+ await createProfileViaUI(page, {+ profileName: PROFILE_B_NAME,+ model: MODEL_B,+ });// Verify profile B appears in the listconst profileRows = page.getByTestId("profile-row");@@ -138,7 +136,6 @@ test.describe("mock-LLM /model slash command", () => {test("step 2: start conversation, switch profile via /model, verify switch", async ({page,- request,}) => {test.setTimeout(120_000);@@ -205,10 +202,9 @@ test.describe("mock-LLM /model slash command", () => {// ── Verify: the switch_llm POST was made ──await test.step("verify switch_llm API was called with profile B model", async () => {- expect(- switchLlmCalled,- "POST /switch_llm should have been called",- ).toBe(true);+ expect(switchLlmCalled, "POST /switch_llm should have been called").toBe(+ true,+ );expect(switchLlmBody).toBeTruthy();// ConversationClient.switchLLM posts { llm: <config> } to switch_llm,// so the model is nested under the "llm" key in the HTTP body.diff --git a/tests/e2e/mock-llm/skills/mock-llm-skills.spec.ts b/tests/e2e/mock-llm/skills/mock-llm-skills.spec.tsindex 22f4c866da..0182a7e323 100644--- a/tests/e2e/mock-llm/skills/mock-llm-skills.spec.ts+++ b/tests/e2e/mock-llm/skills/mock-llm-skills.spec.ts@@ -22,7 +22,12 @@* appears in the conversation events API.*/-import { test, expect, type APIRequestContext } from "@playwright/test";+import {+ test,+ expect,+ type APIRequestContext,+ type Page,+} from "@playwright/test";import {BACKEND_URL,SESSION_API_KEY,@@ -84,6 +89,15 @@ async function removeWorkspaceFromServer(});}+async function navigateToNewChat(page: Page): Promise<void> {+ await expect(async () => {+ await page+ .getByTestId("sidebar-conversations-link")+ .click({ timeout: 5_000 });+ await expect(page).toHaveURL(/\/conversations\/?$/, { timeout: 5_000 });+ }).toPass({ timeout: 30_000, intervals: [500, 1_000, 2_000] });+}+// ── Shared constants ─────────────────────────────────────────────────const REPLY_TOKEN = "SKILLS_E2E_REPLY_OK";@@ -150,15 +164,13 @@ test.describe("skill loading: project, user, and deletion", () => {await ensureMockLLMProfile(page);// Create a git repo with the skill committed- const { agentDir } = await test.step(- "create git repo with project skill",- () => {+ const { agentDir } =+ await test.step("create git repo with project skill", () => {return createProjectSkillRepo(PROJECT_SKILL_NAME,PROJECT_SKILL_TRIGGER,);- },- );+ });projectSkillAgentDir = agentDir;// Register the workspace on the server using the agent-side path@@ -261,8 +273,7 @@ test.describe("skill loading: project, user, and deletion", () => {await activateTrajectory(request, "user-skill");await routeSessionApiKey(page);- await page.goto("/", { waitUntil: "domcontentloaded" });- await dismissAnalyticsModal(page);+ await navigateToNewChat(page);await test.step("send message with user skill trigger", async () => {await setChatInput(@@ -334,20 +345,13 @@ test.describe("skill loading: project, user, and deletion", () => {await activateTrajectory(request, "deleted-skill");await routeSessionApiKey(page);- await page.goto("/", { waitUntil: "domcontentloaded" });- await dismissAnalyticsModal(page);+ await navigateToNewChat(page);- await test.step(- "send message with deleted skill trigger keyword",- async () => {- await setChatInput(- page,- `Help me with ${USER_SKILL_TRIGGER} please`,- );- await page.getByTestId("submit-button").click();- await waitForPath(page, /\/conversations\/.+/, 30_000);- },- );+ await test.step("send message with deleted skill trigger keyword", async () => {+ await setChatInput(page, `Help me with ${USER_SKILL_TRIGGER} please`);+ await page.getByTestId("submit-button").click();+ await waitForPath(page, /\/conversations\/.+/, 30_000);+ });const conversationId = getConversationIdFromURL(page);conversationIds.add(conversationId);