Skip to content

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

refactor(v4-migration): rename migration badge component and update logic (#15593)

marliessophiea759f48c31e6
diff --git a/web/src/components/table/peek/peek-evaluator-config-detail.tsx b/web/src/components/table/peek/peek-evaluator-config-detail.tsx
index fbcd8ba476..a5de0bd46f 100644
--- a/web/src/components/table/peek/peek-evaluator-config-detail.tsx
+++ b/web/src/components/table/peek/peek-evaluator-config-detail.tsx
@@ -9,7 +9,7 @@ import {
TooltipContent,
TooltipTrigger,
} from "@/src/components/ui/tooltip";
-import { V4MigrationUpdateRequiredAssistantBadge } from "@/src/features/v4-migration/V4MigrationDelayBadge";
+import { V4MigrationUpdateRequiredBadge } from "@/src/features/v4-migration/V4MigrationDelayBadge";
import { UserCircle2Icon } from "lucide-react";
import { StatusBadge } from "@/src/components/ui/StatusBadge/StatusBadge";
import { DeleteEvalConfigButton } from "@/src/components/deleteButton";
@@ -26,6 +26,8 @@ import { useLazyEvaluatorExecutionCounts } from "@/src/features/evals/hooks/useL
import { TablePeekView } from "@/src/components/table/peek";
import { LangfuseIcon } from "@/src/components/design-system/LangfuseIcon/LangfuseIcon";
import { useEvalCapabilities } from "@/src/features/evals/hooks/useEvalCapabilities";
+import { useCanUseInAppAgent } from "@/src/features/in-app-agent/components/InAppAiAgentProvider";
+import { isLegacyEvalTarget } from "@/src/features/evals/utils/typeHelpers";
const PeekViewEvaluatorConfigDetail = ({
projectId,
@@ -46,6 +48,7 @@ const PeekViewEvaluatorConfigDetail = ({
evaluatorId: evalConfig?.id,
evaluator: evalConfig,
});
+ const canUseAgent = useCanUseInAppAgent();
const hasAccess = useHasProjectAccess({ projectId, scope: "evalJob:CUD" });
@@ -72,6 +75,9 @@ const PeekViewEvaluatorConfigDetail = ({
<DeactivateEvalConfig
projectId={projectId}
evalConfig={evalConfig}
+ // Status changes remount the form below; drop edit mode so
+ // in-progress form state cannot fight the new status.
+ onStatusChange={() => setIsEditMode(false)}
/>
</div>
</div>
@@ -88,15 +94,16 @@ const PeekViewEvaluatorConfigDetail = ({
</span>
<Switch
disabled={
- !hasAccess || (evaluatorRequiresMigration && !allowLegacy)
+ !hasAccess ||
+ (isLegacyEvalTarget(evalConfig.targetObject) && !allowLegacy)
}
checked={isEditMode}
onCheckedChange={setIsEditMode}
- {...(evaluatorRequiresMigration &&
- !allowLegacy && {
- title:
- "Deprecated evaluators are only available in read-only mode",
- })}
+ title={
+ isLegacyEvalTarget(evalConfig.targetObject) && !allowLegacy
+ ? "Deprecated evaluators are only available in read-only mode"
+ : undefined
+ }
/>
<DeleteEvalConfigButton
aria-label="delete"
@@ -114,8 +121,8 @@ const PeekViewEvaluatorConfigDetail = ({
</div>
</div>
- {evaluatorRequiresMigration && evalConfig.evalTemplate && (
- <V4MigrationUpdateRequiredAssistantBadge />
+ {evaluatorRequiresMigration && evalConfig.evalTemplate && canUseAgent && (
+ <V4MigrationUpdateRequiredBadge />
)}
<EvaluatorPausedCallout projectId={projectId} evalConfig={evalConfig} />
diff --git a/web/src/features/evals/components/deactivate-config.tsx b/web/src/features/evals/components/deactivate-config.tsx
index b509aaaa81..632048110c 100644
--- a/web/src/features/evals/components/deactivate-config.tsx
+++ b/web/src/features/evals/components/deactivate-config.tsx
@@ -16,9 +16,12 @@ import { useEvalCapabilities } from "@/src/features/evals/hooks/useEvalCapabilit
export function DeactivateEvalConfig({
projectId,
evalConfig,
+ onStatusChange,
}: {
projectId: string;
evalConfig: RouterOutputs["evals"]["configById"];
+ /** Called when the user confirms an activate/deactivate toggle. */
+ onStatusChange?: () => void;
}) {
const utils = api.useUtils();
const hasAccess = useHasProjectAccess({ projectId, scope: "evalJob:CUD" });
@@ -40,7 +43,7 @@ export function DeactivateEvalConfig({
},
});
- const onClick = () => {
+ const onClick = async () => {
if (!projectId) {
console.error("Project ID is missing");
return;
@@ -53,18 +56,25 @@ export function DeactivateEvalConfig({
const prevStatus = evalConfig?.status;
- mutEvaluator.mutateAsync({
- projectId,
- evalConfigId: evalConfig?.id ?? "",
- config: {
- status: isActive ? EvaluatorStatus.INACTIVE : EvaluatorStatus.ACTIVE,
- },
- });
+ try {
+ await mutEvaluator.mutateAsync({
+ projectId,
+ evalConfigId: evalConfig?.id ?? "",
+ config: {
+ status: isActive ? EvaluatorStatus.INACTIVE : EvaluatorStatus.ACTIVE,
+ },
+ });
+ } catch {
+ // The default mutation error toast reports the failure; the status is
+ // unchanged, so keep the popover open and skip the change callbacks.
+ return;
+ }
capture(
prevStatus === EvaluatorStatus.ACTIVE
? "eval_config:deactivate"
: "eval_config:activate",
);
+ onStatusChange?.();
setIsOpen(false);
};
diff --git a/web/src/features/evals/pages/evaluators.tsx b/web/src/features/evals/pages/evaluators.tsx
index 0307756250..93e3829eb0 100644
--- a/web/src/features/evals/pages/evaluators.tsx
+++ b/web/src/features/evals/pages/evaluators.tsx
@@ -13,7 +13,6 @@ import { useEntitlementLimit } from "@/src/features/entitlements/hooks";
import { SupportOrUpgradePage } from "@/src/ee/features/billing/components/SupportOrUpgradePage";
import { EvaluatorsOnboarding } from "@/src/components/onboarding/EvaluatorsOnboarding";
import { ManageDefaultEvalModel } from "@/src/features/evals/components/manage-default-eval-model";
-import { V4MigrationModal } from "@/src/features/v4-migration/V4MigrationModal";
import { V4MigrationUpdateRequiredBadge } from "@/src/features/v4-migration/V4MigrationDelayBadge";
export default function EvaluatorsPage() {
@@ -75,47 +74,44 @@ export default function EvaluatorsPage() {
}
return (
- <>
- <V4MigrationModal />
- <Page
- headerProps={{
- title: "Evaluators",
- titleBadges: <V4MigrationUpdateRequiredBadge />,
- help: {
- description:
- "Configure a langfuse managed or custom evaluator to evaluate incoming traces.",
- href: "https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge",
- },
- tabsProps: {
- tabs: getEvalsTabs(projectId),
- activeTab: EVALS_TABS.CONFIGS,
- },
- actionButtonsRight: (
- <>
- <ManageDefaultEvalModel projectId={projectId} />
- <ActionButton
- hasAccess={hasWriteAccess}
- href={`/project/${projectId}/evals/new`}
- icon={<Plus className="h-4 w-4" />}
- trackingEventName="eval_config:new_form_open"
- variant="default"
- usageLimit={
- typeof evaluatorLimit === "number"
- ? {
- current: countsQuery.data?.configActiveCount ?? 0,
- max: evaluatorLimit,
- }
- : undefined
- }
- >
- Set up evaluator
- </ActionButton>
- </>
- ),
- }}
- >
- <EvaluatorTable projectId={projectId} />
- </Page>
- </>
+ <Page
+ headerProps={{
+ title: "Evaluators",
+ titleBadges: <V4MigrationUpdateRequiredBadge />,
+ help: {
+ description:
+ "Configure a langfuse managed or custom evaluator to evaluate incoming traces.",
+ href: "https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge",
+ },
+ tabsProps: {
+ tabs: getEvalsTabs(projectId),
+ activeTab: EVALS_TABS.CONFIGS,
+ },
+ actionButtonsRight: (
+ <>
+ <ManageDefaultEvalModel projectId={projectId} />
+ <ActionButton
+ hasAccess={hasWriteAccess}
+ href={`/project/${projectId}/evals/new`}
+ icon={<Plus className="h-4 w-4" />}
+ trackingEventName="eval_config:new_form_open"
+ variant="default"
+ usageLimit={
+ typeof evaluatorLimit === "number"
+ ? {
+ current: countsQuery.data?.configActiveCount ?? 0,
+ max: evaluatorLimit,
+ }
+ : undefined
+ }
+ >
+ Set up evaluator
+ </ActionButton>
+ </>
+ ),
+ }}
+ >
+ <EvaluatorTable projectId={projectId} />
+ </Page>
);
}
diff --git a/web/src/features/v4-migration/V4MigrationDelayBadge.tsx b/web/src/features/v4-migration/V4MigrationDelayBadge.tsx
index 95811c8d58..37e7f6082f 100644
--- a/web/src/features/v4-migration/V4MigrationDelayBadge.tsx
+++ b/web/src/features/v4-migration/V4MigrationDelayBadge.tsx
@@ -93,43 +93,15 @@ function useEvalUpdateRequiredBadgeState() {
return { project, organization, enabled, visible };
}
-/** Opens the v4 migration drawer — for page-level surfaces where the drawer
- * is fully visible (e.g. the evaluators page header). */
+/** Opens the v4 migration drawer if no in-app agent is available, otherwise opens the in-app agent */
export function V4MigrationUpdateRequiredBadge() {
- const openMigrationPanel = useOpenV4MigrationPanel();
- const capture = usePostHogClientCapture();
- const { project, visible } = useEvalUpdateRequiredBadgeState();
-
- if (!visible || !project) {
- return null;
- }
-
- const handleClick = () => {
- capture("v4_migration:update_required_badge_clicked");
- openMigrationPanel({ id: project.id, name: project.name });
- };
-
- return (
- <BadgeContent
- handleClick={handleClick}
- title="Action required"
- description="Update your eval set up"
- />
- );
-}
-
-/** Starts the eval upgrade in the in-app assistant — for overlay surfaces
- * like the table peek, where the assistant (`agent` layer) renders above the
- * peek (`panel` layer) while the migration drawer would open behind it.
- * Falls back to the drawer when the assistant is unavailable. */
-export function V4MigrationUpdateRequiredAssistantBadge() {
const openMigrationPanel = useOpenV4MigrationPanel();
const capture = usePostHogClientCapture();
const canUseAgent = useCanUseInAppAgent();
+ const { project, visible, enabled, organization } =
+ useEvalUpdateRequiredBadgeState();
const { setOpen: setAgentOpen, submit: submitAgentMessage } =
useInAppAiAgent();
- const { project, organization, enabled, visible } =
- useEvalUpdateRequiredBadgeState();
const upgradePlan = useEvalUpgradeAssistantPlan({
projectId: project?.id,
orgId: organization?.id,
@@ -156,7 +128,7 @@ export function V4MigrationUpdateRequiredAssistantBadge() {
<BadgeContent
handleClick={handleClick}
title="Action required"
- description="Click here to start the upgrade now"
+ description="Start the upgrade now"
/>
);
}
diff --git a/web/src/features/v4-migration/useV4UpgradeAssistantSupport.ts b/web/src/features/v4-migration/useV4UpgradeAssistantSupport.ts
index e3083ace4d..bb7a079dc3 100644
--- a/web/src/features/v4-migration/useV4UpgradeAssistantSupport.ts
+++ b/web/src/features/v4-migration/useV4UpgradeAssistantSupport.ts
@@ -43,11 +43,9 @@ export type V4UpgradeAssistantMode =
/**
* Plans how the in-app assistant participates in the v4 upgrade:
- * - "evals-ready": deprecated evals remain, all trivially repointable
- * (dataset targets or single-observation mappings, computed server-side as
- * `allAssistantMigratable`), and the SDK upgrade is not known to be
- * pending → the assistant migrates the evals.
- * - "sdk-first-choice": evals are assistant-migratable and the SDK upgrade is
+ * - "evals-ready": deprecated evals remain, all repointable
+ * → the assistant migrates the evals
+ * - "sdk-first-choice": the SDK upgrade is
* known to be pending → the assistant asks whether to do the SDK first
* (recommended, outside Langfuse) or migrate evals now; legacy and new
* evaluators run side by side until the SDK upgrade lands.
@@ -72,15 +70,12 @@ export function useEvalUpgradeAssistantPlan(params: {
sdk.status === "otel_header_required" ||
sdk.upgradeRequiredCount > 0;
const evalsPending = (evalQuery.data?.traceLevelEvalCount ?? 0) > 0;
- const allAssistantMigratable =
- evalQuery.data?.allAssistantMigratable === true;
- const mode: V4UpgradeAssistantMode =
- evalsPending && allAssistantMigratable
- ? sdkUpgradeKnownPending
- ? "sdk-first-choice"
- : "evals-ready"
- : "outside";
+ const mode: V4UpgradeAssistantMode = evalsPending
+ ? sdkUpgradeKnownPending
+ ? "sdk-first-choice"
+ : "evals-ready"
+ : "outside";
return {
canUseAssistant,