Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix(SKY-12240): scope failure reason to one place per surface (#7595)
Celal Zamanoğlu199fae2ec72b
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsxindex 535046c46..bbf65c6a5 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx@@ -555,6 +555,24 @@ describe("RunView failure banner", () => {expect(scope.queryByText("canceled by user")).toBeNull();});++ test("hides the run failure banner outside the Timeline view", () => {+ seedCompletedRun({+ status: Status.Failed,+ failure_reason: "Login page rejected the credentials",+ });+ const { container } = renderRunView();+ const scope = within(container);++ // Visible on the default Timeline view.+ expect(+ scope.getByText("Login page rejected the credentials"),+ ).not.toBeNull();++ // Switching to another tab hides the run-level failure banner.+ fireEvent.click(scope.getByRole("button", { name: "Outputs" }));+ expect(scope.queryByText("Login page rejected the credentials")).toBeNull();+ });});describe("RunView live affordances", () => {diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsxindex 65c849742..20c7ac2e0 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx@@ -352,7 +352,7 @@ export function RunView({</div>) : null}- {failed && !failureDismissed ? (+ {failed && !failureDismissed && view === "timeline" ? (<div className="shrink-0 rounded-lg border border-destructive/40 bg-slate-elevation1 p-4"><div className="flex items-start gap-2 text-sm font-semibold text-foreground"><ExclamationTriangleIcon className="mt-0.5 h-4 w-4 shrink-0 text-destructive" />diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.test.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.test.tsxindex 64b1ee89a..6932555b0 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.test.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.test.tsx@@ -150,16 +150,43 @@ describe("WorkflowRunBlockDetail router", () => {expect(screen.queryByText("Pull the price from the page")).toBeNull();});- it("renders the failure_reason in the detail body (not the header) when set", () => {+ it("shows the failure_reason once, scoped to the Summary sub-panel", () => {const block = buildBlock({block_type: "extraction",failure_reason: "Could not locate the price element",});render(<WorkflowRunBlockDetail activeItem={block} timeline={[]} />);+ // A failed block opens on Summary and shows the failure exactly once — no+ // longer duplicated between the Summary field and a persistent callout.expect(screen.getByText("Failure")).toBeDefined();expect(- screen.getAllByText("Could not locate the price element").length,- ).toBeGreaterThanOrEqual(1);+ screen.getAllByText("Could not locate the price element"),+ ).toHaveLength(1);+ // Switching sub-panels no longer repeats the failure.+ fireEvent.mouseDown(screen.getByRole("tab", { name: "Inputs" }));+ expect(screen.queryByText("Could not locate the price element")).toBeNull();+ });++ it("shows a triggered-workflow failure once, not in a separate body section", () => {+ // The backend copies the child failure into both block.failure_reason and+ // block.output.failure_reason, so the Summary callout already covers it.+ const reason = "Triggered workflow execution failed: boom";+ const block = buildBlock({+ block_type: "workflow_trigger",+ failure_reason: reason,+ output: {+ workflow_run_id: "wr_child",+ status: "failed",+ failure_reason: reason,+ },+ });+ render(+ <MemoryRouter>+ <WorkflowRunBlockDetail activeItem={block} timeline={[]} />+ </MemoryRouter>,+ );+ expect(screen.getAllByText(reason)).toHaveLength(1);+ expect(screen.queryByText("Sub-workflow failure")).toBeNull();});it("renders code block extracted information without the raw output wrapper", () => {diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailConditional.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailConditional.tsxindex 1417c0ebc..c493b5026 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailConditional.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailConditional.tsx@@ -3,7 +3,7 @@ import {type WorkflowRunBlock,} from "../../types/workflowRunTypes";import { JsonExplorer } from "./BlockInspector";-import { BlockDetailFailure, CodeBlock, Section } from "./shared";+import { CodeBlock, Section } from "./shared";import { cn } from "@/util/utils";type Props = {@@ -44,7 +44,6 @@ function BlockDetailConditional({ block }: Props) {return (<div className="space-y-4 px-3 py-3 empty:hidden">- <BlockDetailFailure block={block} />{hasExecutedBranch && evaluations && evaluations.length > 0 ? (<Section title="Branches"><div className="space-y-2">diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailGeneric.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailGeneric.tsxindex 35cbc1d6c..2f3ad65c4 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailGeneric.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailGeneric.tsx@@ -1,5 +1,5 @@import type { WorkflowRunBlock } from "../../types/workflowRunTypes";-import { BlockDetailFailure, GoalText, Section } from "./shared";+import { GoalText, Section } from "./shared";type Props = {block: WorkflowRunBlock;@@ -8,7 +8,6 @@ type Props = {function BlockDetailGeneric({ block }: Props) {return (<div className="space-y-4 px-3 py-3 empty:hidden">- <BlockDetailFailure block={block} />{block.prompt && (<Section title="Prompt"><GoalText text={block.prompt} />diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailHttpRequest.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailHttpRequest.tsxindex 0c4faff38..6189fb224 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailHttpRequest.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailHttpRequest.tsx@@ -1,6 +1,6 @@import type { WorkflowRunBlock } from "../../types/workflowRunTypes";import { JsonExplorer } from "./BlockInspector";-import { BlockDetailFailure, Section } from "./shared";+import { Section } from "./shared";type Props = {block: WorkflowRunBlock;@@ -9,7 +9,6 @@ type Props = {function BlockDetailHttpRequest({ block }: Props) {return (<div className="space-y-4 px-3 py-3 empty:hidden">- <BlockDetailFailure block={block} />{block.url && (<Section title="URL"><span className="break-all text-xs text-tertiary-foreground">diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailHumanInteraction.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailHumanInteraction.tsxindex d6fbc58ca..ee0a9cabd 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailHumanInteraction.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailHumanInteraction.tsx@@ -1,6 +1,6 @@import type { WorkflowRunBlock } from "../../types/workflowRunTypes";import { WorkflowRunHumanInteraction } from "../WorkflowRunHumanInteraction";-import { BlockDetailFailure, GoalText, Section } from "./shared";+import { GoalText, Section } from "./shared";type Props = {block: WorkflowRunBlock;@@ -10,7 +10,6 @@ function BlockDetailHumanInteraction({ block }: Props) {const recipients = block.recipients ?? [];return (<div className="space-y-4 px-3 py-3 empty:hidden">- <BlockDetailFailure block={block} />{block.instructions && (<Section title="Instructions"><GoalText text={block.instructions} />diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailLoop.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailLoop.tsxindex 614937fad..08a6a0241 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailLoop.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailLoop.tsx@@ -1,6 +1,6 @@import type { WorkflowRunBlock } from "../../types/workflowRunTypes";import { stringifyTimelineValue } from "./formatValue";-import { BlockDetailFailure, CodeBlock, Section } from "./shared";+import { CodeBlock, Section } from "./shared";type Props = {block: WorkflowRunBlock;@@ -29,7 +29,6 @@ function BlockDetailLoop({ block, iterationIndex = null }: Props) {return (<div className="space-y-4 px-3 py-3 empty:hidden">- <BlockDetailFailure block={block} />{showIterationOnly && (<Section title={`Iteration ${(highlightIndex ?? 0) + 1} value`}><CodeBlock>{stringifyTimelineValue(highlightedValue)}</CodeBlock>diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailTask.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailTask.tsxindex e98fc6230..cd659b2c1 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailTask.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailTask.tsx@@ -3,7 +3,7 @@ import type {WorkflowRunBlock,} from "../../types/workflowRunTypes";import type { WorkflowRunOverviewActiveElement } from "../WorkflowRunOverview";-import { BlockDetailFailure, BlockThoughtList } from "./shared";+import { BlockThoughtList } from "./shared";type Props = {block: WorkflowRunBlock;@@ -13,14 +13,12 @@ type Props = {};function BlockDetailTask({- block,activeItem,thoughts = [],onThoughtSelect,}: Props) {return (<div className="space-y-4 px-3 py-3 empty:hidden">- <BlockDetailFailure block={block} /><BlockThoughtListthoughts={thoughts}activeItem={activeItem}diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailWorkflowTrigger.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailWorkflowTrigger.tsxindex 2b72947fb..f0caf9674 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailWorkflowTrigger.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockDetailWorkflowTrigger.tsx@@ -1,6 +1,6 @@import { Link } from "react-router-dom";import type { WorkflowRunBlock } from "../../types/workflowRunTypes";-import { BlockDetailFailure, JsonView, Section } from "./shared";+import { JsonView, Section } from "./shared";type Props = {block: WorkflowRunBlock;@@ -10,7 +10,6 @@ type SubWorkflowRun = {workflow_run_id?: string;workflow_permanent_id?: string;status?: string;- failure_reason?: string | null;outputs?: unknown;};@@ -35,7 +34,6 @@ function BlockDetailWorkflowTrigger({ block }: Props) {return (<div className="space-y-4 px-3 py-3 empty:hidden">- <BlockDetailFailure block={block} />{subRun?.workflow_run_id && (<Section title="Triggered run"><div className="flex flex-wrap items-center gap-2 text-xs">@@ -56,13 +54,6 @@ function BlockDetailWorkflowTrigger({ block }: Props) {</div></Section>)}- {subRun?.failure_reason && (- <Section title="Sub-workflow failure">- <div className="rounded border border-destructive/40 bg-destructive/10 px-2.5 py-2 text-xs leading-relaxed text-destructive">- {subRun.failure_reason}- </div>- </Section>- )}{hasSubRunOutput && (<Section title="Sub-workflow output"><JsonView value={subRun!.outputs} />diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.test.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.test.tsxindex 5ea7f9ca5..9c5914885 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.test.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.test.tsx@@ -150,3 +150,37 @@ describe("BlockInspector Inputs tab", () => {expect(screen.getByText("Fill out the form")).toBeDefined();});});++describe("BlockInspector failure scoping", () => {+ it("shows the failure reason on Summary and not on the other sub-panels", () => {+ const block = buildBlock({+ failure_reason: "Element not found",+ });+ render(<BlockInspector block={block} />);++ expect(screen.getByText("Failure")).toBeDefined();+ expect(screen.getByText("Element not found")).toBeDefined();++ fireEvent.mouseDown(screen.getByRole("tab", { name: "Inputs" }));+ expect(screen.queryByText("Element not found")).toBeNull();+ });++ it("opens on Summary for a failed block even when output exists", () => {+ const block = buildBlock({+ failure_reason: "Element not found",+ output: { result: "partial" },+ });+ render(<BlockInspector block={block} />);++ // Default tab is Summary (not Outputs), so the failure is visible on load.+ expect(screen.getByText("Element not found")).toBeDefined();+ });++ it("surfaces the block failure on Summary when an action is selected", () => {+ const block = buildBlock({ failure_reason: "Login rejected" });+ const action = buildAction({ action_type: ActionTypes.Click });+ render(<BlockInspector block={block} action={action} />);++ expect(screen.getByText("Login rejected")).toBeDefined();+ });+});diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.tsxindex 032a38209..2f99cc38f 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.tsx@@ -19,6 +19,7 @@ import {shouldShowExtractedInformation,type WorkflowRunBlock,} from "../../types/workflowRunTypes";+import { BlockDetailFailure } from "./shared";type InspectorField = {label: string;@@ -380,7 +381,6 @@ function getSummaryFields(block: WorkflowRunBlock): Array<InspectorField> {const fields: Array<InspectorField> = [];pushField(fields, "Task ID", block.task_id);pushField(fields, "Engine", block.engine);- pushField(fields, "Failure reason", block.failure_reason);pushField(fields, "Executed branch", block.executed_branch_expression);pushField(fields, "Executed branch result", block.executed_branch_result);pushField(fields, "Executed next block", block.executed_branch_next_block);@@ -543,7 +543,13 @@ function BlockInspector({const outputTabLabel = showsExtractedInformation? "Extracted Information": "Outputs";- const defaultTab = hasOutput ? "outputs" : "summary";+ // A failed block/action opens on Summary so its failure reason (the only+ // place it now renders) is visible without hunting through tabs.+ const defaultTab = block.failure_reason+ ? "summary"+ : hasOutput+ ? "outputs"+ : "summary";const [activeTab, setActiveTab] = useState(defaultTab);const diagnosticsTaskId = action?.task_id ?? block.task_id;const diagnosticsStepIndex = action@@ -599,7 +605,8 @@ function BlockInspector({</Link>)}</TabsList>- <TabsContent value="summary" className="m-0">+ <TabsContent value="summary" className="m-0 space-y-3">+ <BlockDetailFailure block={block} /><FieldListfields={summaryFields}emptyText="No additional summary data."