🙌 OpenHands: AI-Driven Development
fix(onboarding): cloud-only setup polish (#1607)
Graham Neubig9d8b9d0653df
diff --git a/__tests__/root.test.tsx b/__tests__/root.test.tsxindex ebe178ae10..3d8faa27e1 100644--- a/__tests__/root.test.tsx+++ b/__tests__/root.test.tsx@@ -608,6 +608,37 @@ describe("App root agent-server availability guard", () => {).toBeNull();});+ it("renders Cloud login directly for a fresh locked-to-Cloud first run", async () => {+ vi.stubEnv("VITE_LOCK_TO_CLOUD", "https://app.all-hands.dev");+ vi.stubEnv("VITE_SESSION_API_KEY", "");+ delete (window as unknown as Record<string, unknown>)+ .__AGENT_CANVAS_SESSION_API_KEY__;+ __resetActiveStoreForTests();++ renderApp(["/"]);++ await waitFor(() => {+ expect(+ screen.getByTestId("first-run-onboarding-screen"),+ ).toBeInTheDocument();+ });++ expect(await screen.findByTestId("onboarding-modal")).toBeInTheDocument();+ expect(screen.getByTestId("add-backend-cloud-title")).toBeVisible();+ expect(screen.getByTestId("add-backend-login-button")).toBeVisible();+ expect(+ screen.queryByTestId("onboarding-step-check-backend"),+ ).not.toBeInTheDocument();+ expect(+ screen.queryByTestId("onboarding-progress-bar"),+ ).not.toBeInTheDocument();+ expect(screen.queryByTestId("add-backend-close")).not.toBeInTheDocument();+ expect(+ screen.queryByTestId("add-backend-advanced-toggle"),+ ).not.toBeInTheDocument();+ expect(screen.queryByTestId("app-outlet")).not.toBeInTheDocument();+ });+it("hides first-run onboarding immediately after Cloud login completes in locked-to-Cloud mode (no flicker)", async () => {// Regression for hieptl's flicker report on PR #1389: after Cloud// login succeeds in locked-to-Cloud mode, the onboarding modal'sdiff --git a/src/components/features/backends/backend-form-modal.tsx b/src/components/features/backends/backend-form-modal.tsxindex 89a8e522f6..5c85c42561 100644--- a/src/components/features/backends/backend-form-modal.tsx+++ b/src/components/features/backends/backend-form-modal.tsx@@ -45,6 +45,8 @@ interface BackendFormModalProps {onClose: () => void;/** Analytics surface for the `backend_added` event (add mode only). */source?: BackendAddedSource;+ /** Hide the close button and disable backdrop/escape dismissal. Used for locked Cloud first-run. */+ hideCloseButton?: boolean;}/**@@ -965,7 +967,7 @@ function CloudLoginColumn({};return (- <div className="flex flex-1 min-w-0 flex-col items-center gap-3 pb-7">+ <div className="flex flex-1 min-w-0 flex-col items-center gap-3 pb-8"><div className="flex flex-col items-center gap-1"><OpenHandsLogoWhite width={56} height={56} aria-hidden />@@ -1080,33 +1082,41 @@ export function BackendFormModal({backend,onClose,source = "add_backend_modal",+ hideCloseButton = false,}: BackendFormModalProps) {const { t } = useTranslation("openhands");if (mode === "add") {return (<ModalBackdrop- onClose={onClose}+ onClose={hideCloseButton ? undefined : onClose}closeOnEscape={false}+ closeOnBackdropClick={!hideCloseButton}aria-label={t(I18nKey.BACKEND$ADD_TITLE)}><div- data-testid="add-backend-modal"+ data-testid={+ hideCloseButton ? "onboarding-modal" : "add-backend-modal"+ }className={cn("relative rounded-xl border border-[var(--oh-border)] bg-base-secondary",modalWidthClassName("xl"),MODAL_MAX_WIDTH_VIEWPORT,)}>- <ModalCloseButton onClose={onClose} testId="add-backend-close" />- {/* Header */}- <div className="px-6 pt-6 pb-2 pr-12">- <h2 className={modalTitleLgClassName}>- {t(I18nKey.BACKEND$ADD_TITLE)}- </h2>- </div>+ {hideCloseButton ? null : (+ <ModalCloseButton onClose={onClose} testId="add-backend-close" />+ )}+ {/* Header - hide in locked Cloud first-run mode for cleaner UX */}+ {hideCloseButton ? null : (+ <div className="px-6 pt-6 pb-2 pr-12">+ <h2 className={modalTitleLgClassName}>+ {t(I18nKey.BACKEND$ADD_TITLE)}+ </h2>+ </div>+ )}- <div className="px-6 pb-6 pt-2">+ <div className={cn("px-6 pb-6", hideCloseButton ? "pt-6" : "pt-2")}><AddBackendConnectionOptions onClose={onClose} source={source} /></div></div>diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex 2ad705897a..176aa82566 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -28985,7 +28985,7 @@"ca": "OpenHands Cloud"},"BACKEND$CLOUD_DESCRIPTION": {- "en": "Skip the setup — connect instantly with your OpenHands Cloud account.",+ "en": "Connect instantly to OpenHands Cloud to try out Agent Canvas","ja": "セットアップをスキップ — OpenHands Cloud アカウントですぐに接続できます。","zh-CN": "跳过设置 — 使用您的 OpenHands Cloud 帐户即时连接。","zh-TW": "跳過設定 — 使用您的 OpenHands Cloud 帳戶即時連線。",diff --git a/src/root.tsx b/src/root.tsxindex a01f870567..cd888dccf7 100644--- a/src/root.tsx+++ b/src/root.tsx@@ -74,6 +74,14 @@ const OnboardingModal = React.lazy(() =>})),);+// Rendered for first-run in locked-to-Cloud mode; shows Cloud login directly+// without the onboarding progress bars.+const BackendFormModal = React.lazy(() =>+ import("#/components/features/backends/backend-form-modal").then((m) => ({+ default: m.BackendFormModal,+ })),+);+export function Layout({ children }: { children: React.ReactNode }) {return (<html lang="en">@@ -160,6 +168,31 @@ function FirstRunOnboardingScreen({ onClose }: { onClose: () => void }) {[conversationId, location.pathname, navigate, routerNavigation.location],);+ const lockedCloudHost = getLockedCloudHost();+ const isLockedToCloud = lockedCloudHost !== null;++ // In locked-to-Cloud mode, show the Add Backend modal directly with Cloud+ // login, instead of the full onboarding flow with progress bars. This+ // matches the UX expectation for canvas.openhands.dev where Cloud is the+ // only backend option.+ if (isLockedToCloud) {+ return (+ <main+ data-testid="first-run-onboarding-screen"+ className="min-h-screen bg-base"+ >+ <React.Suspense fallback={<AgentServerBootstrapLoading />}>+ <BackendFormModal+ mode="add"+ onClose={onClose}+ source="manage_backends_modal"+ hideCloseButton+ />+ </React.Suspense>+ </main>+ );+ }+return (<maindata-testid="first-run-onboarding-screen"