YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(onboarding): never auto-advance into plan selection without a token
Louis Beaumont637ce3ece51b
diff --git a/apps/screenpipe-app-tauri/app/onboarding/page.test.tsx b/apps/screenpipe-app-tauri/app/onboarding/page.test.tsxindex 48ba8e08e..50e2f26a7 100644--- a/apps/screenpipe-app-tauri/app/onboarding/page.test.tsx+++ b/apps/screenpipe-app-tauri/app/onboarding/page.test.tsx@@ -27,6 +27,10 @@ const mocks = vi.hoisted(() => ({user: null as null | {cloud_subscribed?: boolean;has_payment_method?: boolean;+ // Plan selection needs a token to do anything: without one it can neither+ // load checkout nor start the cardless trial, so page.tsx keeps the slide+ // out of visibleOrder. Seed it wherever a signed-in user is intended.+ token?: string;},},isSettingsLoaded: true,@@ -254,8 +258,9 @@ describe("enterprise onboarding authentication", () => {expect(screen.queryByText("connect apps")).not.toBeInTheDocument();});- it("shows plan selection last for consumer onboarding", async () => {+ it("shows plan selection last for signed-in consumer onboarding", async () => {mocks.enterprisePolicy.isManagedDeployment = false;+ mocks.settings.user = { has_payment_method: false, token: "tok" };onboardingData.currentStep = "engine";render(<OnboardingPage />);@@ -272,6 +277,28 @@ describe("enterprise onboarding authentication", () => {);});+ // Regression: "plan" is the last slide, so showing it to a user who skipped+ // sign-in trapped onboarding forever — the real PlanSelectionStep can neither+ // load checkout nor start a cardless trial without a token, and+ // handleNextSlide never reaches completeOnboarding while a next slide exists.+ // The mock below always advances, which is why only the desktop E2E+ // (onboarding-background-ai-tools) caught it. Keep this asserting completion.+ it("finishes setup without plan selection when the user is signed out", async () => {+ mocks.enterprisePolicy.isManagedDeployment = false;+ mocks.settings.user = null;+ onboardingData.currentStep = "engine";++ render(<OnboardingPage />);+ fireEvent.click(await screen.findByRole("button", { name: "finish engine" }));++ await waitFor(() =>+ expect(mocks.completeOnboarding).toHaveBeenCalledWith({+ method: "setup_finished",+ }),+ );+ expect(screen.queryByText("plan selection")).not.toBeInTheDocument();+ });+it("does not restore managed onboarding onto consumer pricing", async () => {onboardingData.currentStep = "plan";@@ -286,6 +313,7 @@ describe("enterprise onboarding authentication", () => {mocks.settings.user = {cloud_subscribed: true,has_payment_method: false,+ token: "tok",};onboardingData.currentStep = "engine";diff --git a/apps/screenpipe-app-tauri/app/onboarding/page.tsx b/apps/screenpipe-app-tauri/app/onboarding/page.tsxindex 46d259950..ca9102b8c 100644--- a/apps/screenpipe-app-tauri/app/onboarding/page.tsx+++ b/apps/screenpipe-app-tauri/app/onboarding/page.tsx@@ -165,6 +165,17 @@ export default function OnboardingPage() {: "unknown";const shouldShowPlanSelection =!isManagedDeployment && user?.has_payment_method !== true;+ // "plan" is the last slide, so auto-advancing onto it without a token traps+ // the user in onboarding: PlanSelectionStep can neither load embedded+ // checkout (it renders "sign in to continue") nor start the cardless trial,+ // and handleNextSlide stops calling completeOnboarding once a next slide+ // exists. Someone who skipped sign-in would sit on /onboarding forever.+ //+ // This gates only the automatic walk out of the engine slide. The slide stays+ // in visibleOrder — and so in the progress total and the restore mapping — so+ // navigating to it directly still renders card capture.+ const canAdvanceIntoPlanSelection =+ shouldShowPlanSelection && Boolean(user?.token);const visibleOrder = useMemo(() =>SLIDE_ORDER.filter(@@ -353,8 +364,10 @@ export default function OnboardingPage() {// for a slide that policy hides, then land on the next visible slide.// Consumer onboarding ends on plan selection after the engine is ready.// Managed deployments skip that consumer purchase surface.- const nextSlide = SLIDE_ORDER.slice(currentIdx + 1).find((s) =>- visibleOrder.includes(s),+ const nextSlide = SLIDE_ORDER.slice(currentIdx + 1).find(+ (s) =>+ visibleOrder.includes(s) &&+ (s !== "plan" || canAdvanceIntoPlanSelection),);if (!nextSlide) {await completeOnboarding({ method: "setup_finished" });@@ -376,6 +389,7 @@ export default function OnboardingPage() {setIsTransitioning(false);}, 300);}, [+ canAdvanceIntoPlanSelection,completeOnboarding,currentSlide,deviceTierForAnalytics,diff --git a/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.tsx b/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.tsxindex f1c7e21d1..77c957e6a 100644--- a/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.tsx+++ b/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.tsx@@ -165,7 +165,18 @@ export default function PlanSelectionStep({}, [handleNextSlide, user?.has_payment_method, user?.subscription_plan]);const continueWithoutCard = async () => {- if (!userToken || startingCardlessTrial) return;+ if (startingCardlessTrial) return;+ // This is the last slide, so a no-op here strands the user in onboarding.+ // With no token there is no account to attach a cardless trial to (the+ // sign-in guard above has already blocked checkout), so the only correct+ // move is to let setup finish; the plan is still selectable from Settings.+ // page.tsx keeps this slide out of visibleOrder without a token, so this+ // only fires if the token clears while the slide is already mounted.+ if (!userToken) {+ advancedRef.current = true;+ await handleNextSlide();+ return;+ }setStartingCardlessTrial(true);setError(null);try {