Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix(settings): keep LLM Profiles reachable while an ACP agent is active (#1915)

Vasco Schiavo28cac0c378a6
diff --git a/__tests__/hooks/use-settings-nav-items.test.tsx b/__tests__/hooks/use-settings-nav-items.test.tsx
index 44ef4f0084..0c54f4e173 100644
--- a/__tests__/hooks/use-settings-nav-items.test.tsx
+++ b/__tests__/hooks/use-settings-nav-items.test.tsx
@@ -132,13 +132,13 @@ describe("useSettingsNavItems", () => {
});
const { result } = renderHook(() => useSettingsNavItems());
- const llm = result.current.find(
- (r) => r.type === "item" && r.item.to === "/settings/llm",
+ const condenser = result.current.find(
+ (r) => r.type === "item" && r.item.to === "/settings/condenser",
);
- expect(llm?.type).toBe("item");
- if (llm?.type === "item") {
- expect(llm.disabled).toBe(true);
- expect(llm.disabledAgentName).toBe("MyClaude");
+ expect(condenser?.type).toBe("item");
+ if (condenser?.type === "item") {
+ expect(condenser.disabled).toBe(true);
+ expect(condenser.disabledAgentName).toBe("MyClaude");
}
});
@@ -171,7 +171,7 @@ describe("useSettingsNavItems", () => {
expect(paths).not.toContain("/settings/mcp");
});
- it("disables LLM + Condenser when the active agent_kind is acp", () => {
+ it("disables Condenser but keeps LLM Profiles reachable when the active agent_kind is acp", () => {
useConfigMock.mockReturnValue({ data: createConfig() });
useSettingsMock.mockReturnValue({ data: acpClaudeCodeSettings });
@@ -184,17 +184,19 @@ describe("useSettingsNavItems", () => {
),
);
- const llm = byPath.get("/settings/llm");
- expect(llm?.type).toBe("item");
- if (llm?.type === "item") {
- expect(llm.disabled).toBe(true);
- expect(llm.disabledAgentName).toBe("Claude Code");
- }
-
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.
@@ -217,11 +219,12 @@ describe("useSettingsNavItems", () => {
});
const { result } = renderHook(() => useSettingsNavItems());
- const llm = result.current.find(
- (r) => r.type === "item" && r.item.to === "/settings/llm",
+ const condenser = result.current.find(
+ (r) => r.type === "item" && r.item.to === "/settings/condenser",
);
- if (llm?.type === "item") {
- expect(llm.disabledAgentName).toBe("ACP Agent");
+ expect(condenser?.type).toBe("item");
+ if (condenser?.type === "item") {
+ expect(condenser.disabledAgentName).toBe("ACP Agent");
}
});
diff --git a/__tests__/routes/settings.test.tsx b/__tests__/routes/settings.test.tsx
index 64a3f50ff4..56ca301a7d 100644
--- a/__tests__/routes/settings.test.tsx
+++ b/__tests__/routes/settings.test.tsx
@@ -57,8 +57,7 @@ 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 instead of bouncing
- // through /settings/llm (which is disabled for ACP users).
+ // there too and reach LLM via the left nav.
expect(
getFirstAvailablePath({
hide_llm_settings: false,
@@ -165,7 +164,7 @@ describe("settings route", () => {
});
const response = (await clientLoader({
- request: new Request("http://localhost/settings/llm"),
+ request: new Request("http://localhost/settings/condenser"),
params: {},
context: {},
} as never)) as Response;
@@ -174,6 +173,40 @@ describe("settings route", () => {
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: {
diff --git a/src/constants/settings-nav.tsx b/src/constants/settings-nav.tsx
index daf44ac188..16548cb2a0 100644
--- a/src/constants/settings-nav.tsx
+++ b/src/constants/settings-nav.tsx
@@ -12,10 +12,11 @@ export interface SettingsNavItem {
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 LLM / condenser / MCP, 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.
+ // 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;
}
@@ -31,11 +32,13 @@ 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",
subtitle: "SETTINGS$PAGE_LLM_SUBLINE",
- disabledByAcp: true,
},
{
icon: <MemoryIcon width={16} height={16} />,
diff --git a/src/utils/settings-utils.ts b/src/utils/settings-utils.ts
index 451f8abf41..7742f02d64 100644
--- a/src/utils/settings-utils.ts
+++ b/src/utils/settings-utils.ts
@@ -63,9 +63,8 @@ export function getFirstAvailablePath(
// ``/settings/agents`` (the Agent Profile library β€” the "Agent" page) always
// wins: it is where the agent is defined (OpenHands / ACP, via the active
// profile) and is always available regardless of feature flags. Landing here
- // keeps routing simple β€” ACP users no longer have to bounce through
- // ``/settings/llm`` (which is disabled for them), and OpenHands users are one
- // nav-click away from the LLM page.
+ // keeps routing simple β€” every user lands where the agent is chosen, and
+ // the LLM page is one nav-click away.
const fallbackOrder = [
{ path: "/settings/agents", hidden: false },
{ path: "/settings/llm", hidden: !!featureFlags?.hide_llm_settings },