Skip to content

Automate browser based workflows with AI

fix: gate secure CodeBlock runner on browser session, flag-only in staging (#6825)

Shuchang Zhengef516e867ef2
diff --git a/skyvern/forge/agent_functions.py b/skyvern/forge/agent_functions.py
index e83abd141..d8f069e4f 100644
--- a/skyvern/forge/agent_functions.py
+++ b/skyvern/forge/agent_functions.py
@@ -708,12 +708,14 @@ class AgentFunction:
workflow_run_context: "WorkflowRunContext",
organization_id: str | None,
block_label: str | None,
+ browser_session_id: str | None,
) -> bool:
"""Whether a workflow CodeBlock run should execute in the secure runner sidecar.
Gating lives here, at the block-execution call site, rather than inside
execute_code_block_override so the override only runs the runner. OSS has no
- runner and returns False; cloud overrides to consult SECURE_CODEBLOCK_ENABLED.
+ runner and returns False; cloud overrides to consult SECURE_CODEBLOCK_ENABLED and
+ only routes runs that have a browser session for the runner to broker against.
"""
return False
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py
index ae9e81afa..f368833e3 100644
--- a/skyvern/forge/sdk/workflow/models/block.py
+++ b/skyvern/forge/sdk/workflow/models/block.py
@@ -4102,6 +4102,7 @@ async def wrapper({default_args}):
workflow_run_context=workflow_run_context,
organization_id=organization_id,
block_label=self.label,
+ browser_session_id=browser_session_id,
)
except CodeBlockRunnerSelectionError as selection_error:
return await self.build_block_result(