Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
feat(SKY-11666): studio Run pane — Browser-pane interplay, run concurrency UX, output parity (#7010)
Celal Zamanoğlud1cee634853c
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsxnew file mode 100644index 000000000..e297ee04e--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx@@ -0,0 +1,110 @@+// @vitest-environment jsdom++import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { MemoryRouter, Route, Routes, useLocation } from "react-router-dom";+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";++import { Status } from "@/api/types";++const { workflowRunQueryMock } = vi.hoisted(() => ({+ workflowRunQueryMock: vi.fn(),+}));++vi.mock("../hooks/useWorkflowRunWithWorkflowQuery", () => ({+ useWorkflowRunWithWorkflowQuery: () => workflowRunQueryMock(),+}));+vi.mock("@/api/AxiosClient", () => ({ getClient: vi.fn() }));+vi.mock("@/hooks/useCredentialGetter", () => ({+ useCredentialGetter: () => vi.fn(),+}));++import { RunStopButton } from "./StudioTopBar";++function LocationProbe() {+ const location = useLocation();+ return <div data-testid="location">{location.pathname}</div>;+}++function renderAt(path: string) {+ const queryClient = new QueryClient({+ defaultOptions: { queries: { retry: false }, mutations: { retry: false } },+ });+ return render(+ <QueryClientProvider client={queryClient}>+ <MemoryRouter initialEntries={[path]}>+ <Routes>+ <Route+ path="/workflows/:workflowPermanentId/studio"+ element={<RunStopButton />}+ />+ <Route+ path="/workflows/:workflowPermanentId/run"+ element={<LocationProbe />}+ />+ </Routes>+ </MemoryRouter>+ </QueryClientProvider>,+ );+}++function mockRun(status: Status) {+ workflowRunQueryMock.mockReturnValue({+ data: { workflow_run_id: "wr_1", status },+ });+}++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});+beforeEach(() => mockRun(Status.Running));++describe("RunStopButton concurrency with a live block run", () => {+ test("a running block run keeps both Stop and Run available", () => {+ renderAt("/workflows/wpid_1/studio?wr=wr_1&bl=Block%201");+ expect(screen.queryByRole("button", { name: /Stop/ })).not.toBeNull();+ expect(screen.queryByRole("button", { name: /Run/ })).not.toBeNull();+ });++ test("starting a full run over a live block run asks for a soft confirm", () => {+ renderAt("/workflows/wpid_1/studio?wr=wr_1&bl=Block%201");++ fireEvent.click(screen.getByRole("button", { name: /Run/ }));+ expect(screen.queryByText("Start a full run?")).not.toBeNull();+ expect(screen.queryByTestId("location")).toBeNull();++ fireEvent.click(screen.getByRole("button", { name: "Start full run" }));+ expect(screen.getByTestId("location").textContent).toBe(+ "/workflows/wpid_1/run",+ );+ });++ test("the confirm can be declined without navigating", () => {+ renderAt("/workflows/wpid_1/studio?wr=wr_1&bl=Block%201");++ fireEvent.click(screen.getByRole("button", { name: /Run/ }));+ fireEvent.click(screen.getByRole("button", { name: "Not now" }));++ expect(screen.queryByTestId("location")).toBeNull();+ expect(screen.queryByRole("button", { name: /Stop/ })).not.toBeNull();+ });++ test("a running full run offers Stop only", () => {+ renderAt("/workflows/wpid_1/studio?wr=wr_1");+ expect(screen.queryByRole("button", { name: /Stop/ })).not.toBeNull();+ expect(screen.queryByRole("button", { name: /Run/ })).toBeNull();+ });++ test("an idle workflow starts a run directly, with no confirm", () => {+ mockRun(Status.Completed);+ renderAt("/workflows/wpid_1/studio?wr=wr_1");++ fireEvent.click(screen.getByRole("button", { name: /Run/ }));++ expect(screen.queryByText("Start a full run?")).toBeNull();+ expect(screen.getByTestId("location").textContent).toBe(+ "/workflows/wpid_1/run",+ );+ });+});diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsxindex d508c23a8..a5fe3c5ac 100644--- a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx@@ -7,7 +7,7 @@ import {StopIcon,} from "@radix-ui/react-icons";import { useMutation, useQueryClient } from "@tanstack/react-query";-import { useNavigate, useParams } from "react-router-dom";+import { useNavigate, useParams, useSearchParams } from "react-router-dom";import { getClient } from "@/api/AxiosClient";import { SaveIcon } from "@/components/icons/SaveIcon";@@ -125,10 +125,11 @@ function PanelToggle({);}-function RunStopButton() {+export function RunStopButton() {const navigate = useNavigate();const { workflowPermanentId } = useParams();const runId = useStudioRunId();+ const [searchParams] = useSearchParams();const queryClient = useQueryClient();const credentialGetter = useCredentialGetter();const isRecording = useRecordingStore((s) => s.isRecording);@@ -137,6 +138,9 @@ function RunStopButton() {);const activeRunId = workflowRun?.workflow_run_id;const running = runOutcomeFromStatus(workflowRun?.status) === "running";+ // ?bl= marks the URL run as a block run; a full run can start alongside it+ // (they execute concurrently), so Run stays available next to Stop.+ const isBlockRun = searchParams.has("bl");const cancelRun = useMutation({mutationFn: async () => {@@ -166,8 +170,10 @@ function RunStopButton() {},});+ const startFullRun = () => navigate(`/workflows/${workflowPermanentId}/run`);+if (running && activeRunId) {- return (+ const stopDialog = (<Dialog><DialogTrigger asChild><Button@@ -204,13 +210,42 @@ function RunStopButton() {</DialogContent></Dialog>);+ if (!isBlockRun) {+ return stopDialog;+ }+ return (+ <>+ {stopDialog}+ <Dialog>+ <DialogTrigger asChild>+ <Button size="default" disabled={isRecording}>+ <PlayIcon className="mr-2 size-4" /> Run+ </Button>+ </DialogTrigger>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Start a full run?</DialogTitle>+ <DialogDescription>+ A block run is still executing. It will keep running — you can+ watch it in the Browser pane while the Run pane switches to the+ new full run.+ </DialogDescription>+ </DialogHeader>+ <DialogFooter>+ <DialogClose asChild>+ <Button variant="secondary">Not now</Button>+ </DialogClose>+ <DialogClose asChild>+ <Button onClick={startFullRun}>Start full run</Button>+ </DialogClose>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ </>+ );}return (- <Button- size="default"- disabled={isRecording}- onClick={() => navigate(`/workflows/${workflowPermanentId}/run`)}- >+ <Button size="default" disabled={isRecording} onClick={startFullRun}><PlayIcon className="mr-2 size-4" /> Run</Button>);diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsxindex 988c02366..4537ed4e3 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx@@ -58,6 +58,87 @@ describe("RunHero block-run stream", () => {});});+describe("RunHero when the Browser pane hosts the debug stream", () => {+ const blockRunProps = {+ ...baseProps,+ showDebugStream: true,+ debugStreamInBrowserPane: true,+ };++ test("renders live-edge screenshots, not a dead stream slot", () => {+ render(+ <RunHero+ {...blockRunProps}+ heroSelection={{+ kind: "action",+ artifactId: "art_1",+ stepId: "step_1",+ actionOrder: 0,+ }}+ />,+ );+ expect(screen.queryByTestId("run-stream-slot")).toBeNull();+ expect(screen.queryByTestId("run-live-stream")).toBeNull();+ expect(screen.queryByTestId("hero-screenshot")).not.toBeNull();+ });++ test("the Live chip focuses the Browser pane and unpins to the live edge", () => {+ const onFocusBrowserPane = vi.fn();+ useRunViewStore.getState().pinFrame("act_1");+ render(+ <RunHero {...blockRunProps} onFocusBrowserPane={onFocusBrowserPane} />,+ );++ fireEvent.click(screen.getByRole("button", { name: "Live" }));++ expect(onFocusBrowserPane).toHaveBeenCalledTimes(1);+ expect(useRunViewStore.getState().pinnedFrameId).toBeNull();+ expect(screen.queryByTestId("run-stream-slot")).toBeNull();+ });++ test("a queued block run surfaces its queued state", () => {+ render(<RunHero {...blockRunProps} provisioning />);+ expect(screen.queryByText(/Run queued/)).not.toBeNull();+ });++ test("a queued block run also shows the queued chip over the hosted slot", () => {+ render(+ <RunHero+ {...baseProps}+ showDebugStream+ debugStreamInBrowserPane={false}+ provisioning+ />,+ );+ expect(screen.queryByTestId("run-stream-slot")).not.toBeNull();+ expect(screen.queryByText(/Run queued/)).not.toBeNull();+ });+});++describe("RunHero closed pane", () => {+ test("mounts no full-run stream while the pane is hidden", () => {+ render(<RunHero {...baseProps} showDebugStream={false} paneOpen={false} />);+ expect(screen.queryByTestId("run-live-stream")).toBeNull();+ expect(screen.queryByTestId("run-stream-slot")).toBeNull();+ });+});++describe("RunHero archived recording", () => {+ test("explains an archived recording instead of hiding it silently", () => {+ render(+ <RunHero+ {...baseProps}+ showDebugStream={false}+ running={false}+ recordingArchived+ heroSelection={{ kind: "thought", thoughtId: "t1" }}+ />,+ );+ const chip = screen.getByRole("button", { name: /Recording archived/ });+ expect((chip as HTMLButtonElement).disabled).toBe(true);+ });+});+describe("RunHero Code surface (single source of truth)", () => {test("the Code toggle opens the generated-code view", () => {render(<RunHero {...baseProps} showDebugStream={false} />);diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsxindex c94c9b2bf..3732c0033 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx@@ -1,5 +1,6 @@import { type ReactNode, useEffect, useRef, useState } from "react";import {+ ClockIcon,CodeIcon,CounterClockwiseClockIcon,Cross2Icon,@@ -19,6 +20,7 @@ import { cn } from "@/util/utils";import { WorkflowRunCode } from "../../workflowRun/WorkflowRunCode";import { useStudioShellContext } from "../StudioShellContext";+import { matchFailureTips } from "./failureTips";import { HeroRecording } from "./HeroRecording";import { HeroScreenshot, type HeroSelection } from "./HeroScreenshot";import { RunLiveStream } from "./RunLiveStream";@@ -31,9 +33,13 @@ type RunHeroProps = {// A block run shows the shared debug-session stream (re-parented in by the// shell), view-only, instead of mounting a separate run stream.showDebugStream: boolean;- // The open Browser pane outranks this hero for the single stream node; point- // at it instead of registering a slot that would stay black.+ // The open Browser pane outranks this hero for the single stream node; the+ // Live affordance points there instead of registering a slot that stays black.debugStreamInBrowserPane?: boolean;+ onFocusBrowserPane?: () => void;+ // The pane keeps rendering while closed (display:none); never mount a stream+ // socket into a hidden pane.+ paneOpen?: boolean;provisioning: boolean;isPaused: boolean;failed: boolean;@@ -41,6 +47,7 @@ type RunHeroProps = {codeGenerating?: boolean;browserSessionId: string | null;recordingUrls: string[];+ recordingArchived?: boolean;hasScreenshots?: boolean;elapsed: string;inputs?: ReactNode;@@ -63,6 +70,9 @@ type CenterView =// Below this header width the toggle/dropdown labels collapse to icons.const HEADER_COMPACT_BELOW_PX = 640;+const RECORDING_ARCHIVED_LABEL =+ "Recording archived — contact [email protected] to request restoration";+// RunCenterView stores user intent; the hero renders screenshots in one surface.function resolveCenterView({centerView,@@ -71,6 +81,7 @@ function resolveCenterView({hasOutputs,scrubbing,showDebugStream,+ debugStreamInBrowserPane,recordingOpen,hasRecording,running,@@ -82,6 +93,7 @@ function resolveCenterView({hasOutputs: boolean;scrubbing: boolean;showDebugStream: boolean;+ debugStreamInBrowserPane: boolean;recordingOpen: boolean;hasRecording: boolean;running: boolean;@@ -103,7 +115,12 @@ function resolveCenterView({return "screenshot";}if (showDebugStream) {- return recordingOpen && hasRecording ? "recording" : "stream";+ if (recordingOpen && hasRecording) {+ return "recording";+ }+ // The Browser pane owns the singleton stream node; the hero shows+ // live-edge screenshots and its Live chip points at that pane instead.+ return debugStreamInBrowserPane ? "screenshot" : "stream";}if (running) {return "stream";@@ -157,6 +174,8 @@ export function RunHero({running,showDebugStream,debugStreamInBrowserPane = false,+ onFocusBrowserPane,+ paneOpen = true,provisioning,isPaused,failed,@@ -164,6 +183,7 @@ export function RunHero({codeGenerating = false,browserSessionId,recordingUrls,+ recordingArchived = false,hasScreenshots = false,elapsed,inputs,@@ -224,12 +244,21 @@ export function RunHero({hasOutputs: Boolean(outputs),scrubbing,showDebugStream,+ debugStreamInBrowserPane,recordingOpen,hasRecording,running,failed,});+ const focusBrowserPane = () => {+ setRecordingOpen(false);+ // Unpin instead of pinning "stream": the hero can't host the debug node,+ // so its screenshot surface follows the live edge while the pane streams.+ jumpToLive();+ onFocusBrowserPane?.();+ };+// The right-side toggles own the view identity (Live/Recording/Code) and the// in-card "Inspecting step" bar owns a scrubbed action's description; the// header only adds context they don't surface — the live page URL, or the@@ -258,13 +287,22 @@ export function RunHero({{showDebugStream ? (<><ViewToggle- active={center === "stream"}- onClick={() => {- setRecordingOpen(false);- pinFrame("stream");- }}+ active={!debugStreamInBrowserPane && center === "stream"}+ onClick={+ debugStreamInBrowserPane+ ? focusBrowserPane+ : () => {+ setRecordingOpen(false);+ pinFrame("stream");+ }+ }compact={compact}label="Live"+ title={+ debugStreamInBrowserPane+ ? "Watch live in the Browser pane"+ : undefined+ }icon={<span className="h-1.5 w-1.5 animate-pulse rounded-full bg-success" />}@@ -300,6 +338,17 @@ export function RunHero({label="Recording"icon={<PlayIcon className="h-3 w-3" />}/>+ ) : recordingArchived ? (+ <button+ type="button"+ disabled+ title={RECORDING_ARCHIVED_LABEL}+ aria-label={RECORDING_ARCHIVED_LABEL}+ className="inline-flex cursor-not-allowed items-center gap-1.5 rounded px-2 py-1 text-[11px] font-medium text-muted-foreground opacity-60"+ >+ <PlayIcon className="h-3 w-3" />+ {compact ? null : "Recording archived"}+ </button>) : null}{hasScreenshots ? (<ViewToggle@@ -392,22 +441,16 @@ export function RunHero({{outputs}</div>) : center === "stream" ? (- showDebugStream ? (- debugStreamInBrowserPane ? (- <div className="absolute inset-0 grid place-items-center px-6 text-center text-sm text-muted-foreground">- This block run's live browser is showing in the Browser pane.- </div>- ) : (- // The shell re-parents the persistent debug-session stream into this- // slot (the same node as the Browser pane), so a block run shows its- // live browser here, view-only. The slot unmounts when the user scrubs- // or opens code/recording, which parks the node back offscreen.- <div- ref={setRunStreamSlot}- data-testid="run-stream-slot"- className="absolute inset-0"- />- )+ !paneOpen ? null : showDebugStream ? (+ // The shell re-parents the persistent debug-session stream into this+ // slot (the same node as the Browser pane), so a block run shows its+ // live browser here, view-only. The slot unmounts when the user scrubs+ // or opens code/recording, which parks the node back offscreen.+ <div+ ref={setRunStreamSlot}+ data-testid="run-stream-slot"+ className="absolute inset-0"+ />) : provisioning ? (// Mounting the stream while the run is still queued opens a socket// the backend never feeds; wait until the run is actually running.@@ -441,6 +484,18 @@ export function RunHero({</div>)}+ {provisioning &&+ showDebugStream &&+ !scrubbing &&+ (center === "stream" || center === "screenshot") ? (+ // A block run can queue behind a running full run (run_sequentially);+ // the debug browser is already live, so say why nothing moves yet.+ <div className="absolute left-3 top-3 flex items-center gap-2 rounded-md bg-black/70 px-3 py-1.5 text-xs text-white backdrop-blur">+ <ClockIcon className="h-3.5 w-3.5 shrink-0" />+ <span>Run queued — waiting to start</span>+ </div>+ ) : null}+{center === "screenshot" && scrubbing && heroSelection ? (<div className="absolute left-3 top-3 flex max-w-[26rem] items-center gap-2 rounded-md bg-black/70 px-3 py-1.5 text-xs text-white backdrop-blur"><CounterClockwiseClockIcon className="h-3.5 w-3.5 shrink-0" />@@ -450,10 +505,14 @@ export function RunHero({{running || showDebugStream ? (<buttontype="button"- onClick={() => {- setRecordingOpen(false);- pinFrame("stream");- }}+ onClick={+ showDebugStream && debugStreamInBrowserPane+ ? focusBrowserPane+ : () => {+ setRecordingOpen(false);+ pinFrame("stream");+ }+ }className="ml-1 inline-flex items-center gap-1.5 rounded-full bg-white/15 px-2 py-0.5 text-[11px] hover:bg-white/25 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white"><span className="h-1.5 w-1.5 animate-pulse rounded-full bg-success" />@@ -482,6 +541,14 @@ export function RunHero({<ExclamationTriangleIcon className="mt-0.5 h-4 w-4 shrink-0 text-destructive" /><span className="min-w-0 flex-1">{failureReason ?? "The run failed."}+ {matchFailureTips(failureReason).map((tip) => (+ <span+ key={tip}+ className="mt-1.5 block text-xs font-normal italic text-muted-foreground"+ >+ {tip}+ </span>+ ))}</span><buttontype="button"diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.test.tsxnew file mode 100644index 000000000..54bf273af--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.test.tsx@@ -0,0 +1,49 @@+// @vitest-environment jsdom++import { cleanup, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, test, vi } from "vitest";++vi.mock("@/components/SummarizeOutput", () => ({+ SummarizeOutput: () => null,+}));+vi.mock("./OverviewCodeBlock", () => ({+ OverviewCodeBlock: ({ value }: { value: string }) => <pre>{value}</pre>,+}));++import { RunOutputsSection } from "./RunOutputsSection";++const baseProps = {+ workflowRunId: "wr_1",+ extractedInformation: null,+ files: [],+ summary: null,+ onSummary: () => {},+};++afterEach(cleanup);++describe("RunOutputsSection task 2.0 and webhook surfaces", () => {+ test("renders the webhook failure reason", () => {+ render(+ <RunOutputsSection+ {...baseProps}+ webhookFailureReason="Webhook endpoint returned 500"+ />,+ );+ expect(screen.queryByText("Webhook failure reason")).not.toBeNull();+ expect(screen.queryByText("Webhook endpoint returned 500")).not.toBeNull();+ });++ test("renders the task 2.0 output", () => {+ render(+ <RunOutputsSection {...baseProps} observerOutput={{ answer: 42 }} />,+ );+ expect(screen.queryByText("Task 2.0 output")).not.toBeNull();+ expect(screen.queryByText(/"answer": 42/)).not.toBeNull();+ });++ test("renders nothing without any output signal", () => {+ const { container } = render(<RunOutputsSection {...baseProps} />);+ expect(container.firstChild).toBeNull();+ });+});diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.tsxindex e00b9f8d8..09b3edecb 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunOutputsSection.tsx@@ -11,6 +11,9 @@ type RunOutputsSectionProps = {workflowTitle?: string | null;extractedInformation: Record<string, unknown> | null;files: RunOutputFile[];+ // Task 2.0 runs report their output on task_v2, not the run-level outputs.+ observerOutput?: Record<string, unknown> | null;+ webhookFailureReason?: string | null;// Owned by RunView so the generated summary survives center-tab switches// (this section unmounts when another tab takes the center).summary: string | null;@@ -22,13 +25,20 @@ export function RunOutputsSection({workflowTitle,extractedInformation,files,+ observerOutput = null,+ webhookFailureReason = null,summary,onSummary,}: RunOutputsSectionProps) {const hasExtracted =extractedInformation != null &&Object.values(extractedInformation).some((value) => value !== null);- if (!hasExtracted && files.length === 0) {+ if (+ !hasExtracted &&+ files.length === 0 &&+ observerOutput == null &&+ !webhookFailureReason+ ) {return null;}@@ -36,6 +46,27 @@ export function RunOutputsSection({return (<div className="flex flex-col gap-5">+ {webhookFailureReason ? (+ <div className="flex flex-col gap-2">+ <span className="text-xs font-medium text-muted-foreground">+ Webhook failure reason+ </span>+ <div className="whitespace-pre-wrap rounded-md border border-border bg-slate-elevation3 p-3 text-sm text-warning">+ {webhookFailureReason}+ </div>+ </div>+ ) : null}+ {observerOutput != null ? (+ <div className="flex flex-col gap-2">+ <span className="text-xs font-medium text-muted-foreground">+ Task 2.0 output+ </span>+ <OverviewCodeBlock+ value={JSON.stringify(observerOutput, null, 2)}+ maxHeight="320px"+ />+ </div>+ ) : null}{hasExtracted ? (<div className="flex flex-col gap-2"><div className="flex items-center justify-between">diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsxindex 736332bd5..701f26462 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx@@ -22,6 +22,7 @@ import { RunView } from "./RunView";const mocks = vi.hoisted(() => ({workflowRun: undefined as unknown,timeline: undefined as unknown,+ debugSession: undefined as unknown,runHeroProps: [] as Array<Record<string, unknown>>,}));@@ -38,7 +39,7 @@ vi.mock("../../hooks/useWorkflowRunTimelineQuery", () => ({}),}));vi.mock("../../hooks/useDebugSessionQuery", () => ({- useDebugSessionQuery: () => ({ data: undefined }),+ useDebugSessionQuery: () => ({ data: mocks.debugSession }),}));vi.mock("../../editor/hooks/useIsGeneratingCode", () => ({useIsGeneratingCode: () => false,@@ -176,10 +177,73 @@ afterEach(() => {cleanup();mocks.workflowRun = undefined;mocks.timeline = undefined;+ mocks.debugSession = undefined;mocks.runHeroProps = [];});beforeEach(() => useRunViewStore.getState().reset());+function seedLiveBlockRun() {+ mocks.debugSession = { browser_session_id: "pbs_1" };+ mocks.timeline = [+ buildBlockItem(+ buildBlock({+ workflow_run_block_id: "wrb_1",+ actions: [+ buildAction({+ action_id: "act_1",+ action_order: 0,+ screenshot_artifact_id: "art_1",+ }),+ ],+ }),+ ),+ ];+ mocks.workflowRun = {+ workflow_run_id: "wr_1",+ status: Status.Running,+ browser_session_id: "pbs_1",+ workflow: {+ workflow_definition: { blocks: [], finally_block_label: null },+ },+ };+}++describe("RunView block run and the Browser pane", () => {+ test("Browser pane open: the hero gets live-edge screenshots, not the stream selection", () => {+ seedLiveBlockRun();+ render(+ <MemoryRouter+ initialEntries={["/?wr=wr_1&bl=Block%201&panes=run,browser"]}+ >+ <RunView workflowRunId="wr_1" />+ </MemoryRouter>,+ );++ const props = mocks.runHeroProps[mocks.runHeroProps.length - 1];+ expect(props?.showDebugStream).toBe(true);+ expect(props?.debugStreamInBrowserPane).toBe(true);+ // Without the remap the "stream" selection would leave heroSelection null.+ expect(props?.heroSelection).toMatchObject({+ kind: "action",+ artifactId: "art_1",+ });+ });++ test("Browser pane closed, Run pane open: the hero stays self-sufficient", () => {+ seedLiveBlockRun();+ render(+ <MemoryRouter initialEntries={["/?wr=wr_1&bl=Block%201&panes=run"]}>+ <RunView workflowRunId="wr_1" />+ </MemoryRouter>,+ );++ const props = mocks.runHeroProps[mocks.runHeroProps.length - 1];+ expect(props?.showDebugStream).toBe(true);+ expect(props?.debugStreamInBrowserPane).toBe(false);+ expect(props?.paneOpen).toBe(true);+ });+});+describe("RunView iteration selection", () => {test("selecting the loop block after an iteration clears the iteration scope", () => {seedForLoopRun();diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsxindex bf0c11378..553ba5e58 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx@@ -40,6 +40,7 @@ import {formatElapsed,runOutcomeFromStatus,} from "../runProjections";+import { studioPanelId } from "../constants";import { useStudioPanes } from "../useStudioPanes";import { RunHero } from "./RunHero";import { type HeroSelection } from "./HeroScreenshot";@@ -108,7 +109,7 @@ export function RunView({const pinFrame = useRunViewStore((s) => s.pinFrame);const resetRunView = useRunViewStore((s) => s.reset);const headerCompact = useRunViewStore((s) => s.headerCompact);- const { panes: studioPanes } = useStudioPanes();+ const { panes: studioPanes, openPane } = useStudioPanes();const runPaneOpen = studioPanes.includes("run");const browserPaneOpen = studioPanes.includes("browser");const [searchParams, setSearchParams] = useSearchParams();@@ -228,6 +229,23 @@ export function RunView({searchParams.has("bl") &&workflowRun?.browser_session_id != null &&workflowRun.browser_session_id === debugSession?.browser_session_id;+ // The open Browser pane outranks the hero for the singleton debug-stream+ // node (StudioShell priority); the hero then points at it instead.+ const debugStreamInBrowserPane = showDebugStream && browserPaneOpen;+ const focusBrowserPane = useCallback(() => {+ openPane("browser");+ // Defer past the pane-open commit so the scroll sees the visible panel.+ requestAnimationFrame(() => {+ const reduceMotion =+ typeof window.matchMedia === "function" &&+ window.matchMedia("(prefers-reduced-motion: reduce)").matches;+ document.getElementById(studioPanelId("browser"))?.scrollIntoView({+ behavior: reduceMotion ? "auto" : "smooth",+ block: "nearest",+ inline: "nearest",+ });+ });+ }, [openPane]);const fixSeedMessage = useMemo(() => buildRunFixMessage(workflowRun?.failure_reason ?? null),[workflowRun?.failure_reason],@@ -239,10 +257,16 @@ export function RunView({const finalized = workflowRun ? statusIsFinalized(workflowRun) : false;const finallyBlockLabel =workflowRun?.workflow?.workflow_definition?.finally_block_label ?? null;- const selectedId =+ const rawSelectedId =pinnedFrameId ??(running && !showingScreenshots ? "stream" : lastFrame?.id) ??null;+ // A "stream" selection has no hero surface while the Browser pane hosts the+ // debug node; follow the newest frame so screenshots track the live edge.+ const selectedId =+ rawSelectedId === "stream" && debugStreamInBrowserPane+ ? (lastFrame?.id ?? null)+ : rawSelectedId;const activeItem = useMemo(() =>findActiveItem(timeline ?? [], selectedId, finalized, finallyBlockLabel),@@ -360,12 +384,22 @@ export function RunView({return { parameters, meta };}, [workflowRun]);+ // Task 2.0 runs carry their output (and any webhook failure) on task_v2,+ // not on the workflow-run outputs field.+ const observerOutput = workflowRun?.task_v2?.output ?? null;+ const webhookFailureReason =+ workflowRun?.task_v2?.webhook_failure_reason ??+ workflowRun?.webhook_failure_reason ??+ null;+const hasInputs =runInputs.parameters.length > 0 || runInputs.meta.length > 0;const hasOutputs =(extractedInformation != null &&Object.values(extractedInformation).some((value) => value !== null)) ||- downloadedFiles.length > 0;+ downloadedFiles.length > 0 ||+ observerOutput != null ||+ webhookFailureReason != null;if (!workflowRun) {return <RunPlaceholder loading={isLoading || runIdPending} />;@@ -389,7 +423,9 @@ export function RunView({heroLabel={heroLabel}running={running}showDebugStream={showDebugStream}- debugStreamInBrowserPane={browserPaneOpen}+ debugStreamInBrowserPane={debugStreamInBrowserPane}+ onFocusBrowserPane={focusBrowserPane}+ paneOpen={runPaneOpen}provisioning={workflowRun.status === Status.Created ||workflowRun.status === Status.Queued@@ -400,6 +436,7 @@ export function RunView({codeGenerating={codeGenerating}browserSessionId={workflowRun.browser_session_id ?? null}recordingUrls={recordingUrls}+ recordingArchived={workflowRun.recording_archived ?? false}hasScreenshots={hasScreenshots}elapsed={elapsed}overview={@@ -430,6 +467,8 @@ export function RunView({workflowTitle={workflowRun.workflow?.title}extractedInformation={extractedInformation}files={downloadedFiles}+ observerOutput={observerOutput}+ webhookFailureReason={webhookFailureReason}summary={outputSummary}onSummary={setOutputSummary}/>diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/failureTips.ts b/skyvern-frontend/src/routes/workflows/studio/runview/failureTips.tsnew file mode 100644index 000000000..46ab6f65a--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/studio/runview/failureTips.ts@@ -0,0 +1,16 @@+const FAILURE_TIPS: Array<{ match: (reason: string) => boolean; tip: string }> =+ [+ {+ match: (reason) => reason.includes("Invalid master password"),+ tip: "Tip: If inputting the master password via Docker Compose or in any container environment, make sure to double any dollar signs and do not surround it with quotes.",+ },+ ];++export function matchFailureTips(reason: string | null): string[] {+ if (!reason) {+ return [];+ }+ return FAILURE_TIPS.filter(({ match }) => match(reason)).map(+ ({ tip }) => tip,+ );+}