Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix(onboarding): skip the first-run modal on a canvas locked to a Cloud host (OHE-3670) (#18724)

Hiep Lebfd3d8b8b981
diff --git a/.agents/skills/frontend-api-contracts/references/guide.md b/.agents/skills/frontend-api-contracts/references/guide.md
index 5321e340a0..51901bfec4 100644
--- a/.agents/skills/frontend-api-contracts/references/guide.md
+++ b/.agents/skills/frontend-api-contracts/references/guide.md
@@ -186,7 +186,7 @@ return new ConversationClient(getAgentServerClientOptions()).someMethod(...);
- Changes tab / `FileDiffViewer` deleted-file note: the agent-server's `/api/git/diff` endpoint calls `path.exists()` first (see `openhands-sdk/openhands/sdk/git/git_diff.py` β†’ `get_git_diff`), so requesting a diff for a `D` (deleted) file returns `GitPathError` β†’ HTTP 400 and trips the global QueryCache error toast. `useUnifiedGitDiff` disables the query when `type === "D"` and `FileDiffViewer` renders a localized "file deleted" placeholder (`DIFF_VIEWER$FILE_DELETED`, `data-testid="file-deleted-message"`) instead of the view-mode toolbar / Monaco editor for that case.
-- Onboarding modal: `src/components/features/onboarding/onboarding-modal.tsx` is rendered by `<OnboardingHost />` and normally gated by the `openhands-onboarded` localStorage flag. `OnboardingHost` also suppresses the modal, without writing that flag, when any active Cloud backend's settings report a usable LLM (non-empty model plus API-key or subscription auth); this readiness exception must not apply to Local backends. It tracks logical phases (`backend`, `agent`, `setup`, `hello`) rather than fixed numeric steps; the backend phase may be omitted for an already configured backend. Agent choices are derived from `ACP_PROVIDERS` plus OpenHands. The setup phase renders `SetupLlmStep` for OpenHands or `SetupAcpSecretsStep` for ACP providers. Keep the phase-based navigation so adding or removing the backend slide cannot move users to the wrong step.
+- Onboarding modal: `src/components/features/onboarding/onboarding-modal.tsx` is rendered by `<OnboardingHost />` and normally gated by the `openhands-onboarded` localStorage flag. `OnboardingHost` also suppresses the modal, without writing that flag, when any active Cloud backend's settings report a usable LLM (non-empty model plus API-key or subscription auth); this readiness exception must not apply to Local backends. It also suppresses the modal, again without writing the flag, on a canvas locked to a Cloud host (`getLockedCloudHost() !== null`), where the main app owns setup. It tracks logical phases (`backend`, `agent`, `setup`, `hello`) rather than fixed numeric steps; the backend phase may be omitted for an already configured backend. Agent choices are derived from `ACP_PROVIDERS` plus OpenHands. The setup phase renders `SetupLlmStep` for OpenHands or `SetupAcpSecretsStep` for ACP providers. Keep the phase-based navigation so adding or removing the backend slide cannot move users to the wrong step.
- Collapsible thinking: `ThinkAction` events and LLM extended reasoning (`reasoning_content` / `thinking_blocks` on `ActionEvent`) are rendered as collapsible sections via `CollapsibleThinking` (`src/components/conversation-events/chat/event-message-components/collapsible-thinking.tsx`). Collapsed by default to keep the chat compact β€” the thinking is often in English regardless of the user's conversation language. The `getReasoningContent()` helper in `event-thought-helpers.ts` extracts the content, preferring `reasoning_content` (plain string) and falling back to Anthropic `thinking_blocks`. i18n keys: `THINKING$TITLE`, `THINKING$EXPAND`, `THINKING$COLLAPSE`. Tests: `__tests__/components/conversation-events/chat/event-message-think-action.test.tsx`.
diff --git a/__tests__/components/onboarding/onboarding-host.test.tsx b/__tests__/components/onboarding/onboarding-host.test.tsx
index ffd6279582..9bb7a6b263 100644
--- a/__tests__/components/onboarding/onboarding-host.test.tsx
+++ b/__tests__/components/onboarding/onboarding-host.test.tsx
@@ -24,7 +24,7 @@ vi.mock("#/components/features/onboarding/onboarding-modal", () => ({
),
}));
-function renderHost() {
+function renderHost(initialEntry = "/") {
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
});
@@ -36,7 +36,7 @@ function renderHost() {
};
return render(
<QueryClientProvider client={queryClient}>
- <MemoryRouter initialEntries={["/"]}>
+ <MemoryRouter initialEntries={[initialEntry]}>
<ActiveBackendProvider>
<NavigationProvider value={navigationValue}>
<OnboardingHost />
@@ -161,6 +161,47 @@ describe("OnboardingHost", () => {
).toBeNull();
});
+ it("never opens the modal on a canvas locked to its Cloud host, even with no LLM configured", async () => {
+ vi.stubEnv("VITE_LOCK_TO_CLOUD", "https://app.all-hands.dev");
+ seedCloudBackend();
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue({
+ ...DEFAULT_SETTINGS,
+ llm_api_key_set: false,
+ agent_settings: {
+ ...DEFAULT_SETTINGS.agent_settings,
+ llm: { model: "" },
+ },
+ });
+
+ renderHost();
+
+ await expect(
+ screen.findByTestId("onboarding-modal-stub"),
+ ).rejects.toThrow();
+ expect(
+ window.localStorage.getItem(ONBOARDING_COMPLETED_STORAGE_KEY),
+ ).toBeNull();
+ });
+
+ it("still opens the design preview on a canvas locked to its Cloud host", async () => {
+ vi.stubEnv("VITE_LOCK_TO_CLOUD", "https://app.all-hands.dev");
+ seedCloudBackend();
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue({
+ ...DEFAULT_SETTINGS,
+ llm_api_key_set: false,
+ agent_settings: {
+ ...DEFAULT_SETTINGS.agent_settings,
+ llm: { model: "" },
+ },
+ });
+
+ renderHost("/?previewOnboardingStep=1");
+
+ expect(
+ await screen.findByTestId("onboarding-modal-stub"),
+ ).toBeInTheDocument();
+ });
+
it("skips the modal when the active Cloud backend uses subscription auth", async () => {
seedCloudBackend();
const getSettings = vi
diff --git a/src/components/features/onboarding/onboarding-host.tsx b/src/components/features/onboarding/onboarding-host.tsx
index e986556326..82af31366c 100644
--- a/src/components/features/onboarding/onboarding-host.tsx
+++ b/src/components/features/onboarding/onboarding-host.tsx
@@ -1,4 +1,5 @@
import { useLocation } from "react-router";
+import { getLockedCloudHost } from "#/api/agent-server-config";
import { useActiveBackend } from "#/contexts/active-backend-context";
import { SEEDED_DEFAULT_BACKEND_ID } from "#/api/backend-registry/default-backend";
import { useSettings } from "#/hooks/query/use-settings";
@@ -32,6 +33,10 @@ function hasUsableLlm(settings: Settings | undefined): boolean {
* skipped β€” except the launcher-seeded default-local one, which may hold an
* LLM from an earlier user, leaving `openhands-onboarded` its first-run signal.
*
+ * A canvas locked to a Cloud host (SaaS / self-hosted OHE) never opens it: the
+ * main app owns setup there, including the LLM and agent pages this flow
+ * mirrors (OHE-3457), so the modal would only compete with it (OHE-3670).
+ *
* With `?previewOnboardingStep=<0-3>` the modal opens on that slide for
* design review without persisting completion (works on any route when
* mounted from the root layout).
@@ -51,6 +56,7 @@ export function OnboardingHost() {
if (!isPreview) {
if (isCompleted) return null;
+ if (getLockedCloudHost() !== null) return null;
if (trustsBackendLlm && settings.isLoading) return null;
if (trustsBackendLlm && hasUsableLlm(settings.data)) {
return null;