π OpenHands: AI-Driven Development
Set onboarding LLM default to OpenHands (#639)
Graham Neubig16aef1a31c31
diff --git a/__tests__/components/onboarding/onboarding-modal.test.tsx b/__tests__/components/onboarding/onboarding-modal.test.tsxindex b0168e6354..e6c4736788 100644--- a/__tests__/components/onboarding/onboarding-modal.test.tsx+++ b/__tests__/components/onboarding/onboarding-modal.test.tsx@@ -10,15 +10,24 @@ import { OnboardingModal } from "#/components/features/onboarding/onboarding-modimport { NavigationProvider } from "#/context/navigation-context";import SettingsService from "#/api/settings-service/settings-service.api";+const llmSettingsScreenMock = vi.hoisted(() => vi.fn());+// Both the backend status badge in the embedded edit form and the-// step-1 health probe ride on `useBackendsHealth`, which itself-// resolves through these two clients.+// step-1 health probe ride on `useBackendsHealth`, which resolves+// server metadata through `ServerClient`.vi.mock("@openhands/typescript-client/clients", () => ({ServerClient: vi.fn(function ServerClientMock() {return {getServerInfo: vi.fn().mockResolvedValue({ version: "1.18.0" }),};}),+ // The always-mounted LLM slide initializes settings hooks even though+ // `LlmSettingsScreen` is stubbed, so provide the minimal client it needs.+ SettingsClient: vi.fn(function SettingsClientMock() {+ return {+ getSettings: vi.fn().mockResolvedValue({}),+ };+ }),}));vi.mock("#/api/cloud/organization-service.api", () => ({@@ -31,12 +40,21 @@ vi.mock("#/api/cloud/organization-service.api", () => ({// The LLM step renders the full `LlmSettingsScreen`, which transitively// pulls in agent-server config + schema queries we don't need to// exercise here. Stub it to a marker so we can still verify the LLM-// step is mounted.-vi.mock("#/routes/llm-settings", () => ({- LlmSettingsScreen: () => (- <div data-testid="llm-settings-screen-stub">llm settings</div>- ),-}));+// step is mounted and inspect the onboarding defaults passed to it.+vi.mock("#/routes/llm-settings", async () => {+ const React = await import("react");++ return {+ LlmSettingsScreen: (props: Record<string, unknown>) => {+ llmSettingsScreenMock(props);+ return React.createElement(+ "div",+ { "data-testid": "llm-settings-screen-stub" },+ "llm settings",+ );+ },+ };+});vi.mock("#/components/features/automations/recommended-automations-launcher",@@ -91,6 +109,7 @@ function renderModal(onClose = vi.fn()) {beforeEach(() => {window.localStorage.clear();__resetActiveStoreForTests();+ llmSettingsScreenMock.mockClear();// ChooseAgentStep's Next button now persists the selection via// saveSettings before advancing. Stub it so the rest of the flow// (which these tests focus on) isn't gated on a real HTTP call.@@ -129,6 +148,19 @@ describe("OnboardingModal", () => {);});+ it("pre-fills the LLM step with the OpenHands provider", () => {+ renderModal();++ expect(llmSettingsScreenMock).toHaveBeenCalledTimes(1);+ expect(llmSettingsScreenMock).toHaveBeenCalledWith(+ expect.objectContaining({+ initialValueOverrides: {+ "llm.model": "openhands/claude-opus-4-5-20251101",+ },+ }),+ );+ });+it("advances each step via the per-step Next button and reframes slide offsets", async () => {renderModal();const user = userEvent.setup();diff --git a/src/components/features/onboarding/steps/setup-llm-step.tsx b/src/components/features/onboarding/steps/setup-llm-step.tsxindex 3c47677cde..dabea79241 100644--- a/src/components/features/onboarding/steps/setup-llm-step.tsx+++ b/src/components/features/onboarding/steps/setup-llm-step.tsx@@ -15,14 +15,12 @@ interface SetupLlmStepProps {}/**- * Pre-fills the LLM form with Anthropic / Claude Opus when the user- * lands on this onboarding step. The global `DEFAULT_SETTINGS` ships- * the OpenHands-prefixed Opus, but the onboarding spec calls for- * routing directly through Anthropic, and these overrides are also- * marked dirty so the Next button is enabled immediately.+ * Pre-fills the LLM form with the OpenHands provider's default Claude+ * Opus model. Keeping this as an explicit override marks the model+ * dirty so the Next button persists the suggested default immediately.*/const ONBOARDING_LLM_OVERRIDES = {- "llm.model": "anthropic/claude-opus-4-7",+ "llm.model": "openhands/claude-opus-4-5-20251101",} as const;/**diff --git a/src/components/features/settings/sdk-settings/sdk-section-page.tsx b/src/components/features/settings/sdk-settings/sdk-section-page.tsxindex 684d405ad3..9e37f16440 100644--- a/src/components/features/settings/sdk-settings/sdk-section-page.tsx+++ b/src/components/features/settings/sdk-settings/sdk-section-page.tsx@@ -174,7 +174,7 @@ export function SdkSectionPage({* marked dirty on hydration so the user can save the form without* having to touch the prefilled fields. Useful when the page is* embedded in a flow that wants to nudge brand-new users toward a- * particular default (e.g. onboarding pre-filling Anthropic/Opus).+ * particular default (e.g. onboarding pre-filling OpenHands/Opus).*/initialValueOverrides?: SettingsFormValues;/**diff --git a/src/mocks/mcp-handlers.ts b/src/mocks/mcp-handlers.tsindex 3ff92b1789..059bd72275 100644--- a/src/mocks/mcp-handlers.ts+++ b/src/mocks/mcp-handlers.ts@@ -1,5 +1,5 @@-import { http, HttpResponse } from "msw";import type { MCPTestResponse } from "@openhands/typescript-client";+import { http, HttpResponse } from "msw";/*** MSW handlers for the MCP API.