Skip to content

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

docs(v4-migration): restyle badges and make sure assistant upgrade is opened in v4 content modal (#16070)

marliessophied056e64a2dea
diff --git a/web/src/features/evals/components/evaluator-table.tsx b/web/src/features/evals/components/evaluator-table.tsx
index 60fc1d920a..eab261a1a7 100644
--- a/web/src/features/evals/components/evaluator-table.tsx
+++ b/web/src/features/evals/components/evaluator-table.tsx
@@ -61,13 +61,11 @@ import { useV4UpgradeUiEnabled } from "@/src/features/v4-migration/useV4UpgradeU
import { V4MigrationBadgeContent } from "@/src/features/v4-migration/V4MigrationBadgeContent";
import { buildEvaluatorUpgradeUrl } from "@/src/features/v4-migration/evaluatorMigrationUrls";
-function DeprecatedChipCell() {
+function DeprecatedChip() {
return (
- <div className="flex items-center gap-1.5">
- <span className="bg-light-yellow text-dark-yellow inline-flex w-fit shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-bold whitespace-nowrap">
- Deprecated
- </span>
- </div>
+ <span className="bg-light-yellow text-dark-yellow inline-flex w-fit shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-bold whitespace-nowrap">
+ Deprecated
+ </span>
);
}
@@ -182,7 +180,7 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
columnHelper.accessor("scoreName", {
id: "scoreName",
header: "Generated Score Name",
- size: v4UpgradeUiEnabled ? 320 : 200,
+ size: 320,
cell: (row) => {
const scoreName = row.getValue();
if (!scoreName) return undefined;
@@ -190,14 +188,18 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
return (
<div className="flex w-[calc(var(--col-scoreName-size)*1px-0.75rem)] items-center gap-2">
<TableIdOrName value={scoreName} className="min-w-[4px] flex-1" />
- {v4UpgradeUiEnabled && row.row.original.isLegacy ? (
+ {row.row.original.isLegacy ? (
<span className="ml-auto justify-self-end">
- <V4MigrationBadgeContent
- onClick={() => openEvaluatorUpgrade(row.row.original.id)}
- title="Upgrade now"
- showChevron={false}
- compact
- />
+ {v4UpgradeUiEnabled ? (
+ <V4MigrationBadgeContent
+ onClick={() => openEvaluatorUpgrade(row.row.original.id)}
+ title="Upgrade now"
+ showChevron={false}
+ compact
+ />
+ ) : (
+ <DeprecatedChip />
+ )}
</span>
) : null}
</div>
@@ -218,20 +220,6 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
);
},
}),
- columnHelper.accessor("isLegacy", {
- id: "isLegacy",
- header: "Eval Version",
- size: 180,
- enableHiding: true,
- loadingCell: <TableBadgeLoadingCell />,
- cell: (row) => {
- // Set by useEvaluatorTableData only for active legacy evaluators with
- // a NEW time scope — the ones that actually require migration.
- if (!row.row.original.isLegacy) return null;
-
- return <DeprecatedChipCell />;
- },
- }),
columnHelper.accessor("totalCost", {
header: "Total Cost (7d)",
id: "totalCost",
diff --git a/web/src/features/v4-migration/EvaluatorMigrationDialog.tsx b/web/src/features/v4-migration/EvaluatorMigrationDialog.tsx
index eaeee7dd81..c26d682266 100644
--- a/web/src/features/v4-migration/EvaluatorMigrationDialog.tsx
+++ b/web/src/features/v4-migration/EvaluatorMigrationDialog.tsx
@@ -27,6 +27,10 @@ type EvaluatorMigrationDialogProps = {
assistantPrompt: string;
onManualUpgrade: () => void;
onAssistantStarted: () => void;
+ /** Opens the dialog with this action already selected, skipping the
+ * choice screen. Only honored while AI features are enabled — otherwise
+ * the choice screen keeps owning the enable-AI and admin-handoff flows. */
+ initialAction?: SelectedMigrationAction;
};
type SelectedMigrationAction = "assistant";
@@ -41,6 +45,7 @@ export function EvaluatorMigrationDialog({
assistantPrompt,
onManualUpgrade,
onAssistantStarted,
+ initialAction,
}: EvaluatorMigrationDialogProps) {
const canUseAssistant = useCanUseInAppAgent();
const { organization } = useQueryProjectOrOrganization();
@@ -56,6 +61,14 @@ export function EvaluatorMigrationDialog({
const aiFeaturesEnabled = Boolean(organization?.aiFeaturesEnabled);
const isSingleEvaluator = scope.type === "single";
const showAssistantOption = canUseAssistant;
+ // With AI features disabled, the choice screen's assistant option owns the
+ // enable-AI and admin-handoff side effects, so the preselect only applies
+ // once the assistant can actually start.
+ const effectiveAction =
+ selectedAction ??
+ (initialAction === "assistant" && showAssistantOption && aiFeaturesEnabled
+ ? "assistant"
+ : null);
const capture = usePostHogClientCapture();
const startAssistant = async () => {
@@ -108,7 +121,7 @@ export function EvaluatorMigrationDialog({
<DialogContent>
<DialogHeader>
<DialogTitle>
- {selectedAction === "assistant"
+ {effectiveAction === "assistant"
? "Ready to start your evaluator upgrade?"
: isSingleEvaluator
? "How would you like to upgrade this evaluator?"
@@ -116,7 +129,7 @@ export function EvaluatorMigrationDialog({
</DialogTitle>
</DialogHeader>
<DialogBody className="gap-3">
- {selectedAction === "assistant" ? (
+ {effectiveAction === "assistant" ? (
<p className="text-muted-foreground text-sm">
{aiFeaturesEnabled
? "The Assistant will review your deprecated evaluators and suggest upgrading all of them at once."
@@ -158,9 +171,8 @@ export function EvaluatorMigrationDialog({
"Open the evaluator upgrade form."
) : (
<>
- Click evaluators with the Deprecated label to review{" "}
- <br />
- them and start each upgrade individually.
+ Click the Upgrade now button on an evaluator to <br />
+ review it and start each upgrade individually.
</>
)}
</span>
@@ -169,17 +181,21 @@ export function EvaluatorMigrationDialog({
</>
)}
</DialogBody>
- {selectedAction ? (
+ {effectiveAction ? (
<DialogFooter>
- <Button
- type="button"
- variant="outline"
- onClick={() => {
- setSelectedAction(null);
- }}
- >
- Back
- </Button>
+ {/* Back returns to the choice screen; when the dialog opened
+ preselected there is no choice screen to go back to. */}
+ {selectedAction ? (
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => {
+ setSelectedAction(null);
+ }}
+ >
+ Back
+ </Button>
+ ) : null}
<Button
type="button"
onClick={startAssistant}
diff --git a/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx b/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx
index b2bc9f555f..c2ba9fd75c 100644
--- a/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx
+++ b/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx
@@ -300,7 +300,7 @@ describe("V4MigrationDetailsContent", () => {
"Evals, experiments, APIs and integrations are up to date.",
),
).toBeInTheDocument();
- expect(screen.queryByText("Retarget Evals")).not.toBeInTheDocument();
+ expect(screen.queryByText("Update Evals")).not.toBeInTheDocument();
expect(screen.queryByText("Experiments")).not.toBeInTheDocument();
expect(screen.queryByText("Migrate APIs")).not.toBeInTheDocument();
expect(screen.queryByText("Migrate Integrations")).not.toBeInTheDocument();
@@ -316,20 +316,21 @@ describe("V4MigrationDetailsContent", () => {
screen.getByText("Evals and experiments are up to date."),
).toBeInTheDocument();
expect(
- screen.queryByText("Retarget Evals", { exact: true }),
+ screen.queryByText("Update Evals", { exact: true }),
).not.toBeInTheDocument();
});
- it("uses Retarget consistently for affected evals", () => {
+ it("uses Update consistently for affected evals", () => {
mocks.migrationData.evals = { status: "loaded", count: 2 };
render(<V4MigrationDetailsContent projectId="project-1" />);
- fireEvent.click(screen.getByRole("button", { name: /Retarget Evals/ }));
+ fireEvent.click(screen.getByRole("button", { name: /Update Evals/ }));
expect(
- screen.getByText(/Retarget them at observations/),
+ screen.getByText(/Update them to target observations/),
).toBeInTheDocument();
expect(screen.queryByText(/Repoint them/)).not.toBeInTheDocument();
+ expect(screen.queryByText(/Retarget them/)).not.toBeInTheDocument();
});
it("shows the experiment instrumentation upgrade requirement", () => {
@@ -919,12 +920,18 @@ describe("V4MigrationDetailsContent", () => {
render(<V4MigrationDetailsContent projectId="project-1" />);
fireEvent.click(screen.getByRole("button", { name: "Use Assistant" }));
+ // The panel entry point preselects the assistant: no choice screen.
const migrationDialog = screen.getByRole("dialog");
- fireEvent.click(
- within(migrationDialog).getByRole("button", {
+ expect(
+ within(migrationDialog).getByRole("heading", {
+ name: "Ready to start your evaluator upgrade?",
+ }),
+ ).toBeInTheDocument();
+ expect(
+ within(migrationDialog).queryByRole("button", {
name: /^Use Assistant/,
}),
- );
+ ).not.toBeInTheDocument();
fireEvent.click(
within(migrationDialog).getByRole("button", {
name: "Start upgrade now",
@@ -940,6 +947,33 @@ describe("V4MigrationDetailsContent", () => {
);
});
+ it("keeps the choice screen when AI features are disabled", () => {
+ mocks.migrationData.evals = { status: "loaded", count: 1 };
+ mocks.aiFeaturesEnabled = false;
+
+ render(<V4MigrationDetailsContent projectId="project-1" />);
+
+ // Without AI features the button drops the assistant branding …
+ expect(
+ screen.queryByRole("button", { name: "Use Assistant" }),
+ ).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Update evals" }));
+
+ // … and the dialog does not preselect the assistant, so the choice
+ // screen keeps owning the enable-AI flow.
+ const migrationDialog = screen.getByRole("dialog");
+ expect(
+ within(migrationDialog).getByRole("heading", {
+ name: "How would you like to upgrade your evaluators?",
+ }),
+ ).toBeInTheDocument();
+ expect(
+ within(migrationDialog).getByRole("button", {
+ name: /^Use Assistant/,
+ }),
+ ).toBeInTheDocument();
+ });
+
it("shows the admin handoff after a non-admin chooses the Assistant", () => {
mocks.migrationData.evals = { status: "loaded", count: 1 };
mocks.canUpdateOrgSettings = false;
@@ -947,7 +981,7 @@ describe("V4MigrationDetailsContent", () => {
render(<V4MigrationDetailsContent projectId="project-1" />);
- fireEvent.click(screen.getByRole("button", { name: "Use Assistant" }));
+ fireEvent.click(screen.getByRole("button", { name: "Update evals" }));
const migrationDialog = screen.getByRole("dialog");
fireEvent.click(
within(migrationDialog).getByRole("button", {
diff --git a/web/src/features/v4-migration/V4MigrationContent.tsx b/web/src/features/v4-migration/V4MigrationContent.tsx
index 5452a6cda0..187eaa908f 100644
--- a/web/src/features/v4-migration/V4MigrationContent.tsx
+++ b/web/src/features/v4-migration/V4MigrationContent.tsx
@@ -53,7 +53,10 @@ import {
import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";
import { numberFormatter } from "@/src/utils/numbers";
import { formatCompactRelativeTime } from "@/src/utils/dates";
-import { useProject } from "@/src/features/projects/hooks";
+import {
+ useProject,
+ useQueryProjectOrOrganization,
+} from "@/src/features/projects/hooks";
import { V4PreviewToggleRow } from "@/src/features/events/components/V4SidebarToggle";
import {
useEvalUpgradeAssistantPlan,
@@ -629,8 +632,10 @@ export function V4MigrationEvalsSection({
defaultOpen,
}: {
state: MigrationCountState;
- /** Assistant CTA; null hides the button. */
- assistant: { onMigrate: () => void } | null;
+ /** Upgrade CTA; null hides the button. Assistant branding only while AI
+ * features are on — otherwise the dialog opens on its choice screen, so
+ * the button must not promise the assistant. */
+ assistant: { onMigrate: () => void; aiFeaturesEnabled?: boolean } | null;
evalsUrl?: string;
onNavigate?: () => void;
defaultOpen?: boolean;
@@ -638,7 +643,7 @@ export function V4MigrationEvalsSection({
const capture = usePostHogClientCapture();
return (
<Section
- title="Retarget Evals"
+ title="Update Evals"
analyticsSection="evals"
count={state.status === "loaded" ? state.count : undefined}
meta={
@@ -684,13 +689,19 @@ export function V4MigrationEvalsSection({
input/output
</>
)}
- , which v4 no longer sets. Retarget{" "}
- {state.count === 1 ? "it" : "them"} at observations.
+ , which v4 no longer sets. Update{" "}
+ {state.count === 1 ? "it" : "them"} to target observations.
</p>
{assistant && (
<Button variant="outline" size="sm" onClick={assistant.onMigrate}>
- <BotMessageSquare className="mr-1.5 h-4 w-4" />
- Use Assistant
+ {assistant.aiFeaturesEnabled !== false ? (
+ <>
+ <BotMessageSquare className="mr-1.5 h-4 w-4" />
+ Use Assistant
+ </>
+ ) : (
+ "Update evals"
+ )}
</Button>
)}
</>
@@ -1290,6 +1301,10 @@ export function V4MigrationDetailsContent({
openSupportDrawerWithMode("form", { topic: "V4 Migration" });
};
const canUseAssistant = useCanUseInAppAgent();
+ // Same org source as EvaluatorMigrationDialog's gating, so the button
+ // branding and the dialog's preselect can't disagree.
+ const { organization: routeOrganization } = useQueryProjectOrOrganization();
+ const aiFeaturesEnabled = Boolean(routeOrganization?.aiFeaturesEnabled);
const [evalMigrationDialogOpen, setEvalMigrationDialogOpen] = useState(false);
const upgradePlan = useEvalUpgradeAssistantPlan({
projectId,
@@ -1339,7 +1354,10 @@ export function V4MigrationDetailsContent({
state={migrationData.evals}
assistant={
canUseAssistant
- ? { onMigrate: handleMigrateEvalsWithAgent }
+ ? {
+ onMigrate: handleMigrateEvalsWithAgent,
+ aiFeaturesEnabled,
+ }
: null
}
evalsUrl={evalsUrl}
@@ -1458,6 +1476,7 @@ export function V4MigrationDetailsContent({
open={evalMigrationDialogOpen}
onOpenChange={setEvalMigrationDialogOpen}
scope={{ type: "all" }}
+ initialAction="assistant"
assistantPrompt={upgradePlan.assistantPrompt}
onManualUpgrade={handleManualEvalUpgrade}
onAssistantStarted={() => onNavigate?.()}
diff --git a/web/src/features/v4-migration/V4MigrationStatusPage.tsx b/web/src/features/v4-migration/V4MigrationStatusPage.tsx
index 78405c0659..a4e416faa5 100644
--- a/web/src/features/v4-migration/V4MigrationStatusPage.tsx
+++ b/web/src/features/v4-migration/V4MigrationStatusPage.tsx
@@ -528,8 +528,8 @@ function V4MigrationStatusPageContent() {
>
one prompt
</button>
- : the agent updates your SDK, repoints your evals, and migrates your
- API calls, checking with you before it changes anything.
+ : the agent updates your SDK and evals, and migrates your API calls,
+ checking with you before it changes anything.
</>
),
},