Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

refactor(web): Always allow toggling V4 in dev mode (#13284)

Ben Bachem6508550cc792
diff --git a/web/src/components/layouts/app-layout/utils/navigationFilters.ts b/web/src/components/layouts/app-layout/utils/navigationFilters.ts
index 1ffccaa8e5..dc5dfec727 100644
--- a/web/src/components/layouts/app-layout/utils/navigationFilters.ts
+++ b/web/src/components/layouts/app-layout/utils/navigationFilters.ts
@@ -79,8 +79,8 @@ export const filters = {
}
if (route.featureFlag === "v4BetaToggleVisible") {
- const canToggleV4 = ctx.session?.user?.canToggleV4 === true;
-
+ const isDev = process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "DEV";
+ const canToggleV4 = isDev || ctx.session?.user?.canToggleV4 === true;
return canToggleV4 && ctx.isLangfuseCloud ? route : null;
}
diff --git a/web/src/features/events/lib/v4Rollout.ts b/web/src/features/events/lib/v4Rollout.ts
index ac21ab3947..bbb3ff2782 100644
--- a/web/src/features/events/lib/v4Rollout.ts
+++ b/web/src/features/events/lib/v4Rollout.ts
@@ -38,5 +38,9 @@ export function shouldAutoEnableV4({
}
export function canToggleV4(context: V4RolloutContext): boolean {
+ if (process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "DEV") {
+ return true;
+ }
+
return !shouldAutoEnableV4(context);
}
diff --git a/web/src/server/api/routers/userAccount.ts b/web/src/server/api/routers/userAccount.ts
index f784be77c8..8ac16a88c5 100644
--- a/web/src/server/api/routers/userAccount.ts
+++ b/web/src/server/api/routers/userAccount.ts
@@ -133,7 +133,10 @@ export const userAccountRouter = createTRPCRouter({
.mutation(async ({ input, ctx }) => {
const isCloudDeployment = Boolean(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION);
- if (!isCloudDeployment) {
+ if (
+ !isCloudDeployment &&
+ process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION !== "DEV"
+ ) {
return {
success: true,
v4BetaEnabled: false,
diff --git a/web/src/server/auth.ts b/web/src/server/auth.ts
index 775311944c..8d23ab0dd4 100644
--- a/web/src/server/auth.ts
+++ b/web/src/server/auth.ts
@@ -803,7 +803,7 @@ export async function getAuthOptions(): Promise<NextAuthOptions> {
span.setAttribute("langfuse.user.email", dbUser?.email ?? "");
span.setAttribute("langfuse.user.id", dbUser?.id ?? "");
- const isCloudDeployment = Boolean(
+ const isCloudDeploymentOrDev = Boolean(
env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION,
);
@@ -828,10 +828,10 @@ export async function getAuthOptions(): Promise<NextAuthOptions> {
: undefined,
image: dbUser.image,
admin: dbUser.admin,
- v4BetaEnabled: isCloudDeployment
+ v4BetaEnabled: isCloudDeploymentOrDev
? dbUser.v4BetaEnabled
: false,
- canToggleV4: isCloudDeployment
+ canToggleV4: isCloudDeploymentOrDev
? canToggleV4({
userCreatedAt: dbUser.createdAt,
organizations: dbUser.organizationMemberships.map(