Skip to content

Automate browser based workflows with AI

feat(SKY-12191): add new-output indicator to the studio Outputs toggle (#7269)

Celal Zamanoğlu1b0c2a4b3743
diff --git a/skyvern-frontend/src/routes/workflows/studio/ViewToggle.tsx b/skyvern-frontend/src/routes/workflows/studio/ViewToggle.tsx
index 4189800d4..1ed0f06c9 100644
--- a/skyvern-frontend/src/routes/workflows/studio/ViewToggle.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/ViewToggle.tsx
@@ -18,6 +18,7 @@ export function ViewToggle({
label,
compact,
title,
+ ariaLabel,
}: {
active: boolean;
onClick: () => void;
@@ -25,13 +26,16 @@ export function ViewToggle({
label: string;
compact: boolean;
title?: string;
+ // Overrides the accessible name without changing the visible label, e.g. to
+ // append a badge's state ("Outputs, new output") to a screen reader only.
+ ariaLabel?: string;
}) {
- const tip = title ?? (compact ? label : undefined);
+ const tip = title ?? (compact ? (ariaLabel ?? label) : undefined);
const button = (
<button
type="button"
onClick={onClick}
- aria-label={label}
+ aria-label={ariaLabel ?? label}
aria-pressed={active}
className={cn(
"inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-[11px] font-medium",
diff --git a/skyvern-frontend/src/routes/workflows/studio/runProjections.test.ts b/skyvern-frontend/src/routes/workflows/studio/runProjections.test.ts
index 67c503073..79d8d07f0 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runProjections.test.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/runProjections.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, test } from "vitest";
-import { ActionsApiResponse, Status } from "@/api/types";
+import { ActionsApiResponse, Status, TaskV2 } from "@/api/types";
import {
WorkflowRunBlock,
WorkflowRunTimelineBlockItem,
@@ -11,6 +11,7 @@ import {
buildBlockStatusMap,
buildFilmstrip,
finalizedRunStatus,
+ runHasOutputs,
runOutcomeFromStatus,
} from "./runProjections";
@@ -128,6 +129,168 @@ describe("finalizedRunStatus", () => {
});
});
+describe("runHasOutputs", () => {
+ type Source = NonNullable<Parameters<typeof runHasOutputs>[0]>;
+
+ function outputsSource(overrides: Partial<Source> = {}): Source {
+ return {
+ outputs: null,
+ errors: null,
+ downloaded_files: null,
+ downloaded_file_urls: null,
+ task_v2: null,
+ webhook_failure_reason: null,
+ ...overrides,
+ };
+ }
+
+ function taskV2(overrides: Partial<TaskV2> = {}): TaskV2 {
+ return {
+ task_id: "task_1",
+ status: Status.Completed,
+ workflow_run_id: null,
+ workflow_id: null,
+ workflow_permanent_id: null,
+ prompt: null,
+ url: null,
+ created_at: "2026-01-01T00:00:00Z",
+ modified_at: "2026-01-01T00:00:00Z",
+ output: null,
+ summary: null,
+ webhook_callback_url: null,
+ webhook_failure_reason: null,
+ totp_verification_url: null,
+ totp_identifier: null,
+ proxy_location: null,
+ extra_http_headers: null,
+ ...overrides,
+ };
+ }
+
+ test("false for a missing run", () => {
+ expect(runHasOutputs(null)).toBe(false);
+ expect(runHasOutputs(undefined)).toBe(false);
+ });
+
+ test("false when every signal is empty", () => {
+ expect(runHasOutputs(outputsSource())).toBe(false);
+ });
+
+ test("true for a record-shaped error", () => {
+ expect(
+ runHasOutputs(outputsSource({ errors: [{ error_code: "E1" }] })),
+ ).toBe(true);
+ });
+
+ test("false when the errors array holds no record entries", () => {
+ // Mirrors RunView's normalizeRunOutputErrors isRecord filter.
+ const nonRecordErrors = ["not a record"] as unknown as Array<
+ Record<string, unknown>
+ >;
+ expect(runHasOutputs(outputsSource({ errors: nonRecordErrors }))).toBe(
+ false,
+ );
+ });
+
+ test("true when extracted_information has a non-null value", () => {
+ expect(
+ runHasOutputs(
+ outputsSource({ outputs: { extracted_information: { a: "b" } } }),
+ ),
+ ).toBe(true);
+ });
+
+ test("false when extracted_information values are all null", () => {
+ expect(
+ runHasOutputs(
+ outputsSource({ outputs: { extracted_information: { a: null } } }),
+ ),
+ ).toBe(false);
+ });
+
+ // extracted_information is cast to Record<string, unknown> without a runtime
+ // check (RunView.tsx), so a string/array/etc. flows through Object.values
+ // as-is. These pin that behavior against a well-meaning isRecord "cleanup".
+ test("true when extracted_information is a plain string", () => {
+ expect(
+ runHasOutputs(
+ outputsSource({ outputs: { extracted_information: "some text" } }),
+ ),
+ ).toBe(true);
+ });
+
+ test("false when extracted_information is explicitly null", () => {
+ expect(
+ runHasOutputs(
+ outputsSource({ outputs: { extracted_information: null } }),
+ ),
+ ).toBe(false);
+ });
+
+ test("false when extracted_information is an empty object", () => {
+ expect(
+ runHasOutputs(outputsSource({ outputs: { extracted_information: {} } })),
+ ).toBe(false);
+ });
+
+ test("false when extracted_information is absent from outputs", () => {
+ expect(
+ runHasOutputs(outputsSource({ outputs: { other_field: "x" } })),
+ ).toBe(false);
+ });
+
+ test("true for rich downloaded_files", () => {
+ expect(
+ runHasOutputs(
+ outputsSource({
+ downloaded_files: [
+ {
+ url: "https://example.test/a.pdf",
+ filename: "a.pdf",
+ checksum: null,
+ file_size: null,
+ modified_at: null,
+ artifact_id: null,
+ },
+ ],
+ }),
+ ),
+ ).toBe(true);
+ });
+
+ test("true for downloaded_file_urls with no rich file metadata", () => {
+ expect(
+ runHasOutputs(
+ outputsSource({
+ downloaded_file_urls: ["https://example.test/a.pdf"],
+ }),
+ ),
+ ).toBe(true);
+ });
+
+ test("true for a task 2.0 observer output", () => {
+ expect(
+ runHasOutputs(outputsSource({ task_v2: taskV2({ output: { a: 1 } }) })),
+ ).toBe(true);
+ });
+
+ test("true for a task 2.0 webhook failure reason", () => {
+ expect(
+ runHasOutputs(
+ outputsSource({
+ task_v2: taskV2({ webhook_failure_reason: "x" }),
+ }),
+ ),
+ ).toBe(true);
+ });
+
+ test("true for a top-level webhook failure reason with no task_v2", () => {
+ expect(runHasOutputs(outputsSource({ webhook_failure_reason: "x" }))).toBe(
+ true,
+ );
+ });
+});
+
describe("buildFilmstrip", () => {
test("empty or undefined timeline yields no frames", () => {
expect(buildFilmstrip(undefined)).toEqual([]);
diff --git a/skyvern-frontend/src/routes/workflows/studio/runProjections.ts b/skyvern-frontend/src/routes/workflows/studio/runProjections.ts
index 2d684e485..67e06a4ea 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runProjections.ts
+++ b/skyvern-frontend/src/routes/workflows/studio/runProjections.ts
@@ -3,6 +3,7 @@ import {
ActionType,
ReadableActionTypes,
Status,
+ WorkflowRunStatusApiResponseWithWorkflow,
} from "@/api/types";
import { statusIsAFailureType, statusIsFinalized } from "@/routes/tasks/types";
import {
@@ -10,6 +11,7 @@ import {
WorkflowRunTimelineItem,
} from "@/routes/workflows/types/workflowRunTypes";
import { flattenTimelineChronologically } from "@/routes/workflows/workflowRun/workflowTimelineUtils";
+import { isRecord } from "@/util/utils";
import { normalizeUtcTimestamp } from "@/util/timeFormat";
export type RunOutcome = "idle" | "running" | "failed" | "success";
@@ -63,6 +65,54 @@ export function finalizedRunStatus(
return statusIsFinalized({ status }) ? status : null;
}
+type RunOutputSignals = Pick<
+ WorkflowRunStatusApiResponseWithWorkflow,
+ | "outputs"
+ | "errors"
+ | "downloaded_files"
+ | "downloaded_file_urls"
+ | "task_v2"
+ | "webhook_failure_reason"
+>;
+
+// The pane-header indicator and RunView's Outputs tab both key off this; keep
+// them routed through here so they can't drift. The extracted_information cast
+// below is unsound on purpose — a string value must stay truthy via
+// Object.values, matching what RunOutputsSection actually renders.
+export function runHasOutputs(
+ workflowRun: RunOutputSignals | null | undefined,
+): boolean {
+ if (!workflowRun) {
+ return false;
+ }
+ const hasErrors =
+ Array.isArray(workflowRun.errors) && workflowRun.errors.some(isRecord);
+ const outputs = workflowRun.outputs;
+ const extractedInformation =
+ isRecord(outputs) && "extracted_information" in outputs
+ ? (outputs.extracted_information as Record<string, unknown>)
+ : null;
+ const hasExtracted =
+ extractedInformation != null &&
+ Object.values(extractedInformation).some((value) => value !== null);
+ // A raw-count check, not RunView's deduped file list — dedup only ever
+ // shrinks a non-empty input, never zeroes it out, so truthiness matches.
+ const hasDownloads =
+ (workflowRun.downloaded_files?.length ?? 0) > 0 ||
+ (workflowRun.downloaded_file_urls?.length ?? 0) > 0;
+ const hasObserverOutput = workflowRun.task_v2?.output != null;
+ const hasWebhookFailure =
+ workflowRun.task_v2?.webhook_failure_reason != null ||
+ workflowRun.webhook_failure_reason != null;
+ return (
+ hasErrors ||
+ hasExtracted ||
+ hasDownloads ||
+ hasObserverOutput ||
+ hasWebhookFailure
+ );
+}
+
export type FilmstripFrame = {
id: string;
index: number;
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunPaneHeader.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunPaneHeader.tsx
index b831a8a25..228e786b6 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunPaneHeader.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunPaneHeader.tsx
@@ -30,7 +30,7 @@ import { useIsGeneratingCode } from "../../editor/hooks/useIsGeneratingCode";
import { constructCacheKeyValue } from "../../editor/utils";
import { useWorkflowRunWithWorkflowQuery } from "../../hooks/useWorkflowRunWithWorkflowQuery";
import { PaneHeaderDivider } from "../PaneHeaderDivider";
-import { runOutcomeFromStatus } from "../runProjections";
+import { runHasOutputs, runOutcomeFromStatus } from "../runProjections";
import { studioPanelId } from "../constants";
import { useStudioPaneCompact } from "../StudioShellContext";
import { useStudioInspectedRun } from "../useStudioInspectedRun";
@@ -97,6 +97,7 @@ export function RunPaneViewToggles() {
workflowRun.status === Status.Created ||
workflowRun.status === Status.Queued;
const showLive = outcome === "running" && !provisioning;
+ const showOutputsIndicator = runHasOutputs(workflowRun) && view !== "outputs";
return (
<>
@@ -125,7 +126,20 @@ export function RunPaneViewToggles() {
onClick={() => setView("outputs")}
compact={compact}
label="Outputs"
- icon={<FileTextIcon className="h-3 w-3" />}
+ ariaLabel={
+ showOutputsIndicator ? "Outputs, content available" : undefined
+ }
+ icon={
+ <span className="relative inline-flex">
+ <FileTextIcon className="h-3 w-3" />
+ {showOutputsIndicator ? (
+ <span
+ aria-hidden
+ className="absolute -right-0.5 -top-0.5 size-1.5 rounded-full bg-primary"
+ />
+ ) : null}
+ </span>
+ }
/>
<ViewToggle
active={view === "code"}
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
index 4c873f400..2bd100a53 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
@@ -15,6 +15,7 @@ import type {
WorkflowRunBlock,
WorkflowRunTimelineItem,
} from "../../types/workflowRunTypes";
+import { StudioPaneCompactContext } from "../StudioShellContext";
import { RunPaneViewToggles } from "./RunPaneHeader";
import { RunView } from "./RunView";
@@ -223,6 +224,7 @@ function LocationSpy() {
function renderRunView(
props: Partial<Parameters<typeof RunView>[0]> = {},
initialEntry = "/",
+ compact = false,
) {
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
@@ -234,9 +236,12 @@ function renderRunView(
<MemoryRouter initialEntries={[initialEntry]}>
{/* The toggles live in the pane header (StudioShell); render them
alongside the body, under a TooltipProvider, the way the shell
- composes them. */}
+ composes them. Only headerExtras (the toggles) sit under the
+ compact context in production (StudioShell.tsx), not the body. */}
<TooltipProvider delayDuration={0}>
- <RunPaneViewToggles />
+ <StudioPaneCompactContext.Provider value={compact}>
+ <RunPaneViewToggles />
+ </StudioPaneCompactContext.Provider>
<RunView workflowRunId="wr_1" {...props} />
</TooltipProvider>
<LocationSpy />
@@ -594,7 +599,9 @@ describe("RunView output signals", () => {
const { container } = renderRunView();
const scope = within(container);
- fireEvent.click(scope.getByRole("button", { name: "Outputs" }));
+ // This run has outputs, so the toggle's accessible name carries the new-
+ // output indicator suffix; match by prefix since that's not under test here.
+ fireEvent.click(scope.getByRole("button", { name: /^Outputs/ }));
expect(scope.getByText("Run errors")).not.toBeNull();
expect(scope.getAllByText("E_INVOICE_MISSING").length).toBeGreaterThan(0);
@@ -633,3 +640,50 @@ describe("RunView output signals", () => {
expect(scope.queryByText("Downloaded files")).toBeNull();
});
});
+
+describe("RunView output indicator", () => {
+ test("the Outputs toggle carries a new-output indicator when unviewed output exists", () => {
+ seedCompletedRun({ errors: [{ error_code: "E1", reasoning: "x" }] });
+ const { container } = renderRunView();
+ const scope = within(container);
+
+ expect(
+ scope.getByRole("button", { name: "Outputs, content available" }),
+ ).not.toBeNull();
+ });
+
+ test("the indicator clears once the Outputs view is active", () => {
+ seedCompletedRun({ errors: [{ error_code: "E1", reasoning: "x" }] });
+ const { container } = renderRunView();
+ const scope = within(container);
+
+ fireEvent.click(
+ scope.getByRole("button", { name: "Outputs, content available" }),
+ );
+ expect(scope.getByRole("button", { name: "Outputs" })).not.toBeNull();
+ expect(
+ scope.queryByRole("button", { name: "Outputs, content available" }),
+ ).toBeNull();
+ });
+
+ test("no indicator when the run has no output signals", () => {
+ seedCompletedRun();
+ const { container } = renderRunView();
+ const scope = within(container);
+
+ expect(scope.getByRole("button", { name: "Outputs" })).not.toBeNull();
+ expect(
+ scope.queryByRole("button", { name: "Outputs, content available" }),
+ ).toBeNull();
+ });
+
+ test("the indicator survives the header collapsing to icon-only", () => {
+ seedCompletedRun({ errors: [{ error_code: "E1", reasoning: "x" }] });
+ const { container } = renderRunView({}, "/", true);
+ const scope = within(container);
+
+ expect(
+ scope.getByRole("button", { name: "Outputs, content available" }),
+ ).not.toBeNull();
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
index 347d30a02..ffe0bc204 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
@@ -26,6 +26,7 @@ import { getOrderedRunParameters } from "../../utils";
import {
buildFilmstrip,
formatElapsed,
+ runHasOutputs,
runOutcomeFromStatus,
} from "../runProjections";
import { toReadableSearch } from "../panes";
@@ -318,13 +319,7 @@ export function RunView({
const hasInputs =
runInputs.parameters.length > 0 || runInputs.meta.length > 0;
- const hasOutputs =
- runErrors.length > 0 ||
- (extractedInformation != null &&
- Object.values(extractedInformation).some((value) => value !== null)) ||
- downloadedFiles.length > 0 ||
- observerOutput != null ||
- webhookFailureReason != null;
+ const hasOutputs = runHasOutputs(workflowRun);
if (!workflowRun) {
return <RunPlaceholder loading={isLoading || runIdPending} />;