Skip to content

Automate browser based workflows with AI

Save Default as no block engine and label Skyvern 1.0 and 2.0 as Legacy in the engine picker (#8735)

pedrohsdb0831d8294a89
diff --git a/skyvern-frontend/src/components/EngineSelector.test.tsx b/skyvern-frontend/src/components/EngineSelector.test.tsx
index fc37967af..4db879b96 100644
--- a/skyvern-frontend/src/components/EngineSelector.test.tsx
+++ b/skyvern-frontend/src/components/EngineSelector.test.tsx
@@ -53,9 +53,7 @@ vi.mock("./ui/select", () => {
describe("RunEngineSelector", () => {
test("hides Yutori Navigator by default", () => {
- render(
- <RunEngineSelector value={RunEngine.SkyvernV1} onChange={() => {}} />,
- );
+ render(<RunEngineSelector value={null} onChange={() => {}} />);
expect(screen.queryByText("Yutori Navigator")).toBeNull();
});
@@ -88,39 +86,57 @@ describe("RunEngineSelector", () => {
expect(screen.getAllByText("Enterprise").length).toBeGreaterThan(0);
});
- test("selecting Skyvern 3.0 calls onChange with skyvern-3.0", () => {
+ test("selecting Default or Skyvern 3.0 calls onChange with null or skyvern-3.0", () => {
const onChange = vi.fn();
render(
<RunEngineSelector
- value={RunEngine.SkyvernV1}
+ value={RunEngine.SkyvernV2}
onChange={onChange}
availableEngines={[RunEngine.SkyvernV1, RunEngine.SkyvernV3]}
/>,
);
fireEvent.click(screen.getByText("Skyvern 3.0"));
+ fireEvent.click(screen.getByText("Default"));
- expect(onChange).toHaveBeenCalledWith(RunEngine.SkyvernV3);
+ expect(onChange.mock.calls).toEqual([[RunEngine.SkyvernV3], [null]]);
});
- test("falls back to Default (Skyvern 1.0, routable) when value is null", () => {
- render(<RunEngineSelector value={null} onChange={() => {}} />);
+ test.each([
+ [null, /follows engine routing/],
+ [RunEngine.SkyvernV3, /runs on Skyvern 3\.0/],
+ ])(
+ "Default on a workflow whose effective default is %s says %s",
+ (effectiveDefaultEngine, hint) => {
+ render(
+ <RunEngineSelector
+ value={null}
+ onChange={() => {}}
+ effectiveDefaultEngine={effectiveDefaultEngine}
+ />,
+ );
- expect(screen.getAllByText("Default").length).toBeGreaterThan(0);
- });
+ expect(screen.getAllByText("Default").length).toBeGreaterThan(0);
+ expect(screen.getAllByText(hint).length).toBeGreaterThan(0);
+ },
+ );
- test("renders Default with no badge for Skyvern 1.0", () => {
- render(
- <RunEngineSelector value={RunEngine.SkyvernV1} onChange={() => {}} />,
+ test("offers Skyvern 1.0 as Legacy only where the workflow can pin it", () => {
+ const { unmount } = render(
+ <RunEngineSelector value={null} onChange={() => {}} />,
);
-
- expect(screen.getAllByText("Default").length).toBeGreaterThan(0);
- expect(
- screen.getAllByText(
- /follows routing; most new self-serve workflows run on 3\.0/,
- ),
- ).not.toHaveLength(0);
expect(screen.queryByText("Skyvern 1.0")).toBeNull();
+ unmount();
+
+ render(
+ <RunEngineSelector
+ value={null}
+ onChange={() => {}}
+ effectiveDefaultEngine={RunEngine.SkyvernV3}
+ />,
+ );
+ expect(screen.getByText("Skyvern 1.0")).toBeTruthy();
+ expect(screen.getByText("Legacy")).toBeTruthy();
});
test("marks Skyvern 3.0 as Recommended", () => {
diff --git a/skyvern-frontend/src/components/EngineSelector.tsx b/skyvern-frontend/src/components/EngineSelector.tsx
index 8e82badec..899e9ed32 100644
--- a/skyvern-frontend/src/components/EngineSelector.tsx
+++ b/skyvern-frontend/src/components/EngineSelector.tsx
@@ -10,33 +10,29 @@ import {
} from "./ui/select";
import { BadgeLabel, type BadgeVariant } from "./BadgeLabel";
+const DEFAULT_ENGINE_VALUE = "default";
+
type EngineOption = {
- value: RunEngine;
+ value: RunEngine | typeof DEFAULT_ENGINE_VALUE;
label: ReactNode;
badge?: string;
badgeVariant?: BadgeVariant;
};
-const defaultEngineLabel = (
- <span className="flex items-center gap-1.5">
- <span>Default</span>
- <span className="text-xs text-muted-foreground">
- follows routing; most new self-serve workflows run on 3.0
- </span>
- </span>
-);
-
type Props = {
value: RunEngine | null;
- onChange: (value: RunEngine) => void;
+ onChange: (value: RunEngine | null) => void;
className?: string;
availableEngines?: Array<RunEngine>;
+ effectiveDefaultEngine?: RunEngine | null;
};
-const allEngineOptions: Array<EngineOption> = [
+const engineOptions: Array<EngineOption & { value: RunEngine }> = [
{
value: RunEngine.SkyvernV1,
- label: defaultEngineLabel,
+ label: "Skyvern 1.0",
+ badge: "Legacy",
+ badgeVariant: "default",
},
{
value: RunEngine.SkyvernV2,
@@ -70,7 +66,6 @@ const allEngineOptions: Array<EngineOption> = [
},
];
-// Default engines for blocks that don't support V2 mode
const defaultEngines: Array<RunEngine> = [
RunEngine.SkyvernV1,
RunEngine.SkyvernV3,
@@ -78,25 +73,49 @@ const defaultEngines: Array<RunEngine> = [
RunEngine.AnthropicCua,
];
+function defaultOption(effectiveDefaultEngine: RunEngine | null): EngineOption {
+ return {
+ value: DEFAULT_ENGINE_VALUE,
+ label: (
+ <span className="flex items-center gap-1.5">
+ <span>Default</span>
+ <span className="text-xs text-muted-foreground">
+ {effectiveDefaultEngine === RunEngine.SkyvernV3
+ ? "runs on Skyvern 3.0"
+ : "follows engine routing"}
+ </span>
+ </span>
+ ),
+ };
+}
+
function RunEngineSelector({
value,
onChange,
className,
availableEngines,
+ effectiveDefaultEngine = null,
}: Props) {
- const engines = availableEngines ?? defaultEngines;
+ // Without a chosen-engine default, a skyvern-1.0 block is the routed Default, so it cannot be pinned.
+ const engines = (availableEngines ?? defaultEngines).filter(
+ (engine) => engine !== RunEngine.SkyvernV1 || effectiveDefaultEngine,
+ );
const visibleEngines =
value && !engines.includes(value) ? [...engines, value] : engines;
- const engineOptions = allEngineOptions.filter((opt) =>
- visibleEngines.includes(opt.value),
- );
-
- const selectedOption = engineOptions.find(
- (opt) => opt.value === (value ?? RunEngine.SkyvernV1),
- );
+ const options: Array<EngineOption> = [
+ defaultOption(effectiveDefaultEngine),
+ ...engineOptions.filter((opt) => visibleEngines.includes(opt.value)),
+ ];
+ const selectValue = value ?? DEFAULT_ENGINE_VALUE;
+ const selectedOption = options.find((opt) => opt.value === selectValue);
return (
- <Select value={value ?? RunEngine.SkyvernV1} onValueChange={onChange}>
+ <Select
+ value={selectValue}
+ onValueChange={(next) =>
+ onChange(next === DEFAULT_ENGINE_VALUE ? null : (next as RunEngine))
+ }
+ >
<SelectTrigger className={className}>
<SelectValue>
{selectedOption && (
@@ -109,7 +128,7 @@ function RunEngineSelector({
</SelectValue>
</SelectTrigger>
<SelectContent>
- {engineOptions.map((option) => (
+ {options.map((option) => (
<SelectItem key={option.value} value={option.value}>
<BadgeLabel
label={option.label}
diff --git a/skyvern-frontend/src/components/onboarding/CopilotCTAStep.tsx b/skyvern-frontend/src/components/onboarding/CopilotCTAStep.tsx
index f8b8711ba..c2db26d53 100644
--- a/skyvern-frontend/src/components/onboarding/CopilotCTAStep.tsx
+++ b/skyvern-frontend/src/components/onboarding/CopilotCTAStep.tsx
@@ -159,10 +159,10 @@ function CopilotCTAStep({
template.workflow_permanent_id,
selectedIntent,
);
- const cloned = convert({
- ...template,
- title: `${template.title} (copy)`,
- });
+ const cloned = convert(
+ { ...template, title: `${template.title} (copy)` },
+ { asNewWorkflow: true },
+ );
// flow_completed fires from useCreateWorkflowMutation (it owns the navigation
// that unmounts this modal); the navigation also dismisses the modal.
createWorkflowMutation.mutate({ ...cloned, _via: "onboarding_template" });
diff --git a/skyvern-frontend/src/components/onboarding/GetStartedModal.tsx b/skyvern-frontend/src/components/onboarding/GetStartedModal.tsx
index 47d811717..585e293be 100644
--- a/skyvern-frontend/src/components/onboarding/GetStartedModal.tsx
+++ b/skyvern-frontend/src/components/onboarding/GetStartedModal.tsx
@@ -600,10 +600,10 @@ function GetStartedModalForUser() {
template.workflow_permanent_id,
selectedIntent!,
);
- const cloned = convert({
- ...template,
- title: `${template.title} (copy)`,
- });
+ const cloned = convert(
+ { ...template, title: `${template.title} (copy)` },
+ { asNewWorkflow: true },
+ );
// Completion telemetry fires from useCreateWorkflowMutation (it owns the
// navigation that unmounts this modal); first_save_at prevents re-display,
// so no dismiss write is needed here.
diff --git a/skyvern-frontend/src/routes/discover/WorkflowTemplates.tsx b/skyvern-frontend/src/routes/discover/WorkflowTemplates.tsx
index c42634bac..359a18c1e 100644
--- a/skyvern-frontend/src/routes/discover/WorkflowTemplates.tsx
+++ b/skyvern-frontend/src/routes/discover/WorkflowTemplates.tsx
@@ -168,7 +168,10 @@ function WorkflowTemplates({ folderId }: { folderId?: string | null } = {}) {
if (!plainClick) return;
event.preventDefault();
createWorkflow.mutate({
- ...convert({ ...workflow, title: `${workflow.title} (copy)` }),
+ ...convert(
+ { ...workflow, title: `${workflow.title} (copy)` },
+ { asNewWorkflow: true },
+ ),
folder_id: folderId,
_via: TEMPLATE_VIA,
});
diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx
index 5a43d7f0c..ffba0d18c 100644
--- a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx
+++ b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx
@@ -1372,10 +1372,10 @@ function WorkflowsFlat() {
open={isTemplateDialogOpen}
onOpenChange={setIsTemplateDialogOpen}
onSelectTemplate={(template) => {
- const clonedWorkflow = convert({
- ...template,
- title: `${template.title} (copy)`,
- });
+ const clonedWorkflow = convert(
+ { ...template, title: `${template.title} (copy)` },
+ { asNewWorkflow: true },
+ );
createWorkflowMutation.mutate({
...clonedWorkflow,
folder_id: selectedFolderId,
diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx
index 8134e41a8..474791377 100644
--- a/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx
+++ b/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx
@@ -1092,10 +1092,10 @@ function WorkflowsTree() {
open={isTemplateDialogOpen}
onOpenChange={setIsTemplateDialogOpen}
onSelectTemplate={(template) => {
- const clonedWorkflow = convert({
- ...template,
- title: `${template.title} (copy)`,
- });
+ const clonedWorkflow = convert(
+ { ...template, title: `${template.title} (copy)` },
+ { asNewWorkflow: true },
+ );
createWorkflowMutation.mutate({
...clonedWorkflow,
folder_id: selectedFolderId,
diff --git a/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx b/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx
index ba46dce6a..65e8602bf 100644
--- a/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx
+++ b/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx
@@ -128,10 +128,10 @@ function BulkActionBar({
const results = await runWithConcurrency(
selectedWorkflows.map((workflow) => () => {
const yaml = convertToYAML(
- convert({
- ...workflow,
- title: `Copy of ${workflow.title}`,
- }),
+ convert(
+ { ...workflow, title: `Copy of ${workflow.title}` },
+ { asNewWorkflow: true },
+ ),
);
return client.post("/workflows", yaml, {
headers: { "Content-Type": "text/plain" },
diff --git a/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx b/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx
index 886536676..9af0f8557 100644
--- a/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx
+++ b/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx
@@ -60,7 +60,12 @@ function Debugger() {
const settings = apiWorkflowToSettings(workflow);
- const elements = getElements(blocksToRender, settings, true);
+ const elements = getElements(
+ blocksToRender,
+ settings,
+ true,
+ workflow.effective_default_engine,
+ );
return (
<div className="relative flex h-screen w-full">
diff --git a/skyvern-frontend/src/routes/workflows/editor/MakeACopyButton.tsx b/skyvern-frontend/src/routes/workflows/editor/MakeACopyButton.tsx
index bb25c0105..afccbc0c5 100644
--- a/skyvern-frontend/src/routes/workflows/editor/MakeACopyButton.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/MakeACopyButton.tsx
@@ -19,7 +19,7 @@ function MakeACopyButton() {
if (!workflow) {
return;
}
- createWorkflowMutation.mutate(convert(workflow));
+ createWorkflowMutation.mutate(convert(workflow, { asNewWorkflow: true }));
};
return (
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx
index 5625e0164..d0c416dc5 100644
--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx
@@ -102,6 +102,7 @@ function WorkflowEditor() {
blocksToRender,
settings,
!isGlobalWorkflow && !workflowDeleted,
+ workflow.effective_default_engine,
);
return (
diff --git a/skyvern-frontend/src/routes/workflows/editor/helpContent.ts b/skyvern-frontend/src/routes/workflows/editor/helpContent.ts
index 24c345403..a052a8d2c 100644
--- a/skyvern-frontend/src/routes/workflows/editor/helpContent.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/helpContent.ts
@@ -30,7 +30,7 @@ export const baseHelpTooltipContent = {
includeActionHistoryInVerification:
"Include the action history in the completion verification.",
engine:
- "Default follows the workflow's engine routing (most new self-serve workflows run on Skyvern 3.0). Choosing Skyvern 3.0 or 2.0 pins this block to that engine.",
+ "Default follows the workflow's engine routing, or runs on Skyvern 3.0 for new workflows. Choosing an engine pins this block to it.",
} as const;
export const basePlaceholderContent = {
diff --git a/skyvern-frontend/src/routes/workflows/editor/hooks/useEffectiveDefaultEngine.ts b/skyvern-frontend/src/routes/workflows/editor/hooks/useEffectiveDefaultEngine.ts
new file mode 100644
index 000000000..0c28571ed
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/editor/hooks/useEffectiveDefaultEngine.ts
@@ -0,0 +1,11 @@
+import type { RunEngine } from "@/api/types";
+import { useWorkflowPermanentId } from "@/routes/workflows/WorkflowPermanentIdContext";
+import { useWorkflowQuery } from "@/routes/workflows/hooks/useWorkflowQuery";
+
+function useEffectiveDefaultEngine(): RunEngine | null {
+ const workflowPermanentId = useWorkflowPermanentId();
+ const { data: workflow } = useWorkflowQuery({ workflowPermanentId });
+ return workflow?.effective_default_engine ?? null;
+}
+
+export { useEffectiveDefaultEngine };
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/ActionNode/ActionEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/ActionNode/ActionEditor.tsx
index 5473d48cc..235af6610 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/ActionNode/ActionEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/ActionNode/ActionEditor.tsx
@@ -8,6 +8,7 @@ import {
AccordionTrigger,
} from "@/components/ui/accordion";
import { RunEngineSelector } from "@/components/EngineSelector";
+import { useEffectiveDefaultEngine } from "../../hooks/useEffectiveDefaultEngine";
import { HelpTooltip } from "@/components/HelpTooltip";
import { Label } from "@/components/ui/label";
import { ModelSelector } from "@/components/ModelSelector";
@@ -79,6 +80,7 @@ function ActionEditorBody({
];
const { editable } = data;
const update = useUpdate<ActionNodeData>({ id: blockId, editable });
+ const effectiveDefaultEngine = useEffectiveDefaultEngine();
const nodes = useNodes<AppNode>();
const edges = useEdges();
const urlPlaceholder = isFirstBrowserTaskBlock(nodes, edges, blockId)
@@ -186,6 +188,7 @@ function ActionEditorBody({
<HelpTooltip content={helpTooltips["action"]["engine"]} />
</div>
<RunEngineSelector
+ effectiveDefaultEngine={effectiveDefaultEngine}
value={data.engine}
onChange={(value) => update({ engine: value })}
className="nopan w-52 text-xs"
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/ActionNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/ActionNode/types.ts
index e30b31e85..743a23811 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/ActionNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/ActionNode/types.ts
@@ -34,7 +34,7 @@ export const actionNodeDefaultData: ActionNodeData = {
totpIdentifier: null,
continueOnFailure: false,
disableCache: false,
- engine: RunEngine.SkyvernV1,
+ engine: null,
model: null,
ignoreWorkflowSystemPrompt: false,
} as const;
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/ExtractionNode/ExtractionEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/ExtractionNode/ExtractionEditor.tsx
index 4524b6ffd..44cc4ad13 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/ExtractionNode/ExtractionEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/ExtractionNode/ExtractionEditor.tsx
@@ -15,6 +15,7 @@ import { Textarea } from "@/components/ui/textarea";
import { WorkflowBlockInputTextarea } from "@/components/WorkflowBlockInputTextarea";
import { WorkflowDataSchemaInputGroup } from "@/components/DataSchemaInputGroup/WorkflowDataSchemaInputGroup";
import { RunEngineSelector } from "@/components/EngineSelector";
+import { useEffectiveDefaultEngine } from "../../hooks/useEffectiveDefaultEngine";
import { ModelSelector } from "@/components/ModelSelector";
import { AI_IMPROVE_CONFIGS } from "../../constants";
@@ -96,6 +97,7 @@ function ExtractionEditorBody({
];
const { editable } = data;
const update = useUpdate<ExtractionNodeData>({ id: blockId, editable });
+ const effectiveDefaultEngine = useEffectiveDefaultEngine();
const nodes = useNodes<AppNode>();
const edges = useEdges();
const outputParameterKeys = getAvailableOutputParameterKeys(
@@ -283,6 +285,7 @@ function ExtractionEditorBody({
</Label>
</div>
<RunEngineSelector
+ effectiveDefaultEngine={effectiveDefaultEngine}
value={data.engine}
onChange={(value) => update({ engine: value })}
className="nopan w-52 text-xs"
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/ExtractionNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/ExtractionNode/types.ts
index 7f5c9e205..f41d554cd 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/ExtractionNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/ExtractionNode/types.ts
@@ -46,7 +46,7 @@ export const extractionNodeDefaultData: ExtractionNodeData = {
parameterKeys: [],
continueOnFailure: false,
disableCache: false,
- engine: RunEngine.SkyvernV1,
+ engine: null,
model: null,
ignoreWorkflowSystemPrompt: false,
exportEnabled: false,
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/FileDownloadEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/FileDownloadEditor.tsx
index 8579e9d6f..64441f4f7 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/FileDownloadEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/FileDownloadEditor.tsx
@@ -3,6 +3,7 @@ import type { ReactNode } from "react";
import { BROWSER_DOWNLOAD_TIMEOUT_SECONDS } from "@/api/types";
import { RunEngineSelector } from "@/components/EngineSelector";
+import { useEffectiveDefaultEngine } from "../../hooks/useEffectiveDefaultEngine";
import { HelpTooltip } from "@/components/HelpTooltip";
import { ModelSelector } from "@/components/ModelSelector";
import { WorkflowBlockInput } from "@/components/WorkflowBlockInput";
@@ -148,6 +149,7 @@ function FileDownloadEditorBody({
const isInsideForLoop = isNodeInsideForLoop(nodes, blockId);
const parentLoopSkipsOnFail = getParentLoopSkipsOnFail(nodes, blockId);
const update = useUpdate<FileDownloadNodeData>({ id: blockId, editable });
+ const effectiveDefaultEngine = useEffectiveDefaultEngine();
const hasInteracted = useHasInteractedThisSession();
const credentialTotpIdentifier = useSelectedCredentialTotpIdentifier(
parameterKeys.length > 0 ? parameterKeys[0] : undefined,
@@ -614,6 +616,7 @@ function FileDownloadEditorBody({
</Label>
</div>
<RunEngineSelector
+ effectiveDefaultEngine={effectiveDefaultEngine}
value={engine}
onChange={(next) => update({ engine: next })}
className="nopan w-52 text-xs"
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/types.ts
index 804bb17ea..33439a9b6 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/types.ts
@@ -57,7 +57,7 @@ export const fileDownloadNodeDefaultData: FileDownloadNodeData = {
totpIdentifier: null,
continueOnFailure: false,
disableCache: false,
- engine: RunEngine.SkyvernV1,
+ engine: null,
model: null,
downloadTimeout: null,
downloadTarget: "website",
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginEditor.tsx
index bfc350525..64d3873af 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginEditor.tsx
@@ -22,6 +22,7 @@ import { Label } from "@/components/ui/label";
import { Separator } from "@/components/ui/separator";
import { Switch } from "@/components/ui/switch";
import { RunEngineSelector } from "@/components/EngineSelector";
+import { useEffectiveDefaultEngine } from "../../hooks/useEffectiveDefaultEngine";
import { ModelSelector } from "@/components/ModelSelector";
import { WorkflowBlockInputTextarea } from "@/components/WorkflowBlockInputTextarea";
import { useWorkflowParametersStore } from "@/store/WorkflowParametersStore";
@@ -88,6 +89,7 @@ function LoginEditorBody({
];
const { editable } = data;
const update = useUpdate<LoginNodeData>({ id: blockId, editable });
+ const effectiveDefaultEngine = useEffectiveDefaultEngine();
const nodes = useNodes<AppNode>();
const edges = useEdges();
const urlPlaceholder = isFirstBrowserTaskBlock(nodes, edges, blockId)
@@ -379,6 +381,7 @@ function LoginEditorBody({
</Label>
</div>
<RunEngineSelector
+ effectiveDefaultEngine={effectiveDefaultEngine}
value={data.engine}
onChange={(value) => update({ engine: value })}
className="nopan w-52 text-xs"
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts
index 1ab095529..4d2410f47 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts
@@ -39,7 +39,7 @@ export const loginNodeDefaultData: LoginNodeData = {
completeCriterion: "",
terminateCriterion: "",
includeActionHistoryInVerification: false,
- engine: RunEngine.SkyvernV1,
+ engine: null,
model: null,
ignoreWorkflowSystemPrompt: false,
} as const;
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationEditor.test.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationEditor.test.tsx
index 3139e42b6..051a46bbd 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationEditor.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationEditor.test.tsx
@@ -9,6 +9,10 @@ import { navigationNodeDefaultData, type NavigationNodeData } from "./types";
let nodeData: { type: "navigation"; data: NavigationNodeData } | null = null;
+vi.mock("../../hooks/useEffectiveDefaultEngine", () => ({
+ useEffectiveDefaultEngine: () => null,
+}));
+
vi.mock("@xyflow/react", () => ({
useNodesData: () => nodeData,
useNodes: () => [],
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationEditor.tsx
index fb5cf5bae..af0257517 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationEditor.tsx
@@ -2,6 +2,7 @@ import { useEdges, useNodes, useNodesData } from "@xyflow/react";
import { RunEngine } from "@/api/types";
import { RunEngineSelector } from "@/components/EngineSelector";
+import { useEffectiveDefaultEngine } from "../../hooks/useEffectiveDefaultEngine";
import { HelpTooltip } from "@/components/HelpTooltip";
import { ModelSelector } from "@/components/ModelSelector";
import { WorkflowBlockInput } from "@/components/WorkflowBlockInput";
@@ -71,6 +72,7 @@ function NavigationEditorBody({
}) {
const { editable } = data;
const update = useUpdate<NavigationNodeData>({ id: blockId, editable });
+ const effectiveDefaultEngine = useEffectiveDefaultEngine();
const nodes = useNodes<AppNode>();
const edges = useEdges();
const urlPlaceholder = isFirstBrowserTaskBlock(nodes, edges, blockId)
@@ -105,7 +107,7 @@ function NavigationEditorBody({
data.parameterKeys.length > 0 ? data.parameterKeys[0] : undefined,
);
- const handleEngineChange = (value: RunEngine) => {
+ const handleEngineChange = (value: RunEngine | null) => {
if (!editable) return;
const updates: Partial<NavigationNodeData> = {
engine: value,
@@ -168,6 +170,7 @@ function NavigationEditorBody({
<HelpTooltip content={helpTooltips["navigation"]["engine"]} />
</div>
<RunEngineSelector
+ effectiveDefaultEngine={effectiveDefaultEngine}
value={data.engine}
onChange={handleEngineChange}
className="nopan w-72 text-xs"
@@ -343,6 +346,7 @@ function NavigationEditorBody({
<HelpTooltip content={helpTooltips["navigation"]["engine"]} />
</div>
<RunEngineSelector
+ effectiveDefaultEngine={effectiveDefaultEngine}
value={data.engine}
onChange={handleEngineChange}
className="nopan w-72 text-xs"
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/types.ts
index b513a55be..ae051aeaa 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/types.ts
@@ -38,7 +38,7 @@ export const navigationNodeDefaultData: NavigationNodeData = {
terminateCriterion: "",
errorCodeMapping: "null",
model: { model_name: "" },
- engine: RunEngine.SkyvernV1,
+ engine: null,
maxRetries: null,
maxStepsOverride: null,
allowDownloads: false,
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskEditor.tsx
index 58bf3a548..d8d43b302 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskEditor.tsx
@@ -16,6 +16,7 @@ import { WorkflowBlockInput } from "@/components/WorkflowBlockInput";
import { WorkflowBlockInputTextarea } from "@/components/WorkflowBlockInputTextarea";
import { WorkflowDataSchemaInputGroup } from "@/components/DataSchemaInputGroup/WorkflowDataSchemaInputGroup";
import { RunEngineSelector } from "@/components/EngineSelector";
+import { useEffectiveDefaultEngine } from "../../hooks/useEffectiveDefaultEngine";
import { ModelSelector } from "@/components/ModelSelector";
import { ErrorCodeMappingEditor } from "@/routes/workflows/editor/ErrorCodeMappingEditor";
@@ -77,6 +78,7 @@ function TaskEditorBody({ blockId }: { blockId: string }) {
const data = taskNode?.data as TaskNodeData | undefined;
const editable = data?.editable ?? false;
const update = useUpdate<TaskNodeData>({ id: blockId, editable });
+ const effectiveDefaultEngine = useEffectiveDefaultEngine();
const outputParameterKeys = getAvailableOutputParameterKeys(
nodes,
edges,
@@ -252,6 +254,7 @@ function TaskEditorBody({ blockId }: { blockId: string }) {
<HelpTooltip content={helpTooltips["task"]["engine"]} />
</div>
<RunEngineSelector
+ effectiveDefaultEngine={effectiveDefaultEngine}
value={data.engine}
onChange={(value) => update({ engine: value })}
className="nopan w-52 text-xs"
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts
index 8390ce571..56c9597be 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts
@@ -45,7 +45,7 @@ export const taskNodeDefaultData: TaskNodeData = {
continueOnFailure: false,
disableCache: false,
includeActionHistoryInVerification: false,
- engine: RunEngine.SkyvernV1,
+ engine: null,
model: null,
ignoreWorkflowSystemPrompt: false,
} as const;
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/ValidationNode/ValidationEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/ValidationNode/ValidationEditor.tsx
index 8936adb1f..74dadcaf5 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/ValidationNode/ValidationEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/ValidationNode/ValidationEditor.tsx
@@ -2,6 +2,7 @@ import { useEdges, useNodes, useNodesData } from "@xyflow/react";
import { RunEngine } from "@/api/types";
import { RunEngineSelector } from "@/components/EngineSelector";
+import { useEffectiveDefaultEngine } from "../../hooks/useEffectiveDefaultEngine";
import { HelpTooltip } from "@/components/HelpTooltip";
import { ModelSelector } from "@/components/ModelSelector";
import {
@@ -81,6 +82,7 @@ function ValidationEditorBody({
const parentLoopSkipsOnFail = getParentLoopSkipsOnFail(nodes, blockId);
const isFirstWorkflowBlock = useIsFirstBlockInWorkflow({ id: blockId });
const update = useUpdate<ValidationNodeData>({ id: blockId, editable });
+ const effectiveDefaultEngine = useEffectiveDefaultEngine();
return (
<div data-testid="validation-block-form" className="space-y-4">
@@ -144,6 +146,7 @@ function ValidationEditorBody({
</Label>
</div>
<RunEngineSelector
+ effectiveDefaultEngine={effectiveDefaultEngine}
value={engine}
onChange={(next) => update({ engine: next })}
className="nopan w-52 text-xs"
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/ValidationNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/ValidationNode/types.ts
index cbe15cb8a..04208203f 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/ValidationNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/ValidationNode/types.ts
@@ -24,7 +24,7 @@ export const validationNodeDefaultData: ValidationNodeData = {
parameterKeys: [],
disableCache: false,
model: null,
- engine: RunEngine.SkyvernV1,
+ engine: null,
};
export function isValidationNode(node: Node): node is ValidationNode {
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/ActionBlockForm.test.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/ActionBlockForm.test.tsx
index 9ae820455..c6bd9c6f4 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/ActionBlockForm.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/ActionBlockForm.test.tsx
@@ -7,6 +7,10 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
// exercises, and pulling the full barrel transitively imports every block
// component plus their providers, none of which are needed to verify
// ActionBlockForm's contract.
+vi.mock("../../hooks/useEffectiveDefaultEngine", () => ({
+ useEffectiveDefaultEngine: () => null,
+}));
+
vi.mock("../../nodes", () => ({
isWorkflowBlockNode: (node: { type: string }) =>
node.type !== "nodeAdder" && node.type !== "start",
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/FileDownloadBlockForm.test.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/FileDownloadBlockForm.test.tsx
index f4f02e688..df459aeac 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/FileDownloadBlockForm.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/FileDownloadBlockForm.test.tsx
@@ -31,6 +31,10 @@ const mockNodes = new Map<
const mockEdges: Array<{ id: string; source: string; target: string }> = [];
const updateNodeData = vi.fn();
+vi.mock("../../hooks/useEffectiveDefaultEngine", () => ({
+ useEffectiveDefaultEngine: () => null,
+}));
+
vi.mock("@xyflow/react", async () => {
const actual =
await vi.importActual<typeof import("@xyflow/react")>("@xyflow/react");
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/LoginBlockForm.test.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/LoginBlockForm.test.tsx
index 9ae5fba39..e929f8c10 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/LoginBlockForm.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/LoginBlockForm.test.tsx
@@ -10,6 +10,10 @@ const mockEmailCredentials = vi.hoisted(() => ({
microsoft: vi.fn(),
}));
+vi.mock("../../hooks/useEffectiveDefaultEngine", () => ({
+ useEffectiveDefaultEngine: () => null,
+}));
+
vi.mock("@/hooks/useGoogleOAuthCredentials", async (importActual) => {
const actual =
await importActual<typeof import("@/hooks/useGoogleOAuthCredentials")>();
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/ValidationBlockForm.test.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/ValidationBlockForm.test.tsx
index 515a78fee..12cd9cd73 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/ValidationBlockForm.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/ValidationBlockForm.test.tsx
@@ -18,6 +18,10 @@ const mockNodes = new Map<
>();
const updateNodeData = vi.fn();
+vi.mock("../../hooks/useEffectiveDefaultEngine", () => ({
+ useEffectiveDefaultEngine: () => null,
+}));
+
vi.mock("@xyflow/react", async () => {
const actual =
await vi.importActual<typeof import("@xyflow/react")>("@xyflow/react");
diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.test.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.test.ts
index 5154d45a1..140612079 100644
--- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.test.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.test.ts
@@ -1,13 +1,19 @@
import { describe, expect, test } from "vitest";
-import { RunEngine } from "@/api/types";
+import { ProxyLocation, RunEngine } from "@/api/types";
import type { AppNode } from "./nodes";
-import type { WorkflowBlock } from "../types/workflowTypes";
+import type {
+ WorkflowApiResponse,
+ WorkflowBlock,
+ WorkflowSettings,
+} from "../types/workflowTypes";
import {
blockRunErrors,
- convertToNode,
+ convert,
createNode,
+ getElements,
+ getWorkflowBlocks,
getWorkflowErrors,
pendingGoalChangesOf,
withGoalUndoRecordsFrom,
@@ -41,6 +47,36 @@ function minimalTaskBlock(overrides: { engine?: RunEngine } = {}) {
} as unknown as WorkflowBlock;
}
+const SETTINGS: WorkflowSettings = {
+ proxyLocation: ProxyLocation.Residential,
+ webhookCallbackUrl: null,
+ totpVerificationUrl: null,
+ totpIdentifier: null,
+ adaptiveCaching: false,
+ generateScriptOnTerminal: false,
+ persistBrowserSession: false,
+ reuseBrowserSession: false,
+ pinSavedSessionIp: false,
+ browserProfileId: null,
+ browserProfileKey: null,
+ model: null,
+ maxScreenshotScrolls: null,
+ maxElapsedTimeMinutes: null,
+ extraHttpHeaders: null,
+ cdpConnectHeaders: null,
+ runWith: "agent",
+ codeVersion: null,
+ scriptCacheKey: null,
+ aiFallback: true,
+ maskSecrets: false,
+ runSequentially: false,
+ sequentialKey: null,
+ finallyBlockLabel: null,
+ workflowSystemPrompt: null,
+ errorCodeMapping: null,
+ retryPolicy: null,
+};
+
function codeBlock(goalNeedsRegeneration: boolean | null): AppNode {
return {
id: "cb1",
@@ -150,34 +186,86 @@ describe("blockRunErrors", () => {
});
});
-describe("createNode", () => {
- test("defaults a new task block to the routable Skyvern 1.0 engine, not a V3 pin", () => {
+function loadAndSave(
+ stored: RunEngine | undefined,
+ effectiveDefaultEngine: RunEngine | null | undefined,
+) {
+ const { nodes, edges } = getElements(
+ [minimalTaskBlock(stored ? { engine: stored } : {})],
+ SETTINGS,
+ true,
+ effectiveDefaultEngine,
+ );
+ const [saved] = getWorkflowBlocks(nodes, edges);
+ return (saved as { engine?: RunEngine | null }).engine;
+}
+
+describe("block engine load and save", () => {
+ test("a new block is Default and saves no engine", () => {
const node = createNode({ id: "n1" }, "task", "My Task");
- expect((node.data as { engine: RunEngine | null }).engine).toBe(
- RunEngine.SkyvernV1,
- );
+ expect(getWorkflowBlocks([node], [])[0]).toMatchObject({ engine: null });
});
-});
-
-describe("convertToNode", () => {
- test("fills a saved task block missing an engine with Skyvern 1.0, not the new-node default", () => {
- const node = convertToNode({ id: "n1" }, minimalTaskBlock(), true);
- expect((node.data as { engine: RunEngine | null }).engine).toBe(
+ test.each([
+ ["unset", undefined, null, null],
+ ["skyvern-1.0 on a routed workflow", RunEngine.SkyvernV1, null, null],
+ [
+ "skyvern-1.0 on a chosen-engine workflow",
RunEngine.SkyvernV1,
- );
+ RunEngine.SkyvernV3,
+ RunEngine.SkyvernV1,
+ ],
+ [
+ "skyvern-1.0 when the workflow's default is unknown",
+ RunEngine.SkyvernV1,
+ undefined,
+ RunEngine.SkyvernV1,
+ ],
+ ["skyvern-2.0", RunEngine.SkyvernV2, null, RunEngine.SkyvernV2],
+ ["skyvern-3.0", RunEngine.SkyvernV3, null, RunEngine.SkyvernV3],
+ ])("%s loads and saves as %s", (_, stored, effective, expected) => {
+ expect(loadAndSave(stored, effective)).toBe(expected);
});
- test("keeps a saved block's explicit engine unchanged", () => {
- const node = convertToNode(
- { id: "n1" },
- minimalTaskBlock({ engine: RunEngine.SkyvernV3 }),
- true,
- );
+ test("a copy drops a legacy skyvern-1.0 unless the source honours chosen engines; an export keeps it", () => {
+ const source = {
+ title: "Source",
+ description: null,
+ is_saved_task: false,
+ status: null,
+ run_with: "agent",
+ workflow_definition: {
+ parameters: [],
+ blocks: [
+ minimalTaskBlock({ engine: RunEngine.SkyvernV1 }),
+ {
+ ...minimalTaskBlock({ engine: RunEngine.SkyvernV3 }),
+ label: "b2",
+ },
+ ],
+ },
+ } as unknown as WorkflowApiResponse;
+ const engines = (request: ReturnType<typeof convert>) =>
+ request.workflow_definition.blocks.map(
+ (block) => (block as { engine?: RunEngine | null }).engine,
+ );
- expect((node.data as { engine: RunEngine | null }).engine).toBe(
+ expect(engines(convert(source, { asNewWorkflow: true }))).toEqual([
+ null,
RunEngine.SkyvernV3,
- );
+ ]);
+ expect(
+ engines(
+ convert(
+ { ...source, effective_default_engine: RunEngine.SkyvernV3 },
+ { asNewWorkflow: true },
+ ),
+ ),
+ ).toEqual([RunEngine.SkyvernV1, RunEngine.SkyvernV3]);
+ expect(engines(convert(source))).toEqual([
+ RunEngine.SkyvernV1,
+ RunEngine.SkyvernV3,
+ ]);
});
});
diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
index 9d68a408f..cece92acd 100644
--- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
@@ -693,10 +693,23 @@ function declaredSmtpParameterKey(
return parameter.key;
}
+// A stored skyvern-1.0 is only a pin where the workflow honours chosen engines; elsewhere it is the
+// routed Default. `undefined` means the workflow's semantics are unknown, so the stored engine is kept.
+function blockEngineForWorkflow(
+ engine: RunEngine | null | undefined,
+ effectiveDefaultEngine: RunEngine | null | undefined,
+): RunEngine | null {
+ if (engine === RunEngine.SkyvernV1 && effectiveDefaultEngine === null) {
+ return null;
+ }
+ return engine ?? null;
+}
+
function convertToNode(
identifiers: { id: string; parentId?: string },
block: WorkflowBlock,
editable: boolean,
+ effectiveDefaultEngine?: RunEngine | null,
): AppNode {
const common = {
draggable: false,
@@ -764,7 +777,7 @@ function convertToNode(
terminateCriterion: block.terminate_criterion ?? "",
includeActionHistoryInVerification:
block.include_action_history_in_verification ?? false,
- engine: block.engine ?? RunEngine.SkyvernV1,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
},
};
}
@@ -812,7 +825,7 @@ function convertToNode(
terminateCriterion: block.terminate_criterion ?? "",
parameterKeys: (block.parameters ?? []).map((p) => p.key),
disableCache: block.disable_cache ?? false,
- engine: block.engine ?? RunEngine.SkyvernV1,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
},
};
}
@@ -833,7 +846,7 @@ function convertToNode(
totpIdentifier: block.totp_identifier ?? null,
totpVerificationUrl: block.totp_verification_url ?? null,
disableCache: block.disable_cache ?? false,
- engine: block.engine ?? RunEngine.SkyvernV1,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
},
};
}
@@ -858,7 +871,7 @@ function convertToNode(
maxStepsOverride: block.max_steps_per_run ?? null,
completeCriterion: block.complete_criterion ?? "",
terminateCriterion: block.terminate_criterion ?? "",
- engine: block.engine ?? RunEngine.SkyvernV1,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
legacyV2Available: isV2Engine,
includeActionHistoryInVerification:
block.include_action_history_in_verification ?? false,
@@ -908,7 +921,7 @@ function convertToNode(
maxRetries: block.max_retries ?? null,
maxStepsOverride: block.max_steps_per_run ?? null,
disableCache: block.disable_cache ?? false,
- engine: block.engine ?? RunEngine.SkyvernV1,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
exportEnabled: block.export_enabled ?? false,
exportDataSchema:
block.export_data_schema == null
@@ -939,7 +952,7 @@ function convertToNode(
terminateCriterion: block.terminate_criterion ?? "",
includeActionHistoryInVerification:
block.include_action_history_in_verification ?? false,
- engine: block.engine ?? RunEngine.SkyvernV1,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
},
};
}
@@ -982,7 +995,7 @@ function convertToNode(
totpVerificationUrl: block.totp_verification_url ?? null,
disableCache: block.disable_cache ?? false,
maxStepsOverride: block.max_steps_per_run ?? null,
- engine: block.engine ?? RunEngine.SkyvernV1,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
downloadTimeout: block.download_timeout ?? null, // seconds
downloadTarget: block.download_target ?? "website",
path: block.path ?? "{{ workflow_run_id }}",
@@ -2214,6 +2227,7 @@ function getElements(
blocks: Array<WorkflowBlock>,
settings: WorkflowSettings,
editable: boolean,
+ effectiveDefaultEngine?: RunEngine | null,
): {
nodes: Array<AppNode>;
edges: Array<Edge>;
@@ -2305,6 +2319,7 @@ function getElements(
},
d.block,
editable,
+ effectiveDefaultEngine,
);
nodes.push(node);
if (isWorkflowBlockNode(node)) {
@@ -4702,6 +4717,7 @@ export function foldWebSearchErrorCodeMapping(
function convertBlocksToBlockYAML(
blocks: Array<WorkflowBlock>,
+ effectiveDefaultEngine?: RunEngine | null,
): Array<BlockYAML> {
return blocks.map((block) => {
const base = {
@@ -4735,7 +4751,7 @@ function convertBlocksToBlockYAML(
disable_cache: block.disable_cache ?? false,
include_action_history_in_verification:
block.include_action_history_in_verification,
- engine: block.engine,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
};
return blockYaml;
}
@@ -4760,7 +4776,7 @@ function convertBlocksToBlockYAML(
terminate_criterion: block.terminate_criterion,
error_code_mapping: block.error_code_mapping,
parameter_keys: (block.parameters ?? []).map((p) => p.key),
- engine: block.engine,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
};
return blockYaml;
}
@@ -4812,7 +4828,7 @@ function convertBlocksToBlockYAML(
totp_identifier: block.totp_identifier,
totp_verification_url: block.totp_verification_url,
disable_cache: block.disable_cache ?? false,
- engine: block.engine,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
};
return blockYaml;
}
@@ -4822,7 +4838,7 @@ function convertBlocksToBlockYAML(
block_type: "navigation",
url: block.url,
title: block.title,
- engine: block.engine,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
model: block.model,
navigation_goal: block.navigation_goal,
error_code_mapping: block.error_code_mapping,
@@ -4853,7 +4869,7 @@ function convertBlocksToBlockYAML(
max_steps_per_run: block.max_steps_per_run,
parameter_keys: (block.parameters ?? []).map((p) => p.key),
disable_cache: block.disable_cache ?? false,
- engine: block.engine,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
export_enabled: block.export_enabled ?? false,
export_data_schema: block.export_data_schema ?? null,
export_file_name: block.export_file_name ?? null,
@@ -4879,7 +4895,7 @@ function convertBlocksToBlockYAML(
terminate_criterion: block.terminate_criterion,
include_action_history_in_verification:
block.include_action_history_in_verification,
- engine: block.engine,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
};
return blockYaml;
}
@@ -4914,7 +4930,7 @@ function convertBlocksToBlockYAML(
totp_identifier: block.totp_identifier,
totp_verification_url: block.totp_verification_url,
disable_cache: block.disable_cache ?? false,
- engine: block.engine,
+ engine: blockEngineForWorkflow(block.engine, effectiveDefaultEngine),
download_timeout: null, // seconds
...(block.download_target &&
block.download_target !== "website" && {
@@ -4960,7 +4976,10 @@ function convertBlocksToBlockYAML(
...base,
block_type: "for_loop",
loop_over_parameter_key: block.loop_over?.key ?? "",
- loop_blocks: convertBlocksToBlockYAML(block.loop_blocks),
+ loop_blocks: convertBlocksToBlockYAML(
+ block.loop_blocks,
+ effectiveDefaultEngine,
+ ),
loop_variable_reference: block.loop_variable_reference,
complete_if_empty: block.complete_if_empty,
data_schema: block.data_schema,
@@ -4972,7 +4991,10 @@ function convertBlocksToBlockYAML(
const blockYaml: WhileLoopBlockYAML = {
...base,
block_type: "while_loop",
- loop_blocks: convertBlocksToBlockYAML(wblock.loop_blocks),
+ loop_blocks: convertBlocksToBlockYAML(
+ wblock.loop_blocks,
+ effectiveDefaultEngine,
+ ),
condition: {
criteria_type: wblock.condition.criteria_type,
expression: wblock.condition.expression,
@@ -5253,7 +5275,10 @@ function convertBlocksToBlockYAML(
});
}
-function convert(workflow: WorkflowApiResponse): WorkflowCreateYAMLRequest {
+function convert(
+ workflow: WorkflowApiResponse,
+ options?: { asNewWorkflow?: boolean },
+): WorkflowCreateYAMLRequest {
const workflowDefinitionVersion = workflow.workflow_definition.version ?? 1;
const userParameters = workflow.workflow_definition.parameters.filter(
(parameter) => parameter.parameter_type !== WorkflowParameterTypes.Output,
@@ -5280,7 +5305,12 @@ function convert(workflow: WorkflowApiResponse): WorkflowCreateYAMLRequest {
error_code_mapping:
workflow.workflow_definition.error_code_mapping ?? null,
parameters: convertParametersToParameterYAML(userParameters),
- blocks: convertBlocksToBlockYAML(workflow.workflow_definition.blocks),
+ blocks: convertBlocksToBlockYAML(
+ workflow.workflow_definition.blocks,
+ options?.asNewWorkflow
+ ? (workflow.effective_default_engine ?? null)
+ : undefined,
+ ),
retry_policy: normalizeRetryPolicy(
workflow.workflow_definition.retry_policy,
),
@@ -5819,6 +5849,7 @@ function getParentLoopSkipsOnFail(
}
export {
+ blockEngineForWorkflow,
containsJinjaReference,
convert,
convertEchoParameters,
diff --git a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRowActions.ts b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRowActions.ts
index ee01d8be6..9eb2d0d57 100644
--- a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRowActions.ts
+++ b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRowActions.ts
@@ -96,10 +96,10 @@ function useWorkflowRowActions(workflow: WorkflowApiResponse) {
});
function clone() {
- const clonedWorkflow = convert({
- ...workflow,
- title: `Copy of ${workflow.title}`,
- });
+ const clonedWorkflow = convert(
+ { ...workflow, title: `Copy of ${workflow.title}` },
+ { asNewWorkflow: true },
+ );
createWorkflowMutation.mutate(clonedWorkflow);
}
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
index 3367cadd2..2c76ff20d 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
@@ -834,6 +834,7 @@ export type WorkflowApiResponse = {
original_created_by?: string | null;
original_created_at?: string | null;
copilot_authored?: boolean | null;
+ effective_default_engine?: RunEngine | null;
};
// Each save inserts a new version row, so created_at is the latest save; the list endpoint adds the first version's.
diff --git a/skyvern-frontend/src/store/WorkflowHasChangesStore.recording.test.tsx b/skyvern-frontend/src/store/WorkflowHasChangesStore.recording.test.tsx
index 8e7efbef4..9c2ae1445 100644
--- a/skyvern-frontend/src/store/WorkflowHasChangesStore.recording.test.tsx
+++ b/skyvern-frontend/src/store/WorkflowHasChangesStore.recording.test.tsx
@@ -716,6 +716,64 @@ describe("workflow recording attachment", () => {
},
);
+ it("A46 keeps the cached effective_default_engine when a disposed-owner PUT hydrates the active editor", async () => {
+ const owner = useWorkflowYamlEditorStore.getState().editorOwner!;
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, retry: false } },
+ });
+ const queryKey = ["workflow", "wpid-1"];
+ queryClient.setQueryData(queryKey, {
+ ...saveData.workflow,
+ effective_default_engine: "skyvern-3.0",
+ });
+ function cacheWrapper({ children }: { children: ReactNode }) {
+ return (
+ <QueryClientProvider client={queryClient}>
+ {children}
+ </QueryClientProvider>
+ );
+ }
+ let resolvePut!: (value: unknown) => void;
+ mocks.put.mockImplementationOnce(
+ () =>
+ new Promise((resolve) => {
+ resolvePut = resolve;
+ }),
+ );
+ const hook = renderHook(() => useWorkflowSave(), { wrapper: cacheWrapper });
+ beginYamlCommit(owner);
+ let saving!: Promise<unknown>;
+ act(() => {
+ saving = hook.result.current.mutateAsync({
+ yamlCommit: {
+ owner,
+ revision: useWorkflowYamlEditorStore.getState().revision,
+ },
+ });
+ });
+ await waitFor(() => expect(mocks.put).toHaveBeenCalledOnce());
+ hook.unmount();
+ unregisterEditorOwner(owner);
+ registerEditorOwner(createYamlCommitOwner("wpid-1"));
+ const hydrate = vi.fn();
+ useWorkflowHasChangesStore.setState({ hydrateSavedSettings: hydrate });
+ await act(async () => {
+ resolvePut({
+ data: {
+ ...saveData.workflow,
+ title: "Original saved",
+ effective_default_engine: null,
+ },
+ });
+ await saving;
+ });
+ expect(hydrate).toHaveBeenCalledOnce();
+ expect(queryClient.getQueryData(queryKey)).toMatchObject({
+ title: "Original saved",
+ effective_default_engine: "skyvern-3.0",
+ });
+ });
+
it("A46 clears an attached recording after disposed-owner success without deleting it", async () => {
const owner = useWorkflowYamlEditorStore.getState().editorOwner!;
let resolvePut!: (value: unknown) => void;
diff --git a/skyvern-frontend/src/store/WorkflowHasChangesStore.ts b/skyvern-frontend/src/store/WorkflowHasChangesStore.ts
index 9b1fcd36d..a77637d93 100644
--- a/skyvern-frontend/src/store/WorkflowHasChangesStore.ts
+++ b/skyvern-frontend/src/store/WorkflowHasChangesStore.ts
@@ -495,9 +495,15 @@ const useWorkflowSave = (opts?: WorkflowSaveOpts) => {
useWorkflowHasChangesStore
.getState()
.clearPendingRecording(recordingId);
+ // Only the detail GET computes effective_default_engine; the PUT returns null for it.
queryClient.setQueryData(
["workflow", saveData.workflow.workflow_permanent_id],
- response.data,
+ (prev?: WorkflowApiResponse) => ({
+ ...response.data,
+ effective_default_engine:
+ prev?.effective_default_engine ??
+ response.data.effective_default_engine,
+ }),
);
setHasChanges(false, { fromYamlCommit: true });
}