AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(platform): guide existing users to workflows in Otto (#14935)
Toran Bruce Richards3b784e07a47b
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex af416fa26d..f6b918e199 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -11,7 +11,7 @@ repos:hooks:- id: check-added-large-filesargs: ["--maxkb=500"]- exclude: ^autogpt_platform/frontend/public/autogpt-characters/v1\.1/expert-(maria|mina)/neutral/1024\.png$+ exclude: ^autogpt_platform/frontend/public/(autogpt-characters/v1\.1/expert-(maria|mina)/neutral/1024\.png|videos/workflows-moved\.mp4)$- id: fix-byte-order-marker- id: check-case-conflict- id: check-merge-conflictdiff --git a/assets/workflows-moved-notice.webp b/assets/workflows-moved-notice.webpnew file mode 100644index 0000000000..c98e043048Binary files /dev/null and b/assets/workflows-moved-notice.webp differdiff --git a/autogpt_platform/backend/backend/api/features/onboarding/step_test.py b/autogpt_platform/backend/backend/api/features/onboarding/step_test.pyindex 96e924c5b4..d5d4b1ee0b 100644--- a/autogpt_platform/backend/backend/api/features/onboarding/step_test.py+++ b/autogpt_platform/backend/backend/api/features/onboarding/step_test.py@@ -49,6 +49,20 @@ def test_complete_step_accepts_renamed_complete_value(mocker):assert mock_complete.await_args.args[1] == OnboardingStep.ONBOARDING_COMPLETE+def test_complete_step_accepts_workflows_moved(mocker):+ mock_complete = mocker.patch(+ "backend.api.features.onboarding.routes.complete_onboarding_step",+ new_callable=AsyncMock,+ return_value=None,+ )++ response = client.post("/onboarding/step", params={"step": "WORKFLOWS_MOVED"})++ assert response.status_code == 200+ mock_complete.assert_awaited_once()+ assert mock_complete.await_args.args[1] == "WORKFLOWS_MOVED"++@pytest.mark.parametrize("step",[@@ -104,11 +118,10 @@ def test_complete_step_rejects_rewarded_backend_only_steps(step, mocker):OnboardingStep.AGENTS_TAB_INTRO,OnboardingStep.MARKETPLACE_TAB_INTRO,OnboardingStep.BUILD_TAB_INTRO,+ OnboardingStep.WORKFLOWS_MOVED,],)-async def test_tab_intro_steps_grant_no_reward(step, mocker):- # The tab intros are client-writable, so "unrewarded" has to be enforced- # rather than documented: posting one must never reach the credit model.+async def test_intro_steps_grant_no_reward(step, mocker):mock_credit_model = mocker.patch.object(onboarding_module,"get_user_credit_model",diff --git a/autogpt_platform/backend/backend/data/onboarding_steps.py b/autogpt_platform/backend/backend/data/onboarding_steps.pyindex d49b390c29..e4469b3a29 100644--- a/autogpt_platform/backend/backend/data/onboarding_steps.py+++ b/autogpt_platform/backend/backend/data/onboarding_steps.py@@ -63,6 +63,7 @@ class OnboardingStep(StrEnum):AGENTS_TAB_INTRO = "AGENTS_TAB_INTRO"MARKETPLACE_TAB_INTRO = "MARKETPLACE_TAB_INTRO"BUILD_TAB_INTRO = "BUILD_TAB_INTRO"+ WORKFLOWS_MOVED = "WORKFLOWS_MOVED"FrontendOnboardingStep = Literal[@@ -79,4 +80,5 @@ FrontendOnboardingStep = Literal[OnboardingStep.AGENTS_TAB_INTRO,OnboardingStep.MARKETPLACE_TAB_INTRO,OnboardingStep.BUILD_TAB_INTRO,+ OnboardingStep.WORKFLOWS_MOVED,]diff --git a/autogpt_platform/frontend/.gitignore b/autogpt_platform/frontend/.gitignoreindex afab230420..3099c0622b 100644--- a/autogpt_platform/frontend/.gitignore+++ b/autogpt_platform/frontend/.gitignore@@ -62,4 +62,5 @@ src/app/api/__generated__/# Video recordings (screen captures, bug repros)*.mov*.mp4-!public/onboarding/*.mp4\ No newline at end of file+!public/onboarding/*.mp4+!public/videos/workflows-moved.mp4diff --git a/autogpt_platform/frontend/public/videos/workflows-moved-poster.webp b/autogpt_platform/frontend/public/videos/workflows-moved-poster.webpnew file mode 100644index 0000000000..e78b57fd00Binary files /dev/null and b/autogpt_platform/frontend/public/videos/workflows-moved-poster.webp differdiff --git a/autogpt_platform/frontend/public/videos/workflows-moved.mp4 b/autogpt_platform/frontend/public/videos/workflows-moved.mp4new file mode 100644index 0000000000..0d95f373d6Binary files /dev/null and b/autogpt_platform/frontend/public/videos/workflows-moved.mp4 differdiff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsxindex c6cc616beb..5627ad5a67 100644--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx@@ -7,6 +7,7 @@ import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { environment } from "@/services/environment";import { useAuth } from "@/lib/auth/hooks/useAuth";import { PaywallModal } from "./PaywallModal";+import { WorkflowsMovedNotice } from "../components/WorkflowsMovedNotice/WorkflowsMovedNotice";// Routes that bypass the paywall regardless of subscription state — primarily// the credits page itself (the modal would render on top of itself), auth@@ -62,6 +63,9 @@ export function PaywallGate({ children }: { children: ReactNode }) {<>{children}{shouldGate && <PaywallModal />}+ {!shouldGate && (!isPaymentEnabled || !isLoading) && (+ <WorkflowsMovedNotice />+ )}</>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallGate.test.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallGate.test.tsxindex 54da99fa5f..afe54a8818 100644--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallGate.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallGate.test.tsx@@ -50,6 +50,12 @@ vi.mock("../PaywallModal", () => ({PaywallModal: () => <div data-testid="paywall-modal">paywall</div>,}));+vi.mock("../../components/WorkflowsMovedNotice/WorkflowsMovedNotice", () => ({+ WorkflowsMovedNotice: () => (+ <div data-testid="migration-notice">migration</div>+ ),+}));+import { PaywallGate } from "../PaywallGate";describe("PaywallGate", () => {@@ -72,6 +78,7 @@ describe("PaywallGate", () => {);expect(screen.getByText("protected")).toBeDefined();expect(screen.queryByTestId("paywall-modal")).toBeNull();+ expect(screen.getByTestId("migration-notice")).toBeDefined();});it("renders modal over children when paid cohort + tier is NO_TIER", () => {@@ -84,6 +91,7 @@ describe("PaywallGate", () => {);expect(screen.getByText("protected")).toBeDefined();expect(screen.getByTestId("paywall-modal")).toBeDefined();+ expect(screen.queryByTestId("migration-notice")).toBeNull();});it("does not render modal once the user is logged out, even when paid cohort + tier is NO_TIER", () => {@@ -123,6 +131,7 @@ describe("PaywallGate", () => {</PaywallGate>,);expect(screen.queryByTestId("paywall-modal")).toBeNull();+ expect(screen.getByTestId("migration-notice")).toBeDefined();unmount();}});@@ -162,5 +171,23 @@ describe("PaywallGate", () => {</PaywallGate>,);expect(screen.queryByTestId("paywall-modal")).toBeNull();+ expect(screen.queryByTestId("migration-notice")).toBeNull();+ });++ it("defers the migration notice until the paywall clears", () => {+ mockIsPaymentEnabled = true;+ mockSubscriptionResult = { data: undefined, isLoading: true };+ const { rerender } = render(<PaywallGate>protected</PaywallGate>);+ expect(screen.queryByTestId("migration-notice")).toBeNull();++ mockSubscriptionResult = { data: { tier: "NO_TIER" }, isLoading: false };+ rerender(<PaywallGate>protected</PaywallGate>);+ expect(screen.getByTestId("paywall-modal")).toBeDefined();+ expect(screen.queryByTestId("migration-notice")).toBeNull();++ mockSubscriptionResult = { data: { tier: "PRO" }, isLoading: false };+ rerender(<PaywallGate>protected</PaywallGate>);+ expect(screen.queryByTestId("paywall-modal")).toBeNull();+ expect(screen.getByTestId("migration-notice")).toBeDefined();});});diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/BuildTabIntro/BuildTabIntro.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/BuildTabIntro/BuildTabIntro.tsxindex d3b43fb5c2..32dada70fa 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/BuildTabIntro/BuildTabIntro.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/BuildTabIntro/BuildTabIntro.tsx@@ -27,7 +27,7 @@ export function BuildTabIntro() {function askAutoPilot() {takeAction("ask_autopilot");- router.push("/copilot");+ router.push("/copilot?new=1");}function learnToBuild() {diff --git a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/tab-intros.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/tab-intros.test.tsxindex b286e50fa4..895e1ca3fa 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/tab-intros.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/tab-intros.test.tsx@@ -150,7 +150,7 @@ describe("BuildTabIntro", () => {screen.getByRole("button", { name: "Ask Otto to build it" }),);- expect(push).toHaveBeenCalledWith("/copilot");+ expect(push).toHaveBeenCalledWith("/copilot?new=1");expect(startTutorial).not.toHaveBeenCalled();expect(completeStep).toHaveBeenCalledWith("BUILD_TAB_INTRO");expect(capture).toHaveBeenCalledWith("tab_intro_cta_clicked", {diff --git a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/useTabIntroCard.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/useTabIntroCard.test.tsxindex 569ffbe9c9..0d9490ba08 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/useTabIntroCard.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/useTabIntroCard.test.tsx@@ -5,7 +5,7 @@ const capture = vi.hoisted(() => vi.fn());vi.mock("posthog-js", () => ({ default: { capture } }));const authUser = vi.hoisted(() => ({- current: { id: "user-1" } as { id: string } | null,+ current: { id: "user-1" } as { id: string; created_at?: string } | null,}));vi.mock("@/lib/auth/hooks/useAuth", () => ({useAuth: () => ({ user: authUser.current }),@@ -13,11 +13,18 @@ vi.mock("@/lib/auth/hooks/useAuth", () => ({const flags = vi.hoisted(() => ({ current: {} as Record<string, boolean> }));const flagsReady = vi.hoisted(() => ({ current: true }));+const flagReadiness = vi.hoisted(() => ({+ current: {} as Record<string, boolean>,+}));vi.mock("@/services/feature-flags/use-get-flag", () => ({- Flag: { ONBOARDING_BRAIN_DUMP: "onboarding-brain-dump" },+ Flag: {+ ONBOARDING_BRAIN_DUMP: "onboarding-brain-dump",+ HIRE_EXPERTS: "hire-experts",+ AUTOGPT_NEW_LAYOUT: "autogpt-new-layout",+ },useFlagStatus: (flag: string) => ({enabled: flags.current[flag] ?? false,- ready: flagsReady.current,+ ready: flagReadiness.current[flag] ?? flagsReady.current,}),}));@@ -48,6 +55,7 @@ beforeEach(() => {authUser.current = { id: "user-1" };flags.current = { "onboarding-brain-dump": true };flagsReady.current = true;+ flagReadiness.current = {};onboarding.current = { state: { completedSteps: [] }, completeStep: vi.fn() };});@@ -153,6 +161,55 @@ describe("useTabIntroCard — when it opens", () => {});});+describe("useTabIntroCard — workflow migration", () => {+ beforeEach(() => {+ authUser.current = { id: "user-1", created_at: "2026-09-01T00:00:00Z" };+ flags.current = {+ "onboarding-brain-dump": true,+ "hire-experts": true,+ "autogpt-new-layout": true,+ };+ });++ it("replaces the old agents intro without recording or showing it", () => {+ onboarding.current.state = { completedSteps: ["WORKFLOWS_MOVED"] };++ expect(renderGate().result.current.isOpen).toBe(false);+ expect(capture).not.toHaveBeenCalled();+ expect(onboarding.current.completeStep).not.toHaveBeenCalled();+ expect(window.localStorage.getItem(SEEN_KEY)).toBeNull();+ });++ it.each(["hire-experts", "autogpt-new-layout"])(+ "waits for %s before deciding which intro applies",+ (flag) => {+ flags.current[flag] = false;+ flagReadiness.current[flag] = false;+ const { result, rerender } = renderGate();+ expect(result.current.isOpen).toBe(false);+ expect(capture).not.toHaveBeenCalled();++ flagReadiness.current[flag] = true;+ rerender();++ expect(result.current.isOpen).toBe(true);+ },+ );++ it.each(["marketplace", "build"] as const)(+ "preserves the %s intro for existing users",+ (tab) => {+ expect(renderGate(tab).result.current.isOpen).toBe(true);+ },+ );++ it("preserves the agents intro for users who joined after the rollout", () => {+ authUser.current = { id: "user-1", created_at: "2026-09-22T00:00:00Z" };++ expect(renderGate().result.current.isOpen).toBe(true);+ });+});+describe("useTabIntroCard — dismissal", () => {it("records the step, caches it locally, and never reopens", async () => {const { result, rerender } = renderGate();diff --git a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/useTabIntroCard.ts b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/useTabIntroCard.tsindex 68d94db80c..18a5cfe9e7 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/useTabIntroCard.ts+++ b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/useTabIntroCard.ts@@ -5,6 +5,7 @@ import { useOnboarding } from "@/providers/onboarding/onboarding-provider";import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";import { trackTabIntro } from "@/services/onboarding/tab-intro-analytics";import { useEffect, useState } from "react";+import { isPreExpertsUser } from "../WorkflowsMovedNotice/helpers";import {peekTabIntroSeen,setTabIntroSeen,@@ -27,6 +28,13 @@ export function useTabIntroCard(tab: TabIntroTab, canShow = true) {// that rollout, so they ship and roll back with it rather than on a flag// of their own.const { enabled, ready } = useFlagStatus(Flag.ONBOARDING_BRAIN_DUMP);+ const experts = useFlagStatus(Flag.HIRE_EXPERTS);+ const layout = useFlagStatus(Flag.AUTOGPT_NEW_LAYOUT);+ const isMigrationCohort =+ tab === "agents" && isPreExpertsUser(user?.created_at);+ const hasMigrationNotice =+ isMigrationCohort &&+ (!experts.ready || !layout.ready || (experts.enabled && layout.enabled));const step = TAB_INTRO_STEPS[tab];// Who closed the card in this mounted session, rather than a boolean: a@@ -43,6 +51,7 @@ export function useTabIntroCard(tab: TabIntroTab, canShow = true) {// case never touches localStorage at all.const isOpen =canShow &&+ !hasMigrationNotice &&ready &&Boolean(enabled) &&userId !== null &&diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedContent.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedContent.tsxnew file mode 100644index 0000000000..9b67895040--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedContent.tsx@@ -0,0 +1,93 @@+import { Button } from "@/components/atoms/Button/Button";+import { Icon } from "@/components/atoms/Icon/Icon";+import { ArrowRight02Icon } from "@hugeicons/core-free-icons";+import * as Dialog from "@radix-ui/react-dialog";+import { RefObject } from "react";+import { WorkflowsMovedWalkthrough } from "./WorkflowsMovedWalkthrough";++interface Props {+ titleRef: RefObject<HTMLHeadingElement>;+ onDismiss: () => void;+}++export function WorkflowsMovedContent({ titleRef, onDismiss }: Props) {+ return (+ <>+ <div className="min-h-0 flex-1 overflow-y-auto overscroll-contain">+ <div className="px-6 pb-3 pt-5 sm:px-8">+ <p className="mb-1.5 text-xs font-medium uppercase tracking-widest text-violet-700">+ Workspace update+ </p>+ <Dialog.Title+ ref={titleRef}+ tabIndex={-1}+ className="pr-7 text-2xl font-semibold leading-tight tracking-tight text-zinc-900 outline-none sm:text-[1.625rem]"+ >+ Your agents have moved+ </Dialog.Title>+ <Dialog.Description className="mt-1.5 text-sm leading-relaxed text-zinc-600">+ Agents are now{" "}+ <strong className="font-medium text-zinc-900">workflows</strong>.+ Find yours under{" "}+ <strong className="font-medium text-zinc-900">Otto</strong> in Team.+ </Dialog.Description>+ <WorkflowLocation />+ </div>+ <div className="px-4 pb-3 sm:px-6">+ <WorkflowsMovedWalkthrough />+ </div>+ </div>+ <WorkflowsMovedActions onDismiss={onDismiss} />+ </>+ );+}++function WorkflowsMovedActions({ onDismiss }: Pick<Props, "onDismiss">) {+ return (+ <div className="shrink-0 border-t border-zinc-100 bg-white px-6 py-2 sm:px-8">+ <p className="mb-1.5 text-xs leading-none text-zinc-500">+ Nothing to set up again.+ </p>+ <div className="flex flex-col gap-2 sm:flex-row-reverse">+ <Button+ as="NextLink"+ href="/team/autopilot?tab=workflows"+ onClick={onDismiss}+ rightIcon={<Icon icon={ArrowRight02Icon} size={18} aria-hidden />}+ >+ Go to my workflows+ </Button>+ <Button variant="ghost" onClick={onDismiss}>+ Got it+ </Button>+ </div>+ </div>+ );+}++function WorkflowLocation() {+ return (+ <ol+ aria-label="Where to find your workflows"+ className="mt-3 flex w-fit flex-wrap items-center gap-2 rounded-full border border-zinc-200/80 bg-zinc-50 px-3 py-1 text-xs text-zinc-600"+ >+ {["Team", "Otto", "Workflows"].map((label, index) => (+ <li key={label} className="flex items-center gap-2">+ {index > 0 && (+ <Icon+ icon={ArrowRight02Icon}+ size={12}+ className="text-zinc-400"+ aria-hidden+ />+ )}+ <span+ className={index === 2 ? "font-medium text-violet-700" : undefined}+ >+ {label}+ </span>+ </li>+ ))}+ </ol>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedDialog.tsxnew file mode 100644index 0000000000..c888e63733--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedDialog.tsx@@ -0,0 +1,60 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Icon } from "@/components/atoms/Icon/Icon";+import { isComposingEvent } from "@/lib/keyboard";+import { Cancel01Icon } from "@hugeicons/core-free-icons";+import * as Dialog from "@radix-ui/react-dialog";+import { useRef } from "react";+import { WorkflowsMovedContent } from "./WorkflowsMovedContent";+import { hasCompetingDialog } from "./helpers";++interface Props {+ isOpen: boolean;+ onDismiss: () => void;+}++export function WorkflowsMovedDialog({ isOpen, onDismiss }: Props) {+ const titleRef = useRef<HTMLHeadingElement>(null);+ const previousFocus = useRef<HTMLElement | null>(null);+ return (+ <Dialog.Root open={isOpen} onOpenChange={(open) => !open && onDismiss()}>+ <Dialog.Portal>+ <Dialog.Overlay className="fixed inset-0 z-[100] bg-zinc-950/25 backdrop-blur-sm motion-safe:animate-fade-in" />+ <Dialog.Content+ data-workflows-moved-notice=""+ className="fixed left-1/2 top-1/2 z-[100] flex max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-[44rem] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-3xl border border-white/80 bg-white shadow-2xl outline-none motion-safe:animate-fade-in"+ onEscapeKeyDown={(event) => {+ if (isComposingEvent(event)) event.preventDefault();+ }}+ onOpenAutoFocus={(event) => {+ event.preventDefault();+ previousFocus.current =+ document.activeElement instanceof HTMLElement+ ? document.activeElement+ : null;+ titleRef.current?.focus();+ }}+ onCloseAutoFocus={(event) => {+ event.preventDefault();+ if (hasCompetingDialog()) return;+ if (previousFocus.current?.isConnected)+ previousFocus.current.focus();+ }}+ >+ <Button+ variant="icon"+ size="icon-sm"+ aria-label="Close notice"+ onClick={onDismiss}+ withTooltip={false}+ className="absolute right-4 top-4 z-10 rounded-full border-white/80 bg-white/80"+ >+ <Icon icon={Cancel01Icon} size={16} aria-hidden />+ </Button>+ <WorkflowsMovedContent titleRef={titleRef} onDismiss={onDismiss} />+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedNotice.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedNotice.tsxnew file mode 100644index 0000000000..8750c19bee--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedNotice.tsx@@ -0,0 +1,9 @@+"use client";++import { WorkflowsMovedDialog } from "./WorkflowsMovedDialog";+import { useWorkflowsMovedNotice } from "./useWorkflowsMovedNotice";++export function WorkflowsMovedNotice() {+ const { isOpen, dismiss } = useWorkflowsMovedNotice();+ return <WorkflowsMovedDialog isOpen={isOpen} onDismiss={dismiss} />;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedWalkthrough.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedWalkthrough.tsxnew file mode 100644index 0000000000..96493bfd73--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/WorkflowsMovedWalkthrough.tsx@@ -0,0 +1,127 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Icon } from "@/components/atoms/Icon/Icon";+import { PauseIcon, PlayIcon, RefreshIcon } from "@hugeicons/core-free-icons";+import { useId } from "react";+import { useWorkflowsMovedWalkthrough } from "./useWorkflowsMovedWalkthrough";++type Player = ReturnType<typeof useWorkflowsMovedWalkthrough>;++export function WorkflowsMovedWalkthrough() {+ const player = useWorkflowsMovedWalkthrough();+ const descriptionID = useId();++ return (+ <div+ ref={player.containerRef}+ className="overflow-hidden rounded-2xl border border-zinc-200 bg-zinc-50"+ >+ <p id={descriptionID} className="sr-only">+ In the sidebar, open Team. Select Otto, then select the Workflows tab to+ find your existing workflows. Select a workflow name to see its details.+ Choose Setup your task to review the inputs and start or schedule a run.+ This video has no sound.+ </p>+ {player.playback === "failed" ? (+ <div className="flex aspect-video items-center justify-center px-8">+ <p+ ref={player.fallbackRef}+ role="status"+ tabIndex={-1}+ className="max-w-sm text-center text-sm leading-relaxed text-zinc-600 outline-none"+ >+ The walkthrough couldn't load. Open Team, select Otto, then+ choose Workflows.+ </p>+ </div>+ ) : (+ <>+ <div className="relative">+ <video+ ref={player.videoRef}+ src="/videos/workflows-moved.mp4"+ poster="/videos/workflows-moved-poster.webp"+ aria-label="How to find your workflows"+ aria-describedby={descriptionID}+ className="block aspect-video w-full bg-zinc-100 object-contain"+ muted+ playsInline+ preload="metadata"+ controls={player.hasStarted}+ onPlay={player.handlePlay}+ onPause={player.handlePause}+ onEnded={player.handleEnded}+ onError={player.handleError}+ onLoadedMetadata={player.handleMetadata}+ onDurationChange={player.handleMetadata}+ />+ <WalkthroughControl player={player} />+ </div>+ {player.playback === "blocked" && (+ <p+ role="status"+ className="border-t border-zinc-200 px-4 py-3 text-xs leading-relaxed text-zinc-600"+ >+ The video couldn't start. Try playing it again, or open Team,+ select Otto, then choose Workflows.+ </p>+ )}+ </>+ )}+ </div>+ );+}++function WalkthroughControl({ player }: { player: Player }) {+ const isPlaying = player.playback === "playing";+ const hasEnded = player.playback === "ended";+ const action = isPlaying ? "Pause" : hasEnded ? "Replay" : "Play";+ const icon = isPlaying ? PauseIcon : hasEnded ? RefreshIcon : PlayIcon;++ return (+ <>+ {!player.hasStarted && (+ <div+ aria-hidden+ className="pointer-events-none absolute inset-x-0 bottom-14 top-0 bg-zinc-950/15"+ />+ )}+ <div className="flex min-h-14 items-center border-t border-zinc-200/80 bg-white px-4 py-2">+ <div className={player.hasStarted ? "pr-24" : undefined}>+ <p className="text-sm font-medium text-zinc-700">+ See where they live+ </p>+ <p className="mt-0.5 text-xs text-zinc-500">+ {player.durationLabel && (+ <>+ <span aria-label="Video duration">{player.durationLabel}</span>+ <span aria-hidden> · </span>+ </>+ )}+ No sound needed+ </p>+ </div>+ </div>+ <Button+ type="button"+ variant={player.hasStarted ? "secondary" : "primary"}+ size={player.hasStarted ? "small" : "icon"}+ withTooltip={false}+ aria-label={`${action} walkthrough`}+ aria-busy={player.isStarting}+ onClick={player.togglePlayback}+ className={+ player.hasStarted+ ? "absolute bottom-2.5 right-3"+ : "absolute left-1/2 top-[calc(50%-1.75rem)] size-16 -translate-x-1/2 -translate-y-1/2 rounded-full border-white/20 bg-violet-600 text-white shadow-xl hover:border-white/30 hover:bg-violet-700 focus-visible:ring-2 focus-visible:ring-violet-600 focus-visible:ring-offset-4"+ }+ >+ <Icon icon={icon} size={player.hasStarted ? 14 : 26} aria-hidden />+ <span className={player.hasStarted ? undefined : "sr-only"}>+ {action}+ </span>+ </Button>+ </>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/WorkflowsMovedDialog.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/WorkflowsMovedDialog.test.tsxnew file mode 100644index 0000000000..55236217c7--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/WorkflowsMovedDialog.test.tsx@@ -0,0 +1,142 @@+import {+ fireEvent,+ render,+ screen,+ waitFor,+ within,+} from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { useState } from "react";+import { describe, expect, test, vi } from "vitest";+import { WorkflowsMovedDialog } from "../WorkflowsMovedDialog";++function NoticeHarness({ onDismiss }: { onDismiss: () => void }) {+ const [isOpen, setIsOpen] = useState(false);++ function dismiss() {+ setIsOpen(false);+ onDismiss();+ }++ return (+ <>+ <button onClick={() => setIsOpen(true)}>Continue working</button>+ <WorkflowsMovedDialog isOpen={isOpen} onDismiss={dismiss} />+ </>+ );+}++describe("WorkflowsMovedDialog", () => {+ test("announces its title and explanation, with a readable destination", () => {+ render(<WorkflowsMovedDialog isOpen onDismiss={vi.fn()} />);++ const dialog = screen.getByRole("dialog", {+ name: "Your agents have moved",+ });+ const descriptionID = dialog.getAttribute("aria-describedby");+ expect(descriptionID).toBeTruthy();+ const description = document.getElementById(descriptionID!);+ expect(description?.textContent).toContain("Agents are now workflows");+ expect(description?.textContent).toContain("Otto");+ const destination = within(dialog).getByRole("list", {+ name: "Where to find your workflows",+ });+ expect(+ within(destination)+ .getAllByRole("listitem")+ .map((item) => item.textContent),+ ).toEqual(["Team", "Otto", "Workflows"]);+ });++ test("links directly to Otto's workflows and records acknowledgment on click", async () => {+ const user = userEvent.setup();+ const onDismiss = vi.fn();+ render(<WorkflowsMovedDialog isOpen onDismiss={onDismiss} />);++ const link = screen.getByRole("link", { name: "Go to my workflows" });+ expect(link.getAttribute("href")).toBe("/team/autopilot?tab=workflows");+ await user.click(link);++ expect(onDismiss).toHaveBeenCalledTimes(1);+ });++ test.each(["Got it", "Close notice"])(+ "allows dismissal with %s",+ async (name) => {+ const user = userEvent.setup();+ const onDismiss = vi.fn();+ render(<WorkflowsMovedDialog isOpen onDismiss={onDismiss} />);++ await user.click(screen.getByRole("button", { name }));++ expect(onDismiss).toHaveBeenCalledTimes(1);+ },+ );++ test("focuses the heading and contains keyboard focus", async () => {+ const user = userEvent.setup();+ render(<NoticeHarness onDismiss={vi.fn()} />);+ await user.click(screen.getByRole("button", { name: "Continue working" }));++ const dialog = screen.getByRole("dialog");+ expect(document.activeElement).toBe(+ screen.getByRole("heading", { name: "Your agents have moved" }),+ );+ await user.tab();+ expect(document.activeElement).toBe(+ screen.getByRole("button", { name: /play walkthrough/i }),+ );+ await user.tab();+ expect(document.activeElement).toBe(+ screen.getByRole("link", { name: "Go to my workflows" }),+ );+ await user.tab();+ expect(document.activeElement).toBe(+ screen.getByRole("button", { name: "Got it" }),+ );++ for (let index = 0; index < 6; index += 1) {+ await user.tab();+ expect(dialog.contains(document.activeElement)).toBe(true);+ }+ for (let index = 0; index < 4; index += 1) {+ await user.tab({ shift: true });+ expect(dialog.contains(document.activeElement)).toBe(true);+ }+ });++ test("Escape dismisses and returns focus to the previous task", async () => {+ const user = userEvent.setup();+ const onDismiss = vi.fn();+ render(<NoticeHarness onDismiss={onDismiss} />);+ const previousControl = screen.getByRole("button", {+ name: "Continue working",+ });+ await user.click(previousControl);++ await user.keyboard("{Escape}");++ expect(onDismiss).toHaveBeenCalledTimes(1);+ expect(screen.queryByRole("dialog")).toBeNull();+ await waitFor(() => expect(document.activeElement).toBe(previousControl));+ });++ test("does not dismiss when Escape belongs to an input method", () => {+ const onDismiss = vi.fn();+ render(<WorkflowsMovedDialog isOpen onDismiss={onDismiss} />);++ fireEvent.keyDown(screen.getByRole("dialog"), {+ key: "Escape",+ isComposing: true,+ });++ expect(onDismiss).not.toHaveBeenCalled();+ });++ test("renders no notice when closed", () => {+ render(<WorkflowsMovedDialog isOpen={false} onDismiss={vi.fn()} />);++ expect(screen.queryByRole("dialog")).toBeNull();+ expect(screen.queryByText("Your agents have moved")).toBeNull();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/WorkflowsMovedWalkthrough.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/WorkflowsMovedWalkthrough.test.tsxnew file mode 100644index 0000000000..b1331753a2--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/WorkflowsMovedWalkthrough.test.tsx@@ -0,0 +1,219 @@+import * as Dialog from "@radix-ui/react-dialog";+import {+ act,+ fireEvent,+ render,+ screen,+ waitFor,+} from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { beforeEach, describe, expect, it, vi } from "vitest";+import { WorkflowsMovedWalkthrough } from "../WorkflowsMovedWalkthrough";++beforeEach(() => {+ vi.restoreAllMocks();+ vi.spyOn(HTMLMediaElement.prototype, "play").mockImplementation(function (+ this: HTMLMediaElement,+ ) {+ this.dispatchEvent(new Event("play"));+ return Promise.resolve();+ });+ vi.spyOn(HTMLMediaElement.prototype, "pause").mockImplementation(() => {});+});++function getVideo() {+ return screen.getByLabelText<HTMLVideoElement>("How to find your workflows");+}++describe("WorkflowsMovedWalkthrough", () => {+ it("waits for intentional playback and provides a text alternative", () => {+ render(<WorkflowsMovedWalkthrough />);+ const video = getVideo();+ expect(video.getAttribute("src")).toBe("/videos/workflows-moved.mp4");+ expect(video.getAttribute("poster")).toBe(+ "/videos/workflows-moved-poster.webp",+ );+ expect(video.preload).toBe("metadata");+ expect(video.autoplay).toBe(false);+ expect(video.muted).toBe(true);+ expect(video.hasAttribute("playsinline")).toBe(true);+ expect(video.controls).toBe(false);+ expect(HTMLMediaElement.prototype.play).not.toHaveBeenCalled();+ const description = document.getElementById(+ video.getAttribute("aria-describedby")!,+ );+ expect(description?.textContent).toContain("Team");+ expect(description?.textContent).toContain("Otto");+ expect(description?.textContent).toContain("Workflows");+ expect(description?.textContent).toContain("Select a workflow name");+ expect(description?.textContent).toContain("Setup your task");+ expect(+ screen.getByRole("button", { name: "Play walkthrough" }),+ ).toBeTruthy();+ });++ it("plays and pauses while keeping keyboard focus on the control", async () => {+ const user = userEvent.setup();+ render(<WorkflowsMovedWalkthrough />);+ const control = screen.getByRole("button", { name: "Play walkthrough" });+ await user.click(control);+ await screen.findByRole("button", { name: "Pause walkthrough" });+ expect(getVideo().controls).toBe(true);+ expect(HTMLMediaElement.prototype.play).toHaveBeenCalledTimes(1);+ expect(document.activeElement).toBe(control);+ await user.keyboard(" ");+ expect(HTMLMediaElement.prototype.pause).toHaveBeenCalledTimes(1);+ expect(screen.getByRole("button", { name: "Play walkthrough" })).toBe(+ control,+ );+ expect(document.activeElement).toBe(control);+ });++ it("shows duration from loaded metadata without guessing before it arrives", () => {+ render(<WorkflowsMovedWalkthrough />);+ expect(screen.queryByLabelText("Video duration")).toBeNull();+ Object.defineProperty(getVideo(), "duration", {+ configurable: true,+ value: Infinity,+ });+ fireEvent.loadedMetadata(getVideo());+ expect(screen.queryByLabelText("Video duration")).toBeNull();+ Object.defineProperty(getVideo(), "duration", {+ configurable: true,+ value: 26.4,+ });+ fireEvent.loadedMetadata(getVideo());+ expect(screen.getByLabelText("Video duration").textContent).toBe("0:27");+ expect(HTMLMediaElement.prototype.play).not.toHaveBeenCalled();+ });++ it("offers replay after ending and restarts from the beginning", async () => {+ const user = userEvent.setup();+ render(<WorkflowsMovedWalkthrough />);+ await user.click(screen.getByRole("button", { name: "Play walkthrough" }));+ getVideo().currentTime = 12;+ fireEvent.ended(getVideo());+ await user.click(+ screen.getByRole("button", { name: "Replay walkthrough" }),+ );+ expect(getVideo().currentTime).toBe(0);+ expect(HTMLMediaElement.prototype.play).toHaveBeenCalledTimes(2);+ await screen.findByRole("button", { name: "Pause walkthrough" });+ });++ it("keeps the visible control in sync with native playback controls", async () => {+ const user = userEvent.setup();+ render(<WorkflowsMovedWalkthrough />);+ await user.click(screen.getByRole("button", { name: "Play walkthrough" }));+ fireEvent.pause(getVideo());+ expect(+ screen.getByRole("button", { name: "Play walkthrough" }),+ ).toBeTruthy();+ fireEvent.play(getVideo());+ expect(+ screen.getByRole("button", { name: "Pause walkthrough" }),+ ).toBeTruthy();+ });++ it("lets the user retry a rejected play request", async () => {+ vi.mocked(HTMLMediaElement.prototype.play).mockRejectedValueOnce(+ new Error("Playback blocked"),+ );+ const user = userEvent.setup();+ render(<WorkflowsMovedWalkthrough />);+ const control = screen.getByRole("button", { name: "Play walkthrough" });+ await user.click(control);+ expect((await screen.findByRole("status")).textContent).toContain(+ "Try playing it again",+ );+ expect(document.activeElement).toBe(control);+ await user.click(control);+ await screen.findByRole("button", { name: "Pause walkthrough" });+ expect(screen.queryByRole("status")).toBeNull();+ });++ it("does not resume the custom control after a pending play is paused", async () => {+ let resolvePlay = () => {};+ vi.mocked(HTMLMediaElement.prototype.play).mockImplementationOnce(function (+ this: HTMLMediaElement,+ ) {+ this.dispatchEvent(new Event("play"));+ return new Promise<void>((resolve) => {+ resolvePlay = resolve;+ });+ });+ const user = userEvent.setup();+ render(<WorkflowsMovedWalkthrough />);+ await user.click(screen.getByRole("button", { name: "Play walkthrough" }));+ fireEvent.pause(getVideo());+ await act(async () => resolvePlay());+ expect(+ screen.getByRole("button", { name: "Play walkthrough" }),+ ).toBeTruthy();+ });++ it("preserves the media fallback when a pending play later rejects", async () => {+ let rejectPlay: (reason: Error) => void = () => {};+ vi.mocked(HTMLMediaElement.prototype.play).mockImplementationOnce(+ () =>+ new Promise<void>((_, reject) => {+ rejectPlay = reject;+ }),+ );+ const user = userEvent.setup();+ render(<WorkflowsMovedWalkthrough />);+ await user.click(screen.getByRole("button", { name: "Play walkthrough" }));+ fireEvent.error(getVideo());+ await act(async () => rejectPlay(new Error("Missing video")));+ expect(screen.getByRole("status").textContent).toContain("couldn't load");+ expect(screen.queryByRole("button", { name: /walkthrough/ })).toBeNull();+ });++ it("allows pausing a pending play without reporting an aborted request as an error", async () => {+ let rejectPlay: (reason: DOMException) => void = () => {};+ vi.mocked(HTMLMediaElement.prototype.play).mockImplementationOnce(function (+ this: HTMLMediaElement,+ ) {+ this.dispatchEvent(new Event("play"));+ return new Promise<void>((_, reject) => {+ rejectPlay = reject;+ });+ });+ const user = userEvent.setup();+ render(<WorkflowsMovedWalkthrough />);+ await user.click(screen.getByRole("button", { name: "Play walkthrough" }));+ await user.click(screen.getByRole("button", { name: "Pause walkthrough" }));+ await act(async () => rejectPlay(new DOMException("Paused", "AbortError")));+ expect(HTMLMediaElement.prototype.pause).toHaveBeenCalledTimes(1);+ expect(+ screen.getByRole("button", { name: "Play walkthrough" }),+ ).toBeTruthy();+ expect(screen.queryByRole("status")).toBeNull();+ });++ it("replaces failed media with directions and keeps focus in the dialog", async () => {+ const onOpenChange = vi.fn();+ const user = userEvent.setup();+ render(+ <Dialog.Root defaultOpen onOpenChange={onOpenChange}>+ <Dialog.Content aria-describedby={undefined}>+ <Dialog.Title>Your agents have moved</Dialog.Title>+ <WorkflowsMovedWalkthrough />+ <button>Show my workflows</button>+ </Dialog.Content>+ </Dialog.Root>,+ );+ await user.click(screen.getByRole("button", { name: "Play walkthrough" }));+ fireEvent.error(getVideo());+ const fallback = await screen.findByRole("status");+ expect(fallback.textContent).toContain("Team");+ expect(fallback.textContent).toContain("Otto");+ expect(fallback.textContent).toContain("Workflows");+ expect(screen.queryByRole("button", { name: /walkthrough/ })).toBeNull();+ await waitFor(() => expect(document.activeElement).toBe(fallback));+ expect(+ screen.getByRole("button", { name: "Show my workflows" }),+ ).toBeTruthy();+ expect(onOpenChange).not.toHaveBeenCalled();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/helpers.test.tsnew file mode 100644index 0000000000..de4cab552d--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/helpers.test.ts@@ -0,0 +1,116 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+import {+ isPreExpertsUser,+ isWorkflowsMovedNoticeRoute,+ hasPendingChatHandoff,+ peekWorkflowsMovedNoticeSeen,+ setWorkflowsMovedNoticeSeen,+} from "../helpers";++beforeEach(() => {+ window.localStorage.clear();+ window.sessionStorage.clear();+ vi.restoreAllMocks();+});++describe("the experts release audience", () => {+ it.each([+ ["2026-09-20T23:59:59.999Z", true],+ ["2026-09-21T00:00:00Z", false],+ ["2026-09-22T12:00:00Z", false],+ ["2026-09-21T01:00:00+02:00", true],+ ["not a date", false],+ ["", false],+ [undefined, false],+ ])("checks signup %s against the confirmed release", (signup, expected) => {+ expect(isPreExpertsUser(signup)).toBe(expected);+ });+});++describe("safe landing routes", () => {+ it.each([+ "sessionId=chat-1",+ "expertId=expert-1",+ "kickoff=1",+ "autosubmit=true",+ "new=1",+ "modal=skills",+ ])("defers copilot with %s", (search) =>+ expect(+ isWorkflowsMovedNoticeRoute("/copilot", new URLSearchParams(search)),+ ).toBe(false),+ );++ it.each(["/copilot", "/team", "/library", "/team/"])(+ "allows %s",+ (pathname) => expect(isWorkflowsMovedNoticeRoute(pathname)).toBe(true),+ );++ it.each([+ "/copilot/session-1",+ "/team/expert-1",+ "/library/agents/agent-1",+ "/build",+ "/build/agent-1",+ "/settings",+ "/marketplace",+ "/onboarding",+ null,+ ])("does not interrupt %s", (pathname) => {+ expect(isWorkflowsMovedNoticeRoute(pathname)).toBe(false);+ });+});++describe("chat handoffs", () => {+ it.each(["A", "B"])("defers an unconsumed onboarding path %s", (path) => {+ window.sessionStorage.setItem("autogpt:onboarding-intro-path", path);++ expect(hasPendingChatHandoff()).toBe(true);+ expect(window.sessionStorage.getItem("autogpt:onboarding-intro-path")).toBe(+ path,+ );+ });++ it("defers imported prompts and welcome handoffs", () => {+ window.sessionStorage.setItem("importWorkflowPrompt", "Run my workflow");+ expect(hasPendingChatHandoff()).toBe(true);+ window.sessionStorage.removeItem("importWorkflowPrompt");+ window.sessionStorage.setItem("autogpt:onboarding-welcome-pending", "1");+ expect(hasPendingChatHandoff()).toBe(true);+ window.sessionStorage.clear();+ });++ it("defers safely when session storage is unavailable", () => {+ vi.spyOn(window.sessionStorage, "getItem").mockImplementation(() => {+ throw new Error("Storage unavailable");+ });+ expect(hasPendingChatHandoff()).toBe(true);+ });+});++describe("per-account dismissal cache", () => {+ it("keeps both accounts dismissed when users switch back and forth", () => {+ setWorkflowsMovedNoticeSeen("user-1");+ expect(peekWorkflowsMovedNoticeSeen("user-2")).toBe(false);+ setWorkflowsMovedNoticeSeen("user-2");+ expect(peekWorkflowsMovedNoticeSeen("user-1")).toBe(true);+ expect(peekWorkflowsMovedNoticeSeen("user-2")).toBe(true);+ });++ it("ignores an unresolved account", () => {+ setWorkflowsMovedNoticeSeen(null);+ expect(peekWorkflowsMovedNoticeSeen(null)).toBe(false);+ expect(window.localStorage.length).toBe(0);+ });++ it("tolerates browsers that deny storage access", () => {+ vi.spyOn(window.localStorage, "getItem").mockImplementation(() => {+ throw new Error("Storage unavailable");+ });+ vi.spyOn(window.localStorage, "setItem").mockImplementation(() => {+ throw new Error("Storage unavailable");+ });+ expect(peekWorkflowsMovedNoticeSeen("user-1")).toBe(false);+ expect(() => setWorkflowsMovedNoticeSeen("user-1")).not.toThrow();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/tutorialCoexistence.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/tutorialCoexistence.test.tsxnew file mode 100644index 0000000000..c5d681bccd--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/tutorialCoexistence.test.tsx@@ -0,0 +1,303 @@+import {+ getGetV1OnboardingStateMockHandler,+ getGetV1OnboardingStateResponseMock,+} from "@/app/api/__generated__/endpoints/onboarding/onboarding.msw";+import { server } from "@/mocks/mock-server";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { act, render, screen, waitFor } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { HttpResponse, http } from "msw";+import type { ComponentType } from "react";+import { beforeEach, describe, expect, it, vi } from "vitest";++const context = vi.hoisted(() => ({+ user: { id: "returning-user", created_at: "2026-09-01T00:00:00Z" },+ pathname: "/library",+ search: "",+ flags: {} as Record<string, boolean>,+ readiness: {} as Record<string, boolean>,+ state: null as { completedSteps: string[] } | null,+ noticeWait: null as Promise<void> | null,+ completeStep: vi.fn(),+ capture: vi.fn(),+ getState: vi.fn(),+ postedStep: vi.fn(),+ push: vi.fn(),+}));+vi.mock("@/lib/auth/hooks/useAuth", () => ({+ useAuth: () => ({ user: context.user }),+}));+vi.mock("@/providers/onboarding/onboarding-provider", () => ({+ useOnboarding: () => ({+ state: context.state,+ completeStep: context.completeStep,+ }),+}));+vi.mock("posthog-js", () => ({ default: { capture: context.capture } }));+vi.mock("next/navigation", () => ({+ usePathname: () => context.pathname,+ useSearchParams: () => new URLSearchParams(context.search),+ useRouter: () => ({ push: context.push }),+}));+vi.mock("@/services/feature-flags/use-get-flag", () => ({+ Flag: {+ ONBOARDING_BRAIN_DUMP: "onboarding-brain-dump",+ HIRE_EXPERTS: "hire-experts",+ AUTOGPT_NEW_LAYOUT: "autogpt-new-layout",+ },+ useGetFlag: (flag: string) => context.flags[flag] ?? false,+ useFlagStatus: (flag: string) => ({+ enabled: context.flags[flag] ?? false,+ ready: context.readiness[flag] ?? true,+ }),+}));++import { AgentsTabIntro } from "@/app/(platform)/library/components/AgentsTabIntro/AgentsTabIntro";+import { MarketplaceTabIntro } from "@/app/(platform)/marketplace/components/MarketplaceTabIntro/MarketplaceTabIntro";+import { BuildTabIntro } from "@/app/(platform)/build/components/BuildTabIntro/BuildTabIntro";+import { WorkflowsMovedNotice } from "../WorkflowsMovedNotice";++function renderTogether(Intro: ComponentType = AgentsTabIntro) {+ const queryClient = new QueryClient({+ defaultOptions: { queries: { retry: false }, mutations: { retry: false } },+ });+ const introPath = context.pathname;+ function Fixture() {+ return (+ <QueryClientProvider client={queryClient}>+ {context.pathname === introPath && <Intro />}+ <WorkflowsMovedNotice />+ </QueryClientProvider>+ );+ }+ const rendered = render(<Fixture />);+ return {+ ...rendered,+ refresh: () => rendered.rerender(<Fixture />),+ queryClient,+ };+}++function expectOnlyDialog(name: string) {+ expect(screen.getByRole("dialog", { name })).toBeTruthy();+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(1);+}++function expectNoWrites() {+ expect(context.completeStep).not.toHaveBeenCalled();+ expect(context.postedStep).not.toHaveBeenCalled();+}++beforeEach(() => {+ vi.restoreAllMocks();+ vi.clearAllMocks();+ vi.spyOn(HTMLMediaElement.prototype, "pause").mockImplementation(() => {});+ window.localStorage.clear();+ window.sessionStorage.clear();+ context.user = { id: "returning-user", created_at: "2026-09-01T00:00:00Z" };+ context.pathname = "/library";+ context.search = "";+ context.flags = {+ "onboarding-brain-dump": true,+ "hire-experts": true,+ "autogpt-new-layout": true,+ };+ context.readiness = {};+ context.state = { completedSteps: ["ONBOARDING_COMPLETE"] };+ context.noticeWait = null;+ server.use(+ getGetV1OnboardingStateMockHandler(async () => {+ context.getState();+ await context.noticeWait;+ return getGetV1OnboardingStateResponseMock({+ completedSteps: ["ONBOARDING_COMPLETE"],+ });+ }),+ http.post("/api/proxy/api/onboarding/step", ({ request }) => {+ context.postedStep(new URL(request.url).searchParams.get("step"));+ return new HttpResponse(null, { status: 200 });+ }),+ );+});++describe("migration notice with production first-visit tutorials", () => {+ it("replaces the unseen agents tutorial, including after dismissal and remount", async () => {+ const mounted = renderTogether();+ await screen.findByRole("dialog", { name: "Your agents have moved" });+ expectOnlyDialog("Your agents have moved");+ expectNoWrites();+ expect(context.capture).not.toHaveBeenCalled();+ await userEvent.click(screen.getByRole("button", { name: "Got it" }));+ await waitFor(() =>+ expect(context.postedStep).toHaveBeenCalledExactlyOnceWith(+ "WORKFLOWS_MOVED",+ ),+ );+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);+ mounted.unmount();+ renderTogether();+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);+ expect(context.completeStep).not.toHaveBeenCalled();+ expect(+ window.localStorage.getItem("autogpt:tab-intro-seen:agents"),+ ).toBeNull();+ expect(context.capture).not.toHaveBeenCalled();+ });++ it.each(["flags", "intro record"])(+ "never flashes the agents tutorial when %s arrives first",+ async (first) => {+ context.state = null;+ context.readiness = {+ "hire-experts": false,+ "autogpt-new-layout": false,+ };+ const { refresh } = renderTogether();+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);+ if (first === "flags") {+ context.readiness = {};+ refresh();+ await screen.findByRole("dialog", { name: "Your agents have moved" });+ expectOnlyDialog("Your agents have moved");+ context.state = { completedSteps: ["ONBOARDING_COMPLETE"] };+ } else {+ context.state = { completedSteps: ["ONBOARDING_COMPLETE"] };+ refresh();+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(+ 0,+ );+ context.readiness = {};+ }+ refresh();+ await screen.findByRole("dialog", { name: "Your agents have moved" });+ expectOnlyDialog("Your agents have moved");+ expect(context.capture).not.toHaveBeenCalled();+ expectNoWrites();+ },+ );++ it("keeps both dialogs closed while the migration record is delayed", async () => {+ let release = () => {};+ context.noticeWait = new Promise<void>((resolve) => {+ release = resolve;+ });+ renderTogether();+ await waitFor(() => expect(context.getState).toHaveBeenCalledTimes(1));+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);+ expectNoWrites();+ await act(async () => release());+ await screen.findByRole("dialog", { name: "Your agents have moved" });+ expectOnlyDialog("Your agents have moved");+ expect(context.capture).not.toHaveBeenCalled();+ });++ it("preserves the agents tutorial for users who joined after the rollout", async () => {+ context.user.created_at = "2026-09-22T00:00:00Z";+ renderTogether();+ expectOnlyDialog("Your mission control.");+ expectNoWrites();+ await userEvent.click(+ screen.getByRole("button", { name: "See my agents" }),+ );+ await waitFor(() =>+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0),+ );+ expect(context.completeStep).toHaveBeenCalledExactlyOnceWith(+ "AGENTS_TAB_INTRO",+ );+ expect(context.getState).not.toHaveBeenCalled();+ expect(context.postedStep).not.toHaveBeenCalled();+ });++ it.each(["hire-experts", "autogpt-new-layout"])(+ "preserves the old tutorial when delayed %s resolves off",+ async (flag) => {+ context.flags[flag] = false;+ context.readiness[flag] = false;+ const { refresh } = renderTogether();+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);+ context.readiness[flag] = true;+ refresh();+ expectOnlyDialog("Your mission control.");+ expectNoWrites();+ await userEvent.click(+ screen.getByRole("button", { name: "See my agents" }),+ );+ expect(context.completeStep).toHaveBeenCalledExactlyOnceWith(+ "AGENTS_TAB_INTRO",+ );+ expect(context.getState).not.toHaveBeenCalled();+ expect(context.postedStep).not.toHaveBeenCalled();+ },+ );++ it.each([+ [+ "/marketplace",+ MarketplaceTabIntro,+ "Agents ready to work.",+ "Browse featured agents",+ "MARKETPLACE_TAB_INTRO",+ ],+ [+ "/build",+ BuildTabIntro,+ "Create your own workflows.",+ "Ask Otto to build it",+ "BUILD_TAB_INTRO",+ ],+ ] as const)(+ "preserves the actual tutorial on %s without showing migration",+ async (path, Intro, title, cta, step) => {+ context.pathname = path;+ renderTogether(Intro);+ expectOnlyDialog(title);+ expectNoWrites();+ await userEvent.click(screen.getByRole("button", { name: cta }));+ await waitFor(() =>+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(+ 0,+ ),+ );+ expect(context.completeStep).toHaveBeenCalledExactlyOnceWith(step);+ expect(context.getState).not.toHaveBeenCalled();+ expect(context.postedStep).not.toHaveBeenCalled();+ },+ );++ it("does not interrupt the Build tutorial's explicit Ask Otto handoff", async () => {+ context.pathname = "/build";+ const { refresh, queryClient } = renderTogether(BuildTabIntro);+ await userEvent.click(+ screen.getByRole("button", { name: "Ask Otto to build it" }),+ );+ expect(context.push).toHaveBeenCalledExactlyOnceWith("/copilot?new=1");+ const destination = new URL(+ context.push.mock.calls[0][0],+ "http://localhost",+ );+ context.pathname = destination.pathname;+ context.search = destination.search;+ refresh();+ await waitFor(() => expect(queryClient.isFetching()).toBe(0));+ await act(async () => {+ await new Promise<void>((resolve) =>+ requestAnimationFrame(() => resolve()),+ );+ });+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);+ context.search = "";+ refresh();+ await act(async () => {+ await new Promise<void>((resolve) =>+ requestAnimationFrame(() => resolve()),+ );+ });+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);+ expect(context.postedStep).not.toHaveBeenCalled();+ context.pathname = "/team";+ refresh();+ await screen.findByRole("dialog", { name: "Your agents have moved" });+ expectOnlyDialog("Your agents have moved");+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/useWorkflowsMovedNotice.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/useWorkflowsMovedNotice.test.tsxnew file mode 100644index 0000000000..fa7fb216de--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/useWorkflowsMovedNotice.test.tsx@@ -0,0 +1,424 @@+import {+ getGetV1OnboardingStateMockHandler,+ getGetV1OnboardingStateResponseMock,+ getPostV1CompleteOnboardingStepMockHandler,+} from "@/app/api/__generated__/endpoints/onboarding/onboarding.msw";+import type { OnboardingStep } from "@/app/api/__generated__/models/onboardingStep";+import { server } from "@/mocks/mock-server";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import {+ act,+ fireEvent,+ render,+ renderHook,+ screen,+ waitFor,+} from "@testing-library/react";+import * as Dialog from "@radix-ui/react-dialog";+import { HttpResponse, http } from "msw";+import type { ReactNode } from "react";+import { beforeEach, describe, expect, it, vi } from "vitest";++const context = vi.hoisted(() => ({+ user: { id: "user-1", created_at: "2026-09-01T00:00:00Z" } as {+ id: string;+ created_at?: string;+ } | null,+ pathname: "/copilot",+ search: "",+ ready: true,+ flagReadiness: {} as Record<string, boolean>,+ flags: { "hire-experts": true, "autogpt-new-layout": true } as Record<+ string,+ boolean+ >,+}));+vi.mock("@/lib/auth/hooks/useAuth", () => ({+ useAuth: () => ({ user: context.user }),+}));+vi.mock("next/navigation", () => ({+ usePathname: () => context.pathname,+ useSearchParams: () => new URLSearchParams(context.search),+}));+vi.mock("@/services/feature-flags/use-get-flag", () => ({+ Flag: {+ HIRE_EXPERTS: "hire-experts",+ AUTOGPT_NEW_LAYOUT: "autogpt-new-layout",+ ONBOARDING_BRAIN_DUMP: "onboarding-brain-dump",+ },+ useFlagStatus: (flag: string) => ({+ enabled: context.flags[flag],+ ready: context.flagReadiness[flag] ?? context.ready,+ }),+}));++import { useWorkflowsMovedNotice } from "../useWorkflowsMovedNotice";+import { WorkflowsMovedNotice } from "../WorkflowsMovedNotice";+import { useOnboardingIntroCard } from "../../../copilot/components/OnboardingIntroCard/useOnboardingIntroCard";+import {+ peekIntroPath,+ setIntroPath,+} from "@/services/onboarding/brain-dump-handoff";++function mockOnboarding(+ completedSteps: OnboardingStep[] = ["ONBOARDING_COMPLETE"],+) {+ server.use(+ getGetV1OnboardingStateMockHandler(+ getGetV1OnboardingStateResponseMock({ completedSteps }),+ ),+ );+}++function renderGate(+ canShow = true,+ queryClient = new QueryClient({+ defaultOptions: { queries: { retry: false }, mutations: { retry: false } },+ }),+) {+ function Wrapper({ children }: { children: ReactNode }) {+ return (+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>+ );+ }+ return {+ ...renderHook(() => useWorkflowsMovedNotice(canShow), { wrapper: Wrapper }),+ queryClient,+ };+}++function expectDeferred(canShow = true) {+ const { result, queryClient } = renderGate(canShow);+ expect(result.current.isOpen).toBe(false);+ expect(queryClient.isFetching()).toBe(0);+}++beforeEach(() => {+ vi.restoreAllMocks();+ window.localStorage.clear();+ window.sessionStorage.clear();+ context.user = { id: "user-1", created_at: "2026-09-01T00:00:00Z" };+ context.pathname = "/copilot";+ context.search = "";+ context.ready = true;+ context.flagReadiness = {};+ context.flags = { "hire-experts": true, "autogpt-new-layout": true };+ mockOnboarding();+});++describe("migration notice eligibility", () => {+ it("yields to a late tutorial without acknowledging the migration or stealing focus", async () => {+ const queryClient = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ });+ function Harness({ tutorialOpen }: { tutorialOpen: boolean }) {+ return (+ <QueryClientProvider client={queryClient}>+ <button>Page action</button>+ <Dialog.Root open={tutorialOpen}>+ <Dialog.Portal>+ <Dialog.Content aria-describedby={undefined}>+ <Dialog.Title>First visit tutorial</Dialog.Title>+ <button>Continue tutorial</button>+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>+ <WorkflowsMovedNotice />+ </QueryClientProvider>+ );+ }+ const { rerender } = render(<Harness tutorialOpen={false} />);+ await screen.findByRole("dialog", { name: "Your agents have moved" });++ rerender(<Harness tutorialOpen />);+ await screen.findByRole("dialog", { name: "First visit tutorial" });+ await waitFor(() =>+ expect(+ document.querySelector("[data-workflows-moved-notice]"),+ ).toBeNull(),+ );+ expect(document.querySelectorAll('[role="dialog"]')).toHaveLength(1);+ expect(document.activeElement).toBe(+ screen.getByRole("button", { name: "Continue tutorial" }),+ );+ expect(+ window.localStorage.getItem("autogpt:workflows-moved:2026-09-21:user-1"),+ ).toBeNull();++ rerender(<Harness tutorialOpen={false} />);+ expect(screen.queryByRole("dialog")).toBeNull();+ context.pathname = "/team";+ rerender(<Harness tutorialOpen={false} />);+ await screen.findByRole("dialog", { name: "Your agents have moved" });+ });++ it.each(["A", "B"] as const)(+ "gives pending welcome path %s priority even when its flag resolves late",+ async (path) => {+ setIntroPath(path);+ context.flagReadiness["onboarding-brain-dump"] = false;+ const queryClient = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ });+ function Wrapper({ children }: { children: ReactNode }) {+ return (+ <QueryClientProvider client={queryClient}>+ {children}+ </QueryClientProvider>+ );+ }+ const { result, rerender } = renderHook(+ () => ({+ welcome: useOnboardingIntroCard(),+ migration: useWorkflowsMovedNotice(),+ }),+ { wrapper: Wrapper },+ );++ await waitFor(() => expect(queryClient.isFetching()).toBe(0));+ await act(async () => {+ await new Promise<void>((resolve) =>+ requestAnimationFrame(() => resolve()),+ );+ });+ expect(result.current.migration.isOpen).toBe(false);+ expect(result.current.welcome.isWelcomeOpen).toBe(false);+ expect(peekIntroPath()).toBe(path);++ context.flags["onboarding-brain-dump"] = true;+ context.flagReadiness["onboarding-brain-dump"] = true;+ rerender();+ await waitFor(() =>+ expect(result.current.welcome.isWelcomeOpen).toBe(true),+ );+ expect(result.current.migration.isOpen).toBe(false);+ expect(peekIntroPath()).toBeNull();++ act(() => result.current.welcome.closeWelcome());+ expect(result.current.welcome.isWelcomeOpen).toBe(false);+ expect(result.current.migration.isOpen).toBe(false);+ context.pathname = "/team";+ rerender();+ await waitFor(() => expect(result.current.migration.isOpen).toBe(true));+ },+ );++ it("defers behind an already open Radix dialog until the next landing visit", async () => {+ const queryClient = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ });+ function Harness({ notificationOpen }: { notificationOpen: boolean }) {+ return (+ <QueryClientProvider client={queryClient}>+ <Dialog.Root open={notificationOpen}>+ <Dialog.Portal>+ <Dialog.Content aria-describedby={undefined}>+ <Dialog.Title>Stay in the loop</Dialog.Title>+ <button>Not now</button>+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>+ <WorkflowsMovedNotice />+ </QueryClientProvider>+ );+ }+ const { rerender } = render(<Harness notificationOpen />);+ await screen.findByRole("dialog", { name: "Stay in the loop" });+ await waitFor(() => expect(queryClient.isFetching()).toBe(0));+ await act(async () => {+ await new Promise<void>((resolve) =>+ requestAnimationFrame(() => resolve()),+ );+ });+ expect(+ screen.queryByRole("dialog", { name: "Your agents have moved" }),+ ).toBeNull();+ expect(screen.getAllByRole("dialog")).toHaveLength(1);+ rerender(<Harness notificationOpen={false} />);+ expect(+ screen.queryByRole("dialog", { name: "Your agents have moved" }),+ ).toBeNull();+ context.pathname = "/team";+ rerender(<Harness notificationOpen={false} />);+ await screen.findByRole("dialog", { name: "Your agents have moved" });+ expect(screen.getAllByRole("dialog")).toHaveLength(1);+ });++ it.each(["pointerDown", "keyDown"] as const)(+ "defers late onboarding after %s until the next landing route",+ async (interaction) => {+ let releaseOnboarding = () => {};+ const pending = new Promise<void>((resolve) => {+ releaseOnboarding = resolve;+ });+ server.use(+ getGetV1OnboardingStateMockHandler(async () => {+ await pending;+ return getGetV1OnboardingStateResponseMock({+ completedSteps: ["ONBOARDING_COMPLETE"],+ });+ }),+ );+ const { result, rerender, queryClient } = renderGate();+ fireEvent[interaction](document.body, { key: "a" });+ await act(async () => releaseOnboarding());+ await waitFor(() => expect(queryClient.isFetching()).toBe(0));+ expect(result.current.isOpen).toBe(false);+ context.pathname = "/team";+ rerender();+ await waitFor(() => expect(result.current.isOpen).toBe(true));+ fireEvent[interaction](document.body, { key: "a" });+ expect(result.current.isOpen).toBe(true);+ },+ );++ it("does not defer for a navigation click on the previous route", async () => {+ context.pathname = "/settings";+ const { result, rerender } = renderGate();+ fireEvent.pointerDown(document.body);+ context.pathname = "/copilot";+ rerender();+ await waitFor(() => expect(result.current.isOpen).toBe(true));+ });++ it("waits for server onboarding before showing an eligible user", async () => {+ const { result } = renderGate();+ expect(result.current.isOpen).toBe(false);+ await waitFor(() => expect(result.current.isOpen).toBe(true));+ });++ it.each(["hire-experts", "autogpt-new-layout"])(+ "stays closed with %s disabled",+ (flag) => {+ context.flags[flag] = false;+ expectDeferred();+ },+ );++ it("waits for feature flag readiness", () => {+ context.ready = false;+ expectDeferred();+ });++ it("waits for auth", () => {+ context.user = null;+ expectDeferred();+ });++ it.each(["2026-09-21T00:00:00Z", undefined, "invalid"])(+ "does not show for signup %s",+ (created_at) => {+ context.user = { id: "user-1", created_at };+ expectDeferred();+ },+ );++ it("defers while the caller has another dialog open", () => {+ expectDeferred(false);+ });++ it.each([+ "sessionId=session-1",+ "expertId=expert-1",+ "kickoff=1",+ "autosubmit=true",+ "modal=skills",+ ])("does not interrupt %s or its handoff", (search) => {+ context.search = search;+ const { result, rerender, queryClient } = renderGate();+ expect(result.current.isOpen).toBe(false);+ context.search = "";+ rerender();+ expect(result.current.isOpen).toBe(false);+ expect(queryClient.isFetching()).toBe(0);+ });++ it("stays closed when onboarding cannot be verified", async () => {+ server.use(+ http.get("/api/proxy/api/onboarding", () => HttpResponse.error()),+ );+ const { result, queryClient } = renderGate();+ await waitFor(() => expect(queryClient.isFetching()).toBe(0));+ expect(result.current.isOpen).toBe(false);+ });++ it.each<{ completedSteps: OnboardingStep[] }>([+ { completedSteps: [] },+ { completedSteps: ["ONBOARDING_COMPLETE", "WORKFLOWS_MOVED"] },+ ])(+ "stays closed for completed steps $completedSteps",+ async ({ completedSteps }) => {+ mockOnboarding(completedSteps);+ const { result, queryClient } = renderGate();+ await waitFor(() => expect(queryClient.isFetching()).toBe(0));+ expect(result.current.isOpen).toBe(false);+ },+ );+});++describe("migration notice dismissal", () => {+ it("retains dismissal after remount when local storage cannot be written", async () => {+ vi.spyOn(window.localStorage, "setItem").mockImplementation(() => {+ throw new Error("Storage unavailable");+ });+ const { result, queryClient, unmount } = renderGate();+ await waitFor(() => expect(result.current.isOpen).toBe(true));+ act(() => result.current.dismiss());+ await waitFor(() => expect(queryClient.isMutating()).toBe(0));+ unmount();+ expect(renderGate(true, queryClient).result.current.isOpen).toBe(false);+ });++ it("closes immediately and persists exactly the migration step", async () => {+ const savedSteps: (string | null)[] = [];+ server.use(+ getPostV1CompleteOnboardingStepMockHandler(+ ({ request }: { request: Request }) => {+ savedSteps.push(new URL(request.url).searchParams.get("step"));+ },+ ),+ );+ const { result, unmount } = renderGate();+ await waitFor(() => expect(result.current.isOpen).toBe(true));+ act(() => result.current.dismiss());+ expect(result.current.isOpen).toBe(false);+ await waitFor(() => expect(savedSteps).toEqual(["WORKFLOWS_MOVED"]));+ unmount();+ expect(renderGate().result.current.isOpen).toBe(false);+ });++ it("stays dismissed when storage and the server are unavailable", async () => {+ vi.spyOn(window.localStorage, "setItem").mockImplementation(() => {+ throw new Error("Storage unavailable");+ });+ server.use(+ http.post("/api/proxy/api/onboarding/step", () =>+ HttpResponse.json({}, { status: 503 }),+ ),+ );+ const { result, rerender, queryClient } = renderGate();+ await waitFor(() => expect(result.current.isOpen).toBe(true));+ act(() => result.current.dismiss());+ expect(result.current.isOpen).toBe(false);+ await waitFor(() => expect(queryClient.isMutating()).toBe(0));+ rerender();+ expect(result.current.isOpen).toBe(false);+ });++ it("does not reuse another account's cached onboarding", async () => {+ const { result, rerender, queryClient } = renderGate();+ await waitFor(() => expect(result.current.isOpen).toBe(true));+ act(() => result.current.dismiss());+ mockOnboarding(["ONBOARDING_COMPLETE", "WORKFLOWS_MOVED"]);+ context.user = { id: "user-2", created_at: "2026-09-01T00:00:00Z" };+ rerender();+ expect(result.current.isOpen).toBe(false);+ await waitFor(() => expect(queryClient.isFetching()).toBe(0));+ expect(result.current.isOpen).toBe(false);+ mockOnboarding();+ context.user = { id: "user-3", created_at: "2026-09-01T00:00:00Z" };+ rerender();+ expect(result.current.isOpen).toBe(false);+ await waitFor(() => expect(result.current.isOpen).toBe(true));+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/helpers.tsnew file mode 100644index 0000000000..156ad94134--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/helpers.ts@@ -0,0 +1,80 @@+import {+ peekIntroPath,+ peekWelcomePending,+} from "@/services/onboarding/brain-dump-handoff";++export const EXPERTS_ROLLOUT_AT = "2026-09-21T00:00:00Z";++// Keep this notice identity stable if the eligibility cutoff changes.+const SEEN_KEY_PREFIX = "autogpt:workflows-moved:2026-09-21:";+const LANDING_ROUTES = new Set(["/copilot", "/team", "/library"]);+const CHAT_INTENT_PARAMS = [+ "sessionId",+ "expertId",+ "new",+ "kickoff",+ "autosubmit",+ "modal",+];++export function isPreExpertsUser(createdAt: string | undefined) {+ if (!createdAt) return false;+ const createdTimestamp = Date.parse(createdAt);+ return (+ Number.isFinite(createdTimestamp) &&+ createdTimestamp < Date.parse(EXPERTS_ROLLOUT_AT)+ );+}++export function isWorkflowsMovedNoticeRoute(+ pathname: string | null,+ searchParams?: Pick<URLSearchParams, "has">,+) {+ const path = pathname?.replace(/\/$/, "");+ return Boolean(+ path &&+ LANDING_ROUTES.has(path) &&+ (path !== "/copilot" ||+ !CHAT_INTENT_PARAMS.some((param) => searchParams?.has(param))),+ );+}++export function hasPendingChatHandoff() {+ if (typeof window === "undefined") return false;+ try {+ return (+ peekWelcomePending() ||+ Boolean(peekIntroPath()) ||+ Boolean(window.sessionStorage.getItem("importWorkflowPrompt")) ||+ new URLSearchParams(window.location.hash.slice(1)).has("prompt")+ );+ } catch {+ return true;+ }+}++export function peekWorkflowsMovedNoticeSeen(userID: string | null) {+ if (typeof window === "undefined" || !userID) return false;+ try {+ return window.localStorage.getItem(SEEN_KEY_PREFIX + userID) === "1";+ } catch {+ return false;+ }+}++export function setWorkflowsMovedNoticeSeen(userID: string | null) {+ if (typeof window === "undefined" || !userID) return;+ try {+ window.localStorage.setItem(SEEN_KEY_PREFIX + userID, "1");+ } catch {+ return;+ }+}+export function hasCompetingDialog() {+ return Boolean(+ document.querySelector(+ '[role="dialog"]:not([data-workflows-moved-notice]):not([hidden]):not([data-state="closed"]), ' ++ '[role="alertdialog"]:not([hidden]):not([data-state="closed"])',+ ),+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useNoticeAdmission.ts b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useNoticeAdmission.tsnew file mode 100644index 0000000000..32d2394787--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useNoticeAdmission.ts@@ -0,0 +1,47 @@+"use client";++import { usePathname } from "next/navigation";+import { useEffect, useState } from "react";+import { hasCompetingDialog } from "./helpers";++export function useNoticeAdmission(+ isReadyToShow: boolean,+ userID: string | null,+) {+ const pathname = usePathname();+ const [admission, setAdmission] = useState<{+ pathname: string | null;+ userID: string | null;+ allowed: boolean;+ } | null>(null);+ const isCurrentVisit =+ admission?.pathname === pathname && admission?.userID === userID;+ const isDeferred = isCurrentVisit && admission?.allowed === false;++ useEffect(() => setAdmission(null), [pathname, userID]);++ useEffect(() => {+ if (!isReadyToShow || isDeferred) return;++ const observer = new MutationObserver(() => {+ if (hasCompetingDialog()) {+ setAdmission({ pathname, userID, allowed: false });+ }+ });+ observer.observe(document.body, {+ childList: true,+ subtree: true,+ attributes: true,+ attributeFilter: ["role", "hidden", "data-state"],+ });+ const frame = requestAnimationFrame(() => {+ setAdmission({ pathname, userID, allowed: !hasCompetingDialog() });+ });+ return () => {+ cancelAnimationFrame(frame);+ observer.disconnect();+ };+ }, [pathname, userID, isReadyToShow, isDeferred]);++ return isCurrentVisit && admission?.allowed === true;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedNotice.ts b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedNotice.tsnew file mode 100644index 0000000000..dc83974d78--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedNotice.ts@@ -0,0 +1,121 @@+"use client";++import {+ getGetV1OnboardingStateQueryKey,+ useGetV1OnboardingState,+ usePostV1CompleteOnboardingStep,+} from "@/app/api/__generated__/endpoints/onboarding/onboarding";+import { PostV1CompleteOnboardingStepStep } from "@/app/api/__generated__/models/postV1CompleteOnboardingStepStep";+import { useAuth } from "@/lib/auth/hooks/useAuth";+import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";+import { useQueryClient } from "@tanstack/react-query";+import { usePathname, useSearchParams } from "next/navigation";+import { useEffect, useState } from "react";+import { useNoticeAdmission } from "./useNoticeAdmission";+import {+ isPreExpertsUser,+ hasPendingChatHandoff,+ isWorkflowsMovedNoticeRoute,+ peekWorkflowsMovedNoticeSeen,+ setWorkflowsMovedNoticeSeen,+} from "./helpers";++const STEP = PostV1CompleteOnboardingStepStep.WORKFLOWS_MOVED;++export function useWorkflowsMovedNotice(canShow = true) {+ const queryClient = useQueryClient();+ const { user } = useAuth();+ const userID = user?.id ?? null;+ const isSafeLanding = useNoticeLandingRoute();+ const experts = useFlagStatus(Flag.HIRE_EXPERTS);+ const layout = useFlagStatus(Flag.AUTOGPT_NEW_LAYOUT);+ const [dismissedUsers, setDismissedUsers] = useState<string[]>([]);+ const isEligible = Boolean(+ canShow &&+ userID &&+ experts.ready &&+ experts.enabled &&+ layout.ready &&+ layout.enabled &&+ isPreExpertsUser(user?.created_at) &&+ isSafeLanding &&+ !dismissedUsers.includes(userID) &&+ !peekWorkflowsMovedNoticeSeen(userID),+ );+ const { data, queryKey } = useGetV1OnboardingState({+ query: {+ queryKey: [+ ...getGetV1OnboardingStateQueryKey(),+ "workflows-moved",+ userID,+ ],+ enabled: isEligible,+ staleTime: 60_000,+ },+ });+ const { mutate: completeStep } = usePostV1CompleteOnboardingStep();+ const steps = data?.status === 200 ? data.data.completedSteps : [];+ const isReadyToShow =+ isEligible &&+ steps.includes("ONBOARDING_COMPLETE") &&+ !steps.includes(STEP);+ const isAdmitted = useNoticeAdmission(isReadyToShow, userID);+ const hasStartedWorking = useNoticeInteraction(isSafeLanding, isAdmitted);+ const isOpen = isReadyToShow && isAdmitted && !hasStartedWorking;++ function dismiss() {+ if (!isOpen || !userID || data?.status !== 200) return;+ setDismissedUsers((users) => [...users, userID]);+ setWorkflowsMovedNoticeSeen(userID);+ queryClient.setQueryData(queryKey, {+ ...data,+ data: {+ ...data.data,+ completedSteps: [...data.data.completedSteps, STEP],+ },+ });+ completeStep({ params: { step: STEP } });+ }++ return { isOpen, dismiss };+}++function useNoticeLandingRoute() {+ const pathname = usePathname();+ const searchParams = useSearchParams();+ const isCopilot = pathname?.replace(/\/$/, "") === "/copilot";+ const isSafeRoute = isWorkflowsMovedNoticeRoute(pathname, searchParams);+ const hasChatIntent = isCopilot && (!isSafeRoute || hasPendingChatHandoff());+ const [deferCopilotVisit, setDeferCopilotVisit] = useState(hasChatIntent);++ useEffect(() => {+ if (!isCopilot) setDeferCopilotVisit(false);+ else if (hasChatIntent) setDeferCopilotVisit(true);+ }, [hasChatIntent, isCopilot]);++ return isSafeRoute && !hasChatIntent && !(isCopilot && deferCopilotVisit);+}++function useNoticeInteraction(isSafeLanding: boolean, isReadyToShow: boolean) {+ const pathname = usePathname();+ const [deferredPath, setDeferredPath] = useState<string | null>(null);++ useEffect(() => setDeferredPath(null), [pathname]);++ useEffect(() => {+ if (!isSafeLanding || isReadyToShow) return;++ function deferThisVisit() {+ setDeferredPath(pathname);+ }++ document.addEventListener("pointerdown", deferThisVisit, true);+ document.addEventListener("keydown", deferThisVisit, true);+ return () => {+ document.removeEventListener("pointerdown", deferThisVisit, true);+ document.removeEventListener("keydown", deferThisVisit, true);+ };+ }, [pathname, isSafeLanding, isReadyToShow]);++ return deferredPath !== null && deferredPath === pathname;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedWalkthrough.ts b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedWalkthrough.tsnew file mode 100644index 0000000000..dd17fbfaa8--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedWalkthrough.ts@@ -0,0 +1,89 @@+"use client";++import { useEffect, useRef, useState } from "react";++type PlaybackState = "paused" | "playing" | "ended" | "blocked" | "failed";++export function useWorkflowsMovedWalkthrough() {+ const videoRef = useRef<HTMLVideoElement>(null);+ const containerRef = useRef<HTMLDivElement>(null);+ const fallbackRef = useRef<HTMLParagraphElement>(null);+ const focusFallback = useRef(false);+ const [playback, setPlayback] = useState<PlaybackState>("paused");+ const [hasStarted, setHasStarted] = useState(false);+ const [isStarting, setIsStarting] = useState(false);+ const [durationLabel, setDurationLabel] = useState<string | null>(null);++ useEffect(() => {+ if (playback === "failed" && focusFallback.current)+ fallbackRef.current?.focus();+ }, [playback]);++ useEffect(() => {+ const video = videoRef.current;+ return () => video?.pause();+ }, []);++ async function togglePlayback() {+ const video = videoRef.current;+ if (!video || playback === "failed") return;+ if (playback === "playing") {+ video.pause();+ setPlayback("paused");+ return;+ }+ if (isStarting) return;+ if (playback === "ended") video.currentTime = 0;+ setIsStarting(true);+ setPlayback("paused");+ try {+ await video.play();+ } catch (error) {+ if (error instanceof DOMException && error.name === "AbortError") return;+ if (videoRef.current === video)+ setPlayback((state) => (state === "failed" ? state : "blocked"));+ } finally {+ if (videoRef.current === video) setIsStarting(false);+ }+ }++ function handleError() {+ focusFallback.current =+ containerRef.current?.contains(document.activeElement) ?? false;+ setPlayback("failed");+ }++ function handlePlay() {+ setHasStarted(true);+ setPlayback((state) => (state === "failed" ? state : "playing"));+ }++ function handleMetadata() {+ const duration = videoRef.current?.duration;+ if (!duration || !Number.isFinite(duration) || duration < 0) return;+ const seconds = Math.ceil(duration);+ setDurationLabel(+ `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`,+ );+ }++ return {+ videoRef,+ containerRef,+ fallbackRef,+ playback,+ hasStarted,+ isStarting,+ durationLabel,+ togglePlayback,+ handleError,+ handlePlay,+ handleMetadata,+ handlePause: () =>+ setPlayback((state) =>+ state === "ended" || state === "failed" ? state : "paused",+ ),+ handleEnded: () =>+ setPlayback((state) => (state === "failed" ? state : "ended")),+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/__tests__/tabs.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/__tests__/tabs.test.tsxnew file mode 100644index 0000000000..0537f53d81--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/__tests__/tabs.test.tsx@@ -0,0 +1,119 @@+import { getListExpertsMockHandler } from "@/app/api/__generated__/endpoints/experts/experts.msw";+import { getGetV2ListLibraryAgentsMockHandler200 } from "@/app/api/__generated__/endpoints/library/library.msw";+import { getGetV1ListExecutionSchedulesForAUserMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";+import { getListCopilotSkillsMockHandler200 } from "@/app/api/__generated__/endpoints/skills/skills.msw";+import { server } from "@/mocks/mock-server";+import { render, screen, waitFor } from "@/tests/integrations/test-utils";+import userEvent from "@testing-library/user-event";+import { NuqsTestingAdapter, UrlUpdateEvent } from "nuqs/adapters/testing";+import { beforeEach, describe, expect, test, vi } from "vitest";+import AutopilotPage from "../page";++vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => ({+ ...(await importOriginal<+ typeof import("@/services/feature-flags/use-get-flag")+ >()),+ useFlagStatus: () => ({ enabled: true, ready: true }),+}));++beforeEach(() => {+ server.use(+ getListExpertsMockHandler([]),+ getGetV1ListExecutionSchedulesForAUserMockHandler([]),+ getGetV2ListLibraryAgentsMockHandler200({+ agents: [],+ pagination: {+ total_items: 0,+ total_pages: 1,+ current_page: 1,+ page_size: 100,+ },+ }),+ getListCopilotSkillsMockHandler200([]),+ );+});++describe("Otto tab navigation", () => {+ test("opens Workflows directly from the migration notice's destination", async () => {+ render(+ <NuqsTestingAdapter searchParams="?tab=workflows">+ <AutopilotPage />+ </NuqsTestingAdapter>,+ );++ expect(await screen.findByText("Otto's Workflows")).toBeDefined();+ expect(+ screen+ .getByRole("tab", { name: "Workflows" })+ .getAttribute("aria-selected"),+ ).toBe("true");+ expect(screen.queryByText("Identity")).toBeNull();+ });++ test.each(["", "?tab=unknown"])(+ "defaults to Basics for %s",+ async (searchParams) => {+ render(+ <NuqsTestingAdapter searchParams={searchParams}>+ <AutopilotPage />+ </NuqsTestingAdapter>,+ );++ expect(await screen.findByText("Identity")).toBeDefined();+ expect(+ screen+ .getByRole("tab", { name: "Basics" })+ .getAttribute("aria-selected"),+ ).toBe("true");+ },+ );++ test("follows query changes after the page has mounted", async () => {+ const { rerender } = render(+ <NuqsTestingAdapter searchParams="?tab=workflows" hasMemory>+ <AutopilotPage />+ </NuqsTestingAdapter>,+ );+ await screen.findByText("Otto's Workflows");++ rerender(+ <NuqsTestingAdapter searchParams="?tab=basics" hasMemory>+ <AutopilotPage />+ </NuqsTestingAdapter>,+ );++ expect(await screen.findByText("Identity")).toBeDefined();+ expect(screen.queryByText("Otto's Workflows")).toBeNull();+ });++ test("writes tab navigation to history and preserves other query parameters", async () => {+ const user = userEvent.setup();+ const onUrlUpdate = vi.fn<(event: UrlUpdateEvent) => void>();+ render(+ <NuqsTestingAdapter+ searchParams="?tab=workflows&source=migration"+ onUrlUpdate={onUrlUpdate}+ hasMemory+ >+ <AutopilotPage />+ </NuqsTestingAdapter>,+ );++ await user.click(await screen.findByRole("tab", { name: "Schedules" }));++ await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled());+ const update = onUrlUpdate.mock.calls.at(-1)?.[0];+ expect(update?.searchParams.get("tab")).toBe("schedules");+ expect(update?.searchParams.get("source")).toBe("migration");+ expect(update?.options.history).toBe("push");++ await user.click(screen.getByRole("tab", { name: "Basics" }));++ await waitFor(() =>+ expect(onUrlUpdate.mock.calls.at(-1)?.[0].searchParams.has("tab")).toBe(+ false,+ ),+ );+ expect(screen.getByText("Identity")).toBeDefined();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/page.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/page.tsxindex 1693d830e3..086223b4a4 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/page.tsx@@ -26,6 +26,7 @@ import { AutopilotAboutSection } from "./components/AutopilotAboutSection";import { AutopilotHeader } from "./components/AutopilotHeader";import { AutopilotSkillsSection } from "./components/AutopilotSkillsSection";import { useAutopilotPage } from "./useAutopilotPage";+import { useAutopilotTab } from "./useAutopilotTab";const MAIN_CLASS ="container min-h-screen max-w-[1180px] space-y-5 pb-16 pt-6 sm:px-8 md:px-12";@@ -39,6 +40,7 @@ const TABS = [export default function AutopilotPage() {const { enabled, ready } = useFlagStatus(Flag.HIRE_EXPERTS);+ const { activeTab, onTabChange } = useAutopilotTab();const { schedules, workflows, skills, isLoading, isError, refetch } =useAutopilotPage({ enabled: Boolean(enabled) && ready });@@ -78,7 +80,7 @@ export default function AutopilotPage() {Built in, always on your team.</Text>- <TabsLine variant="compact" defaultValue="basics">+ <TabsLine variant="compact" value={activeTab} onValueChange={onTabChange}><TabsLineList className="overflow-x-auto">{TABS.map((tab) => (<TabsLineTrigger key={tab.value} value={tab.value} icon={tab.icon}>diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/useAutopilotTab.ts b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/useAutopilotTab.tsnew file mode 100644index 0000000000..1470a4a224--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/useAutopilotTab.ts@@ -0,0 +1,20 @@+import { parseAsStringLiteral, useQueryState } from "nuqs";++const tabParser = parseAsStringLiteral([+ "basics",+ "schedules",+ "workflows",+ "skills",+] as const)+ .withDefault("basics")+ .withOptions({ history: "push" });++export function useAutopilotTab() {+ const [activeTab, setActiveTab] = useQueryState("tab", tabParser);++ function onTabChange(value: string) {+ void setActiveTab(tabParser.parse(value));+ }++ return { activeTab, onTabChange };+}diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 438027682f..69128a5880 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -11875,7 +11875,8 @@"CAPABILITY_CARDS","AGENTS_TAB_INTRO","MARKETPLACE_TAB_INTRO",- "BUILD_TAB_INTRO"+ "BUILD_TAB_INTRO",+ "WORKFLOWS_MOVED"],"type": "string","title": "Step"@@ -26355,7 +26356,8 @@"CAPABILITY_CARDS","AGENTS_TAB_INTRO","MARKETPLACE_TAB_INTRO",- "BUILD_TAB_INTRO"+ "BUILD_TAB_INTRO",+ "WORKFLOWS_MOVED"],"title": "OnboardingStep","description": "Application-level onboarding step identifiers."diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/types.tsindex 9dbcfe3dd3..f392fab4eb 100644--- a/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts+++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts@@ -926,7 +926,9 @@ export type OnboardingStep =// First-visit intro card for a tab, dismissed however the user chose| "AGENTS_TAB_INTRO"| "MARKETPLACE_TAB_INTRO"- | "BUILD_TAB_INTRO";+ | "BUILD_TAB_INTRO"+ // Agents-to-workflows migration notice, dismissed or followed to Otto+ | "WORKFLOWS_MOVED";export interface UserOnboarding {// Plain string[] so legacy step names from existing rows pass through.