Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix(scripts): propagate workflow_scripts.is_pinned from cache_key lookup (#6034)
pedrohsdb3bf378838970
diff --git a/pyproject.toml b/pyproject.tomlindex 855d845a0..034b78bc1 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -71,7 +71,7 @@ local = ["jsonschema>=4.23.0","python-calamine>=0.6.1","python-docx>=1.1.0",- "urllib3>=2.6.3",+ "urllib3>=2.7.0","zstandard>=0.25.0","sse-starlette>=3.4.1,<4","opentelemetry-api>=1.41.1,<2",@@ -145,7 +145,7 @@ server = ["jsonschema>=4.23.0","python-calamine>=0.6.1","python-docx>=1.1.0",- "urllib3>=2.6.3",+ "urllib3>=2.7.0","zstandard>=0.25.0","sse-starlette>=3.4.1,<4","opentelemetry-api>=1.41.1,<2",diff --git a/skyvern/forge/sdk/db/repositories/scripts.py b/skyvern/forge/sdk/db/repositories/scripts.pyindex bdb1e869b..9ee3f9856 100644--- a/skyvern/forge/sdk/db/repositories/scripts.py+++ b/skyvern/forge/sdk/db/repositories/scripts.py@@ -822,14 +822,16 @@ class ScriptsRepository(BaseRepository):"""Get latest script version linked to a workflow by a specific cache_key_value.Returns:- A tuple of (script, is_pinned). The repository implementation does not- support pinned queries, so is_pinned is always False.+ A tuple of (script, is_pinned) where ``is_pinned`` is the+ ``workflow_scripts.is_pinned`` flag on the row that resolved the+ lookup. Callers (e.g. the script reviewer's pin check) rely on+ this flag to decide whether to regenerate."""async with self.Session() as session:# Build the query: join workflow_scripts with scripts- # Join on both script_id and organization_id to leverage uc_org_script_version index+ # Join on both script_id and organization_id to leverage uc_org_script_version index.query = (- select(ScriptModel)+ select(ScriptModel, WorkflowScriptModel.is_pinned).join(WorkflowScriptModel,and_(@@ -860,10 +862,19 @@ class ScriptsRepository(BaseRepository):if statuses is not None and len(statuses) > 0:query = query.where(WorkflowScriptModel.status.in_(statuses))- query = query.order_by(ScriptModel.created_at.desc(), ScriptModel.version.desc()).limit(1)-- script = (await session.scalars(query)).first()- return (convert_to_script(script), False) if script else (None, False)+ # Prefer pinned workflow_scripts rows on ties — a stray un-pinned+ # row for the same cache_key_value must not shadow an explicit pin.+ query = query.order_by(+ WorkflowScriptModel.is_pinned.desc(),+ ScriptModel.created_at.desc(),+ ScriptModel.version.desc(),+ ).limit(1)++ row = (await session.execute(query)).first()+ if row is None:+ return None, False+ script_model, is_pinned = row+ return convert_to_script(script_model), bool(is_pinned)@db_operation("get_workflow_cache_key_count")async def get_workflow_cache_key_count(diff --git a/uv.lock b/uv.lockindex 66592b02c..1ca765f9d 100644--- a/uv.lock+++ b/uv.lock@@ -5831,8 +5831,8 @@ requires-dist = [{ name = "typer", specifier = ">=0.16.0" },{ name = "types-boto3", extras = ["full"], marker = "extra == 'server'", specifier = ">=1.38.31,<2" },{ name = "types-toml", marker = "extra == 'server'", specifier = ">=0.10.8.7,<0.11" },- { name = "urllib3", marker = "extra == 'local'", specifier = ">=2.6.3" },- { name = "urllib3", marker = "extra == 'server'", specifier = ">=2.6.3" },+ { name = "urllib3", marker = "extra == 'local'", specifier = ">=2.7.0" },+ { name = "urllib3", marker = "extra == 'server'", specifier = ">=2.7.0" },{ name = "uvicorn", extras = ["standard"], marker = "extra == 'server'", specifier = ">=0.44.0" },{ name = "websockets", marker = "extra == 'local'", specifier = ">=12.0,<15.1" },{ name = "websockets", marker = "extra == 'server'", specifier = ">=12.0,<15.1" },@@ -6394,11 +6394,11 @@ wheels = [[[package]]name = "urllib3"-version = "2.6.3"+version = "2.7.0"source = { registry = "https://pypi.org/simple" }-sdist = { url = "https://files.pythonhosted.org/packages/c7/24/5f1b3bdffd70275f6661c76461e25f024d5a38a46f04aaca912426a2b1d3/urllib3-2.6.3.tar.gz", hash = "sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed", size = 435556, upload-time = "2026-01-07T16:24:43.925Z" }+sdist = { url = "https://files.pythonhosted.org/packages/53/0c/06f8b233b8fd13b9e5ee11424ef85419ba0d8ba0b3138bf360be2ff56953/urllib3-2.7.0.tar.gz", hash = "sha256:231e0ec3b63ceb14667c67be60f2f2c40a518cb38b03af60abc813da26505f4c", size = 433602, upload-time = "2026-05-07T16:13:18.596Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/39/08/aaaad47bc4e9dc8c725e68f9d04865dbcb2052843ff09c97b08904852d84/urllib3-2.6.3-py3-none-any.whl", hash = "sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4", size = 131584, upload-time = "2026-01-07T16:24:42.685Z" },+ { url = "https://files.pythonhosted.org/packages/7f/3e/5db95bcf282c52709639744ca2a8b149baccf648e39c8cc87553df9eae0c/urllib3-2.7.0-py3-none-any.whl", hash = "sha256:9fb4c81ebbb1ce9531cce37674bbc6f1360472bc18ca9a553ede278ef7276897", size = 131087, upload-time = "2026-05-07T16:13:17.151Z" },][[package]]