Skip to content

Automate browser based workflows with AI

chore: remove ENABLE_PARSE_SELECT_IN_EXTRACT feature flag (#6051)

Shuchang Zhenga92ae20b4b73
diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.py
index ca2010bf0..601f6a403 100644
--- a/skyvern/forge/agent.py
+++ b/skyvern/forge/agent.py
@@ -3537,7 +3537,6 @@ class ForgeAgent:
"verification_code_check": verification_code_check,
"complete_criterion": task.complete_criterion.strip() if task.complete_criterion else None,
"terminate_criterion": task.terminate_criterion.strip() if task.terminate_criterion else None,
- "parse_select_feature_enabled": context.enable_parse_select_in_extract,
"has_magic_link_page": context.has_magic_link_page(task.task_id),
"recent_dialog_messages_str": recent_dialog_messages_str,
}
@@ -3629,7 +3628,6 @@ class ForgeAgent:
verification_code_check=verification_code_check,
complete_criterion=task.complete_criterion.strip() if task.complete_criterion else None,
terminate_criterion=task.terminate_criterion.strip() if task.terminate_criterion else None,
- parse_select_feature_enabled=context.enable_parse_select_in_extract,
has_magic_link_page=context.has_magic_link_page(task.task_id),
recent_dialog_messages_str=recent_dialog_messages_str,
# SKY-9718 Layer 1: planner non-cached fallback. Keep Skyvern IDs
diff --git a/skyvern/forge/prompts/skyvern/extract-action-static.j2 b/skyvern/forge/prompts/skyvern/extract-action-static.j2
index bd40d018e..094091fca 100644
--- a/skyvern/forge/prompts/skyvern/extract-action-static.j2
+++ b/skyvern/forge/prompts/skyvern/extract-action-static.j2
@@ -34,7 +34,7 @@ Reply in JSON format with the following keys:
"click_context": { // The context for CLICK action only. null if not CLICK action
"thought": str, // Describe how you decided that this action is a single choice option or multi-choice option.
"single_option_click": bool, // True if the click is the only choice to proceed towards the goal, regardless of different user context or input. False if there are multiple valid options that depend on user input. Examples: clicking a login button to login is True (it's the only way to login); clicking a radio button for a multi-choice question (e.g., selecting "male", "female", or "other" for gender) is False (the choice depends on user input). When clicking on radio buttons, dropdown options, or any element that represents one of multiple possible selections, this should be False. If the click is intended to open the dropdown menu in order to select an option from the dropdown, this should be False.
- }{% if parse_select_feature_enabled %},
+ },
"context": { // The context for INPUT_TEXT or SELECT_OPTION action only. null if not INPUT_TEXT or SELECT_OPTION action. Extract the following detailed information from the "reasoning", and double-check the information by analysing the HTML elements.
"thought": str, // A string to describe how you double-check the context information to ensure the accuracy.
"field": str, // Which field is this action intended to fill out?
@@ -44,7 +44,7 @@ Reply in JSON format with the following keys:
"is_date_related": bool, // True if the field is related to date input or select, otherwise false.
"date_format": str, // The format of the date or datetime to be input. For example YYYY-MM-DD, YYYY-MM-DD HH:MM:SS, DD.MM.YYYY, MM/DD/YYYY, etc. If the field is not related to date input or select, this should be null.
"is_text_captcha": bool, // True if the field is asking for a text captcha, otherwise false. Do not confuse it with the verification code. Text CAPTCHAs are typically displayed alongside an image of distorted letters or numbers.
- }{% endif %}
+ }
}],{% if verification_code_check %}
"verification_code_reasoning": str, // Let's think step by step. Describe what you see and think if there is somewhere on the current page where you must enter the verification code now for login or any verification step. Explain why you believe a verification code needs to be entered somewhere or not. Do not imagine any place to enter the code if the code has not been sent yet.
"place_to_enter_verification_code": bool, // Whether there is a place on the current page to enter the verification code now.
diff --git a/skyvern/forge/prompts/skyvern/extract-action.j2 b/skyvern/forge/prompts/skyvern/extract-action.j2
index 95b769477..f2dca46d9 100644
--- a/skyvern/forge/prompts/skyvern/extract-action.j2
+++ b/skyvern/forge/prompts/skyvern/extract-action.j2
@@ -34,7 +34,7 @@ Reply in JSON format with the following keys:
"click_context": { // The context for CLICK action only. null if not CLICK action
"thought": str, // Describe how you decided that this action is a single choice option or multi-choice option.
"single_option_click": bool, // True if the click is the only choice to proceed towards the goal, regardless of different user context or input. False if there are multiple valid options that depend on user input. Examples: clicking a login button to login is True (it's the only way to login); clicking a radio button for a multi-choice question (e.g., selecting "male", "female", or "other" for gender) is False (the choice depends on user input). When clicking on radio buttons, dropdown options, or any element that represents one of multiple possible selections, this should be False. If the click is intended to open the dropdown menu in order to select an option from the dropdown, this should be False.
- }{% if parse_select_feature_enabled %},
+ },
"context": { // The context for INPUT_TEXT or SELECT_OPTION action only. null if not INPUT_TEXT or SELECT_OPTION action. Extract the following detailed information from the "reasoning", and double-check the information by analysing the HTML elements.
"thought": str, // A string to describe how you double-check the context information to ensure the accuracy.
"field": str, // Which field is this action intended to fill out?
@@ -44,7 +44,7 @@ Reply in JSON format with the following keys:
"is_date_related": bool, // True if the field is related to date input or select, otherwise false.
"date_format": str, // The format of the date or datetime to be input. For example YYYY-MM-DD, YYYY-MM-DD HH:MM:SS, DD.MM.YYYY, MM/DD/YYYY, etc. If the field is not related to date input or select, this should be null.
"is_text_captcha": bool, // True if the field is asking for a text captcha, otherwise false. Do not confuse it with the verification code. Text CAPTCHAs are typically displayed alongside an image of distorted letters or numbers.
- }{% endif %}
+ }
}],{% if verification_code_check %}
"verification_code_reasoning": str, // Let's think step by step. Describe what you see and think if there is somewhere on the current page where you must enter the verification code now for login or any verification step. Explain why you believe a verification code needs to be entered somewhere or not. Do not imagine any place to enter the code if the code has not been sent yet.
"place_to_enter_verification_code": bool, // Whether there is a place on the current page to enter the verification code now.
diff --git a/skyvern/forge/prompts/skyvern/single-input-action.j2 b/skyvern/forge/prompts/skyvern/single-input-action.j2
index 5096bdd63..6d1e4cc73 100644
--- a/skyvern/forge/prompts/skyvern/single-input-action.j2
+++ b/skyvern/forge/prompts/skyvern/single-input-action.j2
@@ -14,7 +14,7 @@ Reply in JSON format with the following keys:
"confidence_float": float, // The confidence of the action. Pick a number between 0.0 and 1.0. 0.0 means no confidence, 1.0 means full confidence
"action_type": str, // It's a string enum: "INPUT_TEXT". "INPUT_TEXT" is an element you'd like to input text into.
"id": str, // The id of the element to take action on. The id has to be one from the elements list.
- "text": str, // The text to input.{% if parse_select_feature_enabled %}
+ "text": str, // The text to input.
"context": { // Extract the following detailed information from the "reasoning", and double-check the information by analysing the HTML elements.
"thought": str, // A string to describe how you double-check the context information to ensure the accuracy.
"field": str, // Which field is this action intended to fill out?
@@ -24,7 +24,7 @@ Reply in JSON format with the following keys:
"is_date_related": bool, // True if the field is related to date input or select, otherwise false.
"date_format": str, // The format of the date or datetime to be input. For example YYYY-MM-DD, YYYY-MM-DD HH:MM:SS, DD.MM.YYYY, MM/DD/YYYY, etc. If the field is not related to date input or select, this should be null.
"is_text_captcha": bool, // True if the field is asking for a text captcha, otherwise false. Do not confuse it with the verification code. Text CAPTCHAs are typically displayed alongside an image of distorted letters or numbers.
- }{% endif %}
+ }
}]{% if verification_code_check %}
"verification_code_reasoning": str, // Let's think step by step. Describe what you see and think if there is somewhere on the current page where you must enter the verification code now for login or any verification step. Explain why you believe a verification code needs to be entered somewhere or not. Do not imagine any place to enter the code if the code has not been sent yet.
"place_to_enter_verification_code": bool, // Whether there is a place on the current page to enter the verification code now.
diff --git a/skyvern/forge/prompts/skyvern/single-select-action.j2 b/skyvern/forge/prompts/skyvern/single-select-action.j2
index 386f14118..1ad2707e6 100644
--- a/skyvern/forge/prompts/skyvern/single-select-action.j2
+++ b/skyvern/forge/prompts/skyvern/single-select-action.j2
@@ -18,7 +18,7 @@ Reply in JSON format with the following keys:
"label": str, // the label of the option if any. MAKE SURE YOU USE THIS LABEL TO SELECT THE OPTION. DO NOT PUT ANYTHING OTHER THAN A VALID OPTION LABEL HERE
"index": int, // the index corresponding to the option index under the select element.
"value": str // the value of the option. MAKE SURE YOU USE THIS VALUE TO SELECT THE OPTION. DO NOT PUT ANYTHING OTHER THAN A VALID OPTION VALUE HERE
- }{% if parse_select_feature_enabled %},
+ },
"context": { // Extract the following detailed information from the "reasoning", and double-check the information by analysing the HTML elements.
"thought": str, // A string to describe how you double-check the context information to ensure the accuracy.
"field": str, // Which field is this action intended to fill out?
@@ -27,7 +27,7 @@ Reply in JSON format with the following keys:
"is_location_input": bool, // True if the element is asking user to input where he lives, otherwise false. For example, it is asking for location, or address, or other similar information. Output False if it only requires ZIP code or postal code.
"is_date_related": bool, // True if the field is related to date input or select, otherwise false.
"date_format": str, // The format of the date or datetime to be input. For example YYYY-MM-DD, YYYY-MM-DD HH:MM:SS, DD.MM.YYYY, MM/DD/YYYY, etc. If the field is not related to date input or select, this should be null.
- }{% endif %}
+ }
}]
}
diff --git a/skyvern/forge/sdk/core/skyvern_context.py b/skyvern/forge/sdk/core/skyvern_context.py
index 8b8eba31d..fdecf7644 100644
--- a/skyvern/forge/sdk/core/skyvern_context.py
+++ b/skyvern/forge/sdk/core/skyvern_context.py
@@ -80,7 +80,6 @@ class SkyvernContext:
# feature flags
enable_page_ready_wait: bool = False
- enable_parse_select_in_extract: bool = False
use_prompt_caching: bool = False
cached_static_prompt: str | None = None
vertex_cache_name: str | None = None # Vertex AI cache resource name for explicit caching
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py
index c1f1328bd..8bf46d782 100644
--- a/skyvern/forge/sdk/workflow/models/block.py
+++ b/skyvern/forge/sdk/workflow/models/block.py
@@ -5097,6 +5097,41 @@ class FileParserBlock(Block):
error_codes=error_codes or None,
)
+ @staticmethod
+ def _extract_file_url_from_block_output(value: Any) -> str | None:
+ """Extract a file URL from a block output value.
+
+ When users pass an entire block output (e.g. ``{{ block_8_output }}``) as the
+ ``file_url``, the resolved value may be a dict or a string representation of a
+ dict that contains a ``downloaded_files`` list. This helper unwraps that
+ structure and returns the URL of the first downloaded file.
+
+ Handles three forms:
+ - dict with a ``downloaded_files`` list
+ - JSON string encoding such a dict
+ - Python dict-repr string produced by Jinja's default ``str()`` rendering
+ """
+ if isinstance(value, dict):
+ downloaded_files = value.get("downloaded_files")
+ if isinstance(downloaded_files, list) and downloaded_files:
+ first_file = downloaded_files[0]
+ if isinstance(first_file, dict):
+ return first_file.get("url") or None
+ return None
+ if isinstance(value, str):
+ try:
+ parsed = json.loads(value)
+ return FileParserBlock._extract_file_url_from_block_output(parsed)
+ except (json.JSONDecodeError, ValueError):
+ pass
+ try:
+ parsed = ast.literal_eval(value)
+ if isinstance(parsed, dict):
+ return FileParserBlock._extract_file_url_from_block_output(parsed)
+ except (ValueError, SyntaxError):
+ pass
+ return None
+
async def execute(
self,
workflow_run_id: str,
@@ -5114,12 +5149,21 @@ class FileParserBlock(Block):
):
file_url_parameter_value = workflow_run_context.get_value(self.file_url)
if file_url_parameter_value:
- LOG.info(
- "FileParserBlock File URL is parameterized, using parameter value",
- file_url_parameter_value=file_url_parameter_value,
- file_url_parameter_key=self.file_url,
- )
- self.file_url = file_url_parameter_value
+ extracted_url = self._extract_file_url_from_block_output(file_url_parameter_value)
+ if extracted_url:
+ LOG.info(
+ "FileParserBlock Extracted file URL from block output parameter",
+ extracted_url=extracted_url,
+ file_url_parameter_key=self.file_url,
+ )
+ self.file_url = extracted_url
+ else:
+ LOG.info(
+ "FileParserBlock File URL is parameterized, using parameter value",
+ file_url_parameter_value=file_url_parameter_value,
+ file_url_parameter_key=self.file_url,
+ )
+ self.file_url = file_url_parameter_value
try:
self.format_potential_template_parameters(workflow_run_context)
@@ -5132,6 +5176,18 @@ class FileParserBlock(Block):
f"Failed to format jinja template: {str(e)}",
)
+ # After Jinja rendering, self.file_url may be a stringified block output
+ # (e.g. when the user wrote ``{{ block_8_output }}``). Try to extract the
+ # file URL from it before attempting the download.
+ extracted_url = self._extract_file_url_from_block_output(self.file_url)
+ if extracted_url:
+ LOG.info(
+ "FileParserBlock Extracted file URL from rendered block output",
+ extracted_url=extracted_url,
+ rendered_value=self.file_url,
+ )
+ self.file_url = extracted_url
+
try:
# Download the file.
file_path = await download_file(self.file_url, organization_id=organization_id)
diff --git a/skyvern/services/task_v2_service.py b/skyvern/services/task_v2_service.py
index 68a2b0e0f..74f65d8ae 100644
--- a/skyvern/services/task_v2_service.py
+++ b/skyvern/services/task_v2_service.py
@@ -658,12 +658,6 @@ async def run_task_v2_helper(
context.run_id = current_run_id
context.browser_session_id = browser_session_id
context.max_screenshot_scrolls = task_v2.max_screenshot_scrolls
- enable_parse_select_in_extract = await app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
- "ENABLE_PARSE_SELECT_IN_EXTRACT",
- current_run_id,
- properties={"organization_id": organization_id, "task_url": task_v2.url},
- )
- context.enable_parse_select_in_extract = bool(enable_parse_select_in_extract)
task_v2 = await app.DATABASE.observer.update_task_v2(
task_v2_id=task_v2_id, organization_id=organization_id, status=TaskV2Status.running
diff --git a/tests/unit/test_extract_action_dialog_messages_render.py b/tests/unit/test_extract_action_dialog_messages_render.py
index 5999a20af..f4ee38177 100644
--- a/tests/unit/test_extract_action_dialog_messages_render.py
+++ b/tests/unit/test_extract_action_dialog_messages_render.py
@@ -18,7 +18,6 @@ _BASE_KWARGS: dict[str, Any] = {
"verification_code_check": False,
"complete_criterion": None,
"terminate_criterion": None,
- "parse_select_feature_enabled": False,
"has_magic_link_page": False,
"elements": "<html></html>",
}
diff --git a/tests/unit/test_extract_actions_ceiling.py b/tests/unit/test_extract_actions_ceiling.py
index cf42af7b7..bc75b7a0f 100644
--- a/tests/unit/test_extract_actions_ceiling.py
+++ b/tests/unit/test_extract_actions_ceiling.py
@@ -34,7 +34,6 @@ def test_extract_action_ceiling_drops_action_history_on_overshoot() -> None:
verification_code_check=False,
complete_criterion=None,
terminate_criterion=None,
- parse_select_feature_enabled=False,
has_magic_link_page=False,
)
@@ -62,7 +61,6 @@ def test_extract_action_small_prompt_passes_through() -> None:
verification_code_check=False,
complete_criterion=None,
terminate_criterion=None,
- parse_select_feature_enabled=False,
has_magic_link_page=False,
)
diff --git a/tests/unit/workflow/test_file_parser_block.py b/tests/unit/workflow/test_file_parser_block.py
index 202d9c09b..fffe8a398 100644
--- a/tests/unit/workflow/test_file_parser_block.py
+++ b/tests/unit/workflow/test_file_parser_block.py
@@ -251,3 +251,87 @@ class TestParseDocxFileErrorHandling:
block = _make_file_parser_block("https://example.com/missing.docx", FileType.DOCX)
with pytest.raises(InvalidFileType):
await block._parse_docx_file(str(tmp_path / "nonexistent.docx"))
+
+
+class TestExtractFileUrlFromBlockOutput:
+ """Tests for _extract_file_url_from_block_output – unstructured block output parsing."""
+
+ def _extract(self, value: object) -> str | None:
+ return FileParserBlock._extract_file_url_from_block_output(value)
+
+ # --- dict inputs ---
+
+ def test_dict_with_downloaded_files_returns_first_url(self) -> None:
+ value = {"downloaded_files": [{"url": "https://example.com/file.pdf", "checksum": None}]}
+ assert self._extract(value) == "https://example.com/file.pdf"
+
+ def test_dict_multiple_downloaded_files_returns_first(self) -> None:
+ value = {
+ "downloaded_files": [
+ {"url": "https://example.com/first.pdf"},
+ {"url": "https://example.com/second.pdf"},
+ ]
+ }
+ assert self._extract(value) == "https://example.com/first.pdf"
+
+ def test_dict_with_extra_fields_still_extracts_url(self) -> None:
+ value = {
+ "extracted_information": {"key": "value"},
+ "downloaded_files": [{"url": "https://s3.amazonaws.com/bucket/report.xlsx", "filename": "report.xlsx"}],
+ }
+ assert self._extract(value) == "https://s3.amazonaws.com/bucket/report.xlsx"
+
+ def test_dict_empty_downloaded_files_returns_none(self) -> None:
+ assert self._extract({"downloaded_files": []}) is None
+
+ def test_dict_missing_downloaded_files_returns_none(self) -> None:
+ assert self._extract({"extracted_information": {"foo": "bar"}}) is None
+
+ def test_dict_downloaded_files_item_missing_url_returns_none(self) -> None:
+ assert self._extract({"downloaded_files": [{"filename": "file.pdf"}]}) is None
+
+ def test_dict_downloaded_files_item_empty_url_returns_none(self) -> None:
+ assert self._extract({"downloaded_files": [{"url": ""}]}) is None
+
+ # --- JSON string inputs ---
+
+ def test_json_string_with_downloaded_files_returns_url(self) -> None:
+ import json
+
+ value = json.dumps({"downloaded_files": [{"url": "https://example.com/file.csv"}]})
+ assert self._extract(value) == "https://example.com/file.csv"
+
+ def test_json_string_without_downloaded_files_returns_none(self) -> None:
+ import json
+
+ value = json.dumps({"extracted_information": {"k": "v"}})
+ assert self._extract(value) is None
+
+ # --- Python dict repr strings (produced by Jinja {{ block_output }} rendering) ---
+
+ def test_python_repr_string_with_downloaded_files_returns_url(self) -> None:
+ value = "{'downloaded_files': [{'url': 'https://example.com/report.pdf', 'checksum': None}]}"
+ assert self._extract(value) == "https://example.com/report.pdf"
+
+ def test_python_repr_string_without_downloaded_files_returns_none(self) -> None:
+ value = "{'extracted_information': {'a': 1}}"
+ assert self._extract(value) is None
+
+ # --- Plain URL strings (should not be extracted, returns None) ---
+
+ def test_plain_url_string_returns_none(self) -> None:
+ assert self._extract("https://example.com/file.pdf") is None
+
+ def test_plain_string_returns_none(self) -> None:
+ assert self._extract("not a url or dict") is None
+
+ # --- Other types ---
+
+ def test_none_returns_none(self) -> None:
+ assert self._extract(None) is None
+
+ def test_list_returns_none(self) -> None:
+ assert self._extract([{"url": "https://example.com/file.pdf"}]) is None
+
+ def test_integer_returns_none(self) -> None:
+ assert self._extract(42) is None