🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(web): always show the coding-agent prompt in the v4 migration sidebar (#16084)
Max Deichmann978be24e3645
diff --git a/web/src/features/posthog-analytics/usePostHogClientCapture.ts b/web/src/features/posthog-analytics/usePostHogClientCapture.tsindex f48a8c1e6b..8972e3cc43 100644--- a/web/src/features/posthog-analytics/usePostHogClientCapture.ts+++ b/web/src/features/posthog-analytics/usePostHogClientCapture.ts@@ -325,7 +325,6 @@ export const events = {// panel_opened carries the entry surface; panel_checks_loaded carries the// amount of work shown (counts only — never keys or SDK payload values).v4_migration: [- "coding_agent_prompt_viewed","coding_agent_prompt_copied","delay_badge_clicked","project_chip_clicked",diff --git a/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx b/web/src/features/v4-migration/V4MigrationContent.clienttest.tsxindex 517aba0630..d9c825985e 100644--- a/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx+++ b/web/src/features/v4-migration/V4MigrationContent.clienttest.tsx@@ -1132,24 +1132,25 @@ describe("V4MigrationHeaderContent", () => {).toHaveLength(3);});- it("does not create credentials when revealing or copying the prompt", () => {+ it("shows the prompt without any click and copies it in a single click", () => {+ Object.assign(navigator, { clipboard: { writeText: vi.fn() } });render(<V4MigrationAgentUpgradeSection projectId="project-1" />);- fireEvent.click(screen.getByRole("button", { name: "Copy prompt" }));-+ // The prompt is always visible; no reveal step required.expect(screen.getByText("coding-agent-prompt")).toBeInTheDocument();expect(mocks.createProjectApiKey).not.toHaveBeenCalled();- // Second click copies; still no credentials. (jsdom has no clipboard.)- Object.assign(navigator, { clipboard: { writeText: vi.fn() } });+ // A single CTA click copies; still no credentials. (jsdom has no clipboard.)fireEvent.click(screen.getByRole("button", { name: "Copy prompt" }));+ expect(navigator.clipboard.writeText).toHaveBeenCalledWith(+ "coding-agent-prompt",+ );expect(mocks.createProjectApiKey).not.toHaveBeenCalled();});it("creates keys only on the explicit create action and shows an env block", async () => {render(<V4MigrationAgentUpgradeSection projectId="project-1" />);- fireEvent.click(screen.getByRole("button", { name: "Copy prompt" }));const createButton = screen.getByRole("button", {name: "Create API keys",});@@ -1186,7 +1187,6 @@ describe("V4MigrationHeaderContent", () => {const promptButton = screen.getByRole("button", { name: "Copy prompt" });expect(promptButton).toBeEnabled();- fireEvent.click(promptButton);expect(screen.getByText("coding-agent-prompt")).toBeInTheDocument();const createButton = screen.getByRole("button", {@@ -1201,7 +1201,6 @@ describe("V4MigrationHeaderContent", () => {const { rerender } = render(<V4MigrationAgentUpgradeSection key="project-1" projectId="project-1" />,);- fireEvent.click(screen.getByRole("button", { name: "Copy prompt" }));fireEvent.click(screen.getByRole("button", { name: "Create API keys" }));await waitFor(() =>@@ -1217,7 +1216,6 @@ describe("V4MigrationHeaderContent", () => {expect(screen.queryByText(/LANGFUSE_PUBLIC_KEY=pk-lf-project-1/),).not.toBeInTheDocument();- fireEvent.click(screen.getByRole("button", { name: "Copy prompt" }));fireEvent.click(screen.getByRole("button", { name: "Create API keys" }));await waitFor(() =>expect(diff --git a/web/src/features/v4-migration/V4MigrationContent.tsx b/web/src/features/v4-migration/V4MigrationContent.tsxindex 3ee3d40766..f6b07a0110 100644--- a/web/src/features/v4-migration/V4MigrationContent.tsx+++ b/web/src/features/v4-migration/V4MigrationContent.tsx@@ -3,7 +3,6 @@ import { type ReactNode, useEffect, useRef, useState } from "react";import { useRouter } from "next/router";import Link from "next/link";import {- Bot,BotMessageSquare,Check,ChevronRight,@@ -1044,12 +1043,11 @@ export function V4MigrationHeaderContent({);}-// The primary agent CTA as its own group. The CTA is two-step: the first-// click reveals the prompt so users can see what they hand to their agent,-// the second click copies it. Project API keys are NOT created as a side-// effect: credentials only exist after an explicit click on the separate-// "Create keys for project access" action, and secrets never enter the-// agent prompt.+// The primary agent CTA as its own group. The prompt is always visible so a+// single click on the CTA (or the code block's corner button) copies it.+// Project API keys are NOT created as a side effect: credentials only exist+// after an explicit click on the separate "Create keys for project access"+// action, and secrets never enter the agent prompt.export function V4MigrationAgentUpgradeSection({projectId,}: {@@ -1057,7 +1055,6 @@ export function V4MigrationAgentUpgradeSection({}) {const capture = usePostHogClientCapture();const handleCopyPrompt = useCopyMigrationPrompt();- const [promptVisible, setPromptVisible] = useState(false);const [generatedKeys, setGeneratedKeys] = useState<{projectId: string;@@ -1076,11 +1073,6 @@ export function V4MigrationAgentUpgradeSection({scope: "apiKeys:CUD",});- const handleShowPrompt = () => {- capture("v4_migration:coding_agent_prompt_viewed");- setPromptVisible(true);- };-const handleCreateKeys = () => {// Guards double-clicks and re-creation once keys exist for this project.if (@@ -1146,29 +1138,20 @@ export function V4MigrationAgentUpgradeSection({</p></div><div className="flex flex-col gap-2">- <RainbowButton- className="w-full"- onClick={promptVisible ? handleCopyPrompt : handleShowPrompt}- >- {promptVisible ? (- <Copy className="mr-1.5 h-4 w-4 shrink-0" />- ) : (- <Bot className="mr-1.5 h-4 w-4 shrink-0" />- )}+ <RainbowButton className="w-full" onClick={handleCopyPrompt}>+ <Copy className="mr-1.5 h-4 w-4 shrink-0" /><span className="min-w-0 truncate" title="Copy prompt">Copy prompt</span></RainbowButton>- {promptVisible && (- <CodeBlockWithCopy- text={V4_CODING_AGENT_PROMPT}- copyLabel="Copy prompt to clipboard"- onCopy={() => capture("v4_migration:coding_agent_prompt_copied")}- scrollable- className="my-3"- />- )}- {promptVisible && projectId && (+ <CodeBlockWithCopy+ text={V4_CODING_AGENT_PROMPT}+ copyLabel="Copy prompt to clipboard"+ onCopy={() => capture("v4_migration:coding_agent_prompt_copied")}+ scrollable+ className="my-3"+ />+ {projectId && (<div className="flex flex-col gap-2"><div className="flex items-center justify-between gap-2"><p className="text-muted-foreground min-w-0 text-sm leading-relaxed">