From 916e4699d0642334d4ab2dccfdbcd15cdb0614d1 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Thu, 4 Sep 2025 16:17:01 -0700 Subject: [PATCH] show input value before the value is interpretated into a real secret (#3364) --- skyvern/config.py | 2 +- .../core/script_generations/skyvern_page.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/skyvern/config.py b/skyvern/config.py index 8ab1fdf0..d826bda5 100644 --- a/skyvern/config.py +++ b/skyvern/config.py @@ -304,7 +304,7 @@ class Settings(BaseSettings): SVG_MAX_LENGTH: int = 100000 ENABLE_LOG_ARTIFACTS: bool = False - ENABLE_CODE_BLOCK: bool = True + ENABLE_CODE_BLOCK: bool = False TASK_BLOCKED_SITE_FALLBACK_URL: str = "https://www.google.com" diff --git a/skyvern/core/script_generations/skyvern_page.py b/skyvern/core/script_generations/skyvern_page.py index 53ac05d3..2f9fc4ed 100644 --- a/skyvern/core/script_generations/skyvern_page.py +++ b/skyvern/core/script_generations/skyvern_page.py @@ -168,6 +168,7 @@ class SkyvernPage: status=action_status, data=data, kwargs=kwargs, + call_result=call.result, ) # Auto-create screenshot artifact after execution @@ -190,6 +191,7 @@ class SkyvernPage: status: ActionStatus = ActionStatus.pending, data: str | dict[str, Any] = "", kwargs: dict[str, Any] | None = None, + call_result: Any | None = None, ) -> Action | None: """Create an action record in the database before execution if task_id and step_id are available.""" try: @@ -206,6 +208,7 @@ class SkyvernPage: response: str | None = kwargs.get("response") if not response: if action_type == ActionType.INPUT_TEXT: + text = str(call_result) response = text elif action_type == ActionType.SELECT_OPTION: if select_option: @@ -343,8 +346,8 @@ class SkyvernPage: intention: str | None = None, data: str | dict[str, Any] | None = None, timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS, - ) -> None: - await self._input_text(xpath, value, ai_infer, intention, data, timeout) + ) -> str: + return await self._input_text(xpath, value, ai_infer, intention, data, timeout) @action_wrap(ActionType.INPUT_TEXT) async def type( @@ -355,8 +358,8 @@ class SkyvernPage: intention: str | None = None, data: str | dict[str, Any] | None = None, timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS, - ) -> None: - await self._input_text(xpath, value, ai_infer, intention, data, timeout) + ) -> str: + return await self._input_text(xpath, value, ai_infer, intention, data, timeout) async def _input_text( self, @@ -366,7 +369,7 @@ class SkyvernPage: intention: str | None = None, data: str | dict[str, Any] | None = None, timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS, - ) -> None: + ) -> str: """Input text into an element identified by ``xpath``. When ``intention`` and ``data`` are provided a new input text action is @@ -380,6 +383,7 @@ class SkyvernPage: # format the text with the actual value of the parameter if it's a secret when running a workflow context = skyvern_context.current() value = value or "" + transformed_value = value if ai_infer and intention: try: prompt = context.prompt if context else None @@ -402,10 +406,11 @@ class SkyvernPage: LOG.exception(f"Failed to adapt value for input text action on xpath={xpath}, value={value}") if context and context.workflow_run_id: - value = await _get_actual_value_of_parameter_if_secret(context.workflow_run_id, value) + transformed_value = await _get_actual_value_of_parameter_if_secret(context.workflow_run_id, value) locator = self.page.locator(f"xpath={xpath}") - await handler_utils.input_sequentially(locator, value, timeout=timeout) + await handler_utils.input_sequentially(locator, transformed_value, timeout=timeout) + return value @action_wrap(ActionType.UPLOAD_FILE) async def upload_file(