Skip to content

Automate browser based workflows with AI

feat: add action history option to login blocks (#7453)

Suchintan5696c9166499
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 046b4150e..479c42d07 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginEditor.tsx
@@ -400,16 +400,25 @@ function LoginEditorBody({
<BlockExecutionOptions
continueOnFailure={data.continueOnFailure}
nextLoopOnFailure={data.nextLoopOnFailure}
+ includeActionHistoryInVerification={
+ data.includeActionHistoryInVerification
+ }
editable={editable}
isInsideForLoop={isInsideForLoop}
parentLoopSkipsOnFail={parentLoopSkipsOnFail}
blockType="login"
+ showOptions={{
+ includeActionHistoryInVerification: true,
+ }}
onContinueOnFailureChange={(checked) =>
update({ continueOnFailure: checked })
}
onNextLoopOnFailureChange={(checked) =>
update({ nextLoopOnFailure: checked })
}
+ onIncludeActionHistoryInVerificationChange={(checked) =>
+ update({ includeActionHistoryInVerification: checked })
+ }
/>
<DisableCache
disableCache={data.disableCache}
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 fd0a52c1c..1ab095529 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts
@@ -15,6 +15,7 @@ export type LoginNodeData = NodeBaseData & {
disableCache: boolean;
completeCriterion: string;
terminateCriterion: string;
+ includeActionHistoryInVerification: boolean;
engine: RunEngine | null;
};
@@ -37,6 +38,7 @@ export const loginNodeDefaultData: LoginNodeData = {
disableCache: false,
completeCriterion: "",
terminateCriterion: "",
+ includeActionHistoryInVerification: false,
engine: RunEngine.SkyvernV1,
model: null,
ignoreWorkflowSystemPrompt: false,
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 eff7ca8ae..cdd2ad377 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
@@ -88,12 +88,31 @@ vi.mock("../../nodes/components/BlockExecutionOptions", () => ({
BlockExecutionOptions: (props: {
continueOnFailure: boolean;
blockType: string;
+ includeActionHistoryInVerification?: boolean;
+ onIncludeActionHistoryInVerificationChange?: (checked: boolean) => void;
+ showOptions?: { includeActionHistoryInVerification?: boolean };
}) => (
<div
data-testid="block-execution-options"
data-continue={String(props.continueOnFailure)}
data-block-type={props.blockType}
- />
+ data-include-action-history={String(
+ props.includeActionHistoryInVerification ?? false,
+ )}
+ >
+ {props.showOptions?.includeActionHistoryInVerification ? (
+ <button
+ type="button"
+ onClick={() =>
+ props.onIncludeActionHistoryInVerificationChange?.(
+ !(props.includeActionHistoryInVerification ?? false),
+ )
+ }
+ >
+ Include Action History
+ </button>
+ ) : null}
+ </div>
),
}));
@@ -192,6 +211,7 @@ function makeLoginFixture(
disableCache: false,
completeCriterion: "",
terminateCriterion: "",
+ includeActionHistoryInVerification: false,
engine: null,
model: null,
...overrides,
@@ -337,6 +357,30 @@ describe("LoginBlockForm (SKY-9374)", () => {
expect(screen.queryByTestId("error-code-mapping-editor")).toBeNull();
});
+ test("shows Include Action History and updates the login block", () => {
+ mockNodeFixtures.set(
+ "b1",
+ makeLoginFixture("b1", {
+ includeActionHistoryInVerification: true,
+ } as never),
+ );
+ render(<LoginBlockForm blockId="b1" />);
+
+ fireEvent.click(screen.getByText("Advanced Settings"));
+
+ expect(screen.getByText("Include Action History")).toBeDefined();
+ expect(
+ screen
+ .getByTestId("block-execution-options")
+ .getAttribute("data-include-action-history"),
+ ).toBe("true");
+
+ fireEvent.click(screen.getByText("Include Action History"));
+ expect(updateNodeDataMock).toHaveBeenCalledWith("b1", {
+ includeActionHistoryInVerification: false,
+ });
+ });
+
test("renders the error-code-mapping editor when mapping is non-null", () => {
mockNodeFixtures.set(
"b1",
@@ -372,6 +416,7 @@ describe("LoginBlockForm (SKY-9374)", () => {
errorCodeMapping: "null",
parameterKeys: [],
continueOnFailure: false,
+ includeActionHistoryInVerification: false,
disableCache: false,
});
});
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/LoginBlockForm.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/LoginBlockForm.tsx
index ad6b046e9..c75b5fcb5 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/LoginBlockForm.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/BlockConfigForm/LoginBlockForm.tsx
@@ -38,6 +38,8 @@ function LoginBlockFormBody({
errorCodeMapping: data.errorCodeMapping,
continueOnFailure: data.continueOnFailure,
nextLoopOnFailure: data.nextLoopOnFailure,
+ includeActionHistoryInVerification:
+ data.includeActionHistoryInVerification,
disableCache: data.disableCache,
totpIdentifier: data.totpIdentifier,
totpVerificationUrl: data.totpVerificationUrl,
@@ -53,6 +55,7 @@ function LoginBlockFormBody({
data.errorCodeMapping,
data.continueOnFailure,
data.nextLoopOnFailure,
+ data.includeActionHistoryInVerification,
data.disableCache,
data.totpIdentifier,
data.totpVerificationUrl,
diff --git a/skyvern-frontend/src/routes/workflows/editor/sortable/roundTrip.test.ts b/skyvern-frontend/src/routes/workflows/editor/sortable/roundTrip.test.ts
index 63e6a822f..2c674e93c 100644
--- a/skyvern-frontend/src/routes/workflows/editor/sortable/roundTrip.test.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/sortable/roundTrip.test.ts
@@ -554,3 +554,52 @@ describe("round-trip reorder → save → reload (M1 top-level)", () => {
expect(recovered.workflowSystemPrompt).toBe("always double-check totals");
});
});
+
+describe("login block configuration round trip", () => {
+ test("preserves Include Action History through load and save", () => {
+ const loginBlock = {
+ label: "login",
+ block_type: "login",
+ continue_on_failure: false,
+ next_loop_on_failure: false,
+ model: null,
+ next_block_label: null,
+ output_parameter: makeOutputParameter("login"),
+ url: "https://example.test/login",
+ title: "Login",
+ navigation_goal: "Log in",
+ error_code_mapping: null,
+ max_retries: 0,
+ max_steps_per_run: null,
+ parameters: [],
+ totp_verification_url: null,
+ totp_identifier: null,
+ disable_cache: false,
+ complete_criterion: null,
+ terminate_criterion: null,
+ engine: null,
+ include_action_history_in_verification: true,
+ } as unknown as WorkflowBlock;
+
+ const { nodes, edges } = getElements([loginBlock], DEFAULT_SETTINGS, true);
+ const loginNode = nodes.find((node) => node.type === "login");
+
+ expect(loginNode).toBeDefined();
+ expect(
+ (
+ loginNode!.data as unknown as {
+ includeActionHistoryInVerification?: boolean;
+ }
+ ).includeActionHistoryInVerification,
+ ).toBe(true);
+
+ const saved = getWorkflowBlocks(nodes, edges);
+ expect(
+ (
+ saved[0] as unknown as {
+ include_action_history_in_verification?: boolean;
+ }
+ ).include_action_history_in_verification,
+ ).toBe(true);
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
index d8299e32d..18d04da8f 100644
--- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
@@ -881,6 +881,8 @@ function convertToNode(
maxStepsOverride: block.max_steps_per_run ?? null,
completeCriterion: block.complete_criterion ?? "",
terminateCriterion: block.terminate_criterion ?? "",
+ includeActionHistoryInVerification:
+ block.include_action_history_in_verification ?? false,
engine: block.engine ?? RunEngine.SkyvernV1,
},
};
@@ -3058,6 +3060,8 @@ function getWorkflowBlock(
disable_cache: node.data.disableCache ?? false,
complete_criterion: node.data.completeCriterion,
terminate_criterion: node.data.terminateCriterion,
+ include_action_history_in_verification:
+ node.data.includeActionHistoryInVerification,
engine: node.data.engine,
};
}
@@ -4463,6 +4467,8 @@ function convertBlocksToBlockYAML(
disable_cache: block.disable_cache ?? false,
complete_criterion: block.complete_criterion,
terminate_criterion: block.terminate_criterion,
+ include_action_history_in_verification:
+ block.include_action_history_in_verification,
engine: block.engine,
};
return blockYaml;
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
index a928c9647..24aebfaf5 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
@@ -552,6 +552,7 @@ export type LoginBlock = WorkflowBlockBase & {
disable_cache?: boolean;
complete_criterion: string | null;
terminate_criterion: string | null;
+ include_action_history_in_verification: boolean;
engine: RunEngine | null;
};
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
index c806bc40b..c07cea96e 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
@@ -294,6 +294,7 @@ export type LoginBlockYAML = BlockYAMLBase & {
disable_cache: boolean;
complete_criterion: string | null;
terminate_criterion: string | null;
+ include_action_history_in_verification: boolean;
engine: RunEngine | null;
};
diff --git a/skyvern/forge/sdk/workflow/workflow_definition_converter.py b/skyvern/forge/sdk/workflow/workflow_definition_converter.py
index 2420df7d0..13effc94d 100644
--- a/skyvern/forge/sdk/workflow/workflow_definition_converter.py
+++ b/skyvern/forge/sdk/workflow/workflow_definition_converter.py
@@ -816,6 +816,7 @@ def block_yaml_to_block(
complete_criterion=block_yaml.complete_criterion,
terminate_criterion=block_yaml.terminate_criterion,
complete_verification=block_yaml.complete_verification,
+ include_action_history_in_verification=block_yaml.include_action_history_in_verification,
skip_saved_profile=block_yaml.skip_saved_profile,
)
diff --git a/skyvern/schemas/workflows.py b/skyvern/schemas/workflows.py
index 968662e96..093f94123 100644
--- a/skyvern/schemas/workflows.py
+++ b/skyvern/schemas/workflows.py
@@ -1069,6 +1069,7 @@ class LoginBlockYAML(BlockYAML):
complete_criterion: str | None = None
terminate_criterion: str | None = None
complete_verification: bool = True
+ include_action_history_in_verification: bool = False
skip_saved_profile: bool = False
diff --git a/tests/unit/test_login_block_default_navigation_goal.py b/tests/unit/test_login_block_default_navigation_goal.py
index 353ca04f5..4d6b52204 100644
--- a/tests/unit/test_login_block_default_navigation_goal.py
+++ b/tests/unit/test_login_block_default_navigation_goal.py
@@ -76,3 +76,12 @@ class TestLoginBlockDefaultNavigationGoal:
assert "credentials" in block.navigation_goal.lower()
assert "password" in block.navigation_goal.lower()
assert "login" in block.navigation_goal.lower()
+
+
+def test_login_block_preserves_include_action_history_in_verification() -> None:
+ block_yaml = LoginBlockYAML(label="login", include_action_history_in_verification=True)
+
+ block = _convert_login_block(block_yaml)
+
+ assert block_yaml.include_action_history_in_verification is True
+ assert block.include_action_history_in_verification is True