Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
feat(SKY-12773): show created/queued/started/finished run timing in the Studio run summary (#7646)
Celal Zamanoğlu534029a017ac
diff --git a/skyvern-frontend/src/api/types.ts b/skyvern-frontend/src/api/types.tsindex f2341b5fe..18b493bdc 100644--- a/skyvern-frontend/src/api/types.ts+++ b/skyvern-frontend/src/api/types.ts@@ -829,6 +829,7 @@ export type WorkflowRunStatusApiResponse = {webhook_callback_url: string | null;extra_http_headers: Record<string, string> | null;created_at: string;+ queued_at: string | null;started_at: string | null;finished_at: string;modified_at: string;@@ -869,6 +870,7 @@ export type WorkflowRunStatusApiResponseWithWorkflow = {webhook_callback_url: string | null;extra_http_headers: Record<string, string> | null;created_at: string;+ queued_at: string | null;started_at: string | null;finished_at: string;modified_at: string;diff --git a/skyvern-frontend/src/routes/workflows/studio/runProjections.test.ts b/skyvern-frontend/src/routes/workflows/studio/runProjections.test.tsindex 79d8d07f0..be90d814b 100644--- a/skyvern-frontend/src/routes/workflows/studio/runProjections.test.ts+++ b/skyvern-frontend/src/routes/workflows/studio/runProjections.test.ts@@ -1,6 +1,11 @@import { describe, expect, test } from "vitest";-import { ActionsApiResponse, Status, TaskV2 } from "@/api/types";+import {+ ActionsApiResponse,+ Status,+ TaskV2,+ type WorkflowRunStatusApiResponseWithWorkflow,+} from "@/api/types";import {WorkflowRunBlock,WorkflowRunTimelineBlockItem,@@ -11,6 +16,7 @@ import {buildBlockStatusMap,buildFilmstrip,finalizedRunStatus,+ formatRunTimesTooltip,runHasOutputs,runOutcomeFromStatus,} from "./runProjections";@@ -447,3 +453,38 @@ describe("buildActionIndex", () => {expect(buildActionIndex(undefined).size).toBe(0);});});++describe("formatRunTimesTooltip", () => {+ function run(+ overrides: Partial<WorkflowRunStatusApiResponseWithWorkflow> = {},+ ): WorkflowRunStatusApiResponseWithWorkflow {+ return {+ status: Status.Completed,+ created_at: "2026-06-30T23:59:00Z",+ queued_at: "2026-06-30T23:59:30Z",+ started_at: "2026-07-01T00:00:00Z",+ finished_at: "2026-07-01T00:05:00Z",+ ...overrides,+ } as WorkflowRunStatusApiResponseWithWorkflow;+ }++ test("lists created, queued, started, finished for a finalized run", () => {+ const title = formatRunTimesTooltip(run());+ expect(title).toContain("Created");+ expect(title).toContain("Queued");+ expect(title).toContain("Started");+ expect(title).toContain("Finished");+ expect(title.split("\n")).toHaveLength(4);+ });++ test("omits absent timestamps and holds Finished until the run finalizes", () => {+ const title = formatRunTimesTooltip(+ run({ status: Status.Running, queued_at: null, started_at: null }),+ );+ expect(title).toContain("Created");+ expect(title).not.toContain("Queued");+ expect(title).not.toContain("Started");+ // finished_at is present but the run is not finalized → still hidden.+ expect(title).not.toContain("Finished");+ });+});diff --git a/skyvern-frontend/src/routes/workflows/studio/runProjections.ts b/skyvern-frontend/src/routes/workflows/studio/runProjections.tsindex 67e06a4ea..ce5a75b4e 100644--- a/skyvern-frontend/src/routes/workflows/studio/runProjections.ts+++ b/skyvern-frontend/src/routes/workflows/studio/runProjections.ts@@ -12,7 +12,7 @@ import {} from "@/routes/workflows/types/workflowRunTypes";import { flattenTimelineChronologically } from "@/routes/workflows/workflowRun/workflowTimelineUtils";import { isRecord } from "@/util/utils";-import { normalizeUtcTimestamp } from "@/util/timeFormat";+import { basicLocalTimeFormat, normalizeUtcTimestamp } from "@/util/timeFormat";export type RunOutcome = "idle" | "running" | "failed" | "success";@@ -40,6 +40,30 @@ export function formatElapsed(return `${Math.floor(sec / 60)}m ${sec % 60}s`;}+// The elapsed value's hover tooltip: the full created/queued/started/finished+// breakdown, one per line, omitting timestamps the run doesn't have yet.+export function formatRunTimesTooltip(+ workflowRun: WorkflowRunStatusApiResponseWithWorkflow,+): string {+ const finalized = statusIsFinalized(workflowRun);+ return [+ workflowRun.created_at+ ? `Created ${basicLocalTimeFormat(workflowRun.created_at)}`+ : null,+ workflowRun.queued_at+ ? `Queued ${basicLocalTimeFormat(workflowRun.queued_at)}`+ : null,+ workflowRun.started_at+ ? `Started ${basicLocalTimeFormat(workflowRun.started_at)}`+ : null,+ finalized && workflowRun.finished_at+ ? `Finished ${basicLocalTimeFormat(workflowRun.finished_at)}`+ : null,+ ]+ .filter(Boolean)+ .join("\n");+}+export function runOutcomeFromStatus(status: Status | null | undefined,): RunOutcome {diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsxindex 7d9c9fcbf..f6d283818 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.test.tsx@@ -19,6 +19,8 @@ function makeRun(return {workflow_run_id: "wr_123",status: Status.Completed,+ created_at: "2026-06-30T23:59:00Z",+ queued_at: "2026-06-30T23:59:30Z",started_at: "2026-07-01T00:00:00Z",finished_at: "2026-07-01T00:05:00Z",failure_category: null,@@ -31,7 +33,7 @@ function makeRun(function renderStrip(run: WorkflowRunStatusApiResponseWithWorkflow) {return render(<MemoryRouter>- <RunSummaryStrip workflowRun={run} elapsed="5m" />+ <RunSummaryStrip workflowRun={run} /></MemoryRouter>,);}@@ -58,8 +60,40 @@ describe("RunSummaryStrip browser session/profile links", () => {expect(screen.queryByTitle("Browser profile")).toBeNull();});- test("renders no meta line when the run has neither", () => {+ test("renders the run id but no resource links when the run has neither", () => {renderStrip(makeRun());+ expect(screen.getByText("wr_123")).toBeTruthy();expect(screen.queryByRole("link")).toBeNull();});++ test("groups the run id with the browser session and profile ids", () => {+ renderStrip(+ makeRun({+ browser_session_id: "pbs_abc",+ browser_profile_id: "bp_def",+ }),+ );+ expect(screen.getByText("wr_123")).toBeTruthy();+ expect(screen.getByText("pbs_abc")).toBeTruthy();+ expect(screen.getByText("bp_def")).toBeTruthy();+ });+});++describe("RunSummaryStrip visible dates", () => {+ test("shows started and finished as separate chips for a finalized run", () => {+ renderStrip(makeRun());+ expect(screen.getByText(/^Started /)).toBeTruthy();+ expect(screen.getByText(/^Finished /)).toBeTruthy();+ });++ test("shows started without finished while the run is not finalized", () => {+ renderStrip(makeRun({ status: Status.Running }));+ expect(screen.getByText(/^Started /)).toBeTruthy();+ expect(screen.queryByText(/^Finished /)).toBeNull();+ });++ test("renders no dates when the run has not started", () => {+ renderStrip(makeRun({ status: Status.Running, started_at: null }));+ expect(screen.queryByText(/^Started /)).toBeNull();+ });});diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsxindex 2e7900117..9b0a4b5ac 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunSummaryStrip.tsx@@ -1,4 +1,3 @@-import { ClockIcon } from "@radix-ui/react-icons";import { Link } from "react-router-dom";import { type WorkflowRunStatusApiResponseWithWorkflow } from "@/api/types";@@ -6,99 +5,98 @@ import { CopyButton } from "@/components/CopyButton";import { FailureCategoryBadge } from "@/components/FailureCategoryBadge";import { StatusBadge } from "@/components/StatusBadge";import { statusIsFinalized } from "@/routes/tasks/types";-import { basicLocalTimeFormat } from "@/util/timeFormat";+import { compactLocalDateTime } from "@/util/timeFormat";type RunSummaryStripProps = {workflowRun: WorkflowRunStatusApiResponseWithWorkflow;- elapsed: string;};-function RunResourceLink({+function RunIdChip({label,id,to,}: {label: string;id: string;- to: string;+ to?: string;}) {return (- <span className="flex min-w-0 items-center gap-1">- <Link- to={to}- title={label}- className="truncate font-mono text-xs text-muted-foreground underline-offset-4 hover:text-foreground hover:underline"- >- {id}- </Link>+ <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>);}/**- * One meta line atop the Timeline view: status · duration · run id. Counts- * (blocks/actions/steps/credits) live in the timeline's own header row, and- * started/finished timestamps ride the duration tooltip, so the strip never- * eats the timeline's vertical budget. Runs with a browser session/profile get- * a second quiet line linking them (same targets as the legacy run header).+ * Two compact meta rows atop the Timeline view. Row one: the status badge next+ * to the run's started/finished timestamps. Row two: the run id — plus its+ * browser session/profile when present — as copyable, truncating chips. Both+ * rows wrap gracefully under width pressure (dates stack rather than mangle+ * mid-word; ids truncate with the full value on hover/copy). Elapsed time and+ * the counts (blocks/actions/steps/credits) live in the timeline's own header.*/-export function RunSummaryStrip({- workflowRun,- elapsed,-}: RunSummaryStripProps) {+export function RunSummaryStrip({ workflowRun }: RunSummaryStripProps) {const finalized = statusIsFinalized(workflowRun);- const timesTooltip = [+ const dateChips = [workflowRun.started_at- ? `Started ${basicLocalTimeFormat(workflowRun.started_at)}`+ ? `Started ${compactLocalDateTime(workflowRun.started_at)}`: null,finalized && workflowRun.finished_at- ? `Finished ${basicLocalTimeFormat(workflowRun.finished_at)}`+ ? `Finished ${compactLocalDateTime(workflowRun.finished_at)}`: null,- ]- .filter(Boolean)- .join(" · ");+ ].filter((chip): chip is string => Boolean(chip));return (<div className="flex shrink-0 flex-col gap-2">- <div className="flex min-w-0 items-center gap-2">+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1"><StatusBadge status={workflowRun.status} />{workflowRun.failure_category?.length ? (<FailureCategoryBadgefailureCategory={workflowRun.failure_category}/>) : null}- <span- title={timesTooltip || undefined}- className="flex shrink-0 items-center gap-1 text-xs text-muted-foreground"- >- <ClockIcon className="h-3.5 w-3.5" />- {elapsed}- </span>- <span className="min-w-0 flex-1" />- <span className="truncate font-mono text-xs text-muted-foreground">- {workflowRun.workflow_run_id}- </span>- <CopyButton value={workflowRun.workflow_run_id} />+ {dateChips.map((chip) => (+ <span+ key={chip}+ className="whitespace-nowrap text-xs text-muted-foreground"+ >+ {chip}+ </span>+ ))}+ </div>+ <div className="flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1">+ <RunIdChip label="Run" id={workflowRun.workflow_run_id} />+ {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>- {workflowRun.browser_session_id || workflowRun.browser_profile_id ? (- <div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1">- {workflowRun.browser_session_id ? (- <RunResourceLink- label="Browser session"- id={workflowRun.browser_session_id}- to={`/browser-session/${workflowRun.browser_session_id}/stream`}- />- ) : null}- {workflowRun.browser_profile_id ? (- <RunResourceLink- label="Browser profile"- id={workflowRun.browser_profile_id}- to={`/browser-profiles/${workflowRun.browser_profile_id}`}- />- ) : null}- </div>- ) : null}</div>);}diff --git a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsxindex 6511a9152..d725c146f 100644--- a/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx+++ b/skyvern-frontend/src/routes/workflows/studio/runview/RunView.tsx@@ -28,6 +28,7 @@ import { getOrderedRunParameters } from "../../utils";import {buildFilmstrip,formatElapsed,+ formatRunTimesTooltip,runHasOutputs,runOutcomeFromStatus,} from "../runProjections";@@ -348,6 +349,7 @@ export function RunView({workflowRun.started_at ?? workflowRun.created_at ?? null,finalized ? (workflowRun.finished_at ?? null) : null,);+ const elapsedTitle = formatRunTimesTooltip(workflowRun);return (<div className="flex h-full min-h-0 w-full flex-col">@@ -408,7 +410,7 @@ export function RunView({{view === "timeline" ? (<div className="flex min-h-0 flex-1 flex-col gap-3">- <RunSummaryStrip workflowRun={workflowRun} elapsed={elapsed} />+ <RunSummaryStrip workflowRun={workflowRun} /><ResizableTimelineSplitclassName="flex-1"top={@@ -417,6 +419,8 @@ export function RunView({workflowRunId={workflowRunId}hideLiveBadgeenableSearch+ elapsed={elapsed}+ elapsedTitle={elapsedTitle}activeItem={activeItem}activeIteration={activeIteration}onActionItemSelected={(item) => {diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.test.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.test.tsxindex bd458c4c5..1b1db07fa 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.test.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.test.tsx@@ -144,6 +144,8 @@ function renderTimeline(activeItem: WorkflowRunOverviewActiveElement,options: {enableSearch?: boolean;+ elapsed?: string;+ elapsedTitle?: string;onBlockItemSelected?: (block: WorkflowRunBlock) => void;} = {},) {@@ -151,6 +153,8 @@ function renderTimeline(<WorkflowRunTimelineactiveItem={activeItem}enableSearch={options.enableSearch}+ elapsed={options.elapsed}+ elapsedTitle={options.elapsedTitle}onLiveStreamSelected={noop}onActionItemSelected={noop}onBlockItemSelected={options.onBlockItemSelected ?? noop}@@ -454,6 +458,45 @@ describe("WorkflowRunTimeline", () => {});});+describe("timeline header elapsed", () => {+ function seed() {+ mocks.workflowRun = {+ status: Status.Completed,+ total_steps: 0,+ credits_used: 0,+ cached_credits_used: 0,+ workflow: {+ workflow_definition: { blocks: [], finally_block_label: null },+ },+ };+ mocks.timeline = [+ buildBlockItem(+ buildBlock({ workflow_run_block_id: "wrb_a", label: "A" }),+ ),+ ];+ }++ it("shows the elapsed duration with the timestamp breakdown on its tooltip", () => {+ seed();++ renderTimeline(null, {+ elapsed: "18m 55s",+ elapsedTitle: "Created Jun 30\nStarted Jul 1",+ });++ const el = screen.getByText("· 18m 55s");+ expect(el.getAttribute("title")).toContain("Created");+ });++ it("renders no duration when elapsed is omitted (legacy parity)", () => {+ seed();++ renderTimeline(null);++ expect(screen.queryByText(/· \d+m/)).toBeNull();+ });+});+describe("timeline block search", () => {function seed(blocks: Array<WorkflowRunBlock>) {mocks.workflowRun = {diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsxindex 81b37fe86..11d8626c0 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx@@ -56,6 +56,11 @@ type Props = {// Opt-in label search + jump-to-block; off by default so the legacy run// view renders no search UI and stays unchanged.enableSearch?: boolean;+ // Studio surfaces the run's elapsed time here, next to the counts, with the+ // created/queued/started/finished breakdown on its hover tooltip. Legacy+ // passes neither and renders no duration.+ elapsed?: string;+ elapsedTitle?: string;onLiveStreamSelected: () => void;onActionItemSelected: (item: ActionItem) => void;onBlockItemSelected: (item: WorkflowRunBlock) => void;@@ -226,6 +231,8 @@ function WorkflowRunTimeline({workflowRunId,hideLiveBadge = false,enableSearch = false,+ elapsed,+ elapsedTitle,onLiveStreamSelected,onActionItemSelected,onBlockItemSelected,@@ -394,6 +401,14 @@ function WorkflowRunTimeline({<span className="font-medium text-foreground dark:text-slate-200">Timeline</span>+ {elapsed ? (+ <span+ className="text-muted-foreground dark:text-slate-500"+ title={elapsedTitle || undefined}+ >+ · {elapsed}+ </span>+ ) : null}{totalBlocks > 0 && (<spanclassName="text-muted-foreground dark:text-slate-500"