Skip to content

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(paywall): do not show for local users (#13229)

Ubbe676fed2096a4
diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx
index 1daac7603d..2fa557ac8d 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx
@@ -4,6 +4,7 @@ import { ReactNode } from "react";
import { usePathname } from "next/navigation";
import { useGetSubscriptionStatus } from "@/app/api/__generated__/endpoints/credits/credits";
import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
+import { environment } from "@/services/environment";
import { PaywallModal } from "./PaywallModal";
// Routes that bypass the paywall regardless of subscription state — primarily
@@ -45,6 +46,9 @@ export function PaywallGate({ children }: { children: ReactNode }) {
!!isPaymentEnabled &&
!isLoading &&
!isExempt &&
+ // Never gate local dev — running the stack locally shouldn't require a
+ // Stripe subscription to reach AutoPilot.
+ !environment.isLocal() &&
!!subscription &&
subscription.tier === "NO_TIER";
diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallModal.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallModal.tsx
index a50cb6d3eb..70edf397b7 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallModal.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallModal.tsx
@@ -1,10 +1,12 @@
"use client";
import { Dialog } from "@/components/molecules/Dialog/Dialog";
+import { Button } from "@/components/atoms/Button/Button";
import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
import { Text } from "@/components/atoms/Text/Text";
import { PlanCard } from "@/components/molecules/PlanCard/PlanCard";
import { cn } from "@/lib/utils";
+import { SignOutIcon } from "@phosphor-icons/react";
import { SwitchTierDialog } from "../settings/billing/components/SubscriptionTab/YourPlanCard/SwitchTierDialog";
import { usePaywallModal } from "./usePaywallModal";
@@ -25,12 +27,22 @@ export function PaywallModal() {
pendingTierLabel,
confirmPendingTier,
cancelPendingTier,
+ handleLogout,
} = usePaywallModal();
return (
<Dialog forceOpen controlled={{ isOpen: true, set: () => {} }}>
<Dialog.Content>
- <div className="flex w-full flex-col items-center gap-4 px-2 py-2">
+ <div className="relative flex w-full flex-col items-center gap-4 px-2 py-2">
+ <Button
+ variant="ghost"
+ size="small"
+ onClick={handleLogout}
+ leftIcon={<SignOutIcon size={16} />}
+ className="absolute right-0 top-0 text-zinc-500 hover:text-zinc-700"
+ >
+ Log out
+ </Button>
<div className="flex flex-col items-center gap-1 text-center">
<Text
variant="h3"
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.tsx
index 403b843277..799e8079f2 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
@@ -25,6 +25,13 @@ vi.mock("@/app/api/__generated__/endpoints/credits/credits", () => ({
useGetSubscriptionStatus: () => mockSubscriptionResult,
}));
+// Mock environment — default to cloud so the gate logic is exercised; flip to
+// local per test to assert the local-dev bypass.
+let mockIsLocal = false;
+vi.mock("@/services/environment", () => ({
+ environment: { isLocal: () => mockIsLocal },
+}));
+
// Mock PaywallModal — actual rendering depends on Radix portals + the full
// SubscriptionTierSection, neither of which behave well under jsdom. Stand-in
// placeholder lets us assert the gate-vs-no-gate decision without booting the
@@ -40,6 +47,7 @@ describe("PaywallGate", () => {
mockPathname = "/build";
mockIsPaymentEnabled = false;
mockSubscriptionResult = { data: null, isLoading: false };
+ mockIsLocal = false;
});
it("renders children without modal when ENABLE_PLATFORM_PAYMENT flag is off (beta cohort)", () => {
@@ -66,6 +74,19 @@ describe("PaywallGate", () => {
expect(screen.getByTestId("paywall-modal")).toBeDefined();
});
+ it("does not render modal in local dev even when paid cohort + tier is NO_TIER", () => {
+ mockIsPaymentEnabled = true;
+ mockIsLocal = true;
+ mockSubscriptionResult = { data: { tier: "NO_TIER" }, isLoading: false };
+ render(
+ <PaywallGate>
+ <div>protected</div>
+ </PaywallGate>,
+ );
+ expect(screen.getByText("protected")).toBeDefined();
+ expect(screen.queryByTestId("paywall-modal")).toBeNull();
+ });
+
it("does not render modal when paid cohort + tier is PRO/MAX/BUSINESS", () => {
mockIsPaymentEnabled = true;
for (const tier of ["PRO", "MAX", "BUSINESS"]) {
diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx
index 33c6499fbe..eb6f2129e8 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx
@@ -39,6 +39,11 @@ vi.mock("@/components/molecules/Dialog/Dialog", () => ({
Dialog: MockDialog,
}));
+const mockLogOut = vi.fn();
+vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
+ useSupabase: () => ({ logOut: mockLogOut }),
+}));
+
import { PaywallModal } from "../PaywallModal";
interface SubscriptionShape {
@@ -131,6 +136,20 @@ describe("PaywallModal — dynamic plan rendering", () => {
});
});
+describe("PaywallModal — logout", () => {
+ it("logs out when the Log out button is clicked", () => {
+ setupMocks({
+ subscription: { tier: "NO_TIER", tier_costs: { PRO: 5000 } },
+ });
+
+ render(<PaywallModal />);
+
+ fireEvent.click(screen.getByRole("button", { name: /log out/i }));
+
+ expect(mockLogOut).toHaveBeenCalled();
+ });
+});
+
describe("PaywallModal — Monthly/Yearly cycle toggle", () => {
it("defaults to yearly billing with the monthly-equivalent price and the annual total", () => {
setupMocks({
diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts
index 23febb9acf..b7747a0b89 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts
@@ -6,6 +6,7 @@ import {
useUpdateSubscriptionTier,
} from "@/app/api/__generated__/endpoints/credits/credits";
import type { SubscriptionTierRequestTier } from "@/app/api/__generated__/models/subscriptionTierRequestTier";
+import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
import { toast } from "@/components/molecules/Toast/use-toast";
import { COUNTRIES } from "@/components/molecules/PlanCard/countries";
import {
@@ -54,6 +55,7 @@ export function usePaywallModal() {
query: { select: (res) => (res.status === 200 ? res.data : null) },
});
const { mutateAsync: updateTier, isPending } = useUpdateSubscriptionTier();
+ const { logOut } = useSupabase();
const [selectedCycle, setSelectedCycle] = useState<"monthly" | "yearly">(
"yearly",
);
@@ -138,6 +140,10 @@ export function usePaywallModal() {
setPendingTier(null);
}
+ function handleLogout() {
+ void logOut();
+ }
+
const pendingTierLabel = pendingTier
? (PLAN_LABEL[pendingTier] ?? pendingTier)
: null;
@@ -156,5 +162,6 @@ export function usePaywallModal() {
pendingTierLabel,
confirmPendingTier,
cancelPendingTier,
+ handleLogout,
};
}