Skip to content

Automate browser based workflows with AI

Increase loop block iteration limit from 500 to 1000 (SKY-13310) (#7907)

Suchintan0dc37aab0b0e
diff --git a/docs/api-reference/openapi.json b/docs/api-reference/openapi.json
index 071dcf67d..47850cca7 100644
--- a/docs/api-reference/openapi.json
+++ b/docs/api-reference/openapi.json
@@ -26468,7 +26468,7 @@
"condition"
],
"title": "WhileLoopBlock",
- "description": "Loop block driven by a runtime condition. Iterates while ``condition`` evaluates truthy.\n\nTop-of-loop semantics: the condition is evaluated *before* each iteration (including the\nfirst). If the condition is false on the first check, the body never runs and the block\nreturns success with an empty output list.\n\nSafety: the loop is capped at ``DEFAULT_MAX_LOOP_ITERATIONS`` (500). Reaching the cap is\ntreated as a failure so that a misbehaving condition can never spin forever."
+ "description": "Loop block driven by a runtime condition. Iterates while ``condition`` evaluates truthy.\n\nTop-of-loop semantics: the condition is evaluated *before* each iteration (including the\nfirst). If the condition is false on the first check, the body never runs and the block\nreturns success with an empty output list.\n\nSafety: the loop is capped at ``DEFAULT_MAX_LOOP_ITERATIONS`` (1000). Reaching the cap is\ntreated as a failure so that a misbehaving condition can never spin forever."
},
"WhileLoopBlockYAML": {
"properties": {
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShell.test.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioShell.test.tsx
index 545d91585..c15b7baac 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioShell.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShell.test.tsx
@@ -2,18 +2,29 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { TooltipProvider } from "@/components/ui/tooltip";
+import { copyText } from "@/util/copyText";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { StudioPane } from "./StudioShell";
+vi.mock("@/util/copyText", () => ({ copyText: vi.fn() }));
+
+const mockedCopyText = vi.mocked(copyText);
+
// Chromium aborts a native drag when the DOM mutates inside the dragstart
// task, so the reorder state (drop overlays, source dim) must engage on a
// later task. These tests pin that timing contract; only a real mouse drag
// can prove the native drag itself survives.
-describe("StudioPane header drag", () => {
+describe("StudioPane header", () => {
const dataTransfer = () => ({ setData: vi.fn(), effectAllowed: "" });
- const renderPane = () => {
+ const renderPane = ({
+ id = "copilot",
+ runId,
+ }: {
+ id?: "copilot" | "overview";
+ runId?: string;
+ } = {}) => {
const reorder = {
draggingId: null,
placement: null,
@@ -25,7 +36,8 @@ describe("StudioPane header drag", () => {
render(
<TooltipProvider delayDuration={0}>
<StudioPane
- id="copilot"
+ id={id}
+ runId={runId}
open
order={0}
flex={undefined}
@@ -38,7 +50,9 @@ describe("StudioPane header drag", () => {
);
return {
reorder,
- header: screen.getByRole("group", { name: "Copilot pane header" }),
+ header: screen.getByRole("group", {
+ name: `${id === "overview" ? "Run" : "Copilot"} pane header`,
+ }),
};
};
@@ -48,6 +62,7 @@ describe("StudioPane header drag", () => {
afterEach(() => {
vi.useRealTimers();
+ vi.clearAllMocks();
});
test("dragstart sets the drag payload synchronously but engages reorder on a later task", () => {
@@ -91,4 +106,36 @@ describe("StudioPane header drag", () => {
vi.runAllTimers();
expect(reorder.onStart).not.toHaveBeenCalled();
});
+
+ test("a drag starting on the run id copy control is prevented", () => {
+ const { reorder, header } = renderPane({
+ id: "overview",
+ runId: "wr_5574abcdef",
+ });
+
+ fireEvent.pointerDown(
+ screen.getByRole("button", { name: "Copy to clipboard" }),
+ );
+ const notPrevented = fireEvent.dragStart(header, {
+ dataTransfer: dataTransfer(),
+ });
+
+ expect(notPrevented).toBe(false);
+ vi.runAllTimers();
+ expect(reorder.onStart).not.toHaveBeenCalled();
+ });
+
+ test("shows the full run id on hover and copies it from the header control", () => {
+ const runId = "wr_5574abcdef";
+ renderPane({ id: "overview", runId });
+
+ expect(screen.getByText("Run: wr_5574…")).toBeTruthy();
+ const fullRunId = screen.getByText(`Run: ${runId}`);
+ expect(fullRunId.getAttribute("title")).toBe(`Run: ${runId}`);
+ expect(fullRunId.className).toContain("truncate");
+
+ fireEvent.click(screen.getByRole("button", { name: "Copy to clipboard" }));
+
+ expect(mockedCopyText).toHaveBeenCalledWith(runId);
+ });
});
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx
index c4d89bb42..3c0f66974 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioShell.tsx
@@ -10,6 +10,7 @@ import { createPortal } from "react-dom";
import { useWorkflowPermanentId } from "@/routes/workflows/WorkflowPermanentIdContext";
import { Cross2Icon } from "@radix-ui/react-icons";
+import { CopyButton } from "@/components/CopyButton";
import {
Tooltip,
TooltipContent,
@@ -87,6 +88,45 @@ type PaneReorder = {
onMove: (direction: -1 | 1) => void;
};
+function RunPaneLabel({
+ label,
+ runId,
+ dragHint,
+}: {
+ label: string;
+ runId: string;
+ dragHint: string;
+}) {
+ return (
+ <span className="group/runlabel inline-flex min-w-0 items-center text-xs font-medium text-foreground">
+ <span
+ className="inline group-focus-within/runlabel:hidden group-hover/runlabel:hidden"
+ title={dragHint}
+ >
+ {label}
+ </span>
+ <span
+ className="hidden min-w-0 truncate group-focus-within/runlabel:inline-block group-hover/runlabel:inline-block"
+ title={`Run: ${runId}`}
+ >
+ Run: {runId}
+ </span>
+ <span
+ className={cn(
+ "inline-flex w-0 overflow-hidden opacity-0 transition-all",
+ "group-hover/runlabel:ml-1 group-hover/runlabel:w-5 group-hover/runlabel:opacity-100",
+ "group-focus-within/runlabel:ml-1 group-focus-within/runlabel:w-5 group-focus-within/runlabel:opacity-100",
+ )}
+ >
+ <CopyButton
+ value={runId}
+ className="h-5 w-5 shrink-0 p-0.5 text-muted-foreground hover:text-foreground"
+ />
+ </span>
+ </span>
+ );
+}
+
export function StudioPane({
id,
runId,
@@ -242,12 +282,20 @@ export function StudioPane({
<Icon className="size-3.5 text-muted-foreground" aria-hidden />
{iconBadge}
</span>
- <span
- className="min-w-0 truncate text-xs font-medium text-foreground"
- title={`Drag to reorder the ${accessibleLabel} pane (or Ctrl/Cmd+Shift+←/→)`}
- >
- {label}
- </span>
+ {id === "overview" && runId ? (
+ <RunPaneLabel
+ label={label}
+ runId={runId}
+ dragHint={`Drag to reorder the ${accessibleLabel} pane (or Ctrl/Cmd+Shift+←/→)`}
+ />
+ ) : (
+ <span
+ className="min-w-0 truncate text-xs font-medium text-foreground"
+ title={`Drag to reorder the ${accessibleLabel} pane (or Ctrl/Cmd+Shift+←/→)`}
+ >
+ {label}
+ </span>
+ )}
<StudioPaneCompactContext.Provider value={compact}>
{headerExtras}
<span className="min-w-0 flex-1" />
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.tsx
index 83c213486..07c5430e3 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunInputsSection.tsx
@@ -1,3 +1,5 @@
+import { Link } from "react-router-dom";
+
import { CopyButton } from "@/components/CopyButton";
import { workflowBlockTitle } from "@/routes/workflows/editor/nodes/types";
@@ -6,7 +8,9 @@ import type { BlockPrompt } from "./blockPrompts";
import { OverviewField } from "./OverviewField";
import { ClampedProse, RunFieldValue } from "./RunFieldValue";
-export type RunInputMeta = { label: string; value: string };
+export type RunInputMeta = { label: string; value: string; to?: string };
+
+const metaValueClassName = "min-w-0 flex-1 break-words text-sm text-foreground";
type RunInputsSectionProps = {
// Ordered [key, value, definition] entries for the agent (workflow) inputs this run used.
@@ -104,8 +108,17 @@ export function RunInputsSection({
<span className="w-32 shrink-0 pt-px text-[11px] font-medium uppercase tracking-wide text-muted-foreground">
{entry.label}
</span>
- <span className="min-w-0 flex-1 break-words text-sm text-foreground">
- {entry.value}
+ <span className={metaValueClassName}>
+ {entry.to ? (
+ <Link
+ to={entry.to}
+ className="underline decoration-muted-foreground/50 underline-offset-4 hover:decoration-current"
+ >
+ {entry.value}
+ </Link>
+ ) : (
+ entry.value
+ )}
</span>
<CopyButton
value={entry.value}
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx
index c6763154b..ec226c704 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx
@@ -7,7 +7,6 @@ import {
screen,
within,
} from "@testing-library/react";
-import { MemoryRouter } from "react-router-dom";
import { afterEach, describe, expect, test } from "vitest";
import {
@@ -31,65 +30,19 @@ function makeRun(
started_at: "2026-07-01T00:00:00Z",
finished_at: "2026-07-01T00:05:00Z",
failure_category: null,
- browser_session_id: null,
- browser_profile_id: null,
...overrides,
} as WorkflowRunStatusApiResponseWithWorkflow;
}
function renderStrip(run: WorkflowRunStatusApiResponseWithWorkflow) {
return render(
- <MemoryRouter>
- {/* The studio shell provides this in production (StudioShell root). */}
- <TooltipProvider delayDuration={0}>
- <RunSummaryStrip workflowRun={run} />
- </TooltipProvider>
- </MemoryRouter>,
+ // The studio shell provides this in production (StudioShell root).
+ <TooltipProvider delayDuration={0}>
+ <RunSummaryStrip workflowRun={run} />
+ </TooltipProvider>,
);
}
-describe("RunSummaryStrip browser session/profile links", () => {
- test("links the run's browser session and profile at the legacy targets", () => {
- renderStrip(
- makeRun({
- browser_session_id: "pbs_abc",
- browser_profile_id: "bp_def",
- }),
- );
- expect(
- screen.getByRole("link", { name: "pbs_abc" }).getAttribute("href"),
- ).toBe("/browser-session/pbs_abc/stream");
- expect(
- screen.getByRole("link", { name: "bp_def" }).getAttribute("href"),
- ).toBe("/browser-profiles/bp_def");
- });
-
- test("renders only the id the run has", () => {
- renderStrip(makeRun({ browser_session_id: "pbs_abc" }));
- expect(screen.getByRole("link", { name: "pbs_abc" })).toBeTruthy();
- expect(screen.queryByTitle("Browser profile")).toBeNull();
- });
-
- test("renders no id chips at all when the run has neither", () => {
- // The run id itself lives in the top bar's "View Run" tab, not the strip.
- renderStrip(makeRun());
- expect(screen.queryByText("wr_123")).toBeNull();
- expect(screen.queryByRole("link")).toBeNull();
- });
-
- test("groups the session and profile chips without the run id", () => {
- renderStrip(
- makeRun({
- browser_session_id: "pbs_abc",
- browser_profile_id: "bp_def",
- }),
- );
- expect(screen.queryByText("wr_123")).toBeNull();
- expect(screen.getByText("pbs_abc")).toBeTruthy();
- expect(screen.getByText("bp_def")).toBeTruthy();
- });
-});
-
describe("RunSummaryStrip duration", () => {
test("shows a single elapsed chip for a finalized run", () => {
renderStrip(makeRun());
@@ -138,4 +91,9 @@ describe("RunSummaryStrip status badge", () => {
// aria-label is only present in the badge's collapsible mode
expect(container.querySelector('[aria-label="completed"]')).not.toBeNull();
});
+
+ test("renders no links — ids live in the top bar and the Inputs view", () => {
+ renderStrip(makeRun());
+ expect(screen.queryByRole("link")).toBeNull();
+ });
});
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx
index c3f5b03f2..1f9ffca43 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx
@@ -1,7 +1,4 @@
-import { Link } from "react-router-dom";
-
import { type WorkflowRunStatusApiResponseWithWorkflow } from "@/api/types";
-import { CopyButton } from "@/components/CopyButton";
import { FailureCategoryBadge } from "@/components/FailureCategoryBadge";
import { StatusBadge } from "@/components/StatusBadge";
import {
@@ -18,47 +15,14 @@ type RunSummaryStripProps = {
workflowRun: WorkflowRunStatusApiResponseWithWorkflow;
};
-function RunIdChip({
- label,
- id,
- to,
-}: {
- label: string;
- id: string;
- to?: string;
-}) {
- return (
- <span className="flex min-w-0 max-w-full items-center gap-1">
- {to ? (
- <Link
- to={to}
- title={label}
- className="min-w-0 truncate font-mono text-xs text-muted-foreground underline-offset-4 hover:text-foreground hover:underline"
- >
- {id}
- </Link>
- ) : (
- <span
- title={id}
- className="min-w-0 truncate font-mono text-xs text-muted-foreground"
- >
- {id}
- </span>
- )}
- <CopyButton value={id} />
- </span>
- );
-}
-
/**
- * Compact meta rows atop the Timeline view. Row one: the status badge next to
- * the run's duration ("Ran for 50m 12s"), whose hover breaks down the full
+ * Compact meta row atop the Timeline view: the status badge next to the run's
+ * duration ("Ran for 50m 12s"), whose hover breaks down the full
* created/queued/started/finished times; runs the duration can't describe yet
* (still running, or finalized without both endpoints) fall back to the raw
- * started/finished chips. Row two, only when the run has one: the browser
- * session/profile as copyable, truncating chips — the run id itself lives in
- * the top bar's "View Run" tab. The counts (blocks/actions/steps/credits)
- * live in the timeline's own header.
+ * started/finished chips. The run id itself lives in the top bar's "View Run"
+ * tab, the browser session/profile ids in the Inputs view, and the counts
+ * (blocks/actions/steps/credits) in the timeline's own header.
*/
export function RunSummaryStrip({ workflowRun }: RunSummaryStripProps) {
const finalized = statusIsFinalized(workflowRun);
@@ -76,59 +40,37 @@ export function RunSummaryStrip({ workflowRun }: RunSummaryStripProps) {
].filter((chip): chip is string => Boolean(chip));
return (
- <div className="flex shrink-0 flex-col gap-2">
- <div className="flex flex-wrap items-center gap-x-3 gap-y-1 [container-name:status] [container-type:inline-size]">
- <StatusBadge status={workflowRun.status} collapsible />
- {workflowRun.failure_category?.length ? (
- <FailureCategoryBadge
- failureCategory={workflowRun.failure_category}
- />
- ) : null}
- {ranFor ? (
- <Tooltip>
- <TooltipTrigger asChild>
- {/* tabIndex keeps the breakdown reachable from the keyboard —
- the chip is plain text, not a control. */}
- <span
- tabIndex={0}
- className="cursor-default whitespace-nowrap text-xs text-muted-foreground"
- >
- Ran for {ranFor}
- </span>
- </TooltipTrigger>
- <TooltipContent side="bottom" className="text-left">
- {formatRunTimesTooltip(workflowRun)}
- </TooltipContent>
- </Tooltip>
- ) : (
- dateChips.map((chip) => (
+ <div className="flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 [container-name:status] [container-type:inline-size]">
+ <StatusBadge status={workflowRun.status} collapsible />
+ {workflowRun.failure_category?.length ? (
+ <FailureCategoryBadge failureCategory={workflowRun.failure_category} />
+ ) : null}
+ {ranFor ? (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ {/* tabIndex keeps the breakdown reachable from the keyboard —
+ the chip is plain text, not a control. */}
<span
- key={chip}
- className="whitespace-nowrap text-xs text-muted-foreground"
+ tabIndex={0}
+ className="cursor-default whitespace-nowrap text-xs text-muted-foreground"
>
- {chip}
+ Ran for {ranFor}
</span>
- ))
- )}
- </div>
- {workflowRun.browser_session_id || workflowRun.browser_profile_id ? (
- <div className="flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1">
- {workflowRun.browser_session_id ? (
- <RunIdChip
- label="Browser session"
- id={workflowRun.browser_session_id}
- to={`/browser-session/${workflowRun.browser_session_id}/stream`}
- />
- ) : null}
- {workflowRun.browser_profile_id ? (
- <RunIdChip
- label="Browser profile"
- id={workflowRun.browser_profile_id}
- to={`/browser-profiles/${workflowRun.browser_profile_id}`}
- />
- ) : null}
- </div>
- ) : null}
+ </TooltipTrigger>
+ <TooltipContent side="bottom" className="text-left">
+ {formatRunTimesTooltip(workflowRun)}
+ </TooltipContent>
+ </Tooltip>
+ ) : (
+ dateChips.map((chip) => (
+ <span
+ key={chip}
+ className="whitespace-nowrap text-xs text-muted-foreground"
+ >
+ {chip}
+ </span>
+ ))
+ )}
</div>
);
}
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 b5aff65b5..876900b87 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.test.tsx
@@ -365,6 +365,43 @@ describe("RunView view toggles", () => {
expect(scope.getByText("totp-identifier-1")).not.toBeNull();
});
+ test("browser session/profile ids live in the Inputs view, not the Timeline strip", () => {
+ seedCompletedRun({
+ browser_session_id: "pbs_1",
+ browser_profile_id: "bp_1",
+ });
+ const { container } = renderRunView();
+ const scope = within(container);
+
+ expect(scope.queryByText("pbs_1")).toBeNull();
+ expect(scope.queryByText("bp_1")).toBeNull();
+
+ fireEvent.click(scope.getByRole("button", { name: "Inputs" }));
+ expect(scope.getByText("Browser session")).not.toBeNull();
+ expect(
+ scope.getByRole("link", { name: "pbs_1" }).getAttribute("href"),
+ ).toBe("/browser-session/pbs_1/stream");
+ expect(scope.getByText("Browser profile")).not.toBeNull();
+ expect(scope.getByRole("link", { name: "bp_1" }).getAttribute("href")).toBe(
+ "/browser-profiles/bp_1",
+ );
+ expect(
+ scope.getAllByRole("button", { name: "Copy to clipboard" }),
+ ).toHaveLength(2);
+ });
+
+ test("a session-only run lists just the browser session in Inputs", () => {
+ seedCompletedRun({ browser_session_id: "pbs_only" });
+ const { container } = renderRunView();
+ const scope = within(container);
+
+ fireEvent.click(scope.getByRole("button", { name: "Inputs" }));
+ expect(
+ scope.getByRole("link", { name: "pbs_only" }).getAttribute("href"),
+ ).toBe("/browser-session/pbs_only/stream");
+ expect(scope.queryByText("Browser profile")).toBeNull();
+ });
+
test("Inputs view sources TOTP from task_v2 when the top-level run omits it", () => {
seedCompletedRun({
totp_verification_url: null,
diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
index 168ef8a8c..20e123c11 100644
--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx
@@ -336,14 +336,16 @@ export function RunView({
runParameters,
);
const meta: RunInputMeta[] = [];
- const pushMeta = (label: string, value: unknown) => {
+ const pushMeta = (
+ label: string,
+ value: unknown,
+ href?: (value: string) => string,
+ ) => {
if (value === null || value === undefined || value === "") {
return;
}
- meta.push({
- label,
- value: typeof value === "string" ? value : JSON.stringify(value),
- });
+ const text = typeof value === "string" ? value : JSON.stringify(value);
+ meta.push({ label, value: text, to: href?.(text) });
};
pushMeta("Webhook URL", workflowRun?.webhook_callback_url);
// Task 2.0 runs store TOTP config on task_v2, not the top-level run.
@@ -358,7 +360,16 @@ export function RunView({
);
pushMeta("Proxy", workflowRun?.proxy_location);
pushMeta("Extra HTTP headers", workflowRun?.extra_http_headers);
- pushMeta("Browser session", workflowRun?.browser_session_id);
+ pushMeta(
+ "Browser session",
+ workflowRun?.browser_session_id,
+ (id) => `/browser-session/${id}/stream`,
+ );
+ pushMeta(
+ "Browser profile",
+ workflowRun?.browser_profile_id,
+ (id) => `/browser-profiles/${id}`,
+ );
pushMeta("Run with", workflowRun?.run_with);
pushMeta("Max screenshot scrolls", workflowRun?.max_screenshot_scrolls);
return { parameters, blockPrompts, meta };
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py
index fcc05dce9..e804d9d78 100644
--- a/skyvern/forge/sdk/workflow/models/block.py
+++ b/skyvern/forge/sdk/workflow/models/block.py
@@ -369,7 +369,7 @@ def _format_payload_path_segment(key: str) -> str:
# ForLoop constants
-DEFAULT_MAX_LOOP_ITERATIONS = 500
+DEFAULT_MAX_LOOP_ITERATIONS = 1000
MAX_LOOP_OVER_VALUE_LOG_CHARS = 2000
# Persist accumulated loop output to DB every N iterations to survive timeouts.
# Trades up to N-1 iterations of data loss for O(N/K) writes instead of O(N).
@@ -2995,7 +2995,7 @@ class WhileLoopBlock(Block):
first). If the condition is false on the first check, the body never runs and the block
returns success with an empty output list.
- Safety: the loop is capped at ``DEFAULT_MAX_LOOP_ITERATIONS`` (500). Reaching the cap is
+ Safety: the loop is capped at ``DEFAULT_MAX_LOOP_ITERATIONS`` (1000). Reaching the cap is
treated as a failure so that a misbehaving condition can never spin forever.
"""