Skip to content

Automate browser based workflows with AI

fix(SKY-11525): make studio run failure banner dismissable (#6892)

Celal Zamanoğluca128c4cb8e2
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx
index 78020b0d2..1e18d2bcd 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.test.tsx
@@ -1,6 +1,6 @@
// @vitest-environment jsdom
-import { cleanup, render, screen } from "@testing-library/react";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { useRunViewStore } from "@/store/RunViewStore";
@@ -56,3 +56,31 @@ describe("RunHero block-run stream", () => {
expect(screen.queryByTestId("run-stream-slot")).not.toBeNull();
});
});
+
+describe("RunHero failure banner", () => {
+ const failedProps = {
+ ...baseProps,
+ showDebugStream: true,
+ running: false,
+ failed: true,
+ failureReason: "for_loop block failed.",
+ };
+
+ test("shows the failure reason with a dismiss button when the run failed", () => {
+ render(<RunHero {...failedProps} />);
+ expect(screen.queryByText("for_loop block failed.")).not.toBeNull();
+ expect(screen.queryByRole("button", { name: "Dismiss" })).not.toBeNull();
+ });
+
+ test("dismiss hides the failure banner", () => {
+ render(<RunHero {...failedProps} />);
+ fireEvent.click(screen.getByRole("button", { name: "Dismiss" }));
+ expect(screen.queryByText("for_loop block failed.")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Dismiss" })).toBeNull();
+ });
+
+ test("no failure banner when the run has not failed", () => {
+ render(<RunHero {...failedProps} failed={false} />);
+ expect(screen.queryByRole("button", { name: "Dismiss" })).toBeNull();
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx
index 29608fb18..df8edf864 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunHero.tsx
@@ -2,6 +2,7 @@ import { type ReactNode, useEffect, useState } from "react";
import {
CodeIcon,
CounterClockwiseClockIcon,
+ Cross2Icon,
ExclamationTriangleIcon,
GlobeIcon,
PlayIcon,
@@ -104,9 +105,13 @@ export function RunHero({
const [streamUrl, setStreamUrl] = useState<string | null>(null);
// Block runs default to the live debug stream; this opts into the recording.
const [recordingOpen, setRecordingOpen] = useState(false);
+ // The failure banner is dismissable; the route reuses this instance across
+ // runs, so clear the dismissal whenever the run changes.
+ const [failureDismissed, setFailureDismissed] = useState(false);
useEffect(() => {
setStreamUrl(null);
setRecordingOpen(false);
+ setFailureDismissed(false);
}, [workflowRunId]);
const scrubbing = pinnedFrameId != null && pinnedFrameId !== "stream";
@@ -334,13 +339,25 @@ export function RunHero({
) : null}
{failed &&
+ !failureDismissed &&
!scrubbing &&
(center === "screenshot" ||
(showDebugStream && center === "stream")) ? (
<div className="absolute inset-x-0 bottom-0 m-4 rounded-lg border border-destructive/40 bg-slate-elevation1/95 p-4 shadow-lg backdrop-blur">
- <div className="flex items-center gap-2 text-sm font-semibold text-foreground">
- <ExclamationTriangleIcon className="h-4 w-4 text-destructive" />
- {failureReason ?? "The run failed."}
+ <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" />
+ <span className="min-w-0 flex-1">
+ {failureReason ?? "The run failed."}
+ </span>
+ <button
+ type="button"
+ onClick={() => setFailureDismissed(true)}
+ className="-mr-1 -mt-1 shrink-0 rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ aria-label="Dismiss"
+ title="Dismiss"
+ >
+ <Cross2Icon className="h-4 w-4" />
+ </button>
</div>
<div className="mt-3 flex flex-wrap gap-2">
{onFix ? (