Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix(SKY-12021): show user-inputted prompt for file download block (#7202)
Celal Zamanoğlu323adca6a1ff
diff --git a/docs/api-reference/openapi.json b/docs/api-reference/openapi.jsonindex 43e821871..3f216317b 100644--- a/docs/api-reference/openapi.json+++ b/docs/api-reference/openapi.json@@ -10519,6 +10519,31 @@"type": "string","title": "Credential Id"},+ "credential_ids": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "title": "Credential Ids"+ },+ "selection_strategy": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Selection Strategy"+ },"created_at": {"type": "string","format": "date-time",@@ -10579,6 +10604,31 @@"credential_id": {"type": "string","title": "Credential Id"+ },+ "credential_ids": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "title": "Credential Ids"+ },+ "selection_strategy": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Selection Strategy"}},"type": "object",@@ -12853,7 +12903,8 @@"excel","pdf","image",- "docx"+ "docx",+ "zip"],"title": "FileType"},@@ -14664,6 +14715,20 @@"title": "Save Response As File","default": false},+ "secret_response_paths": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "title": "Secret Response Paths"+ },"parameters": {"items": {"oneOf": [@@ -14864,6 +14929,20 @@"title": "Save Response As File","default": false},+ "secret_response_paths": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "title": "Secret Response Paths"+ },"parameter_keys": {"anyOf": [{@@ -25985,6 +26064,17 @@],"title": "Body"},+ "prompt": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Prompt"+ },"instructions": {"anyOf": [{diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.test.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.test.tsxindex 7e2a972fa..5ea7f9ca5 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.test.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.test.tsx@@ -3,12 +3,72 @@import { cleanup, fireEvent, render, screen } from "@testing-library/react";import { afterEach, describe, expect, it } from "vitest";-import { JsonExplorer } from "./BlockInspector";+import { ActionTypes, Status, type ActionsApiResponse } from "@/api/types";+import type { WorkflowRunBlock } from "../../types/workflowRunTypes";+import { BlockInspector, JsonExplorer } from "./BlockInspector";afterEach(() => {cleanup();});+function buildBlock(+ overrides: Partial<WorkflowRunBlock> = {},+): WorkflowRunBlock {+ return {+ workflow_run_block_id: "wrb_default",+ workflow_run_id: "wr_default",+ parent_workflow_run_block_id: null,+ block_type: "file_download",+ label: null,+ description: null,+ title: null,+ status: Status.Failed,+ failure_reason: null,+ output: null,+ continue_on_failure: false,+ task_id: null,+ url: null,+ navigation_goal: null,+ navigation_payload: null,+ data_extraction_goal: null,+ data_schema: null,+ terminate_criterion: null,+ complete_criterion: null,+ include_action_history_in_verification: null,+ engine: null,+ actions: null,+ created_at: "2026-01-01T00:00:00Z",+ modified_at: "2026-01-01T00:00:00Z",+ duration: null,+ loop_values: null,+ current_value: null,+ current_index: null,+ ...overrides,+ };+}++function buildAction(+ overrides: Partial<ActionsApiResponse> = {},+): ActionsApiResponse {+ return {+ action_id: "act_default",+ action_type: ActionTypes.Click,+ status: Status.Completed,+ task_id: null,+ step_id: null,+ step_order: null,+ action_order: null,+ confidence_float: null,+ description: null,+ reasoning: null,+ intention: null,+ response: null,+ created_by: null,+ text: null,+ ...overrides,+ };+}+describe("JsonExplorer", () => {it("previews nested objects with key/value content instead of object counts", () => {render(@@ -57,3 +117,36 @@ describe("JsonExplorer", () => {expect(screen.getByText("loop_value")).toBeDefined();});});++describe("BlockInspector Inputs tab", () => {+ it("surfaces the block's navigation goal even when a click action is selected", () => {+ const block = buildBlock({+ navigation_goal: "Download the latest invoice PDF",+ });+ const action = buildAction({ action_type: ActionTypes.Click, text: null });++ render(<BlockInspector block={block} action={action} />);+ // Radix Tabs activates on mousedown, not a bare click event.+ fireEvent.mouseDown(screen.getByRole("tab", { name: "Inputs" }));++ expect(screen.getByText("Navigation goal")).toBeDefined();+ expect(screen.getByText("Download the latest invoice PDF")).toBeDefined();+ });++ it("keeps the action's own input alongside block context", () => {+ const block = buildBlock({ navigation_goal: "Fill out the form" });+ const action = buildAction({+ action_type: ActionTypes.InputText,+ text: "[email protected]",+ });++ render(<BlockInspector block={block} action={action} />);+ // Radix Tabs activates on mousedown, not a bare click event.+ fireEvent.mouseDown(screen.getByRole("tab", { name: "Inputs" }));++ expect(screen.getByText("Input")).toBeDefined();+ expect(screen.getByText("[email protected]")).toBeDefined();+ expect(screen.getByText("Navigation goal")).toBeDefined();+ expect(screen.getByText("Fill out the form")).toBeDefined();+ });+});diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.tsxindex 4c5ee91e5..392c7bf36 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/blockDetail/BlockInspector.tsx@@ -335,8 +335,17 @@ function pushField(fields.push({ label, value, kind });}-function getInputFields(block: WorkflowRunBlock): Array<InspectorField> {+function getInputFields(+ block: WorkflowRunBlock,+ action?: ActionsApiResponse | null,+): Array<InspectorField> {const fields: Array<InspectorField> = [];+ // Block-level config (Navigation goal, Prompt, ...) doesn't change per+ // action, so it stays visible instead of being fully replaced by the+ // selected action's own input.+ if (action) {+ pushField(fields, "Input", getActionInputValue(action));+ }pushField(fields, "Description", block.description);pushField(fields, "Prompt", block.prompt);pushField(fields, "URL", block.url);@@ -382,14 +391,6 @@ function getActionInputValue(action: ActionsApiResponse): string | null {return action.text;}-function getActionInputFields(- action: ActionsApiResponse,-): Array<InspectorField> {- const fields: Array<InspectorField> = [];- pushField(fields, "Input", getActionInputValue(action));- return fields;-}-function getActionSummaryFields(action: ActionsApiResponse,): Array<InspectorField> {@@ -517,7 +518,7 @@ function BlockInspector({action?: ActionsApiResponse | null;}) {const inputFields = useMemo(- () => (action ? getActionInputFields(action) : getInputFields(block)),+ () => getInputFields(block, action),[action, block],);const summaryFields = useMemo(diff --git a/skyvern/forge/sdk/db/utils.py b/skyvern/forge/sdk/db/utils.pyindex 443a83dfc..4d5b86083 100644--- a/skyvern/forge/sdk/db/utils.py+++ b/skyvern/forge/sdk/db/utils.py@@ -842,6 +842,7 @@ def convert_to_workflow_run_block(attachments=workflow_run_block_model.attachments,subject=workflow_run_block_model.subject,body=workflow_run_block_model.body,+ prompt=workflow_run_block_model.prompt,created_at=workflow_run_block_model.created_at,modified_at=workflow_run_block_model.modified_at,instructions=workflow_run_block_model.instructions,diff --git a/skyvern/forge/sdk/schemas/workflow_runs.py b/skyvern/forge/sdk/schemas/workflow_runs.pyindex f306d9d29..d89ad2b00 100644--- a/skyvern/forge/sdk/schemas/workflow_runs.py+++ b/skyvern/forge/sdk/schemas/workflow_runs.py@@ -55,6 +55,9 @@ class WorkflowRunBlock(BaseModel):subject: str | None = Nonebody: str | None = None+ # prompt block / text prompt block / for loop block+ prompt: str | None = None+# human interaction blockinstructions: str | None = Nonepositive_descriptor: str | None = Nonediff --git a/tests/unit/workflow/test_workflow_run_block_script_run_exposure.py b/tests/unit/workflow/test_workflow_run_block_script_run_exposure.pyindex 3c981213e..db52fe288 100644--- a/tests/unit/workflow/test_workflow_run_block_script_run_exposure.py+++ b/tests/unit/workflow/test_workflow_run_block_script_run_exposure.py@@ -14,7 +14,7 @@ from skyvern.forge.sdk.schemas.workflow_runs import WorkflowRunBlockfrom skyvern.schemas.runs import ScriptRunResponse-def _fake_block_model(script_run_value: dict | None) -> MagicMock:+def _fake_block_model(script_run_value: dict | None, prompt_value: str | None = None) -> MagicMock:"""Build a `WorkflowRunBlockModel` stub that only carries the attrs`convert_to_workflow_run_block` touches. Avoids standing up a DB orconstructing the SQLAlchemy model (which requires a session)."""@@ -52,6 +52,8 @@ def _fake_block_model(script_run_value: dict | None) -> MagicMock:model.executed_branch_result = Nonemodel.executed_branch_next_block = Nonemodel.script_run = script_run_value+ model.prompt = prompt_value+ model.downloaded_file_count = Nonereturn model@@ -122,3 +124,19 @@ def test_converter_preserves_unknown_future_script_run_keys() -> None:block = convert_to_workflow_run_block(model)assert block.script_run is not Noneassert block.script_run.ai_fallback_triggered is False+++def test_converter_passes_prompt_when_set() -> None:+ """`prompt` is written by TextPromptBlock/ForLoopBlock (observer.py's+ `update_workflow_run_block`); the converter must round-trip it."""+ model = _fake_block_model(script_run_value=None, prompt_value="Summarize the page")+ block = convert_to_workflow_run_block(model)+ assert block.prompt == "Summarize the page"+++def test_converter_propagates_null_prompt() -> None:+ """Block types that never write `prompt` (e.g. FileDownloadBlock) keep+ the column NULL — the converter must not invent a value."""+ model = _fake_block_model(script_run_value=None, prompt_value=None)+ block = convert_to_workflow_run_block(model)+ assert block.prompt is None