Skip to content

Automate browser based workflows with AI

SKY-18718 Demonstrate task card: clearer description copy (#8968)

Cindy Lie729b3fb44ec
diff --git a/docs/api-reference/openapi.json b/docs/api-reference/openapi.json
index 83c412c47..8ff748bde 100644
--- a/docs/api-reference/openapi.json
+++ b/docs/api-reference/openapi.json
@@ -15,22 +15,6 @@
"description": "Run a task",
"operationId": "run_task_v1_run_tasks_post",
"parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "X-Api-Key"
- }
- },
{
"name": "x-user-agent",
"in": "header",
@@ -98,6 +82,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -120,22 +109,6 @@
"title": "Template"
}
},
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "X-Api-Key"
- }
- },
{
"name": "x-max-steps-override",
"in": "header",
@@ -229,6 +202,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -256,24 +234,6 @@
"title": "Run Id"
},
"description": "The id of the task run or the workflow run."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -336,6 +296,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -358,24 +323,6 @@
"title": "Run Id"
},
"description": "The id of the task run or the workflow run to cancel."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -412,6 +359,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -423,26 +375,6 @@
"summary": "Bulk cancel runs",
"description": "Cancel multiple runs (tasks or workflows) in a single request",
"operationId": "bulk_cancel_runs_v1_runs_cancel_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -489,6 +421,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -519,24 +456,6 @@
},
"description": "Optional folder ID to assign the workflow to"
},
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- },
{
"name": "Idempotency-Key",
"in": "header",
@@ -602,6 +521,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
},
"get": {
@@ -775,24 +699,6 @@
"default": false,
"title": "Template"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -835,6 +741,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -860,24 +771,6 @@
"title": "Workflow Id"
},
"description": "The ID of the agent to update. Starts with `wpid_`."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -923,6 +816,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -948,24 +846,6 @@
"title": "Workflow Id"
},
"description": "The ID of the agent to delete. Starts with `wpid_`."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -1002,6 +882,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -1013,26 +898,6 @@
"summary": "Create folder",
"description": "Create a new folder to organize workflows",
"operationId": "create_folder_v1_folders_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -1068,7 +933,12 @@
}
}
},
- "x-fern-sdk-method-name": "create_folder"
+ "x-fern-sdk-method-name": "create_folder",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"get": {
"tags": [
@@ -1122,24 +992,6 @@
"title": "Search"
},
"description": "Search folders by title or description"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -1168,7 +1020,12 @@
}
}
},
- "x-fern-sdk-method-name": "get_folders"
+ "x-fern-sdk-method-name": "get_folders",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/folders/{folder_id}": {
@@ -1193,24 +1050,6 @@
"title": "Folder Id"
},
"description": "Folder ID"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -1238,7 +1077,12 @@
}
}
},
- "x-fern-sdk-method-name": "get_folder"
+ "x-fern-sdk-method-name": "get_folder",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"put": {
"tags": [
@@ -1261,24 +1105,6 @@
"title": "Folder Id"
},
"description": "Folder ID"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -1316,7 +1142,12 @@
}
}
},
- "x-fern-sdk-method-name": "update_folder"
+ "x-fern-sdk-method-name": "update_folder",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"delete": {
"tags": [
@@ -1351,24 +1182,6 @@
"title": "Delete Workflows"
},
"description": "If true, also delete all workflows in this folder"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -1398,7 +1211,12 @@
}
}
},
- "x-fern-sdk-method-name": "delete_folder"
+ "x-fern-sdk-method-name": "delete_folder",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/browser_types": {
@@ -1409,26 +1227,6 @@
"summary": "List selectable browser types",
"description": "List the selectable browser engines for the workflow/run browser_type setting. The list is runtime-capability aware: a runtime that can honor an explicit engine (the cloud dynamic-browser capability) returns all supported engines, while a runtime without it (OSS/self-host) returns an empty list rather than advertising selections the server would reject.",
"operationId": "get_browser_types_v1_browser_types_get",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"responses": {
"200": {
"description": "Successfully listed selectable browser types",
@@ -1455,7 +1253,12 @@
}
}
},
- "x-fern-sdk-method-name": "get_browser_types"
+ "x-fern-sdk-method-name": "get_browser_types",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/runs/{workflow_run_id}/tags": {
@@ -1480,24 +1283,6 @@
"title": "Workflow Run Id"
},
"description": "Workflow run ID"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -1529,7 +1314,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "apply_run_tags"
+ "x-fern-sdk-method-name": "apply_run_tags",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"get": {
"tags": [
@@ -1552,24 +1342,6 @@
"title": "Workflow Run Id"
},
"description": "Workflow run ID"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -1598,7 +1370,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "get_run_tags"
+ "x-fern-sdk-method-name": "get_run_tags",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/runs/{workflow_run_id}/tags/{key}": {
@@ -1637,24 +1414,6 @@
"title": "Key"
},
"description": "Tag key to delete"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -1683,7 +1442,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "delete_run_tag"
+ "x-fern-sdk-method-name": "delete_run_tag",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/runs/{workflow_run_id}/tags/history": {
@@ -1759,24 +1523,6 @@
"title": "Key"
},
"description": "Filter to events for a single tag key"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -1805,7 +1551,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "get_run_tag_history"
+ "x-fern-sdk-method-name": "get_run_tag_history",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/tag-keys": {
@@ -1816,26 +1567,6 @@
"summary": "List tag keys",
"description": "List all tag keys registered for the organization with their descriptions.",
"operationId": "list_tag_keys_v1_tag_keys_get",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"responses": {
"200": {
"description": "Successfully retrieved tag keys",
@@ -1863,7 +1594,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "list_tag_keys"
+ "x-fern-sdk-method-name": "list_tag_keys",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/tag-keys/{key}": {
@@ -1885,24 +1621,6 @@
"title": "Key"
},
"description": "Tag key to update"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -1934,7 +1652,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "update_tag_key"
+ "x-fern-sdk-method-name": "update_tag_key",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"delete": {
"tags": [
@@ -1957,24 +1680,6 @@
"title": "Key"
},
"description": "Tag key to delete"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -2003,7 +1708,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "delete_tag_key"
+ "x-fern-sdk-method-name": "delete_tag_key",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/tag-values": {
@@ -2032,24 +1742,6 @@
"title": "Key"
},
"description": "Filter to values for a single tag key"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -2079,7 +1771,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "list_tag_values"
+ "x-fern-sdk-method-name": "list_tag_values",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"post": {
"tags": [
@@ -2088,26 +1785,6 @@
"summary": "Create tag value",
"description": "Register a grouped tag (key, value) with a palette color before any workflow uses it. The label shows a zero workflow count until applied to a workflow.",
"operationId": "create_tag_value_v1_tag_values_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -2137,7 +1814,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "create_tag_value"
+ "x-fern-sdk-method-name": "create_tag_value",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/tag-values/{key}": {
@@ -2162,24 +1844,6 @@
"title": "Key"
},
"description": "Tag key (group)"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -2211,7 +1875,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "update_tag_value"
+ "x-fern-sdk-method-name": "update_tag_value",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"delete": {
"tags": [
@@ -2234,24 +1903,6 @@
"title": "Key"
},
"description": "Tag key (group)"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -2290,7 +1941,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "delete_tag_value"
+ "x-fern-sdk-method-name": "delete_tag_value",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/tag-values/{key}/rename": {
@@ -2315,24 +1971,6 @@
"title": "Key"
},
"description": "Tag key (group)"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -2367,7 +2005,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "rename_tag_value"
+ "x-fern-sdk-method-name": "rename_tag_value",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/workflow-tags": {
@@ -2399,24 +2042,6 @@
"title": "Workflow Permanent Ids"
},
"description": "Comma-separated workflow permanent IDs"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -2445,7 +2070,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "batch_get_workflow_tags"
+ "x-fern-sdk-method-name": "batch_get_workflow_tags",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"post": {
"tags": [
@@ -2454,26 +2084,6 @@
"summary": "Batch get agent tags (POST)",
"description": "Batch fetch current tags for many workflows (POST variant for id lists exceeding URL length).",
"operationId": "batch_get_workflow_tags_post_v1_workflow_tags_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -2510,7 +2120,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "batch_get_workflow_tags_post"
+ "x-fern-sdk-method-name": "batch_get_workflow_tags_post",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/run-tags": {
@@ -2542,24 +2157,6 @@
"title": "Workflow Run Ids"
},
"description": "Comma-separated workflow run IDs"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -2588,7 +2185,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "batch_get_run_tags"
+ "x-fern-sdk-method-name": "batch_get_run_tags",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"post": {
"tags": [
@@ -2597,26 +2199,6 @@
"summary": "Batch get run tags (POST)",
"description": "Batch fetch current tags for many workflow runs (POST variant for id lists exceeding URL length).",
"operationId": "batch_get_run_tags_post_v1_run_tags_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -2653,7 +2235,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "batch_get_run_tags_post"
+ "x-fern-sdk-method-name": "batch_get_run_tags_post",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/run-tag-suggestions": {
@@ -2664,26 +2251,6 @@
"summary": "List run tag suggestions",
"description": "List distinct (key, value) pairs ever set on a run for the organization, sourced from the run-tag event log rather than the tag-key/tag-value registry. Surfaces reserved 'skyvern.*' system keys (which are never registered) so pickers can offer them alongside user-defined tags.",
"operationId": "get_run_tag_suggestions_v1_run_tag_suggestions_get",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"responses": {
"200": {
"description": "Successfully retrieved run tag suggestions",
@@ -2707,7 +2274,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "get_run_tag_suggestions"
+ "x-fern-sdk-method-name": "get_run_tag_suggestions",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/artifacts/{artifact_id}/content": {
@@ -2801,24 +2373,6 @@
],
"title": "Artifact Type"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -2847,7 +2401,12 @@
}
}
},
- "x-fern-sdk-method-name": "get_run_artifacts"
+ "x-fern-sdk-method-name": "get_run_artifacts",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/runs/{run_id}/retry_webhook": {
@@ -2873,24 +2432,6 @@
"title": "Run Id"
},
"description": "The id of the task run or the workflow run."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -2946,6 +2487,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -2972,24 +2518,6 @@
"title": "Run Id"
},
"description": "The id of the workflow run or task_v2 run."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -3038,6 +2566,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -3236,24 +2769,6 @@
"title": "Failure Category"
},
"description": "Exact-match filter on a workflow run's top classifier failure category (`failure_category[0].category`). Only failed, terminated, and timed_out runs are eligible; canceled runs are never returned by this filter. Applies to `run_type=workflow_run` only — combined with a task run_type it matches nothing."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -3283,7 +2798,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "get_runs_v2"
+ "x-fern-sdk-method-name": "get_runs_v2",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/upload_file": {
@@ -3294,26 +2814,6 @@
"summary": "Upload a file",
"description": "Upload a file to Skyvern storage so runs can reference it as an input. Returns the file id, its storage URI, a presigned download URL, and the expiry implied by the requested retention period.",
"operationId": "upload_file_v1_upload_file_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -3346,7 +2846,12 @@
}
}
},
- "x-fern-sdk-method-name": "upload_file"
+ "x-fern-sdk-method-name": "upload_file",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/files/{file_id}": {
@@ -3366,24 +2871,6 @@
"type": "string",
"title": "File Id"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -3401,7 +2888,12 @@
}
}
},
- "x-fern-sdk-method-name": "delete_file"
+ "x-fern-sdk-method-name": "delete_file",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/browser_profiles": {
@@ -3412,26 +2904,6 @@
"summary": "Create a browser profile",
"description": "Create a blank browser profile, or create one from a persistent browser session or workflow run.",
"operationId": "create_browser_profile_v1_browser_profiles_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -3484,6 +2956,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
},
"get": {
@@ -3567,24 +3044,6 @@
"title": "Managed"
},
"description": "Omit to return all profiles; false returns only user-created profiles; true returns only auto-managed profiles."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -3627,6 +3086,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -3652,24 +3116,6 @@
"title": "Profile Id"
},
"description": "The ID of the browser profile. browser_profile_id starts with `bp_`"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -3711,6 +3157,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
},
"patch": {
@@ -3734,24 +3185,6 @@
"title": "Profile Id"
},
"description": "The ID of the browser profile to update. browser_profile_id starts with `bp_`"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -3806,6 +3239,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
},
"delete": {
@@ -3829,24 +3267,6 @@
"title": "Profile Id"
},
"description": "The ID of the browser profile to delete. browser_profile_id starts with `bp_`"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -3881,6 +3301,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -3906,24 +3331,6 @@
"title": "Profile Id"
},
"description": "The ID of the browser profile. browser_profile_id starts with `bp_`"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -3951,7 +3358,12 @@
}
}
},
- "x-fern-sdk-method-name": "get_browser_profile_usage"
+ "x-fern-sdk-method-name": "get_browser_profile_usage",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/browser_sessions": {
@@ -3962,26 +3374,6 @@
"summary": "Create a session",
"description": "Create a browser session that persists across multiple runs",
"operationId": "create_browser_session_v1_browser_sessions_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"content": {
"application/json": {
@@ -4066,6 +3458,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
},
"get": {
@@ -4075,26 +3472,6 @@
"summary": "Get active browser sessions",
"description": "Get all active browser sessions for the organization",
"operationId": "get_browser_sessions_v1_browser_sessions_get",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"responses": {
"200": {
"description": "Successfully retrieved all active browser sessions",
@@ -4138,6 +3515,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -4163,24 +3545,6 @@
"title": "Browser Session Id"
},
"description": "The ID of the browser session to close. completed_at will be set when the browser session is closed. browser_session_id starts with `pbs_`"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -4223,6 +3587,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -4248,24 +3617,6 @@
"title": "Browser Session Id"
},
"description": "The ID of the browser session. browser_session_id starts with `pbs_`"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -4326,6 +3677,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -4351,24 +3707,6 @@
"title": "Browser Session Id"
},
"description": "The ID of the browser session. browser_session_id starts with `pbs_`"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -4412,7 +3750,12 @@
}
}
},
- "x-fern-sdk-method-name": "update_browser_session"
+ "x-fern-sdk-method-name": "update_browser_session",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"get": {
"tags": [
@@ -4435,24 +3778,6 @@
"title": "Browser Session Id"
},
"description": "The ID of the browser session. browser_session_id starts with `pbs_`"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -4530,6 +3855,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -4541,26 +3871,6 @@
"summary": "Send TOTP code",
"description": "Forward a TOTP (2FA, MFA) email or sms message containing the code to Skyvern. This endpoint stores the code in database so that Skyvern can use it while running tasks/workflows.",
"operationId": "send_totp_code_v1_credentials_totp_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -4610,6 +3920,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -4621,26 +3936,6 @@
"summary": "Create credential",
"description": "Creates a new credential for the current organization",
"operationId": "create_credential_v1_credentials_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -4710,6 +4005,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
},
"get": {
@@ -4812,24 +4112,6 @@
"title": "Search"
},
"description": "Case-insensitive search across credential name, username, secret label, and card details, or an exact credential ID"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -4872,6 +4154,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -4900,24 +4187,6 @@
"title": "Credential Id"
},
"description": "The unique identifier of the credential to update"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -4980,6 +4249,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -5008,24 +4282,6 @@
"title": "Credential Id"
},
"description": "The unique identifier of the credential to delete"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -5057,6 +4313,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -5085,24 +4346,6 @@
"title": "Credential Id"
},
"description": "The unique identifier of the credential"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -5141,6 +4384,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -5152,26 +4400,6 @@
"summary": "List Custom LLMs",
"description": "List the custom LLM configurations available to the current organization.",
"operationId": "list_custom_llms_v1_custom_llms_get",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"responses": {
"200": {
"description": "Successful Response",
@@ -5195,7 +4423,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "list_custom_llms"
+ "x-fern-sdk-method-name": "list_custom_llms",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"post": {
"tags": [
@@ -5204,26 +4437,6 @@
"summary": "Create Custom LLM",
"description": "Create a custom LLM configuration for the current organization.",
"operationId": "create_custom_llm_v1_custom_llms_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -5257,7 +4470,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "create_custom_llm"
+ "x-fern-sdk-method-name": "create_custom_llm",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/custom-llms/{custom_llm_id}": {
@@ -5279,24 +4497,6 @@
"title": "Custom Llm Id"
},
"description": "The custom LLM id."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -5332,7 +4532,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "update_custom_llm"
+ "x-fern-sdk-method-name": "update_custom_llm",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"delete": {
"tags": [
@@ -5352,24 +4557,6 @@
"title": "Custom Llm Id"
},
"description": "The custom LLM id."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -5395,7 +4582,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "delete_custom_llm"
+ "x-fern-sdk-method-name": "delete_custom_llm",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/run/tasks/login": {
@@ -5407,22 +4599,6 @@
"description": "Log in to a website using either credential stored in Skyvern, Bitwarden, 1Password, or Azure Vault",
"operationId": "login_v1_run_tasks_login_post",
"parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "X-Api-Key"
- }
- },
{
"name": "x-user-agent",
"in": "header",
@@ -5504,6 +4680,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -5516,22 +4697,6 @@
"description": "Download a file from a website by navigating and clicking download buttons",
"operationId": "download_files_v1_run_tasks_download_files_post",
"parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "X-Api-Key"
- }
- },
{
"name": "x-user-agent",
"in": "header",
@@ -5597,6 +4762,11 @@
}
]
}
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
]
}
},
@@ -5608,26 +4778,6 @@
"summary": "Create script",
"description": "Create a new script with optional files and metadata",
"operationId": "create_script_v1_scripts_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -5661,7 +4811,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "create_script"
+ "x-fern-sdk-method-name": "create_script",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"get": {
"tags": [
@@ -5702,24 +4857,6 @@
"title": "Page Size"
},
"description": "Number of items per page"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -5749,7 +4886,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "get_scripts"
+ "x-fern-sdk-method-name": "get_scripts",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/scripts/{script_id}": {
@@ -5774,24 +4916,6 @@
"title": "Script Id"
},
"description": "The unique identifier of the script"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -5817,7 +4941,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "get_script"
+ "x-fern-sdk-method-name": "get_script",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/scripts/{script_id}/deploy": {
@@ -5842,24 +4971,6 @@
"title": "Script Id"
},
"description": "The unique identifier of the script"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -5895,7 +5006,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "deploy_script"
+ "x-fern-sdk-method-name": "deploy_script",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/scripts/{script_id}/run": {
@@ -5920,24 +5036,6 @@
"title": "Script Id"
},
"description": "The unique identifier of the script"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -5960,7 +5058,12 @@
}
}
},
- "x-hidden": true
+ "x-hidden": true,
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/sdk/run_action": {
@@ -5971,26 +5074,6 @@
"summary": "Run an SDK action",
"description": "Execute a single SDK action with the specified parameters",
"operationId": "run_sdk_action_v1_sdk_run_action_post",
- "parameters": [
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
- }
- ],
"requestBody": {
"required": true,
"content": {
@@ -6024,7 +5107,12 @@
}
},
"x-excluded": true,
- "x-fern-sdk-method-name": "run_sdk_action"
+ "x-fern-sdk-method-name": "run_sdk_action",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/schedules": {
@@ -6098,24 +5186,6 @@
"title": "Search"
},
"description": "Search by workflow title or schedule name"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -6139,7 +5209,12 @@
}
}
}
- }
+ },
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/folder": {
@@ -6164,24 +5239,6 @@
"title": "Workflow Permanent Id"
},
"description": "Workflow permanent ID"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -6222,7 +5279,12 @@
}
}
},
- "x-fern-sdk-method-name": "update_workflow_folder"
+ "x-fern-sdk-method-name": "update_workflow_folder",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/tags": {
@@ -6247,24 +5309,6 @@
"title": "Workflow Permanent Id"
},
"description": "Workflow permanent ID"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -6296,7 +5340,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "apply_workflow_tags"
+ "x-fern-sdk-method-name": "apply_workflow_tags",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"get": {
"tags": [
@@ -6319,24 +5368,6 @@
"title": "Workflow Permanent Id"
},
"description": "Workflow permanent ID"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -6365,7 +5396,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "get_workflow_tags"
+ "x-fern-sdk-method-name": "get_workflow_tags",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/tags/{key}": {
@@ -6404,24 +5440,6 @@
"title": "Key"
},
"description": "Tag key to delete"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -6450,7 +5468,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "delete_workflow_tag"
+ "x-fern-sdk-method-name": "delete_workflow_tag",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/tags/history": {
@@ -6526,24 +5549,6 @@
"title": "Key"
},
"description": "Filter to events for a single tag key"
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -6572,7 +5577,12 @@
}
},
"x-hidden": true,
- "x-fern-sdk-method-name": "get_workflow_tag_history"
+ "x-fern-sdk-method-name": "get_workflow_tag_history",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/runs/{workflow_run_id}/retry": {
@@ -6598,22 +5608,6 @@
},
"description": "The id of the workflow run to retry."
},
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "X-Api-Key"
- }
- },
{
"name": "x-max-steps-override",
"in": "header",
@@ -6686,7 +5680,12 @@
}
}
},
- "x-fern-sdk-method-name": "retry_workflow_run"
+ "x-fern-sdk-method-name": "retry_workflow_run",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/runs": {
@@ -6695,7 +5694,7 @@
"Runs"
],
"summary": "Get all runs",
- "description": "List workflow runs across all workflows for the current organization.\n\nResults are paginated and can be filtered by **status**, **search_key**, and **error_code**. All filters are combined with **AND** logic — a run must match every supplied filter to be returned.\n\n### search_key\n\nA case-insensitive substring search that matches against **any** of the following fields:\n\n| Searched field | Description |\n|---|---|\n| `workflow_run_id` | The unique run identifier (e.g. `wr_123…`) |\n| `workflow_permanent_id` | The permanent ID of the workflow that ran (e.g. `wpid_123…`) |\n| Workflow **title** | The title of the workflow that ran |\n| Parameter **key** | The `key` of any workflow parameter definition associated with the run |\n| Parameter **description** | The `description` of any workflow parameter definition |\n| Run parameter **value** | The actual value supplied for any parameter when the run was created |\n| `extra_http_headers` | Extra HTTP headers attached to the run (searched as raw JSON text) |\n| `webhook_callback_url` | The webhook URL the run posts its result to |\n\nSoft-deleted parameter definitions are excluded from key/description matching. A run is returned if **any** of the fields above contain the search term.\n\nA **complete** identifier also matches the run that used it, by exact equality:\n\n| Identifier | Description |\n|---|---|\n| `browser_profile_id` | The browser profile the run used (e.g. `bp_123…`) |\n| `browser_session_id` | The browser session the run used (e.g. `pbs_123…`) |\n| **Credential id** | A credential the run used (e.g. `cred_123…`) |\n\nA complete browser profile or browser session id is matched against those identifiers only, not the text fields above. A credential id matches a run when it is the run's sequential credential, the credential the run selected from a pool or fell back to, or the credential bound by a credential parameter on the run's workflow version when the run was created and the run recorded no selection for that parameter. Other pool and fallback members the run did not use do not match.\n\n### error_code\n\nAn **exact-match** filter against the `error_code` field inside each task's `errors` JSON array. A run matches if **any** of its tasks contains an error object with a matching `error_code` value. Error codes are user-defined strings set during workflow execution (e.g. `INVALID_CREDENTIALS`, `LOGIN_FAILED`, `CAPTCHA_DETECTED`).\n\n### Combining filters\n\nAll query parameters use AND logic:\n- `?status=failed` — only failed runs\n- `?status=failed&error_code=LOGIN_FAILED` — failed runs **and** have a LOGIN_FAILED error\n- `?status=failed&error_code=LOGIN_FAILED&search_key=prod_credential` — all three conditions must match",
+ "description": "List workflow runs across all workflows for the current organization.\n\nResults are paginated and can be filtered by **status**, **search_key**, and **error_code**. All filters are combined with **AND** logic — a run must match every supplied filter to be returned.\n\n### search_key\n\nA case-insensitive substring search that matches against **any** of the following fields:\n\n| Searched field | Description |\n|---|---|\n| `workflow_run_id` | The unique run identifier (e.g. `wr_123…`) |\n| `workflow_permanent_id` | The permanent ID of the workflow that ran (e.g. `wpid_123…`) |\n| Workflow **title** | The title of the workflow that ran |\n| Parameter **key** | The `key` of any workflow parameter definition associated with the run |\n| Parameter **description** | The `description` of any workflow parameter definition |\n| Run parameter **value** | The actual value supplied for any parameter when the run was created |\n| `extra_http_headers` | Extra HTTP headers attached to the run (searched as raw JSON text) |\n| `webhook_callback_url` | The webhook URL the run posts its result to |\n\nSoft-deleted parameter definitions are excluded from key/description matching. A run is returned if **any** of the fields above contain the search term.\n\nA **complete** identifier also matches the run that used it, by exact equality:\n\n| Identifier | Description |\n|---|---|\n| `browser_profile_id` | The browser profile the run used (e.g. `bp_123…`) |\n| `browser_session_id` | The browser session the run used (e.g. `pbs_123…`) |\n| **Credential id** | A credential the run used (e.g. `cred_123…`) |\n\nA complete browser profile or browser session id is matched against those identifiers only, not the text fields above. A credential id matches a run when it is the run's sequential credential, the credential the run selected from a pool or fell back to, or the credential bound by a credential parameter on the run's workflow version when the run was created and the run recorded no selection for that parameter. Other pool and fallback members the run did not use do not match.\n\n### Default search window\n\nA `search_key` other than a complete browser profile or session id is matched only against runs created in the **30 days before `created_at_end`** (or before now) unless the request supplies `created_at_start`. This includes complete run and credential ids. Supply `created_at_start` (and optionally `created_at_end`) to search a different range. Listings without `search_key` are not windowed. To fetch one run by its id, use `GET /v1/runs/{run_id}`.\n\n### created_at_start / created_at_end\n\nOptional ISO 8601 bounds on the run's creation time: `created_at_start` is inclusive and `created_at_end` is exclusive. A timestamp without an offset is read as UTC.\n\n### error_code\n\nAn **exact-match** filter against the `error_code` field inside each task's `errors` JSON array. A run matches if **any** of its tasks contains an error object with a matching `error_code` value. Error codes are user-defined strings set during workflow execution (e.g. `INVALID_CREDENTIALS`, `LOGIN_FAILED`, `CAPTCHA_DETECTED`).\n\n### Combining filters\n\nAll query parameters use AND logic:\n- `?status=failed` — only failed runs\n- `?status=failed&error_code=LOGIN_FAILED` — failed runs **and** have a LOGIN_FAILED error\n- `?status=failed&error_code=LOGIN_FAILED&search_key=prod_credential` — all three conditions must match (searched over the last 30 days)\n- `?search_key=prod_credential&created_at_start=2026-01-01T00:00:00Z&created_at_end=2026-02-01T00:00:00Z` — search one explicit month",
"operationId": "get_workflow_runs_v1_workflows_runs_get",
"parameters": [
{
@@ -6759,7 +5758,7 @@
"type": "null"
}
],
- "description": "Case-insensitive substring search across: workflow run ID, parameter key, parameter description, run parameter value, extra HTTP headers and webhook callback URL. A run is returned if any of these fields match. Soft-deleted parameter definitions are excluded from key/description matching. A complete browser profile ID, browser session ID or credential ID matches the run that used it exactly (no substring match). A complete browser profile or browser session ID is matched against those identifiers only, not the text fields. A credential ID matches when it is the run's sequential credential, the credential the run selected from a pool or fell back to, or the credential bound by a credential parameter on the run's workflow version when the run was created and the run recorded no selection for it. The workflow title and workflow permanent ID are matched as well.",
+ "description": "Case-insensitive substring search across: workflow run ID, parameter key, parameter description, run parameter value, extra HTTP headers and webhook callback URL. A run is returned if any of these fields match. Soft-deleted parameter definitions are excluded from key/description matching. A complete browser profile ID, browser session ID or credential ID matches the run that used it exactly (no substring match). A complete browser profile or browser session ID is matched against those identifiers only, not the text fields. A credential ID matches when it is the run's sequential credential, the credential the run selected from a pool or fell back to, or the credential bound by a credential parameter on the run's workflow version when the run was created and the run recorded no selection for it. The workflow title and workflow permanent ID are matched as well. Without created_at_start, a search other than a complete browser profile or session ID covers only runs created in the 30 days before created_at_end (or before now).",
"examples": [
"login_url",
"wr_abc123",
@@ -6768,7 +5767,7 @@
],
"title": "Search Key"
},
- "description": "Case-insensitive substring search across: workflow run ID, parameter key, parameter description, run parameter value, extra HTTP headers and webhook callback URL. A run is returned if any of these fields match. Soft-deleted parameter definitions are excluded from key/description matching. A complete browser profile ID, browser session ID or credential ID matches the run that used it exactly (no substring match). A complete browser profile or browser session ID is matched against those identifiers only, not the text fields. A credential ID matches when it is the run's sequential credential, the credential the run selected from a pool or fell back to, or the credential bound by a credential parameter on the run's workflow version when the run was created and the run recorded no selection for it. The workflow title and workflow permanent ID are matched as well."
+ "description": "Case-insensitive substring search across: workflow run ID, parameter key, parameter description, run parameter value, extra HTTP headers and webhook callback URL. A run is returned if any of these fields match. Soft-deleted parameter definitions are excluded from key/description matching. A complete browser profile ID, browser session ID or credential ID matches the run that used it exactly (no substring match). A complete browser profile or browser session ID is matched against those identifiers only, not the text fields. A credential ID matches when it is the run's sequential credential, the credential the run selected from a pool or fell back to, or the credential bound by a credential parameter on the run's workflow version when the run was created and the run recorded no selection for it. The workflow title and workflow permanent ID are matched as well. Without created_at_start, a search other than a complete browser profile or session ID covers only runs created in the 30 days before created_at_end (or before now)."
},
{
"name": "error_code",
@@ -6795,22 +5794,48 @@
"description": "Exact-match filter on the error_code field inside each task's errors JSON array. A run matches if any of its tasks contains an error with a matching error_code. Error codes are user-defined strings set during workflow execution."
},
{
- "name": "x-api-key",
- "in": "header",
+ "name": "created_at_start",
+ "in": "query",
"required": false,
"schema": {
"anyOf": [
{
- "type": "string"
+ "type": "string",
+ "format": "date-time"
},
{
"type": "null"
}
],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
+ "description": "Only include runs created at or after this timestamp (ISO 8601; a value without an offset is read as UTC). Supplying it replaces the 30-day default window of a free-text search_key.",
+ "examples": [
+ "2026-01-01T00:00:00Z"
+ ],
+ "title": "Created At Start"
},
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
+ "description": "Only include runs created at or after this timestamp (ISO 8601; a value without an offset is read as UTC). Supplying it replaces the 30-day default window of a free-text search_key."
+ },
+ {
+ "name": "created_at_end",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "anyOf": [
+ {
+ "type": "string",
+ "format": "date-time"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Only include runs created strictly before this timestamp (ISO 8601; a value without an offset is read as UTC). Without created_at_start, a free-text search_key covers the 30 days before this timestamp.",
+ "examples": [
+ "2026-02-01T00:00:00Z"
+ ],
+ "title": "Created At End"
+ },
+ "description": "Only include runs created strictly before this timestamp (ISO 8601; a value without an offset is read as UTC). Without created_at_start, a free-text search_key covers the 30 days before this timestamp."
}
],
"responses": {
@@ -6839,7 +5864,12 @@
}
}
},
- "x-fern-sdk-method-name": "get_workflow_runs"
+ "x-fern-sdk-method-name": "get_workflow_runs",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_id}/runs": {
@@ -7033,24 +6063,6 @@
"title": "Include Child Runs"
},
"description": "Include child workflow runs — runs started from inside another workflow run. Excluded by default so the history shows only top-level runs."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7079,7 +6091,12 @@
}
}
},
- "x-fern-sdk-method-name": "get_workflow_runs_by_id"
+ "x-fern-sdk-method-name": "get_workflow_runs_by_id",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}": {
@@ -7125,24 +6142,6 @@
"default": false,
"title": "Template"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7167,7 +6166,12 @@
}
}
},
- "x-fern-sdk-method-name": "get_workflow"
+ "x-fern-sdk-method-name": "get_workflow",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/versions": {
@@ -7197,24 +6201,6 @@
"default": false,
"title": "Template"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7243,7 +6229,12 @@
}
}
},
- "x-fern-sdk-method-name": "get_workflow_versions"
+ "x-fern-sdk-method-name": "get_workflow_versions",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/browser_session/reset_profile": {
@@ -7268,24 +6259,6 @@
"title": "Workflow Permanent Id"
},
"description": "The permanent ID of the workflow. Starts with `wpid_`."
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7309,7 +6282,12 @@
}
}
},
- "x-hidden": true
+ "x-hidden": true,
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/schedules": {
@@ -7329,24 +6307,6 @@
"type": "string",
"title": "Workflow Permanent Id"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -7380,7 +6340,12 @@
}
}
}
- }
+ },
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"get": {
"tags": [
@@ -7398,24 +6363,6 @@
"type": "string",
"title": "Workflow Permanent Id"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7439,7 +6386,12 @@
}
}
}
- }
+ },
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/schedules/{workflow_schedule_id}": {
@@ -7468,24 +6420,6 @@
"type": "string",
"title": "Workflow Schedule Id"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7509,7 +6443,12 @@
}
}
}
- }
+ },
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"put": {
"tags": [
@@ -7536,24 +6475,6 @@
"type": "string",
"title": "Workflow Schedule Id"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"requestBody": {
@@ -7587,7 +6508,12 @@
}
}
}
- }
+ },
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
},
"delete": {
"tags": [
@@ -7614,24 +6540,6 @@
"type": "string",
"title": "Workflow Schedule Id"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7655,7 +6563,12 @@
}
}
}
- }
+ },
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/schedules/{workflow_schedule_id}/cancel": {
@@ -7684,24 +6597,6 @@
"type": "string",
"title": "Workflow Schedule Id"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7725,7 +6620,12 @@
}
}
}
- }
+ },
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/schedules/{workflow_schedule_id}/enable": {
@@ -7754,24 +6654,6 @@
"type": "string",
"title": "Workflow Schedule Id"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7795,7 +6677,12 @@
}
}
}
- }
+ },
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/agents/{workflow_permanent_id}/schedules/{workflow_schedule_id}/disable": {
@@ -7824,24 +6711,6 @@
"type": "string",
"title": "Workflow Schedule Id"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
- "title": "X-Api-Key"
- },
- "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
}
],
"responses": {
@@ -7865,7 +6734,12 @@
}
}
}
- }
+ },
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
},
"/v1/recipes/jobs/extract": {
@@ -8451,22 +7325,6 @@
"default": "json",
"title": "Format"
}
- },
- {
- "name": "x-api-key",
- "in": "header",
- "required": false,
- "schema": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "X-Api-Key"
- }
}
],
"responses": {
@@ -8507,7 +7365,12 @@
}
}
},
- "x-fern-sdk-method-name": "export_audit_events"
+ "x-fern-sdk-method-name": "export_audit_events",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ]
}
}
},
@@ -34830,14 +33693,6 @@
{
"url": "https://api.skyvern.com",
"x-fern-server-name": "Cloud"
- },
- {
- "url": "https://api-staging.skyvern.com",
- "x-fern-server-name": "Staging"
- },
- {
- "url": "http://localhost:8000",
- "x-fern-server-name": "Local"
}
]
}
diff --git a/docs/cloud/studio.mdx b/docs/cloud/studio.mdx
index 885517027..f98e50dfe 100644
--- a/docs/cloud/studio.mdx
+++ b/docs/cloud/studio.mdx
@@ -85,7 +85,7 @@ Open the **Editor** pane. Blocks run top to bottom in the order shown.
Hover over the **+** on the line between two blocks (or under **Start** on a new agent).
</Step>
<Step title="Choose Add Block">
- The menu offers **Add Block**, **Demonstrate task** (do the steps yourself in a live browser and turn them into blocks) and **Upload SOP** (generate blocks from a PDF procedure).
+ The menu offers **Add Block**, **Demonstrate task** (do the steps yourself in a live browser and turn them into blocks) and **Upload SOP** (attach a PDF procedure to Copilot with a draft message you can edit and send).
</Step>
<Step title="Pick a block">
The block library lists every block. Type in **Search blocks...** to filter, then click a block to insert it.
diff --git a/docs/reference/actions.mdx b/docs/reference/actions.mdx
index 791d3b883..6f9e3a088 100644
--- a/docs/reference/actions.mdx
+++ b/docs/reference/actions.mdx
@@ -552,7 +552,7 @@ console.log(result.output)
| `prompt` | `str` | Yes | Multi-step goal description |
| `data_extraction_schema` | `dict \| str` | No | JSON Schema for structured output. See [Extract Structured Data](/developers/browser-automation#extract-structured-data). |
| `max_steps` | `int` | No | Cap AI steps. The run ends with status `failed` ("Reached the maximum steps") if hit. Controls cost; each step is one AI decision + action cycle. |
-| `engine` | `RunEngine` | No | AI engine. Defaults to `skyvern-1.0`. In the app, blocks with no engine set run on Skyvern 3.0 in agents created since October 1, 2026, and the engine selector labels `skyvern-3.0` Recommended. `skyvern-2.0` remains available for existing Skyvern 2.0 agents and explicitly requested Skyvern 2.0 task runs. Other options: `skyvern-3.0`, `openai-cua`, `anthropic-cua`, `ui-tars`, `yutori-navigator`. |
+| `engine` | `RunEngine` | No | AI engine. Defaults to `skyvern-1.0`. On Skyvern Cloud, blocks with no engine set run on Skyvern 3.0 in agents created since October 1, 2026, and the engine selector labels `skyvern-3.0` Recommended. `skyvern-2.0` remains available for existing Skyvern 2.0 agents and explicitly requested Skyvern 2.0 task runs. Other options: `skyvern-3.0`, `openai-cua`, `anthropic-cua`, `ui-tars`, `yutori-navigator`. |
| `model` | `dict` / `Record<string, unknown>` | No | Override LLM model configuration |
| `url` | `str` / `string` | No | URL to navigate to (defaults to current page URL) |
| `webhook_url` | `str` / `string` | No | Callback URL. Skyvern POSTs the full run result on completion or failure. See [Webhooks](/developers/production#webhooks). |
diff --git a/docs/reference/blocks.mdx b/docs/reference/blocks.mdx
index 7d39d0181..eaf9fe8cc 100644
--- a/docs/reference/blocks.mdx
+++ b/docs/reference/blocks.mdx
@@ -50,17 +50,17 @@ These fields appear on most blocks:
| **On block failure** | Only inside loops, where it replaces **Continue on Failure**. Choose **Stop the loop**, **Continue to next block in this iteration** or **Skip to next iteration**. |
| **Model** | Override the default LLM model for this block (Advanced Settings on most blocks) |
-Browser-based blocks (Browser Task, Browser Action, Extraction, Login, File Download) share these additional fields:
-
-| Field | Description |
-|-------|-------------|
-| **URL** | Starting URL. Leave blank to continue from the previous block's page. |
-| **Engine** | AI engine for this block. **Default** runs on Skyvern 3.0 in agents created since October 1, 2026. The selector labels Skyvern 3.0 **Recommended** and Skyvern 1.0 **Legacy**. See [Choose an engine per block](/cloud/studio#choose-an-engine-per-block). |
-| **Max Steps Override** | Cap the number of AI reasoning steps |
-| **Disable Cache** | Skip cached script execution |
-| **2FA Identifier** | ID that links 2FA codes to this block. When empty, the block uses the selected credential's identifier, if it has one. |
-| **2FA Verification URL** | Endpoint this block polls when it needs a 2FA code |
-| **Error Messages** | Map error conditions to custom error codes (JSON) |
+Browser-based blocks (Browser Task, Browser Action, Extraction, Login, File Download) add some of these fields:
+
+| Field | Shown on | Description |
+|-------|----------|-------------|
+| **URL** | All except Extraction | Starting URL. Leave blank to continue from the previous block's page. |
+| **Engine** | All five | AI engine for this block. On Skyvern Cloud, **Default** runs on Skyvern 3.0 in agents created since October 1, 2026. The selector labels Skyvern 3.0 **Recommended** and Skyvern 1.0 and 2.0 **Legacy**. See [Choose an engine per block](/cloud/studio#choose-an-engine-per-block). |
+| **Max Steps Override** | All except Browser Action | Cap the number of AI reasoning steps |
+| **Disable Cache** | All five | Skip cached script execution |
+| **2FA Identifier** | All except Extraction | ID that links 2FA codes to this block. When empty, the block uses the selected credential's identifier, if it has one. |
+| **2FA Verification URL** | All except Extraction | Endpoint this block polls when it needs a 2FA code |
+| **Error Messages** | All except Extraction | Map error conditions to custom error codes (JSON) |
<Note>
Set **2FA Verification URL** on the block that may encounter 2FA. A `totp_url` set on the run does not fill empty block fields.
diff --git a/docs/reference/cli.mdx b/docs/reference/cli.mdx
index 2c11ad5a2..1440dd0e2 100644
--- a/docs/reference/cli.mdx
+++ b/docs/reference/cli.mdx
@@ -165,7 +165,7 @@ skyvern config get max_steps_per_run # Show one setting
skyvern config set max_steps_per_run 25 # Change one setting
```
-`config set` accepts `max_steps_per_run`, `max_steps_per_workflow_run`, `max_retries_per_step`, `webhook_callback_url`, `artifact_url_expiry_seconds` (3600 to 604800), `slug`, and the reset flags `clear_max_steps_per_workflow_run` and `clear_artifact_url_expiry_seconds`.
+`config set` accepts `max_steps_per_run`, `max_steps_per_workflow_run`, `max_retries_per_step`, `webhook_callback_url`, `artifact_url_expiry_seconds` (3600 to 604800), `slug`, `default_llm_key` and `default_secondary_llm_key` (custom LLM keys for the Smart and Fast models), and the reset flags `clear_max_steps_per_workflow_run`, `clear_artifact_url_expiry_seconds`, `clear_default_llm_key` and `clear_default_secondary_llm_key`. `skyvern config set --help` prints the current list.
### Credentials
diff --git a/docs/sdk-reference/complete-reference.mdx b/docs/sdk-reference/complete-reference.mdx
index f0e0b8fb6..bbfde7ba6 100644
--- a/docs/sdk-reference/complete-reference.mdx
+++ b/docs/sdk-reference/complete-reference.mdx
@@ -1,7 +1,7 @@
---
title: Complete Reference (For LLMs)
-subtitle: Every public SDK method in one page
-description: Every public method of the Skyvern Python SDK on one page, with its signature and what it does. Covers tasks and runs, agents, schedules, folders, browser sessions, browser profiles, credentials, files, artifacts, helpers, browser control and error handling, with the TypeScript equivalents.
+subtitle: The public SDK methods in one page
+description: The public methods of the Skyvern Python SDK on one page, with its signature and what it does. Covers tasks and runs, agents, schedules, folders, browser sessions, browser profiles, credentials, files, artifacts, helpers, browser control and error handling, with the TypeScript equivalents.
slug: sdk-reference/complete-reference
keywords:
- complete reference
@@ -19,7 +19,7 @@ keywords:
---
<Note>
-This page lists every public SDK method with a one-line signature. Python names are shown; the TypeScript method is the camelCase name (`get_runs_v2` is `getRunsV2`) unless marked Python only. `?` marks an optional argument. The full reference for every method, with each parameter, return type and a runnable Python and TypeScript example, is generated from the SDK code: [Tasks and runs](/sdk-reference/runs), [Agents](/sdk-reference/agents), [Schedules](/sdk-reference/schedules), [Folders](/sdk-reference/folders), [Browser sessions](/sdk-reference/browser-sessions), [Browser profiles](/sdk-reference/browser-profiles), [Credentials](/sdk-reference/credentials), [Files](/sdk-reference/files), [Artifacts](/sdk-reference/artifacts), [Helpers](/sdk-reference/helpers), and for browser automation [Browsers](/sdk-reference/browser-automation/browsers), [Page actions](/sdk-reference/browser-automation/page), [Forms](/sdk-reference/browser-automation/forms), [Frames](/sdk-reference/browser-automation/frames) and [Page agent](/sdk-reference/browser-automation/agent). Where the two disagree, the generated pages are correct.
+This page lists the public SDK methods with a one-line signature. The SDKs also carry methods for run and agent tags, custom LLMs and scripts; those APIs are hidden from the public API reference, so this page leaves them out too. Python names are shown; the TypeScript method is the camelCase name (`get_runs_v2` is `getRunsV2`) unless marked Python only. `?` marks an optional argument. The full reference for every method, with each parameter, return type and a runnable Python and TypeScript example, is generated from the SDK code: [Tasks and runs](/sdk-reference/runs), [Agents](/sdk-reference/agents), [Schedules](/sdk-reference/schedules), [Folders](/sdk-reference/folders), [Browser sessions](/sdk-reference/browser-sessions), [Browser profiles](/sdk-reference/browser-profiles), [Credentials](/sdk-reference/credentials), [Files](/sdk-reference/files), [Artifacts](/sdk-reference/artifacts), [Helpers](/sdk-reference/helpers), and for browser automation [Browsers](/sdk-reference/browser-automation/browsers), [Page actions](/sdk-reference/browser-automation/page), [Forms](/sdk-reference/browser-automation/forms), [Frames](/sdk-reference/browser-automation/frames) and [Page agent](/sdk-reference/browser-automation/agent). Where the two disagree, the generated pages are correct.
</Note>
## Install and initialize
@@ -85,7 +85,7 @@ Skyvern(
follow_redirects: bool | None = True,
httpx_client: httpx.AsyncClient | None = None, # Your own httpx client
)
-await client.aclose() # Close all browsers and release resources
+await client.aclose() # Stops the local driver; end each cloud browser with await browser.close()
# Local mode (Python only - requires pip install "skyvern[local]")
# For local browser control, also run: python -m playwright install chromium
@@ -214,12 +214,6 @@ await page.frame_switch(selector="#payment-iframe")
page.frame_main() # back to main frame
frames = await page.frame_list() # list all frames
-# classify - pick which described state the page is in, returns the option key (Python only)
-state = await page.classify(options={"logged_in": "Account dashboard", "logged_out": "Sign-in form"})
-
-# element_fallback - let the AI reach a goal when selectors fail (Python only)
-await page.element_fallback(navigation_goal="Open the most recent invoice", max_steps=5)
-
# dynamic_field_map - map your data to extracted form fields with AI (Python only)
mapping = await page.dynamic_field_map(form_fields=fields, data={...})
@@ -266,7 +260,7 @@ await page.selectOption({ prompt: "Select United States" });
// fill_form, fill_multipage_form, fill_from_mapping - Python only
// extract_form_fields, validate_mapping, fill_autocomplete - Python only
// frame_switch, frame_main, frame_list - Python only
-// classify, element_fallback, dynamic_field_map - Python only
+// dynamic_field_map - Python only
// keypress, move, drag, wait, download_file, reload_page - Python only
```
</CodeGroup>
@@ -662,4 +656,4 @@ request_options=RequestOptions(
- `engine` accepts `RunEngine` enum values: `skyvern_v1`, `skyvern_v2`, `skyvern_v3` (Python SDK and REST; the TypeScript client's type does not list `"skyvern-3.0"` yet), `openai_cua`, `anthropic_cua`, `ui_tars`, `yutori_navigator`.
- `launch_local_browser` requires Python local mode (`Skyvern.local()`) and the `skyvern[local]` extra.
- `page.agent` methods always wait for completion.
-- Python-only features: `launch_local_browser`, `get_page_for`, `locator`/`AILocator`, `classify`, `element_fallback`, `type`, `hover`, `scroll`, `keypress`, `move`, `drag`, `wait`, `download_file`, `reload_page`, `upload_file` (page-level), form automation (`fill_form`, `fill_multipage_form`, `extract_form_fields`, `dynamic_field_map`, `fill_from_mapping`, `validate_mapping`, `fill_autocomplete`), and iframe management (`frame_switch`, `frame_main`, `frame_list`).
+- Python-only features: `launch_local_browser`, `get_page_for`, `locator`/`AILocator`, `type`, `hover`, `scroll`, `keypress`, `move`, `drag`, `wait`, `download_file`, `reload_page`, `upload_file` (page-level), form automation (`fill_form`, `fill_multipage_form`, `extract_form_fields`, `dynamic_field_map`, `fill_from_mapping`, `validate_mapping`, `fill_autocomplete`), and iframe management (`frame_switch`, `frame_main`, `frame_list`).
diff --git a/fern/openapi/skyvern_openapi.json b/fern/openapi/skyvern_openapi.json
index 4dd4efdc6..f1a65e388 100644
--- a/fern/openapi/skyvern_openapi.json
+++ b/fern/openapi/skyvern_openapi.json
@@ -94,7 +94,7 @@
},
{
"sdk": "typescript",
- "code": "import { SkyvernClient } from \"@skyvern/client\";\n\nconst skyvern = new SkyvernClient({ apiKey: \"YOUR_API_KEY\" });\nawait skyvern.runTask({\n prompt: \"Find the top 3 posts on Hacker News.\"\n})\n"
+ "code": "import { SkyvernClient } from \"@skyvern/client\";\n\nconst skyvern = new SkyvernClient({ apiKey: \"YOUR_API_KEY\" });\nawait skyvern.runTask({\n body: {\n prompt: \"Find the top 3 posts on Hacker News.\"\n }\n})\n"
}
]
}
@@ -225,7 +225,7 @@
},
{
"sdk": "typescript",
- "code": "import { SkyvernClient } from \"@skyvern/client\";\n\nconst skyvern = new SkyvernClient({ apiKey: \"YOUR_API_KEY\" });\nawait skyvern.runWorkflow({\n agent_id: \"wpid_123\",\n parameters: { parameter1: \"value1\", parameter2: \"value2\" }\n});\n"
+ "code": "import { SkyvernClient } from \"@skyvern/client\";\n\nconst skyvern = new SkyvernClient({ apiKey: \"YOUR_API_KEY\" });\nawait skyvern.runWorkflow({\n body: {\n workflow_id: \"wpid_123\",\n parameters: { parameter1: \"value1\", parameter2: \"value2\" }\n }\n});\n"
}
]
}
@@ -4783,10 +4783,10 @@
"type": "null"
}
],
- "description": "Case-insensitive search across credential name, username, secret label, and card details, or an exact credential ID",
+ "description": "Case-insensitive search across credential name, username, secret label, and card details",
"title": "Search"
},
- "description": "Case-insensitive search across credential name, username, secret label, and card details, or an exact credential ID"
+ "description": "Case-insensitive search across credential name, username, secret label, and card details"
},
{
"name": "x-api-key",
@@ -7856,41 +7856,6 @@
"application/json": {
"schema": {
"properties": {
- "webhook_url": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "format": "uri",
- "title": "Webhook Url",
- "description": "After a run is finished, send an update to this URL. Refer to https://www.skyvern.com/docs/running-tasks/webhooks-faq for more details.",
- "examples": [
- "https://my-site.com/webhook"
- ]
- },
- "proxy_location": {
- "anyOf": [
- {
- "$ref": "#/components/schemas/ProxyLocation"
- },
- {
- "$ref": "#/components/schemas/GeoTarget"
- },
- {
- "additionalProperties": true,
- "type": "object"
- },
- {
- "type": "null"
- }
- ],
- "title": "Proxy Location",
- "description": "Geographic Proxy location to route the browser traffic through. This is only available in Skyvern Cloud.\n\nAvailable geotargeting options:\n- RESIDENTIAL: the default value. Skyvern Cloud uses a random US residential proxy.\n- RESIDENTIAL_ES: Spain\n- RESIDENTIAL_IE: Ireland\n- RESIDENTIAL_GB: United Kingdom\n- RESIDENTIAL_IN: India\n- RESIDENTIAL_JP: Japan\n- RESIDENTIAL_FR: France\n- RESIDENTIAL_DE: Germany\n- RESIDENTIAL_NZ: New Zealand\n- RESIDENTIAL_PH: Philippines\n- RESIDENTIAL_KR: South Korea\n- RESIDENTIAL_SA: Saudi Arabia\n- RESIDENTIAL_ZA: South Africa\n- RESIDENTIAL_AR: Argentina\n- RESIDENTIAL_AU: Australia\n- RESIDENTIAL_BR: Brazil\n- RESIDENTIAL_TR: Turkey\n- RESIDENTIAL_CA: Canada\n- RESIDENTIAL_MX: Mexico\n- RESIDENTIAL_IT: Italy\n- RESIDENTIAL_NL: Netherlands\n- RESIDENTIAL_ISP: ISP proxy\n- US-CA: California (deprecated, routes through RESIDENTIAL_ISP)\n- US-NY: New York (deprecated, routes through RESIDENTIAL_ISP)\n- US-TX: Texas (deprecated, routes through RESIDENTIAL_ISP)\n- US-FL: Florida (deprecated, routes through RESIDENTIAL_ISP)\n- US-WA: Washington (deprecated, routes through RESIDENTIAL_ISP)\n- NONE: No proxy\n\nFor self-hosted deployments, you can pass a custom proxy URL as a dict: {\"url\": \"http://user:[email protected]:8080\"}. This routes the browser through your own proxy server and takes precedence over any globally configured proxy pool. Can also be a GeoTarget object for granular city/state targeting: {\"country\": \"US\", \"subdivision\": \"CA\", \"city\": \"San Francisco\"}. Omit it or send null to use the default; Skyvern Cloud then uses RESIDENTIAL."
- },
"job_url": {
"type": "string",
"format": "uri",
@@ -7956,41 +7921,6 @@
"application/json": {
"schema": {
"properties": {
- "webhook_url": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "format": "uri",
- "title": "Webhook Url",
- "description": "After a run is finished, send an update to this URL. Refer to https://www.skyvern.com/docs/running-tasks/webhooks-faq for more details.",
- "examples": [
- "https://my-site.com/webhook"
- ]
- },
- "proxy_location": {
- "anyOf": [
- {
- "$ref": "#/components/schemas/ProxyLocation"
- },
- {
- "$ref": "#/components/schemas/GeoTarget"
- },
- {
- "additionalProperties": true,
- "type": "object"
- },
- {
- "type": "null"
- }
- ],
- "title": "Proxy Location",
- "description": "Geographic Proxy location to route the browser traffic through. This is only available in Skyvern Cloud.\n\nAvailable geotargeting options:\n- RESIDENTIAL: the default value. Skyvern Cloud uses a random US residential proxy.\n- RESIDENTIAL_ES: Spain\n- RESIDENTIAL_IE: Ireland\n- RESIDENTIAL_GB: United Kingdom\n- RESIDENTIAL_IN: India\n- RESIDENTIAL_JP: Japan\n- RESIDENTIAL_FR: France\n- RESIDENTIAL_DE: Germany\n- RESIDENTIAL_NZ: New Zealand\n- RESIDENTIAL_PH: Philippines\n- RESIDENTIAL_KR: South Korea\n- RESIDENTIAL_SA: Saudi Arabia\n- RESIDENTIAL_ZA: South Africa\n- RESIDENTIAL_AR: Argentina\n- RESIDENTIAL_AU: Australia\n- RESIDENTIAL_BR: Brazil\n- RESIDENTIAL_TR: Turkey\n- RESIDENTIAL_CA: Canada\n- RESIDENTIAL_MX: Mexico\n- RESIDENTIAL_IT: Italy\n- RESIDENTIAL_NL: Netherlands\n- RESIDENTIAL_ISP: ISP proxy\n- US-CA: California (deprecated, routes through RESIDENTIAL_ISP)\n- US-NY: New York (deprecated, routes through RESIDENTIAL_ISP)\n- US-TX: Texas (deprecated, routes through RESIDENTIAL_ISP)\n- US-FL: Florida (deprecated, routes through RESIDENTIAL_ISP)\n- US-WA: Washington (deprecated, routes through RESIDENTIAL_ISP)\n- NONE: No proxy\n\nFor self-hosted deployments, you can pass a custom proxy URL as a dict: {\"url\": \"http://user:[email protected]:8080\"}. This routes the browser through your own proxy server and takes precedence over any globally configured proxy pool. Can also be a GeoTarget object for granular city/state targeting: {\"country\": \"US\", \"subdivision\": \"CA\", \"city\": \"San Francisco\"}. Omit it or send null to use the default; Skyvern Cloud then uses RESIDENTIAL."
- },
"job_url": {
"type": "string",
"format": "uri",
@@ -8112,31 +8042,6 @@
"format": "binary",
"title": "Resume File"
},
- "webhook_url": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "format": "uri",
- "title": "Webhook Url",
- "description": "After a run is finished, send an update to this URL. Refer to https://www.skyvern.com/docs/running-tasks/webhooks-faq for more details."
- },
- "proxy_location": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "Proxy Location",
- "description": "A ProxyLocation name such as RESIDENTIAL_GB, or JSON text for a GeoTarget or custom proxy object. Omit it or send blank text to use the default; Skyvern Cloud then uses RESIDENTIAL."
- },
"other_information": {
"anyOf": [
{
@@ -11628,28 +11533,6 @@
],
"title": "Warning",
"description": "Advisory message about how the request was adjusted, if it was. Set when a requested timeout above the maximum was capped at creation, when an extension was granted less than it asked for, or when an extension was accepted but not yet confirmed; null otherwise."
- },
- "source": {
- "type": "string",
- "enum": [
- "managed",
- "external"
- ],
- "title": "Source",
- "description": "\"external\" for a browser the caller registered and runs itself; \"managed\" for one Skyvern runs.",
- "default": "managed"
- },
- "remaining_lifetime_seconds": {
- "anyOf": [
- {
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "title": "Remaining Lifetime Seconds",
- "description": "Seconds left before a registered external browser's fixed deadline. Null for managed sessions and once the session has ended."
}
},
"type": "object",
@@ -13140,74 +13023,6 @@
],
"title": "CreateScriptResponse"
},
- "CredentialCheck": {
- "type": "string",
- "enum": [
- "site_rejected_credentials",
- "no_recent_login_with_same_credential",
- "login_request_not_5xx_or_429"
- ],
- "title": "CredentialCheck",
- "description": "The confirmations a credential-rejection verdict has to clear before it is returned as one."
- },
- "CredentialCheckEvidence": {
- "properties": {
- "confirmed": {
- "type": "boolean",
- "title": "Confirmed",
- "description": "True only when every credential confirmation check passed. The login-request status check is not available yet, so the organization-scoped confirmation flag must remain disabled until that check is implemented."
- },
- "checks_passed": {
- "items": {
- "$ref": "#/components/schemas/CredentialCheck"
- },
- "type": "array",
- "title": "Checks Passed"
- },
- "checks_failed": {
- "items": {
- "$ref": "#/components/schemas/CredentialCheck"
- },
- "type": "array",
- "title": "Checks Failed"
- },
- "checks_skipped": {
- "items": {
- "$ref": "#/components/schemas/CredentialCheck"
- },
- "type": "array",
- "title": "Checks Skipped"
- },
- "site_message": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "Site Message"
- },
- "login_request_status": {
- "anyOf": [
- {
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "title": "Login Request Status"
- }
- },
- "type": "object",
- "required": [
- "confirmed"
- ],
- "title": "CredentialCheckEvidence",
- "description": "Why a credential-rejection verdict was or was not confirmed. Reaches the caller on the run\nresponse and the webhook, so a customer can tell a confirmed rejection from an unconfirmed one\nbefore blocking the credential."
- },
"CredentialParameter": {
"properties": {
"parameter_type": {
@@ -14971,7 +14786,6 @@
"download_attachments": {
"type": "boolean",
"title": "Download Attachments",
- "description": "Download non-inline attachments from matched emails for downstream blocks.",
"default": false
},
"parameter_keys": {
@@ -14996,14 +14810,6 @@
],
"title": "EmailInboxBlockYAML"
},
- "EmailTransport": {
- "type": "string",
- "enum": [
- "smtp",
- "gmail"
- ],
- "title": "EmailTransport"
- },
"ExtendBrowserSessionRequest": {
"properties": {
"additional_minutes": {
@@ -16887,12 +16693,6 @@
}
],
"title": "Worksheet"
- },
- "force_ocr": {
- "type": "boolean",
- "title": "Force Ocr",
- "description": "PDF only: ignore the PDF's embedded text layer and read the pages with vision OCR instead. Use it when a PDF's text layer is unreadable in a way Skyvern does not detect on its own. OCR reads at most the first 50 pages, so a longer PDF loses the rest; leave this off unless the text layer is unusable.",
- "default": false
}
},
"type": "object",
@@ -16985,12 +16785,6 @@
}
],
"title": "Worksheet"
- },
- "force_ocr": {
- "type": "boolean",
- "title": "Force Ocr",
- "description": "PDF only: ignore the PDF's embedded text layer and read the pages with vision OCR instead. Use it when a PDF's text layer is unreadable in a way Skyvern does not detect on its own. OCR reads at most the first 50 pages, so a longer PDF loses the rest; leave this off unless the text layer is unusable.",
- "default": false
}
},
"type": "object",
@@ -23981,43 +23775,6 @@
}
],
"title": "Custom Smtp Password"
- },
- "transport": {
- "anyOf": [
- {
- "$ref": "#/components/schemas/EmailTransport"
- },
- {
- "type": "null"
- }
- ]
- },
- "credential_id": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "Credential Id"
- },
- "cc": {
- "items": {
- "type": "string"
- },
- "type": "array",
- "title": "Cc",
- "default": []
- },
- "bcc": {
- "items": {
- "type": "string"
- },
- "type": "array",
- "title": "Bcc",
- "default": []
}
},
"type": "object",
@@ -24179,9 +23936,7 @@
},
"sender": {
"type": "string",
- "title": "Sender",
- "description": "From address. Required unless transport is 'gmail'.",
- "default": ""
+ "title": "Sender"
},
"recipients": {
"items": {
@@ -24215,50 +23970,12 @@
}
],
"title": "File Attachments"
- },
- "transport": {
- "anyOf": [
- {
- "$ref": "#/components/schemas/EmailTransport"
- },
- {
- "type": "null"
- }
- ],
- "description": "How the email is sent. Omit for SMTP. 'gmail' sends from the connected Google account named by credential_id; sender and the SMTP settings are then unused."
- },
- "credential_id": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "Credential Id",
- "description": "ID of a connected Google account that has send permission. Used only with transport 'gmail'."
- },
- "cc": {
- "items": {
- "type": "string"
- },
- "type": "array",
- "title": "Cc",
- "description": "Cc recipients. Only with transport 'gmail'."
- },
- "bcc": {
- "items": {
- "type": "string"
- },
- "type": "array",
- "title": "Bcc",
- "description": "Bcc recipients. Only with transport 'gmail'."
}
},
"type": "object",
"required": [
"label",
+ "sender",
"recipients",
"subject",
"body"
@@ -26169,7 +25886,7 @@
}
],
"title": "Totp Identifier",
- "description": "\nIdentifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://www.skyvern.com/docs/credentials#push-a-code for more details.\n",
+ "description": "\nIdentifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://www.skyvern.com/docs/credentials/totp#option-3-push-code-to-skyvern for more details.\n",
"examples": [
"4155555555",
@@ -26186,7 +25903,7 @@
}
],
"title": "Totp Url",
- "description": "\nURL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://www.skyvern.com/docs/credentials#let-skyvern-fetch-codes-from-your-endpoint for more details.\n",
+ "description": "\nURL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://www.skyvern.com/docs/credentials/totp#option-2-get-code-from-your-endpoint for more details.\n",
"examples": [
"https://my-totp-service.com/totp"
]
@@ -26510,7 +26227,7 @@
}
],
"title": "Totp Identifier",
- "description": "\nIdentifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://www.skyvern.com/docs/credentials#push-a-code for more details.\n",
+ "description": "\nIdentifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://www.skyvern.com/docs/credentials/totp#option-3-push-code-to-skyvern for more details.\n",
"examples": [
"4155555555",
@@ -26527,7 +26244,7 @@
}
],
"title": "Totp Url",
- "description": "\nURL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://www.skyvern.com/docs/credentials#let-skyvern-fetch-codes-from-your-endpoint for more details.\n",
+ "description": "\nURL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://www.skyvern.com/docs/credentials/totp#option-2-get-code-from-your-endpoint for more details.\n",
"examples": [
"https://my-totp-service.com/totp"
]
@@ -28741,17 +28458,6 @@
"const": "USER_DEFINED_ERROR",
"title": "Error Type",
"default": "USER_DEFINED_ERROR"
- },
- "credential_check": {
- "anyOf": [
- {
- "$ref": "#/components/schemas/CredentialCheckEvidence"
- },
- {
- "type": "null"
- }
- ],
- "description": "Confirmation evidence set by Skyvern; request input is ignored. This field remains unconfirmed until all required checks, including login-request status, are available."
}
},
"type": "object",
@@ -33141,7 +32847,7 @@
}
],
"title": "Totp Url",
- "description": "\nURL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://www.skyvern.com/docs/credentials#let-skyvern-fetch-codes-from-your-endpoint for more details.\n",
+ "description": "\nURL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://www.skyvern.com/docs/credentials/totp#option-2-get-code-from-your-endpoint for more details.\n",
"examples": [
"https://my-totp-service.com/totp"
]
@@ -33156,7 +32862,7 @@
}
],
"title": "Totp Identifier",
- "description": "\nIdentifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://www.skyvern.com/docs/credentials#push-a-code for more details.\n",
+ "description": "\nIdentifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://www.skyvern.com/docs/credentials/totp#option-3-push-code-to-skyvern for more details.\n",
"examples": [
"4155555555",
@@ -33440,7 +33146,7 @@
}
],
"title": "Totp Url",
- "description": "\nURL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://www.skyvern.com/docs/credentials#let-skyvern-fetch-codes-from-your-endpoint for more details.\n",
+ "description": "\nURL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://www.skyvern.com/docs/credentials/totp#option-2-get-code-from-your-endpoint for more details.\n",
"examples": [
"https://my-totp-service.com/totp"
]
@@ -33455,7 +33161,7 @@
}
],
"title": "Totp Identifier",
- "description": "\nIdentifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://www.skyvern.com/docs/credentials#push-a-code for more details.\n",
+ "description": "\nIdentifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://www.skyvern.com/docs/credentials/totp#option-3-push-code-to-skyvern for more details.\n",
"examples": [
"4155555555",
diff --git a/pyproject.toml b/pyproject.toml
index dd0ce3ca0..ceb9dd79b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -189,6 +189,7 @@ cloud = [
"redis>=5.0.3,<6",
"pyrate-limiter>=3.7.0,<4",
"opentelemetry-exporter-otlp-proto-grpc>=1.41.1,<2",
+ "opentelemetry-exporter-otlp-proto-http>=1.41.1,<2",
"kr8s>=0.20.14,<1",
# OpenTelemetry instrumentation
"opentelemetry-distro>=0.60b1,<1",
diff --git a/skyvern-frontend/src/api/types.ts b/skyvern-frontend/src/api/types.ts
index 337f7641f..5e82953a8 100644
--- a/skyvern-frontend/src/api/types.ts
+++ b/skyvern-frontend/src/api/types.ts
@@ -271,6 +271,7 @@ export type OnePasswordItemApiResponse = {
vault_id: string;
vault_name: string;
category: string;
+ importable?: boolean;
url?: string | null;
};
diff --git a/skyvern-frontend/src/components/WorkflowFindingsSlot.tsx b/skyvern-frontend/src/components/WorkflowFindingsSlot.tsx
new file mode 100644
index 000000000..93b7ee92a
--- /dev/null
+++ b/skyvern-frontend/src/components/WorkflowFindingsSlot.tsx
@@ -0,0 +1,27 @@
+import type { ReactNode } from "react";
+import { usePageSlots } from "@/store/PageSlots";
+
+function WorkflowFindingsBoundary({
+ workflowPermanentIds,
+ children,
+}: Readonly<{ workflowPermanentIds: readonly string[]; children: ReactNode }>) {
+ const { workflowFindingsScope: Scope } = usePageSlots();
+ return Scope ? (
+ <Scope workflowPermanentIds={workflowPermanentIds}>{children}</Scope>
+ ) : (
+ <>{children}</>
+ );
+}
+
+function WorkflowFindingsButton(
+ props: Readonly<{
+ workflowPermanentId: string;
+ title?: string;
+ surface: "list" | "editor";
+ }>,
+) {
+ const { workflowFindingsTrigger: Trigger } = usePageSlots();
+ return Trigger ? <Trigger {...props} /> : null;
+}
+
+export { WorkflowFindingsBoundary, WorkflowFindingsButton };
diff --git a/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.ts b/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.ts
index 4b4036c44..22a94e704 100644
--- a/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.ts
+++ b/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.ts
@@ -186,6 +186,7 @@ export function useGoogleOAuthCredentials({
isLoading,
isFetching,
error,
+ refetch: refetchCredentials,
} = useQuery<GoogleOAuthCredential[]>({
queryKey: includeEmail
? ["googleOAuthCredentials", "includeEmail"]
@@ -343,6 +344,7 @@ export function useGoogleOAuthCredentials({
isLoading,
isFetching,
error,
+ refetchCredentials,
startAuthorize: authorizeMutation.mutateAsync,
isStartingAuthorize: authorizeMutation.isPending,
submitOAuthCallback: oauthCallbackMutation.mutate,
diff --git a/skyvern-frontend/src/routes/credentials/ImportOnePasswordDialog.test.tsx b/skyvern-frontend/src/routes/credentials/ImportOnePasswordDialog.test.tsx
index b368d7204..b644d8d56 100644
--- a/skyvern-frontend/src/routes/credentials/ImportOnePasswordDialog.test.tsx
+++ b/skyvern-frontend/src/routes/credentials/ImportOnePasswordDialog.test.tsx
@@ -74,6 +74,7 @@ describe("ImportOnePasswordDialog", () => {
vault_id: "vault-1",
vault_name: "Team vault",
category: "LOGIN",
+ importable: true,
},
{
item_id: "item-new",
@@ -81,6 +82,7 @@ describe("ImportOnePasswordDialog", () => {
vault_id: "vault-1",
vault_name: "Team vault",
category: "LOGIN",
+ importable: true,
},
{
item_id: "item-unsupported",
@@ -88,6 +90,7 @@ describe("ImportOnePasswordDialog", () => {
vault_id: "vault-2",
vault_name: "Archive vault",
category: "DOCUMENT",
+ importable: false,
},
],
};
@@ -134,12 +137,6 @@ describe("ImportOnePasswordDialog", () => {
status: "imported",
reason: null,
},
- {
- vault_id: "vault-2",
- item_id: "item-unsupported",
- status: "skipped",
- reason: "Unsupported 1Password category: DOCUMENT",
- },
],
},
});
@@ -164,9 +161,9 @@ describe("ImportOnePasswordDialog", () => {
fireEvent.click(
screen.getByRole("checkbox", { name: "Select all in Team vault" }),
);
- fireEvent.click(
- screen.getByRole("checkbox", { name: "Select Unsupported item" }),
- );
+ expect(
+ screen.queryByRole("checkbox", { name: "Select Unsupported item" }),
+ ).toBeNull();
expect(screen.getByRole("button", { name: "No folder" })).toBeTruthy();
fireEvent.click(
screen.getByRole("button", { name: "Import selected items" }),
@@ -174,17 +171,11 @@ describe("ImportOnePasswordDialog", () => {
await waitFor(() => {
expect(post).toHaveBeenCalledWith("/credentials/onepassword/import", {
- items: [
- { vault_id: "vault-1", item_id: "item-new" },
- { vault_id: "vault-2", item_id: "item-unsupported" },
- ],
+ items: [{ vault_id: "vault-1", item_id: "item-new" }],
});
});
expect(await screen.findByText("Imported")).toBeTruthy();
- expect(screen.getByText("Skipped")).toBeTruthy();
- expect(
- screen.getByText("Unsupported 1Password category: DOCUMENT"),
- ).toBeTruthy();
+ expect(screen.queryByText("Skipped")).toBeNull();
expect(screen.getAllByText("New login").length).toBeGreaterThan(1);
});
@@ -199,6 +190,7 @@ describe("ImportOnePasswordDialog", () => {
vault_id: "vault-1",
vault_name: "Team vault",
category: "LOGIN",
+ importable: true,
},
{
item_id: "item-new",
@@ -206,6 +198,7 @@ describe("ImportOnePasswordDialog", () => {
vault_id: "vault-1",
vault_name: "Team vault",
category: "LOGIN",
+ importable: true,
},
],
};
@@ -293,6 +286,7 @@ describe("ImportOnePasswordDialog", () => {
vault_id: "vault-1",
vault_name: "Team vault",
category: "LOGIN",
+ importable: true,
},
],
},
@@ -337,3 +331,83 @@ describe("ImportOnePasswordDialog", () => {
expect(screen.queryByText("Import results")).toBeNull();
});
});
+
+describe("SKY-18379 QA R1 repro: ImportOnePasswordDialog", () => {
+ function mockItems(
+ items: OnePasswordItemsApiResponse["items"],
+ post: ReturnType<typeof vi.fn>,
+ ) {
+ const get = vi.fn(async (path: string) => {
+ if (path === "/credentials/onepassword/items") {
+ return { data: { configured: true, source: "organization", items } };
+ }
+ if (path === "/credentials") return { data: [] };
+ if (path === "/credential_folders") {
+ return {
+ data: [
+ {
+ folder_id: "folder-readonly",
+ organization_id: "org-1",
+ title: "Read-only folder",
+ description: null,
+ credential_count: 0,
+ created_at: "2026-10-18T00:00:00Z",
+ modified_at: "2026-10-18T00:00:00Z",
+ },
+ ],
+ };
+ }
+ throw new Error(`Unexpected GET ${path}`);
+ });
+ mockedGetClient.mockResolvedValue({ get, post } as never);
+ }
+
+ function login(index: number, category = "LOGIN") {
+ return {
+ item_id: `item-${index}`,
+ title: `Login ${index}`,
+ vault_id: "vault-1",
+ vault_name: "Team vault",
+ category,
+ importable: category === "LOGIN",
+ };
+ }
+
+ async function openDialog() {
+ fireEvent.click(
+ screen.getByRole("button", { name: "Import from 1Password" }),
+ );
+ await screen.findByRole("checkbox", { name: "Select all in Team vault" });
+ }
+
+ it("QA1-U2: does not offer Password-category items that import always skips", async () => {
+ mockItems([login(0), login(1, "PASSWORD")], vi.fn());
+ renderDialog();
+ await openDialog();
+
+ expect(
+ screen.queryByRole("checkbox", { name: "Select Login 1" }),
+ ).toBeNull();
+ });
+
+ it("keeps legacy items when the API omits importability during rollout", async () => {
+ mockItems(
+ [
+ {
+ item_id: "legacy-login",
+ title: "Legacy login",
+ vault_id: "vault-1",
+ vault_name: "Team vault",
+ category: "LOGIN",
+ },
+ ],
+ vi.fn(),
+ );
+ renderDialog();
+ await openDialog();
+
+ expect(
+ screen.getByRole("checkbox", { name: "Select Legacy login" }),
+ ).toBeTruthy();
+ });
+});
diff --git a/skyvern-frontend/src/routes/credentials/ImportOnePasswordDialog.tsx b/skyvern-frontend/src/routes/credentials/ImportOnePasswordDialog.tsx
index e69065197..53e78f55a 100644
--- a/skyvern-frontend/src/routes/credentials/ImportOnePasswordDialog.tsx
+++ b/skyvern-frontend/src/routes/credentials/ImportOnePasswordDialog.tsx
@@ -78,7 +78,10 @@ function ImportOnePasswordDialog({ trigger }: Props) {
[importedCredentialsQuery.data],
);
const items = useMemo(
- () => itemsQuery.data?.items ?? [],
+ () =>
+ (itemsQuery.data?.items ?? []).filter(
+ (item) => item.importable !== false,
+ ),
[itemsQuery.data?.items],
);
const groups = useMemo(() => {
diff --git a/skyvern-frontend/src/routes/credentials/OnePasswordCredentialsList.test.tsx b/skyvern-frontend/src/routes/credentials/OnePasswordCredentialsList.test.tsx
index 2f786deec..86d55c165 100644
--- a/skyvern-frontend/src/routes/credentials/OnePasswordCredentialsList.test.tsx
+++ b/skyvern-frontend/src/routes/credentials/OnePasswordCredentialsList.test.tsx
@@ -70,6 +70,7 @@ function mockNonPasswordItems() {
vault_id: "vault-1",
vault_name: "Example vault",
category: "CREDIT_CARD",
+ importable: true,
},
],
});
@@ -176,6 +177,7 @@ describe("OnePasswordCredentialsList empty states", () => {
vault_id: "vault-1",
vault_name: "Example vault",
category: "LOGIN",
+ importable: true,
},
],
});
@@ -201,6 +203,7 @@ describe("OnePasswordCredentialsList empty states", () => {
vault_id: "vault-1",
vault_name: "Example vault",
category: "CREDIT_CARD",
+ importable: true,
},
],
});
@@ -215,6 +218,51 @@ describe("OnePasswordCredentialsList empty states", () => {
).toBeTruthy();
});
+ it("does not offer import when the only item category is unsupported", () => {
+ mockItems({
+ configured: true,
+ source: "organization",
+ items: [
+ {
+ item_id: "item-1",
+ title: "Standalone password",
+ vault_id: "vault-1",
+ vault_name: "Example vault",
+ category: "PASSWORD",
+ importable: false,
+ },
+ ],
+ });
+
+ renderList();
+
+ expect(
+ screen.queryByRole("button", { name: "Import from 1Password" }),
+ ).toBeNull();
+ });
+
+ it("keeps import available when the API omits importability during rollout", () => {
+ mockItems({
+ configured: true,
+ source: "organization",
+ items: [
+ {
+ item_id: "legacy-item",
+ title: "Legacy card",
+ vault_id: "vault-1",
+ vault_name: "Example vault",
+ category: "CREDIT_CARD",
+ },
+ ],
+ });
+
+ renderList();
+
+ expect(
+ screen.getByRole("button", { name: "Import from 1Password" }),
+ ).toBeTruthy();
+ });
+
it("keeps import available for unimported non-password items", () => {
mockItems({
configured: true,
@@ -226,6 +274,7 @@ describe("OnePasswordCredentialsList empty states", () => {
vault_id: "vault-1",
vault_name: "Example vault",
category: "CREDIT_CARD",
+ importable: true,
},
{
item_id: "item-new",
@@ -233,6 +282,7 @@ describe("OnePasswordCredentialsList empty states", () => {
vault_id: "vault-1",
vault_name: "Example vault",
category: "CREDIT_CARD",
+ importable: true,
},
],
});
@@ -282,6 +332,7 @@ describe("OnePasswordCredentialsList empty states", () => {
vault_id: "vault-1",
vault_name: "Example vault",
category: "LOGIN",
+ importable: true,
},
],
});
@@ -332,6 +383,7 @@ describe("OnePasswordCredentialsList empty states", () => {
vault_id: "vault-1",
vault_name: "Example vault",
category: "LOGIN",
+ importable: true,
},
],
});
@@ -379,6 +431,7 @@ describe("OnePasswordCredentialsList empty states", () => {
vault_id: "vault-1",
vault_name: "Example vault",
category: "LOGIN",
+ importable: true,
},
],
});
@@ -431,6 +484,7 @@ describe("OnePasswordCredentialsList empty states", () => {
vault_id: "vault-1",
vault_name: "Example vault",
category: "LOGIN",
+ importable: true,
},
],
});
diff --git a/skyvern-frontend/src/routes/credentials/OnePasswordCredentialsList.tsx b/skyvern-frontend/src/routes/credentials/OnePasswordCredentialsList.tsx
index 7fca156b4..0e6a36bf2 100644
--- a/skyvern-frontend/src/routes/credentials/OnePasswordCredentialsList.tsx
+++ b/skyvern-frontend/src/routes/credentials/OnePasswordCredentialsList.tsx
@@ -150,7 +150,9 @@ function OnePasswordCredentialsList({ search, folderId }: Props) {
const hasOrganizationAccount =
data?.configured && data.source === "organization";
const hasImportableItems = (data?.items ?? []).some(
- (item) => !importedKeys.has(JSON.stringify([item.vault_id, item.item_id])),
+ (item) =>
+ item.importable !== false &&
+ !importedKeys.has(JSON.stringify([item.vault_id, item.item_id])),
);
const canImport =
hasOrganizationAccount &&
diff --git a/skyvern-frontend/src/routes/integrations/GoogleOAuthCallback.test.tsx b/skyvern-frontend/src/routes/integrations/GoogleOAuthCallback.test.tsx
index 38fcff6bb..cadd43b6e 100644
--- a/skyvern-frontend/src/routes/integrations/GoogleOAuthCallback.test.tsx
+++ b/skyvern-frontend/src/routes/integrations/GoogleOAuthCallback.test.tsx
@@ -134,4 +134,45 @@ describe("GoogleOAuthCallback", () => {
});
expect(queryByText("Integrations")).toBeNull();
});
+
+ it.each([
+ ["provider cancellation", "?error=access_denied&state=state_1", false],
+ ["missing parameters", "?state=state_1", false],
+ ["an expired or failed exchange", "?code=code_1&state=state_1", true],
+ ])(
+ "closes the copilot card's popup on %s and stays put otherwise",
+ async (_case, query, exchangeFails) => {
+ if (exchangeFails) {
+ submitCallback.mockRejectedValue(new Error("consent expired"));
+ }
+ const page = () => (
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ <MemoryRouter
+ initialEntries={[`/integrations/google/callback${query}`]}
+ >
+ <Routes>
+ <Route
+ path="/integrations/google/callback"
+ element={<GoogleOAuthCallback />}
+ />
+ <Route path="/integrations" element={<div>Integrations</div>} />
+ </Routes>
+ </MemoryRouter>
+ </QueryClientProvider>
+ );
+
+ const first = render(page());
+ await waitFor(() => expect(closePopup).toHaveBeenCalledTimes(1));
+ expect(first.queryByText("Integrations")).toBeNull();
+ first.unmount();
+
+ closePopup.mockReset().mockReturnValue(false);
+ const second = render(page());
+ expect(await second.findByText("Integrations")).toBeTruthy();
+ },
+ );
});
diff --git a/skyvern-frontend/src/routes/integrations/GoogleOAuthCallback.tsx b/skyvern-frontend/src/routes/integrations/GoogleOAuthCallback.tsx
index 78570d3fa..9d408097b 100644
--- a/skyvern-frontend/src/routes/integrations/GoogleOAuthCallback.tsx
+++ b/skyvern-frontend/src/routes/integrations/GoogleOAuthCallback.tsx
@@ -60,7 +60,9 @@ function GoogleOAuthCallback() {
description: error,
variant: "destructive",
});
- navigate("/integrations", { replace: true });
+ if (!closeGoogleOAuthPopupIfMarked()) {
+ navigate("/integrations", { replace: true });
+ }
return;
}
if (!code || !state) {
@@ -69,20 +71,23 @@ function GoogleOAuthCallback() {
description: "The callback URL was missing a code or state value.",
variant: "destructive",
});
- navigate("/integrations", { replace: true });
+ // A bounce whose state this tab never stored is not this popup's consent.
+ if (bouncedCredentialId || !closeGoogleOAuthPopupIfMarked()) {
+ navigate("/integrations", { replace: true });
+ }
return;
}
- let connected = false;
try {
await submitOAuthCallbackAsync({ code, state });
queryClient.invalidateQueries({ queryKey: ["googleOAuthCredentials"] });
- connected = true;
+ } catch {
+ // The callback mutation's onError already reports the failure.
} finally {
clearStoredGoogleOAuthIntegrationIdForState(state);
- if (!connected || !closeGoogleOAuthPopupIfMarked()) {
- navigate("/integrations", { replace: true });
- }
+ }
+ if (!closeGoogleOAuthPopupIfMarked()) {
+ navigate("/integrations", { replace: true });
}
};
diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx
index f0fd05824..e49bc5c7e 100644
--- a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx
+++ b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx
@@ -1,3 +1,7 @@
+import {
+ WorkflowFindingsBoundary,
+ WorkflowFindingsButton,
+} from "@/components/WorkflowFindingsSlot";
import { getClient } from "@/api/AxiosClient";
import { Button } from "@/components/ui/button";
import {
@@ -650,7 +654,7 @@ function WorkflowsFlat() {
}
}
- return (
+ const content = (
<div className="space-y-10">
<div className="flex flex-col justify-between gap-6 xl:h-32 xl:flex-row">
<div className="space-y-5">
@@ -1079,6 +1083,13 @@ function WorkflowsFlat() {
]
}
/>
+ <WorkflowFindingsButton
+ workflowPermanentId={
+ workflow.workflow_permanent_id
+ }
+ title={workflow.title}
+ surface="list"
+ />
</div>
{taggingEnabled &&
workflowTags &&
@@ -1390,6 +1401,11 @@ function WorkflowsFlat() {
</div>
</div>
);
+ return (
+ <WorkflowFindingsBoundary workflowPermanentIds={workflowIds}>
+ {content}
+ </WorkflowFindingsBoundary>
+ );
}
export { WorkflowsFlat };
diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx
index 86db36877..bab9fb55d 100644
--- a/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx
+++ b/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx
@@ -1,3 +1,4 @@
+import { WorkflowFindingsBoundary } from "@/components/WorkflowFindingsSlot";
import { getClient } from "@/api/AxiosClient";
import { Button } from "@/components/ui/button";
import { SelectionHeaderCheckboxCell } from "@/components/SelectionCheckbox";
@@ -874,7 +875,7 @@ function WorkflowsTree() {
);
}
- return (
+ const content = (
<div className="space-y-10">
<div className="flex h-32 justify-between gap-6">
<div className="space-y-5">
@@ -1112,6 +1113,11 @@ function WorkflowsTree() {
</div>
</div>
);
+ return (
+ <WorkflowFindingsBoundary workflowPermanentIds={workflowIds}>
+ {content}
+ </WorkflowFindingsBoundary>
+ );
}
export { WorkflowsTree };
diff --git a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx
index 7a9fdb931..567b00b1b 100644
--- a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx
+++ b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx
@@ -1,3 +1,4 @@
+import { WorkflowFindingsButton } from "@/components/WorkflowFindingsSlot";
import React from "react";
import {
BookmarkFilledIcon,
@@ -222,6 +223,11 @@ function WorkflowRow({ workflow, depth = 0 }: WorkflowRowProps) {
workflowReliabilityMap[workflow.workflow_permanent_id]
}
/>
+ <WorkflowFindingsButton
+ workflowPermanentId={workflow.workflow_permanent_id}
+ title={workflow.title}
+ surface="list"
+ />
</div>
{taggingEnabled && workflowTags && workflowTags.length > 0 ? (
<TagChipList
diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.accountChoice.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.accountChoice.test.tsx
index 76d84f46c..9778eabdb 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.accountChoice.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.accountChoice.test.tsx
@@ -19,6 +19,7 @@ type StreamBody = {
mode?: "build";
idempotency_key?: string | null;
selected_connected_account_id?: string | null;
+ supports_google_setup_card?: boolean;
};
type StreamCall = {
body: StreamBody;
@@ -93,13 +94,15 @@ vi.mock("react-router-dom", async (importOriginal) => {
vi.mock("./cards/GoogleReconnectCard", () => ({
GoogleReconnectCard: ({
+ notice,
disabled,
onSelect,
}: {
+ notice: { scopeProfile: string };
disabled?: boolean;
onSelect?: (id: string) => void;
}) => (
- <div>
+ <div data-testid={`notice-${notice.scopeProfile}`}>
Connection notice
<button disabled={disabled} onClick={() => onSelect?.("goac_notice")}>
Select notice account
@@ -254,6 +257,50 @@ afterEach(() => {
});
describe("WorkflowCopilotChat connected account choices", () => {
+ it("restores separate Gmail and Sheets setup cards after reload and advertises the card", async () => {
+ historyResponse.data = {
+ workflow_copilot_chat_id: "chat-1",
+ proposed_workflow: null,
+ auto_accept: false,
+ chat_history: [
+ {
+ sender: "ai",
+ content: "Connect both accounts below.",
+ created_at: "2026-08-15T00:00:01Z",
+ narrative_payload: {
+ ...narrativePayload(false),
+ googleConnectionNotices: [
+ {
+ provider: "google",
+ connectionId: null,
+ condition: "unbound",
+ scopeProfile: "gmail",
+ origin: "setup",
+ choices: [],
+ },
+ {
+ provider: "google",
+ connectionId: null,
+ condition: "unbound",
+ scopeProfile: "google_sheets",
+ origin: "setup",
+ choices: [],
+ },
+ ],
+ },
+ },
+ ],
+ };
+ await renderChat();
+
+ expect(screen.getByTestId("notice-gmail")).toBeTruthy();
+ expect(screen.getByTestId("notice-google_sheets")).toBeTruthy();
+
+ await submit("connect them");
+ await waitFor(() => expect(postStreaming).toHaveBeenCalledTimes(1));
+ expect(streamCalls[0]?.body.supports_google_setup_card).toBe(true);
+ });
+
it("renders a readable receipt from notice-only account metadata", async () => {
historyResponse.data = {
workflow_copilot_chat_id: "chat-1",
@@ -289,6 +336,44 @@ describe("WorkflowCopilotChat connected account choices", () => {
).toBeTruthy();
});
+ it("renders a readable receipt for a connection made after the card's turn", async () => {
+ historyResponse.data = {
+ workflow_copilot_chat_id: "chat-1",
+ proposed_workflow: null,
+ auto_accept: false,
+ chat_history: [
+ {
+ sender: "ai",
+ content: "Connect",
+ created_at: "2026-08-15T00:00:01Z",
+ narrative_payload: {
+ ...narrativePayload(false),
+ googleConnectionNotices: [
+ {
+ provider: "google",
+ connectionId: null,
+ condition: "unbound",
+ scopeProfile: "gmail",
+ origin: "setup",
+ choices: [],
+ },
+ ],
+ },
+ },
+ {
+ sender: "user",
+ content: "goac_587307069786375772",
+ created_at: "2026-08-15T00:00:02Z",
+ },
+ ],
+ };
+ await renderChat();
+ expect(
+ screen.getByText("Selected Google connection …86375772"),
+ ).toBeTruthy();
+ expect(screen.queryByText("goac_587307069786375772")).toBeNull();
+ });
+
it.each([false, true])(
"preserves the question alongside an unbound notice (account question: %s)",
async (accountQuestion) => {
diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.composerControls.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.composerControls.test.tsx
index 2bf890485..bfa8f043e 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.composerControls.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.composerControls.test.tsx
@@ -614,17 +614,17 @@ describe("WorkflowCopilotChat — unflagged S4 composer", () => {
expect(ta.closest("[class*='focus-within']")).not.toBeNull();
});
- it("starts SOP upload and task demonstration from the empty state", async () => {
- const onUploadSOP = vi.fn();
+ it("stages an SOP as an editable draft with its PDF attached and starts task demonstration from the empty state", async () => {
+ cancelPost.mockImplementation((path: string) =>
+ Promise.resolve(
+ path === "/upload_file" ? { data: { file_id: "file_sop" } } : {},
+ ),
+ );
const onRecordTask = vi.fn();
render(
<FeatureFlagContext.Provider value={() => false}>
- <WorkflowCopilotChat
- onUploadSOP={onUploadSOP}
- onRecordTask={onRecordTask}
- canRecordTask
- />
+ <WorkflowCopilotChat onRecordTask={onRecordTask} canRecordTask />
</FeatureFlagContext.Provider>,
);
@@ -640,80 +640,43 @@ describe("WorkflowCopilotChat — unflagged S4 composer", () => {
expect(actionLayout?.className).toContain(
"[@container_copilot-actions_(min-width:440px)]:grid-cols-2",
);
- const file = new File(["procedure"], "procedure.pdf", {
- type: "application/pdf",
- });
- fireEvent.change(screen.getByLabelText("Choose an SOP PDF"), {
- target: { files: [file] },
+ await act(async () => {
+ fireEvent.change(screen.getByLabelText("Choose an SOP PDF"), {
+ target: {
+ files: [
+ new File(["procedure"], "procedure.pdf", {
+ type: "application/pdf",
+ }),
+ ],
+ },
+ });
});
- expect(onUploadSOP).toHaveBeenCalledWith(file);
-
- fireEvent.click(screen.getByRole("button", { name: "Demonstrate task" }));
- expect(onRecordTask).toHaveBeenCalledTimes(1);
- });
-
- it("does not allow SOP upload and task demonstration at the same time", async () => {
- const onUploadSOP = vi.fn();
- const onRecordTask = vi.fn();
- const { rerender } = render(
- <FeatureFlagContext.Provider value={() => false}>
- <WorkflowCopilotChat
- onUploadSOP={onUploadSOP}
- canUploadSOP
- onRecordTask={onRecordTask}
- canRecordTask
- isUploadingSOP
- />
- </FeatureFlagContext.Provider>,
- );
-
await waitFor(() =>
- expect(screen.getByText("Uploading SOP…")).toBeTruthy(),
+ expect(
+ screen.getByRole("button", { name: "Remove procedure.pdf" }),
+ ).toBeTruthy(),
);
- const recordTaskButton = screen.getByRole("button", {
- name: "Demonstrate task",
- });
- expect(recordTaskButton.hasAttribute("disabled")).toBe(true);
- expect(recordTaskButton.parentElement?.getAttribute("tabindex")).toBe("0");
- expect((textarea() as HTMLTextAreaElement).disabled).toBe(true);
- expect(
- (
- screen.getByRole("button", {
- name: "Send disabled — finish the current authoring action",
- }) as HTMLButtonElement
- ).disabled,
- ).toBe(true);
-
- rerender(
- <FeatureFlagContext.Provider value={() => false}>
- <WorkflowCopilotChat
- onUploadSOP={onUploadSOP}
- canUploadSOP={false}
- onRecordTask={onRecordTask}
- canRecordTask
- />
- </FeatureFlagContext.Provider>,
+ expect(cancelPost).toHaveBeenCalledWith(
+ "/upload_file",
+ expect.any(FormData),
+ expect.anything(),
+ );
+ expect(textarea().value).toBe(
+ "Add the steps from the attached SOP to this agent.",
);
+ expect(postStreaming).not.toHaveBeenCalled();
- const uploadSOPButton = screen.getByRole("button", {
- name: "Upload an SOP",
- });
- expect(uploadSOPButton.hasAttribute("disabled")).toBe(true);
- expect(uploadSOPButton.parentElement?.getAttribute("tabindex")).toBe("0");
+ fireEvent.click(screen.getByRole("button", { name: "Demonstrate task" }));
+ expect(onRecordTask).toHaveBeenCalledTimes(1);
});
it.each(["yaml", "copilot"])(
- "refuses authoring launches when a %s transaction starts after the file picker opens",
+ "stages an SOP but refuses Record when a %s transaction starts after the file picker opens",
async (owner) => {
- const onUploadSOP = vi.fn();
const onRecordTask = vi.fn();
render(
<FeatureFlagContext.Provider value={() => false}>
- <WorkflowCopilotChat
- onUploadSOP={onUploadSOP}
- onRecordTask={onRecordTask}
- canRecordTask
- />
+ <WorkflowCopilotChat onRecordTask={onRecordTask} canRecordTask />
</FeatureFlagContext.Provider>,
);
await waitFor(() =>
@@ -726,17 +689,23 @@ describe("WorkflowCopilotChat — unflagged S4 composer", () => {
copilotAcceptance: owner === "copilot" ? Symbol("turn") : null,
});
});
- fireEvent.change(screen.getByLabelText("Choose an SOP PDF"), {
- target: {
- files: [
- new File(["procedure"], "procedure.pdf", {
- type: "application/pdf",
- }),
- ],
- },
+ await act(async () => {
+ fireEvent.change(screen.getByLabelText("Choose an SOP PDF"), {
+ target: {
+ files: [
+ new File(["procedure"], "procedure.pdf", {
+ type: "application/pdf",
+ }),
+ ],
+ },
+ });
});
fireEvent.click(screen.getByRole("button", { name: "Demonstrate task" }));
- expect(onUploadSOP).not.toHaveBeenCalled();
+ expect(cancelPost).toHaveBeenCalledWith(
+ "/upload_file",
+ expect.any(FormData),
+ expect.anything(),
+ );
expect(onRecordTask).not.toHaveBeenCalled();
},
);
@@ -888,6 +857,13 @@ describe("WorkflowCopilotChat — unflagged S4 composer", () => {
expect(screen.getByTestId("recording-inline")).toBeTruthy();
// A finishing recording refuses sends, so the composer must not offer one.
expect(textarea().disabled).toBe(true);
+ expect(
+ (
+ screen.getByRole("button", {
+ name: "Send disabled — finish the current authoring action",
+ }) as HTMLButtonElement
+ ).disabled,
+ ).toBe(true);
expect(
screen.getByTestId("recording-inline").getAttribute("data-mount-id"),
).toBe(mountId);
diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.credentialCard.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.credentialCard.test.tsx
index 54729a0a2..6fbfed1a9 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.credentialCard.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.credentialCard.test.tsx
@@ -786,6 +786,170 @@ describe("WorkflowCopilotChat — credential receipt placement", () => {
expect(precedes(row("tc-1"), unfolded)).toBe(true);
expect(precedes(unfolded, row("tc-2"))).toBe(true);
});
+
+ it("keeps every card's receipt when the model asks again in the same turn, live and once the turn ends", async () => {
+ credentialsData.current = [
+ { credential_id: "cred-hn", name: "HN Login", tested_url: null },
+ ];
+ await streamScoutTurn();
+ const test = {
+ tool_name: "run_blocks_and_collect_debug",
+ display_label: "Testing",
+ iteration: 1,
+ tool_call_id: "tc-2",
+ };
+ const resolved = (resume_token: string, outcome: string) => ({
+ type: "credential_pause_resolved",
+ turn_id: "turn-1",
+ workflow_copilot_chat_id: "chat-1",
+ resume_token,
+ outcome,
+ credential_id: outcome === "connected" ? "cred-hn" : null,
+ name: outcome === "connected" ? "HN Login" : null,
+ timestamp: new Date().toISOString(),
+ });
+ await act(async () => {
+ streamCalls[0]!.onMessage(
+ credentialFrame({ anchor_tool_call_id: "tc-1" }),
+ );
+ streamCalls[0]!.onMessage(resolved("rt-abc", "connected"));
+ streamCalls[0]!.onMessage({ type: "tool_call", tool_input: {}, ...test });
+ streamCalls[0]!.onMessage({
+ type: "tool_result",
+ success: false,
+ summary: "The test stopped on the sign-in page",
+ ...test,
+ });
+ streamCalls[0]!.onMessage(
+ credentialFrame({
+ anchor_tool_call_id: "tc-2",
+ resume_token: "rt-def",
+ }),
+ );
+ streamCalls[0]!.onMessage(resolved("rt-def", "skipped"));
+ });
+ const row = (id: string) =>
+ document.querySelector(`[data-activity-row-id="${id}"]`)!;
+ const precedes = (a: Node, b: Node) =>
+ Boolean(a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING);
+ const liveConnected = await screen.findByText(
+ "Credential 'HN Login' added",
+ );
+ const liveSkipped = screen.getByText("Sign-in skipped");
+ expect(precedes(row("tc-1"), liveConnected)).toBe(true);
+ expect(precedes(liveConnected, row("tc-2"))).toBe(true);
+ expect(precedes(row("tc-2"), liveSkipped)).toBe(true);
+
+ await act(async () => {
+ streamCalls[0]!.onMessage({
+ type: "response",
+ workflow_copilot_chat_id: "chat-1",
+ message: "The test still stops at the sign-in page.",
+ updated_workflow: null,
+ response_time: "2026-07-13T00:00:06Z",
+ proposal_disposition: "no_proposal",
+ turn_id: "turn-1",
+ narrative_payload: {
+ turnId: "turn-1",
+ turnIndex: 0,
+ designStarted: true,
+ designEnded: true,
+ draft: { blockCount: 1, blockLabels: ["sign_in"] },
+ terminal: "response",
+ terminalMessage: "The test still stops at the sign-in page.",
+ narrativeSummary: "The test still stops at the sign-in page.",
+ startedAt: "2026-07-13T00:00:00Z",
+ endedAt: "2026-07-13T00:00:06Z",
+ designActivity: [
+ {
+ ...scoutResult(),
+ kind: "tool_result",
+ id: "tr-tc-1",
+ text: "Opened the sign-in page",
+ toolName: "navigate_browser",
+ },
+ {
+ kind: "tool_result",
+ id: "tr-tc-2",
+ text: "The test stopped on the sign-in page",
+ toolName: "run_blocks_and_collect_debug",
+ iteration: 1,
+ success: false,
+ },
+ ],
+ credentialPause: { outcome: "skipped", anchorToolCallId: "tc-2" },
+ credentialPauses: [
+ {
+ outcome: "connected",
+ credentialId: "cred-hn",
+ anchorToolCallId: "tc-1",
+ },
+ { outcome: "skipped", anchorToolCallId: "tc-2" },
+ ],
+ },
+ });
+ streamCalls[0]!.resolve();
+ });
+ await screen.findByText("The test still stops at the sign-in page.");
+ expect(screen.getAllByText("Credential 'HN Login' added")).toHaveLength(1);
+ expect(screen.getAllByText("Sign-in skipped")).toHaveLength(1);
+ fireEvent.click(
+ document.querySelector<HTMLButtonElement>("[data-activity-fold]")!,
+ );
+ const savedConnected = screen.getByText("Credential 'HN Login' added");
+ const savedSkipped = screen.getByText("Sign-in skipped");
+ expect(precedes(row("tc-1"), savedConnected)).toBe(true);
+ expect(precedes(savedConnected, row("tc-2"))).toBe(true);
+ expect(precedes(row("tc-2"), savedSkipped)).toBe(true);
+ });
+
+ it("keeps an earlier card's saved receipt when the turn's last card was never shown", async () => {
+ credentialsData.current = [
+ { credential_id: "cred-hn", name: "HN Login", tested_url: null },
+ ];
+ await streamScoutTurn();
+ await act(async () => {
+ streamCalls[0]!.onMessage({
+ type: "response",
+ workflow_copilot_chat_id: "chat-1",
+ message: "The second sign-in request could not be shown.",
+ updated_workflow: null,
+ response_time: "2026-07-13T00:00:06Z",
+ proposal_disposition: "no_proposal",
+ turn_id: "turn-1",
+ narrative_payload: {
+ turnId: "turn-1",
+ turnIndex: 0,
+ terminal: "response",
+ terminalMessage: "The second sign-in request could not be shown.",
+ startedAt: "2026-07-13T00:00:00Z",
+ endedAt: "2026-07-13T00:00:06Z",
+ designActivity: [
+ {
+ ...scoutResult(),
+ kind: "tool_result",
+ id: "tr-tc-1",
+ text: "Opened the sign-in page",
+ toolName: "navigate_browser",
+ },
+ ],
+ credentialPause: { outcome: "declined" },
+ credentialPauses: [
+ {
+ outcome: "connected",
+ credentialId: "cred-hn",
+ anchorToolCallId: "tc-1",
+ },
+ { outcome: "declined" },
+ ],
+ },
+ });
+ streamCalls[0]!.resolve();
+ });
+ await screen.findByText("The second sign-in request could not be shown.");
+ // A saved receipt carries no name; only a tab that saw the live answer can name it.
+ expect(screen.getAllByText("Credential added")).toHaveLength(1);
+ });
});
describe("WorkflowCopilotChat — question receipt placement", () => {
diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.queue.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.queue.test.tsx
index 20595bfcc..9728c6d59 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.queue.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.queue.test.tsx
@@ -324,7 +324,7 @@ async function dropAttachments(...files: File[]) {
function oversizeFile(filename: string) {
const file = new File(["x"], filename);
- Object.defineProperty(file, "size", { value: 11 * 1024 * 1024 });
+ Object.defineProperty(file, "size", { value: 30 * 1024 * 1024 + 1 });
return file;
}
@@ -544,7 +544,7 @@ describe("WorkflowCopilotChat — keep the chat live during a turn", () => {
}
await dropAttachments(
- new File([new Uint8Array(10 * 1024 * 1024 + 1)], "oversized.csv"),
+ oversizeFile("oversized.csv"),
new File(["row_id,url\n"], "accepted.csv"),
);
@@ -561,6 +561,53 @@ describe("WorkflowCopilotChat — keep the chat live during a turn", () => {
);
});
+ it("opens a closed chat for a file staged from the canvas and leaves the draft unsent", async () => {
+ function ClosedChat() {
+ const [isOpen, setIsOpen] = useState(false);
+ return (
+ <WorkflowCopilotChat
+ isOpen={isOpen}
+ onRequestOpen={() => setIsOpen(true)}
+ />
+ );
+ }
+ render(<ClosedChat />);
+ await waitFor(() =>
+ expect(useCopilotActionStore.getState().stageAttachment).not.toBeNull(),
+ );
+ expect(screen.queryByRole("textbox")).toBeNull();
+ const draft = "Add the steps from the attached SOP after the login block.";
+
+ await act(async () => {
+ useCopilotActionStore.getState().stageAttachment!(
+ new File(["%PDF"], "procedure.pdf"),
+ draft,
+ );
+ });
+ await waitFor(() =>
+ expect(
+ screen.getByRole("button", { name: "Remove procedure.pdf" }),
+ ).toBeTruthy(),
+ );
+ expect(textarea().value).toBe(draft);
+ expect(document.activeElement).toBe(textarea());
+
+ fireEvent.change(textarea(), { target: { value: "Use the new SOP" } });
+ await act(async () => {
+ useCopilotActionStore.getState().stageAttachment!(
+ new File(["%PDF"], "appendix.pdf"),
+ draft,
+ );
+ });
+ await waitFor(() =>
+ expect(
+ screen.getByRole("button", { name: "Remove appendix.pdf" }),
+ ).toBeTruthy(),
+ );
+ expect(textarea().value).toBe("Use the new SOP");
+ expect(postStreaming).not.toHaveBeenCalled();
+ });
+
it("keeps the plus-button picker available for attachment uploads", async () => {
await renderChat();
@@ -1077,7 +1124,7 @@ describe("WorkflowCopilotChat — keep the chat live during a turn", () => {
await attachSpreadsheet("scan.png", big);
expect(screen.getByText("scan.png")).toBeTruthy();
- expect(screen.getByText("over 10MB")).toBeTruthy();
+ expect(screen.getByText("over 30MB")).toBeTruthy();
expect(
screen.getByRole("button", { name: "Remove scan.png" }),
).toBeTruthy();
@@ -1088,7 +1135,7 @@ describe("WorkflowCopilotChat — keep the chat live during a turn", () => {
await submit("read the scan");
await waitFor(() => expect(postStreaming).toHaveBeenCalledTimes(1));
- expect(screen.queryByText("over 10MB")).toBeNull();
+ expect(screen.queryByText("over 30MB")).toBeNull();
});
it("drops a failed chip when its message is queued", async () => {
@@ -1103,7 +1150,7 @@ describe("WorkflowCopilotChat — keep the chat live during a turn", () => {
expect(
screen.getByRole("button", { name: "Edit queued message" }),
).toBeTruthy();
- expect(screen.queryByText("over 10MB")).toBeNull();
+ expect(screen.queryByText("over 30MB")).toBeNull();
});
it("drops a failed chip when it adds to a queued message", async () => {
@@ -1118,7 +1165,7 @@ describe("WorkflowCopilotChat — keep the chat live during a turn", () => {
expect(postStreaming).toHaveBeenCalledTimes(1);
expect(queuedStrip().getByText(/read the scan instead/)).toBeTruthy();
- expect(screen.queryByText("over 10MB")).toBeNull();
+ expect(screen.queryByText("over 30MB")).toBeNull();
});
it("says a file staged before a question will not go with the answer", async () => {
diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx
index c684e20cc..26199d769 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx
@@ -245,6 +245,7 @@ import {
import {
CopilotBlockActionsEvent,
EMPTY_NARRATIVE,
+ googleConnectionNoticeKey,
NarrativeEvent,
RecordedActionSummary,
TurnNarrativeState,
@@ -279,6 +280,10 @@ import { useRecordingStore } from "@/store/useRecordingStore";
import { useRecordingRefinementEvidenceStore } from "@/store/RecordingRefinementEvidenceStore";
import { captureRecordBrowser } from "@/util/recordBrowserTelemetry";
import { RecordingFeedbackPrompt } from "@/routes/workflows/editor/recording/RecordingFeedbackPrompt";
+import {
+ sopAttachmentDraft,
+ stageSopFile,
+} from "@/routes/workflows/editor/workspaceAuthoringActions";
import { useWorkflowBlockSearchStore } from "@/store/WorkflowBlockSearchStore";
import { resolveTimelineBlockJumpNodeId } from "@/routes/workflows/studio/runview/timelineBlockJump";
import { TooltipProvider } from "@/components/ui/tooltip";
@@ -782,8 +787,8 @@ const ATTACHMENT_EXTENSIONS = [
...VIDEO_ATTACHMENT_EXTENSIONS,
] as const;
const ATTACHMENT_ACCEPT = ATTACHMENT_EXTENSIONS.join(",");
-const ATTACHMENT_SIZE_LIMIT_BYTES = 10 * 1024 * 1024;
-const VIDEO_ATTACHMENT_SIZE_LIMIT_BYTES = 30 * 1024 * 1024;
+// Mirrors the server's MAX_UPLOAD_FILE_SIZE.
+const ATTACHMENT_SIZE_LIMIT_BYTES = 30 * 1024 * 1024;
// Mirrors MAX_ATTACHED_FILES_PER_MESSAGE on the chat request.
const ATTACHMENT_COUNT_LIMIT = 20;
@@ -801,12 +806,6 @@ function isVideoAttachment(file: File): boolean {
);
}
-function attachmentSizeLimit(file: File): number {
- return isVideoAttachment(file)
- ? VIDEO_ATTACHMENT_SIZE_LIMIT_BYTES
- : ATTACHMENT_SIZE_LIMIT_BYTES;
-}
-
function normalizeHttpUrl(value: string): string | null {
const trimmed = value.trim();
return safeHttpUrl(
@@ -914,6 +913,14 @@ function connectedAccountSelectionReceipt(
return `Selected ${selected.name} — ${connectedAccountChoiceLabel(selected, choices)}`;
}
}
+ // A Google card can list a connection made after its turn ended, which no stored choice set holds.
+ const fromGoogleCard = prior.narrative.googleConnectionNotices.some(
+ (notice) =>
+ notice.condition === "unbound" || notice.connectionId === message.content,
+ );
+ if (fromGoogleCard && /^goac_\w+$/.test(message.content)) {
+ return `Selected Google connection …${message.content.slice(-8)}`;
+ }
return null;
}
@@ -1118,6 +1125,11 @@ function credentialCardFrameFor(
return null;
}
+const EARLIER_PICK_CARD_FRAME: CredentialRequiredFrame = {
+ type: "credential_required",
+ reason: "workflow_credential_inputs_unbound",
+};
+
// A co-occurring credential ask/pause owns this turn's credential UI and its
// credentialResolutions[turnId] entry; the auto-bind receipt would double up and
// mis-adopt that ask's resolution, so it defers whenever a card frame exists.
@@ -1132,10 +1144,9 @@ function autoBoundReceiptFor(
// The persisted credentialPause carries no name, so a tab that received the live
// credential_pause_resolved frame names the receipt from it.
function historicalCredentialOutcome(
- turn: TurnNarrativeState,
+ pause: TurnNarrativeState["credentialPause"],
pauseCardResolutions: Record<string, CredentialPauseHistorical>,
): CredentialPauseHistorical | undefined {
- const pause = turn.credentialPause;
if (!pause || pause.outcome === "declined") return undefined;
const credentialId = pause.credentialId ?? undefined;
const name = credentialId
@@ -1177,8 +1188,10 @@ function terminalCredentialAskFor(
// The persisted pause verdict outranks the optimistic click, so a pick the server did not admit
// never reads as connected; the click's name survives via pauseCardResolutions.
const resolvedOutcome =
- historicalCredentialOutcome(message.narrative, pauseCardResolutions) ??
- localResolution;
+ historicalCredentialOutcome(
+ message.narrative.credentialPause,
+ pauseCardResolutions,
+ ) ?? localResolution;
const canContinue =
isLastMessage || strandedTerminalContinuations.has(turnId);
if (!resolvedOutcome && !canContinue) return null;
@@ -1473,9 +1486,7 @@ interface WorkflowCopilotChatProps {
initialAttachments?: Array<CopilotAttachedFile>;
initialAction?: CopilotProductAction;
onInitialMessageConsumed?: () => void;
- onUploadSOP?: (file: File) => void;
- canUploadSOP?: boolean;
- isUploadingSOP?: boolean;
+ onRequestOpen?: () => void;
onRecordTask?: () => void;
canRecordTask?: boolean;
authoringUnavailableReason?: string | null;
@@ -1718,9 +1729,7 @@ export function WorkflowCopilotChat({
initialAttachments,
initialAction,
onInitialMessageConsumed,
- onUploadSOP,
- canUploadSOP = true,
- isUploadingSOP = false,
+ onRequestOpen,
onRecordTask,
canRecordTask = false,
authoringUnavailableReason,
@@ -1746,6 +1755,8 @@ export function WorkflowCopilotChat({
?.unattributedClaim === true;
const initialHandoffMessageId = `initial-copilot-message-${workflowPermanentId ?? "pending"}`;
const sopFileInputRef = useRef<HTMLInputElement>(null);
+ // Set when a file is staged while the composer is hidden or not yet mounted.
+ const focusComposerWhenShownRef = useRef(false);
const recordingAuthoringActive = useRecordingStore(
(state) => state.isRecording || state.finishRequested || state.isCommitting,
);
@@ -1754,8 +1765,8 @@ export function WorkflowCopilotChat({
);
// Recording is deliberately conversational: the live chapter owns capture,
// while the existing composer remains available for instructions and
- // clarifications. SOP upload and finishing a recording own it exclusively.
- const authoringInProgress = isUploadingSOP || recordingIsFinishing;
+ // clarifications. Finishing a recording owns it exclusively.
+ const authoringInProgress = recordingIsFinishing;
const [messages, setMessages] = useState<ChatMessage[]>(() => [
...(templateGuidance
? [
@@ -2007,6 +2018,10 @@ export function WorkflowCopilotChat({
// turn_start and at every terminal so a dead resume_token can never render.
const [livePauseFrame, setLivePauseFrame] =
useState<WorkflowCopilotCredentialRequiredUpdate | null>(null);
+ // Every card the live turn raised; only one is open at a time, so the earlier ones render as receipts.
+ const [livePauseFrameHistory, setLivePauseFrameHistory] = useState<
+ WorkflowCopilotCredentialRequiredUpdate[]
+ >([]);
const [recoveredPauseFrames, setRecoveredPauseFrames] = useState<
WorkflowCopilotCredentialRequiredUpdate[]
>([]);
@@ -3349,6 +3364,10 @@ export function WorkflowCopilotChat({
const setTextareaRef = useCallback(
(node: HTMLTextAreaElement | null) => {
textareaRef.current = node;
+ if (node && focusComposerWhenShownRef.current) {
+ focusComposerWhenShownRef.current = false;
+ node.focus();
+ }
resizeObserverRef.current?.disconnect();
resizeObserverRef.current = null;
if (!node || typeof ResizeObserver === "undefined") return;
@@ -6234,13 +6253,13 @@ export function WorkflowCopilotChat({
const uploadAttachment = useCallback(
async (file: File) => {
- if (file.size > attachmentSizeLimit(file)) {
+ if (file.size > ATTACHMENT_SIZE_LIMIT_BYTES) {
toast({
variant: "destructive",
title: "File too large",
description: isVideoAttachment(file)
? `${file.name} exceeds the 30MB limit. Shorten or compress the clip, or attach ordered screenshots.`
- : `${file.name} exceeds the 10MB limit.`,
+ : `${file.name} exceeds the 30MB limit.`,
});
setPendingAttachments((prev) => [
...prev,
@@ -6248,7 +6267,7 @@ export function WorkflowCopilotChat({
localId: crypto.randomUUID(),
filename: file.name,
status: "error",
- error: isVideoAttachment(file) ? "over 30MB" : "over 10MB",
+ error: "over 30MB",
},
]);
return;
@@ -7827,10 +7846,10 @@ export function WorkflowCopilotChat({
(file) => !isSupportedAttachment(file),
);
const oversizedFiles = supportedFiles.filter(
- (file) => file.size > attachmentSizeLimit(file),
+ (file) => file.size > ATTACHMENT_SIZE_LIMIT_BYTES,
);
const uploadableFiles = supportedFiles.filter(
- (file) => file.size <= attachmentSizeLimit(file),
+ (file) => file.size <= ATTACHMENT_SIZE_LIMIT_BYTES,
);
if (unsupportedFiles.length > 0) {
toast({
@@ -8875,6 +8894,7 @@ export function WorkflowCopilotChat({
// Turn is terminal — the in-flight pause card (if any) unmounts with
// the live bubble; drop its now-dead resume_token too.
setLivePauseFrame(null);
+ setLivePauseFrameHistory([]);
setWorkflowCopilotChatId(response.workflow_copilot_chat_id);
setQuestionCancelToken(null);
if (response.work_plan) {
@@ -9120,6 +9140,7 @@ export function WorkflowCopilotChat({
// A terminal error carries no credentialPause payload, so the dead
// frame must be cleared explicitly or its card would stay actionable.
setLivePauseFrame(null);
+ setLivePauseFrameHistory([]);
const liveNarrative = errorNarrative ?? narrativeRef.current;
const frozenNarrative: TurnNarrativeState | undefined =
liveNarrative.turnId !== null
@@ -9266,6 +9287,7 @@ export function WorkflowCopilotChat({
supports_question_tool: true,
supports_account_group_card: true,
supports_credential_delete_card: true,
+ supports_google_setup_card: true,
} as WorkflowCopilotChatRequest,
(payload) => {
if (
@@ -9361,6 +9383,12 @@ export function WorkflowCopilotChat({
case "credential_required":
sawCredentialPause = true;
setLivePauseFrame(payload);
+ setLivePauseFrameHistory((frames) => [
+ ...frames.filter(
+ (frame) => frame.turn_id === payload.turn_id,
+ ),
+ payload,
+ ]);
return false;
case "credential_pause_resolved": {
const pause = parseCredentialPause({
@@ -9401,6 +9429,7 @@ export function WorkflowCopilotChat({
}
// A new turn can't carry the prior turn's dead resume_token.
setLivePauseFrame(null);
+ setLivePauseFrameHistory([]);
turnChatIdRef.current =
payload.workflow_copilot_chat_id ??
workflowCopilotChatIdRef.current;
@@ -9584,6 +9613,7 @@ export function WorkflowCopilotChat({
// bubble or its Working/elapsed indicator would tick forever.
setNarrative(EMPTY_NARRATIVE);
setLivePauseFrame(null);
+ setLivePauseFrameHistory([]);
return false;
} finally {
retainUnconfirmedOutcome();
@@ -9819,6 +9849,43 @@ export function WorkflowCopilotChat({
setStartDemonstration,
workflowPermanentId,
]);
+ // An answer to a pending question is sent through the question flow, which carries no files, so
+ // the composer offers no attachment then.
+ const attachDisabledReason = isDemonstrating
+ ? demonstrationRecorder.phase === "recording"
+ ? "Use Done before attaching a file"
+ : "Use Build before attaching a file"
+ : authoringInProgress
+ ? "Finish the current authoring action before attaching a file"
+ : hasPendingQuestion
+ ? "Answer the pending question before attaching a file"
+ : null;
+ const stageComposerAttachment = useCallback(
+ (file: File, draft: string) => {
+ onRequestOpen?.();
+ void uploadAttachment(file);
+ if (!isSpeechListening)
+ setInputValue((current) => (current.trim() ? current : draft));
+ if (isOpen && textareaRef.current) textareaRef.current.focus();
+ else focusComposerWhenShownRef.current = true;
+ },
+ [isOpen, isSpeechListening, onRequestOpen, uploadAttachment],
+ );
+ useEffect(() => {
+ if (!isOpen || !focusComposerWhenShownRef.current || !textareaRef.current)
+ return;
+ focusComposerWhenShownRef.current = false;
+ textareaRef.current.focus();
+ }, [isOpen]);
+ const setStageAttachment = useCopilotActionStore(
+ (state) => state.setStageAttachment,
+ );
+ useEffect(() => {
+ setStageAttachment(
+ attachDisabledReason === null ? stageComposerAttachment : null,
+ );
+ return () => setStageAttachment(null);
+ }, [attachDisabledReason, setStageAttachment, stageComposerAttachment]);
const handleConnectedAccountChoice = useCallback(
(turnId: string, connectionId: string) => {
@@ -10481,6 +10548,24 @@ export function WorkflowCopilotChat({
),
});
}
+ if (!isLoadingHistory) {
+ for (const frame of livePauseFrameHistory) {
+ if (
+ frame.turn_id !== narrative.turnId ||
+ frame.resume_token === livePauseFrame?.resume_token
+ ) {
+ continue;
+ }
+ liveAnchored.push({
+ key: `credential-${frame.resume_token}`,
+ toolCallId: credentialAnchorToolCallId(
+ narrative,
+ frame.anchor_tool_call_id,
+ ),
+ node: pauseCredentialCard(frame),
+ });
+ }
+ }
if (
!isLoadingHistory &&
livePauseFrame &&
@@ -10909,8 +10994,7 @@ export function WorkflowCopilotChat({
}
};
- const uploadSOPDisabled = !onUploadSOP || !canUploadSOP || isUploadingSOP;
- const recordTaskDisabled = !onRecordTask || !canRecordTask || isUploadingSOP;
+ const recordTaskDisabled = !onRecordTask || !canRecordTask;
const recordingChapterController = recordingAuthoringActive ? (
<RecordingPanel
key="live-recording-chapter"
@@ -11079,12 +11163,10 @@ export function WorkflowCopilotChat({
<TooltipProvider>
<ControlTooltip
content={
- uploadSOPDisabled
- ? (authoringUnavailableReason ??
- "SOP upload is not available right now")
- : "Upload a procedure as a PDF"
+ attachDisabledReason ??
+ "Attach a procedure PDF for Copilot to build from"
}
- blocked={uploadSOPDisabled}
+ blocked={attachDisabledReason !== null}
side="top"
wrapperClassName="min-w-0 w-full"
>
@@ -11092,20 +11174,15 @@ export function WorkflowCopilotChat({
type="button"
aria-label="Upload an SOP"
className="flex w-full min-w-0 items-center gap-3 rounded-lg border border-border bg-slate-elevation3 p-3 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50"
- disabled={uploadSOPDisabled}
- onClick={() => {
- if (refuseMutationDuringYamlCommit()) return;
- sopFileInputRef.current?.click();
- }}
+ disabled={attachDisabledReason !== null}
+ onClick={() => sopFileInputRef.current?.click()}
>
<span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border bg-slate-elevation2">
<UploadIcon className="h-4 w-4" />
</span>
<span className="min-w-0">
<span className="block font-medium text-foreground">
- {isUploadingSOP
- ? "Uploading SOP…"
- : "Upload an SOP"}
+ Upload an SOP
</span>
<span className="mt-0.5 block text-xs leading-snug text-muted-foreground">
A PDF of the procedure
@@ -11144,7 +11221,7 @@ export function WorkflowCopilotChat({
Demonstrate task
</span>
<span className="mt-0.5 block text-xs leading-snug text-muted-foreground">
- Do it once in the browser
+ Show Copilot how in the browser
</span>
</span>
</button>
@@ -11354,6 +11431,36 @@ export function WorkflowCopilotChat({
),
});
}
+ if (!isLoadingHistory) {
+ // credentialPause is the last card; credentialPauses adds the turn's earlier ones.
+ const receiptTurn = message.narrative;
+ receiptTurn.credentialPauses
+ .slice(0, -1)
+ .forEach((pause, receiptIndex) => {
+ const resolvedOutcome = historicalCredentialOutcome(
+ pause,
+ pauseCardResolutions,
+ );
+ if (!resolvedOutcome) return;
+ anchored.push({
+ key: `credential-${receiptIndex}`,
+ toolCallId: credentialAnchorToolCallId(
+ receiptTurn,
+ pause.anchorToolCallId,
+ ),
+ node: (
+ <CredentialCard
+ frame={EARLIER_PICK_CARD_FRAME}
+ mode="terminal"
+ reloadKey={credentialsReloadKey}
+ resolvedOutcome={resolvedOutcome}
+ onConnect={() => {}}
+ onSkip={() => {}}
+ />
+ ),
+ });
+ });
+ }
if (credentialCard && credentialCardMidTurn) {
anchored.push({
key: "credential",
@@ -11437,7 +11544,7 @@ export function WorkflowCopilotChat({
{message.narrative.googleConnectionNotices.map(
(notice) => (
<GoogleReconnectCard
- key={notice.connectionId ?? "unbound"}
+ key={googleConnectionNoticeKey(notice)}
notice={notice}
selectedConnectionId={
adjacentMessage?.sender === "user"
@@ -12314,19 +12421,8 @@ export function WorkflowCopilotChat({
className="hidden"
onChange={(event) => {
const file = event.target.files?.[0];
- if (!file) return;
event.target.value = "";
- if (refuseMutationDuringYamlCommit() || uploadSOPDisabled)
- return;
- if (!file.name.toLowerCase().endsWith(".pdf")) {
- toast({
- variant: "destructive",
- title: "Invalid file type",
- description: "Please select a PDF file",
- });
- return;
- }
- onUploadSOP?.(file);
+ if (file) stageSopFile(file, sopAttachmentDraft());
}}
/>
{/* As tall as one textarea line box, so the controls center on the last line as the textarea grows. */}
@@ -12334,22 +12430,8 @@ export function WorkflowCopilotChat({
<button
type="button"
onClick={() => attachmentInputRef.current?.click()}
- // An answer to a pending question is sent through the question flow, which carries
- // no files, so offering the control here would stage a file nothing can send.
- disabled={
- hasPendingQuestion || authoringInProgress || isDemonstrating
- }
- title={
- isDemonstrating
- ? demonstrationRecorder.phase === "recording"
- ? "Use Done before attaching a file"
- : "Use Build before attaching a file"
- : authoringInProgress
- ? "Finish the current authoring action before attaching a file"
- : hasPendingQuestion
- ? "Answer the pending question before attaching a file"
- : "Attach a file"
- }
+ disabled={attachDisabledReason !== null}
+ title={attachDisabledReason ?? "Attach a file"}
aria-label="Attach a file"
className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-accent hover:text-accent-foreground disabled:opacity-50"
>
diff --git a/skyvern-frontend/src/routes/workflows/copilot/cards/GoogleReconnectCard.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/cards/GoogleReconnectCard.test.tsx
index d4724f7d4..ea14ab329 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/cards/GoogleReconnectCard.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/cards/GoogleReconnectCard.test.tsx
@@ -2,10 +2,11 @@ import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { GoogleReconnectCard } from "./GoogleReconnectCard";
+import type { GoogleConnectionNotice } from "../narrativeState";
import { PageSlotsProvider, type PermissionsState } from "@/store/PageSlots";
-const { hookState, startAuthorize, storeIntegration, toast } = vi.hoisted(
- () => ({
+const { hookState, refetchCredentials, startAuthorize, storeIntegration } =
+ vi.hoisted(() => ({
hookState: {
current: {
credentials: [] as Array<{
@@ -13,21 +14,22 @@ const { hookState, startAuthorize, storeIntegration, toast } = vi.hoisted(
state: string;
scopes_granted?: string[];
credential_name?: string;
+ email_address?: string | null;
}>,
isLoading: false,
isFetching: false,
error: null as Error | null,
},
},
+ refetchCredentials: vi.fn(),
startAuthorize: vi.fn(),
storeIntegration: vi.fn(),
- toast: vi.fn(),
- }),
-);
+ }));
vi.mock("@/hooks/useGoogleOAuthCredentials", () => ({
useGoogleOAuthCredentials: () => ({
...hookState.current,
+ refetchCredentials,
startAuthorize,
}),
isGoogleOAuthCredentialActive: (credential: { state: string }) =>
@@ -39,7 +41,6 @@ vi.mock("@/hooks/useGoogleOAuthCredentials", () => ({
requiredScopes.every((scope) => credential.scopes_granted?.includes(scope)),
}));
-vi.mock("@/components/ui/use-toast", () => ({ toast }));
vi.mock("@/routes/integrations/googleOAuth", async (importOriginal) => ({
...(await importOriginal()),
storeGoogleOAuthIntegrationIdForState: storeIntegration,
@@ -50,8 +51,38 @@ const notice = {
connectionId: "goac_error",
displayName: "Work Sheets",
condition: "unusable" as const,
+ scopeProfile: "google_sheets" as const,
+ origin: "workflow" as const,
};
+const SHEETS_SCOPE = "https://www.googleapis.com/auth/spreadsheets";
+const GMAIL_READ_SCOPE = "https://www.googleapis.com/auth/gmail.readonly";
+
+function setupNotice(
+ overrides: Partial<GoogleConnectionNotice> = {},
+): GoogleConnectionNotice {
+ return {
+ provider: "google",
+ connectionId: null,
+ displayName: null,
+ condition: "unbound",
+ scopeProfile: "gmail",
+ origin: "setup",
+ choices: [],
+ ...overrides,
+ };
+}
+
+function openablePopup() {
+ return {
+ location: { assign: vi.fn() },
+ close: vi.fn(),
+ closed: false,
+ opener: window as Window | null,
+ sessionStorage: { setItem: vi.fn() },
+ };
+}
+
const memberPermissions: PermissionsState = {
status: "ready",
data: {
@@ -72,9 +103,9 @@ describe("GoogleReconnectCard", () => {
isFetching: false,
error: null,
};
+ refetchCredentials.mockReset().mockResolvedValue({});
startAuthorize.mockReset();
storeIntegration.mockReset();
- toast.mockReset();
vi.unstubAllEnvs();
});
@@ -161,6 +192,8 @@ describe("GoogleReconnectCard", () => {
connectionId: "goac_missing",
displayName: null,
condition: "missing",
+ scopeProfile: "google_sheets",
+ origin: "workflow",
}}
/>,
);
@@ -200,7 +233,7 @@ describe("GoogleReconnectCard", () => {
expect(open).toHaveBeenCalledWith(
"",
- "skyvern-google-oauth",
+ "skyvern-google-oauth-google_sheets:goac_error",
expect.stringContaining("popup"),
);
expect(popup.opener).toBeNull();
@@ -229,12 +262,23 @@ describe("GoogleReconnectCard", () => {
open.mockRestore();
});
- it("does not leave the studio when the browser blocks the new tab", () => {
+ it("shows a blocked popup on the card and retries from the same card", async () => {
const open = vi.spyOn(window, "open").mockReturnValue(null);
render(<GoogleReconnectCard notice={notice} />);
fireEvent.click(screen.getByRole("button", { name: "Reconnect" }));
expect(startAuthorize).not.toHaveBeenCalled();
- expect(toast).toHaveBeenCalled();
+ expect(screen.getByRole("alert").textContent).toContain("Allow pop-ups");
+ expect(screen.queryByRole("status")).toBeNull();
+
+ const popup = openablePopup();
+ open.mockReturnValue(popup as unknown as Window);
+ startAuthorize.mockResolvedValue({
+ authorize_url: "https://accounts.google.com/oauth",
+ state: "retry",
+ });
+ fireEvent.click(screen.getByRole("button", { name: "Reconnect again" }));
+ await waitFor(() => expect(popup.location.assign).toHaveBeenCalled());
+ expect(screen.queryByRole("alert")).toBeNull();
open.mockRestore();
});
@@ -258,6 +302,8 @@ describe("GoogleReconnectCard", () => {
connectionId: null,
displayName: null,
condition: "unbound" as const,
+ scopeProfile: "google_sheets" as const,
+ origin: "workflow" as const,
choices: [],
};
const { rerender } = render(
@@ -315,6 +361,8 @@ describe("GoogleReconnectCard", () => {
connectionId: null,
displayName: null,
condition: "unbound" as const,
+ scopeProfile: "google_sheets" as const,
+ origin: "workflow" as const,
choices: [],
};
@@ -336,6 +384,8 @@ describe("GoogleReconnectCard", () => {
connectionId: null,
displayName: null,
condition: "unbound" as const,
+ scopeProfile: "google_sheets" as const,
+ origin: "workflow" as const,
choices: [
{
connection_id: "goac_saved",
@@ -357,4 +407,150 @@ describe("GoogleReconnectCard", () => {
fireEvent.click(screen.getByRole("button", { name: /Saved Sheets/ }));
expect(onSelect).not.toHaveBeenCalled();
});
+
+ it("asks Google for exactly the read-only Gmail profile on a Gmail setup card", async () => {
+ const popup = openablePopup();
+ const open = vi
+ .spyOn(window, "open")
+ .mockReturnValue(popup as unknown as Window);
+ startAuthorize.mockResolvedValue({
+ authorize_url: "https://accounts.google.com/oauth",
+ state: "gmail-state",
+ });
+ hookState.current.credentials = [
+ {
+ id: "goac_sheets",
+ credential_name: "Sheets only",
+ state: "active",
+ scopes_granted: [SHEETS_SCOPE],
+ },
+ ];
+
+ render(<GoogleReconnectCard notice={setupNotice()} onSelect={vi.fn()} />);
+ expect(screen.queryByText("Sheets only")).toBeNull();
+ expect(screen.getByText("Connect Gmail (read only)")).not.toBeNull();
+ fireEvent.click(screen.getByRole("button", { name: "Connect" }));
+
+ await waitFor(() => expect(popup.location.assign).toHaveBeenCalled());
+ const body = startAuthorize.mock.calls[0]?.[0];
+ expect(body.scope_profile).toBe("gmail");
+ expect(body).not.toHaveProperty("credential_id");
+ expect(JSON.stringify(body)).not.toContain("send");
+ expect(storeIntegration).toHaveBeenCalledWith("gmail-state", "gmail");
+ open.mockRestore();
+ });
+
+ it("gives Gmail and Sheets setup cards separate consent popups", async () => {
+ const gmailPopup = openablePopup();
+ const sheetsPopup = openablePopup();
+ const open = vi
+ .spyOn(window, "open")
+ .mockReturnValueOnce(gmailPopup as unknown as Window)
+ .mockReturnValueOnce(sheetsPopup as unknown as Window);
+ startAuthorize.mockResolvedValue({
+ authorize_url: "https://accounts.google.com/oauth",
+ state: "state_1",
+ });
+
+ render(
+ <>
+ <GoogleReconnectCard notice={setupNotice()} onSelect={vi.fn()} />
+ <GoogleReconnectCard
+ notice={setupNotice({ scopeProfile: "google_sheets" })}
+ onSelect={vi.fn()}
+ />
+ </>,
+ );
+ for (const button of screen.getAllByRole("button", { name: "Connect" })) {
+ fireEvent.click(button);
+ }
+
+ await waitFor(() => expect(sheetsPopup.location.assign).toHaveBeenCalled());
+ const names = open.mock.calls.map((call) => call[1]);
+ expect(names).toEqual([
+ "skyvern-google-oauth-gmail:unbound",
+ "skyvern-google-oauth-google_sheets:unbound",
+ ]);
+ expect(gmailPopup.location.assign).toHaveBeenCalled();
+ open.mockRestore();
+ });
+
+ it("shows a role denial from the server on the card without a connected claim", async () => {
+ const popup = openablePopup();
+ const open = vi
+ .spyOn(window, "open")
+ .mockReturnValue(popup as unknown as Window);
+ startAuthorize.mockRejectedValue({ response: { status: 403 } });
+
+ render(<GoogleReconnectCard notice={setupNotice()} />);
+ fireEvent.click(screen.getByRole("button", { name: "Connect" }));
+
+ expect((await screen.findByRole("alert")).textContent).toContain(
+ "admin access",
+ );
+ expect(popup.close).toHaveBeenCalled();
+ expect(
+ screen.getByRole("button", { name: "Connect again" }),
+ ).not.toBeNull();
+ expect(screen.queryByRole("status")).toBeNull();
+ open.mockRestore();
+ });
+
+ it("reports a popup closed without a new connection as not completed and binds nothing", async () => {
+ const onSelect = vi.fn();
+ const popup = openablePopup();
+ const open = vi
+ .spyOn(window, "open")
+ .mockReturnValue(popup as unknown as Window);
+ startAuthorize.mockResolvedValue({
+ authorize_url: "https://accounts.google.com/oauth",
+ state: "cancelled",
+ });
+
+ render(<GoogleReconnectCard notice={setupNotice()} onSelect={onSelect} />);
+ fireEvent.click(screen.getByRole("button", { name: "Connect" }));
+ await waitFor(() => expect(popup.location.assign).toHaveBeenCalled());
+ expect(screen.getByRole("button", { name: "Waiting for Google…" }));
+ expect(screen.queryByRole("alert")).toBeNull();
+
+ popup.closed = true;
+ expect(
+ (await screen.findByRole("alert", {}, { timeout: 2000 })).textContent,
+ ).toContain("not completed");
+ expect(refetchCredentials).toHaveBeenCalled();
+ expect(
+ screen.getByRole("button", { name: "Connect again" }),
+ ).not.toBeNull();
+ expect(onSelect).not.toHaveBeenCalled();
+ open.mockRestore();
+ });
+
+ it("makes a successful setup reconnect a one-row choice that waits for a click", () => {
+ const onSelect = vi.fn();
+ hookState.current.credentials = [
+ {
+ id: "goac_mail",
+ credential_name: "Inbox",
+ state: "active",
+ scopes_granted: [GMAIL_READ_SCOPE],
+ },
+ ];
+
+ render(
+ <GoogleReconnectCard
+ notice={setupNotice({
+ connectionId: "goac_mail",
+ displayName: "Inbox",
+ condition: "unusable",
+ choices: undefined,
+ })}
+ onSelect={onSelect}
+ />,
+ );
+
+ expect(screen.queryByRole("status")).toBeNull();
+ expect(onSelect).not.toHaveBeenCalled();
+ fireEvent.click(screen.getByRole("button", { name: /Inbox/ }));
+ expect(onSelect).toHaveBeenCalledWith("goac_mail");
+ });
});
diff --git a/skyvern-frontend/src/routes/workflows/copilot/cards/GoogleReconnectCard.tsx b/skyvern-frontend/src/routes/workflows/copilot/cards/GoogleReconnectCard.tsx
index e8b934797..6928d1c0e 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/cards/GoogleReconnectCard.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/cards/GoogleReconnectCard.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { useEffect, useRef, useState, type ReactNode } from "react";
import {
hasGoogleOAuthCredentialScopes,
@@ -11,13 +11,51 @@ import {
storeGoogleOAuthIntegrationIdForState,
} from "@/routes/integrations/googleOAuth";
import { markGoogleOAuthPopup } from "@/routes/integrations/googleOAuthPopup";
-import { toast } from "@/components/ui/use-toast";
import { useHasCapability } from "@/store/PageSlots";
-import { GOOGLE_SHEETS_BLOCK_REQUIRED_SCOPES } from "@/util/googleScopes";
+import {
+ GOOGLE_GMAIL_REQUIRED_SCOPES,
+ GOOGLE_SHEETS_BLOCK_REQUIRED_SCOPES,
+} from "@/util/googleScopes";
-import type { GoogleConnectionNotice } from "../narrativeState";
+import {
+ googleConnectionNoticeKey,
+ type GoogleConnectionNotice,
+ type GoogleSetupScopeProfile,
+} from "../narrativeState";
import { ConnectedAccountChoiceCard } from "./ConnectedAccountChoiceCard";
+const PROFILE_SCOPES: Record<GoogleSetupScopeProfile, readonly string[]> = {
+ gmail: GOOGLE_GMAIL_REQUIRED_SCOPES,
+ google_sheets: GOOGLE_SHEETS_BLOCK_REQUIRED_SCOPES,
+};
+
+const PROFILE_LABELS: Record<GoogleSetupScopeProfile, string> = {
+ gmail: "Gmail (read only)",
+ google_sheets: "Google Sheets",
+};
+
+const POPUP_POLL_MS = 500;
+
+type AttemptState =
+ | "idle"
+ | "open"
+ | "not_completed"
+ | "popup_blocked"
+ | "forbidden"
+ | "start_failed";
+
+const ATTEMPT_FAILURES: Partial<Record<AttemptState, string>> = {
+ not_completed: "Google connection was not completed.",
+ popup_blocked:
+ "Your browser blocked the Google window. Allow pop-ups for this site, then try again.",
+ forbidden: "Organization admin access is required to connect Google.",
+ start_failed: "Could not start the Google connection.",
+};
+
+function responseStatus(error: unknown): number | undefined {
+ return (error as { response?: { status?: number } } | null)?.response?.status;
+}
+
export function GoogleReconnectCard({
notice,
selectedConnectionId = null,
@@ -29,13 +67,54 @@ export function GoogleReconnectCard({
disabled?: boolean;
onSelect?: (connectionId: string) => void;
}) {
- const { credentials, isLoading, isFetching, error, startAuthorize } =
- useGoogleOAuthCredentials({
- refetchOnMount: notice.condition === "unbound" ? undefined : "always",
- });
+ const {
+ credentials,
+ isLoading,
+ isFetching,
+ error,
+ refetchCredentials,
+ startAuthorize,
+ } = useGoogleOAuthCredentials({
+ refetchOnMount: notice.condition === "unbound" ? undefined : "always",
+ });
const canAuthorize = useHasCapability("google_oauth.authorize");
const [isStarting, setIsStarting] = useState(false);
+ const [attempt, setAttempt] = useState<AttemptState>("idle");
+ const popupRef = useRef<Window | null>(null);
+ const requiredScopes = PROFILE_SCOPES[notice.scopeProfile];
+ const profileLabel = PROFILE_LABELS[notice.scopeProfile];
+ const isSetup = notice.origin === "setup";
const isUnbound = notice.condition === "unbound";
+
+ useEffect(() => {
+ if (attempt !== "open") return;
+ let cancelled = false;
+ const timer = window.setInterval(() => {
+ if (!popupRef.current?.closed) return;
+ window.clearInterval(timer);
+ popupRef.current = null;
+ void refetchCredentials().finally(() => {
+ if (!cancelled) setAttempt("not_completed");
+ });
+ }, POPUP_POLL_MS);
+ return () => {
+ cancelled = true;
+ window.clearInterval(timer);
+ };
+ }, [attempt, refetchCredentials]);
+
+ const withProfileCaption = (card: ReactNode) =>
+ isSetup ? (
+ <div className="space-y-1">
+ <div className="text-xs font-medium text-muted-foreground">
+ Choose a Google account for {profileLabel}
+ </div>
+ {card}
+ </div>
+ ) : (
+ card
+ );
+
const choices =
isLoading || error
? (notice.choices ?? [])
@@ -43,10 +122,7 @@ export function GoogleReconnectCard({
.filter(
(credential) =>
isGoogleOAuthCredentialActive(credential) &&
- hasGoogleOAuthCredentialScopes(
- credential,
- GOOGLE_SHEETS_BLOCK_REQUIRED_SCOPES,
- ),
+ hasGoogleOAuthCredentialScopes(credential, requiredScopes),
)
.map((credential) => ({
connection_id: credential.id,
@@ -55,13 +131,13 @@ export function GoogleReconnectCard({
email_address: credential.email_address ?? null,
}));
if (isUnbound && choices.length > 0) {
- return (
+ return withProfileCaption(
<ConnectedAccountChoiceCard
choices={choices}
selectedConnectionId={selectedConnectionId}
disabled={disabled || !onSelect}
onSelect={(connectionId) => onSelect?.(connectionId)}
- />
+ />,
);
}
const exactCredential = credentials.find(
@@ -74,11 +150,25 @@ export function GoogleReconnectCard({
!error &&
exactCredential &&
isGoogleOAuthCredentialActive(exactCredential) &&
- hasGoogleOAuthCredentialScopes(
- exactCredential,
- GOOGLE_SHEETS_BLOCK_REQUIRED_SCOPES,
- )
+ hasGoogleOAuthCredentialScopes(exactCredential, requiredScopes)
) {
+ if (isSetup) {
+ return withProfileCaption(
+ <ConnectedAccountChoiceCard
+ choices={[
+ {
+ connection_id: exactCredential.id,
+ name: exactCredential.credential_name,
+ state: "active",
+ email_address: exactCredential.email_address ?? null,
+ },
+ ]}
+ selectedConnectionId={selectedConnectionId}
+ disabled={disabled || !onSelect}
+ onSelect={(connectionId) => onSelect?.(connectionId)}
+ />,
+ );
+ }
return (
<div
role="status"
@@ -86,7 +176,7 @@ export function GoogleReconnectCard({
>
<div className="font-medium">{accountName} reconnected</div>
<div className="mt-1 text-xs text-muted-foreground">
- This Google Sheets connection is ready to use.
+ This {profileLabel} connection is ready to use.
</div>
</div>
);
@@ -96,7 +186,7 @@ export function GoogleReconnectCard({
return (
<div className="rounded-lg border border-amber-500/40 bg-amber-500/10 p-3 text-sm">
<div className="font-medium">
- Google Sheets connection is no longer available
+ {profileLabel} connection is no longer available
</div>
<div className="mt-1 text-xs text-muted-foreground">
The workflow draft was saved, but this connection was removed and
@@ -108,55 +198,77 @@ export function GoogleReconnectCard({
}
const reconnect = async () => {
+ // One named window per card, so starting a sibling card's consent cannot take over this card's popup.
const authTab = window.open(
"",
- "skyvern-google-oauth",
+ `skyvern-google-oauth-${googleConnectionNoticeKey(notice)}`,
"popup,width=600,height=760",
);
if (!authTab) {
- toast({
- title: "Unable to open Google",
- description: "Allow pop-ups for this site, then try again.",
- variant: "destructive",
- });
+ setAttempt("popup_blocked");
return;
}
markGoogleOAuthPopup(authTab);
authTab.opener = null;
+ popupRef.current = null;
+ setAttempt("idle");
setIsStarting(true);
try {
const response = await startAuthorize({
redirect_uri: buildGoogleOAuthRedirectUri(),
app_origin: getGoogleOAuthAppOrigin(),
...(notice.connectionId ? { credential_id: notice.connectionId } : {}),
- scope_profile: "google_sheets",
+ scope_profile: notice.scopeProfile,
});
- storeGoogleOAuthIntegrationIdForState(response.state, "google_sheets");
storeGoogleOAuthIntegrationIdForState(
response.state,
- "google_sheets",
+ notice.scopeProfile,
+ );
+ storeGoogleOAuthIntegrationIdForState(
+ response.state,
+ notice.scopeProfile,
authTab,
);
authTab.location.assign(response.authorize_url);
- } catch {
+ popupRef.current = authTab;
+ setAttempt("open");
+ } catch (startError) {
authTab.close();
+ setAttempt(
+ responseStatus(startError) === 403 ? "forbidden" : "start_failed",
+ );
} finally {
setIsStarting(false);
}
};
+ const failure = ATTEMPT_FAILURES[attempt];
+ const retrying = failure !== undefined;
+ const connectLabel = isUnbound ? "Connect" : "Reconnect";
+
return (
<div className="rounded-lg border border-amber-500/40 bg-amber-500/10 p-3 text-sm">
<div className="font-medium">
{isUnbound
- ? "Connect a Google account"
+ ? isSetup
+ ? `Connect ${profileLabel}`
+ : "Connect a Google account"
: `${accountName} needs to be reconnected`}
</div>
<div className="mt-1 text-xs text-muted-foreground">
- {isUnbound
- ? "The workflow draft was saved. Connect an account to use Google Sheets."
- : "The workflow draft was saved, but this Sheets connection is not usable."}
+ {isSetup
+ ? isUnbound
+ ? `Connect a Google account to use ${profileLabel}.`
+ : `This ${profileLabel} connection is not usable.`
+ : isUnbound
+ ? "The workflow draft was saved. Connect an account to use Google Sheets."
+ : "The workflow draft was saved, but this Sheets connection is not usable."}
</div>
+ {failure ? (
+ <div role="alert" className="mt-2 text-xs text-destructive">
+ {failure}
+ </div>
+ ) : null}
<button
type="button"
className="mt-3 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-60"
@@ -168,11 +280,13 @@ export function GoogleReconnectCard({
>
{isStarting
? "Opening Google…"
- : canAuthorize
- ? isUnbound
- ? "Connect"
- : "Reconnect"
- : "Admin required"}
+ : !canAuthorize
+ ? "Admin required"
+ : attempt === "open"
+ ? "Waiting for Google…"
+ : retrying
+ ? `${connectLabel} again`
+ : connectLabel}
</button>
</div>
);
diff --git a/skyvern-frontend/src/routes/workflows/copilot/narrativeState.credentialPause.test.ts b/skyvern-frontend/src/routes/workflows/copilot/narrativeState.credentialPause.test.ts
index 0d65e30b1..1145b2fca 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/narrativeState.credentialPause.test.ts
+++ b/skyvern-frontend/src/routes/workflows/copilot/narrativeState.credentialPause.test.ts
@@ -192,6 +192,8 @@ describe("Google connection notice hydration", () => {
connectionId: null,
displayName: null,
condition: "unbound",
+ scopeProfile: "google_sheets",
+ origin: "workflow",
choices: [
{
connection_id: "goac_active",
@@ -233,6 +235,8 @@ describe("Google connection notice hydration", () => {
connectionId: "goac_error",
displayName: "Work Sheets",
condition: "unusable",
+ scopeProfile: "google_sheets",
+ origin: "workflow",
},
]);
expect(
@@ -241,6 +245,42 @@ describe("Google connection notice hydration", () => {
).toEqual(parseGoogleConnectionNotices(raw));
});
+ it("keys notices by profile so unbound Gmail and Sheets setup cards both survive", () => {
+ const unbound = (scopeProfile?: string) => ({
+ provider: "google",
+ connectionId: null,
+ displayName: null,
+ condition: "unbound",
+ ...(scopeProfile ? { scopeProfile, origin: "setup" } : {}),
+ choices: [],
+ });
+
+ const parsed = parseGoogleConnectionNotices([
+ unbound("gmail"),
+ unbound("google_sheets"),
+ unbound(),
+ unbound("gmail_send"),
+ ]);
+
+ expect(
+ parsed.map((notice) => [notice.scopeProfile, notice.origin]),
+ ).toEqual([
+ ["gmail", "setup"],
+ ["google_sheets", "setup"],
+ ]);
+ expect(parseGoogleConnectionNotices([unbound()])).toEqual([
+ {
+ provider: "google",
+ connectionId: null,
+ displayName: null,
+ condition: "unbound",
+ scopeProfile: "google_sheets",
+ origin: "workflow",
+ choices: [],
+ },
+ ]);
+ });
+
it("defaults absent and malformed notice payloads to an empty list", () => {
expect(EMPTY_NARRATIVE.googleConnectionNotices).toEqual([]);
expect(parseGoogleConnectionNotices(null)).toEqual([]);
diff --git a/skyvern-frontend/src/routes/workflows/copilot/narrativeState.ts b/skyvern-frontend/src/routes/workflows/copilot/narrativeState.ts
index 6ee889178..c0919ce0d 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/narrativeState.ts
+++ b/skyvern-frontend/src/routes/workflows/copilot/narrativeState.ts
@@ -459,6 +459,8 @@ export interface TurnNarrativeState {
// turns recorded before it was stamped.
anchorToolCallId?: string;
} | null;
+ // Every pick card's credentialPause, oldest first; the backend sends it only when more than one settled.
+ credentialPauses: NonNullable<TurnNarrativeState["credentialPause"]>[];
// Silently auto-bound credential, from the credentialAutoBound narrative signal — rendered as a
// receipt with a Change affordance so a confident-but-wrong pick can be corrected after the fact.
credentialAutoBound: { credentialId: string; name: string } | null;
@@ -484,14 +486,24 @@ export interface TurnScreenshot {
toolCallId: string | null;
}
+export type GoogleSetupScopeProfile = "gmail" | "google_sheets";
+
export interface GoogleConnectionNotice {
provider: "google";
connectionId: string | null;
displayName: string | null;
condition: "missing" | "unusable" | "unbound";
+ scopeProfile: GoogleSetupScopeProfile;
+ origin: "setup" | "workflow";
choices?: ConnectedAccountChoice[];
}
+export function googleConnectionNoticeKey(
+ notice: GoogleConnectionNotice,
+): string {
+ return `${notice.scopeProfile}:${notice.connectionId ?? "unbound"}`;
+}
+
export const EMPTY_NARRATIVE: TurnNarrativeState = Object.freeze({
turnId: null,
turnIndex: null,
@@ -515,6 +527,7 @@ export const EMPTY_NARRATIVE: TurnNarrativeState = Object.freeze({
lastRunOutcome: null,
credentialPrompt: null,
credentialPause: null,
+ credentialPauses: [],
credentialAutoBound: null,
connectedAccountChoices: [],
outputFiles: [],
@@ -605,6 +618,18 @@ export function parseCredentialPause(
};
}
+export function parseCredentialPauses(
+ value: unknown,
+): TurnNarrativeState["credentialPauses"] {
+ if (!Array.isArray(value)) return [];
+ return value
+ .map(parseCredentialPause)
+ .filter(
+ (pause): pause is NonNullable<TurnNarrativeState["credentialPause"]> =>
+ pause !== null,
+ );
+}
+
export interface TurnWorkPlan {
toolCallId: string;
items: string[];
@@ -707,7 +732,7 @@ export function parseGoogleConnectionNotices(
): GoogleConnectionNotice[] {
if (!Array.isArray(value)) return [];
const notices: GoogleConnectionNotice[] = [];
- const seen = new Set<string | null>();
+ const seen = new Set<string>();
for (const item of value) {
if (!item || typeof item !== "object") continue;
const row = item as Record<string, unknown>;
@@ -719,26 +744,32 @@ export function parseGoogleConnectionNotices(
row.connectionId.length === 0) ||
(row.condition !== "missing" &&
row.condition !== "unusable" &&
- row.condition !== "unbound")
+ row.condition !== "unbound") ||
+ (row.scopeProfile !== undefined &&
+ row.scopeProfile !== "gmail" &&
+ row.scopeProfile !== "google_sheets")
) {
continue;
}
- const connectionId =
- row.condition === "unbound" ? null : (row.connectionId as string);
- if (seen.has(connectionId)) continue;
- seen.add(connectionId);
- notices.push({
+ const notice: GoogleConnectionNotice = {
provider: "google",
- connectionId,
+ connectionId:
+ row.condition === "unbound" ? null : (row.connectionId as string),
displayName:
typeof row.displayName === "string" && row.displayName.length > 0
? row.displayName
: null,
condition: row.condition,
+ scopeProfile: row.scopeProfile === "gmail" ? "gmail" : "google_sheets",
+ origin: row.origin === "setup" ? "setup" : "workflow",
...(row.condition === "unbound"
? { choices: parseConnectedAccountChoices(row.choices) }
: {}),
- });
+ };
+ const key = googleConnectionNoticeKey(notice);
+ if (seen.has(key)) continue;
+ seen.add(key);
+ notices.push(notice);
}
return notices;
}
@@ -853,7 +884,9 @@ const TOOL_CALL_KINDS: Record<string, ToolCallKind> = {
validate_block: "other",
inspect_current_workflow: "other",
list_integrations: "other",
+ request_google_connection: "other",
read_google_sheet: "other",
+ read_attached_pdf: "other",
get_organization_usage_quota: "other",
extend_browser_session: "other",
search_web: "other",
@@ -2053,6 +2086,7 @@ export function hydrateNarrativeFromPayload(
typeof payload.endedAt === "string" ? (payload.endedAt as string) : null,
credentialPrompt: parseCredentialPrompt(payload.credentialPrompt),
credentialPause: parseCredentialPause(payload.credentialPause),
+ credentialPauses: parseCredentialPauses(payload.credentialPauses),
credentialAutoBound: parseCredentialAutoBound(payload.credentialAutoBound),
workPlan: parseTurnWorkPlan(payload.workPlan),
connectedAccountChoices: parseConnectedAccountChoices(
diff --git a/skyvern-frontend/src/routes/workflows/copilot/workflowCopilotTypes.ts b/skyvern-frontend/src/routes/workflows/copilot/workflowCopilotTypes.ts
index 262c5a7ae..8a233d703 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/workflowCopilotTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/copilot/workflowCopilotTypes.ts
@@ -251,6 +251,7 @@ export interface WorkflowCopilotChatRequest {
supports_question_tool?: boolean;
supports_account_group_card?: boolean;
supports_credential_delete_card?: boolean;
+ supports_google_setup_card?: boolean;
}
export type WorkflowCopilotCancelSource = "escape_key" | "stop_button" | "api";
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowAddMenu.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowAddMenu.tsx
index 1e813c61d..b7b1ee88f 100644
--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowAddMenu.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowAddMenu.tsx
@@ -13,7 +13,7 @@ type WorkflowAddMenuProps = {
radius?: string;
rotateText?: boolean;
startAt?: number;
- isUploadingSOP?: boolean;
+ canUploadSOP?: boolean;
canRecordTask?: boolean;
// --
onAdd: () => void;
@@ -29,7 +29,7 @@ function WorkflowAddMenu({
radius = "80px",
rotateText = true,
startAt = 90,
- isUploadingSOP = false,
+ canUploadSOP = true,
canRecordTask = true,
// --
onAdd,
@@ -71,12 +71,11 @@ function WorkflowAddMenu({
});
}
- // Always show Upload SOP option
menuItems.push({
id: "3",
icon: <UploadIcon className={buttonSize ? "h-3 w-3" : undefined} />,
text: "Upload SOP",
- enabled: !isUploadingSOP,
+ enabled: canUploadSOP,
onClick: () => {
onUploadSOP();
},
@@ -92,7 +91,7 @@ function WorkflowAddMenu({
recordingStore.isRecording,
settingsStore.isUsingABrowser,
settingsStore.isLoadingABrowser,
- isUploadingSOP,
+ canUploadSOP,
]);
// The studio editor (/studio, blockRunsEnabled) surfaces these actions too;
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowAdderBusy.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowAdderBusy.tsx
index 5fd9d8684..2c580e6b2 100644
--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowAdderBusy.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowAdderBusy.tsx
@@ -1,15 +1,6 @@
import { StopIcon } from "@radix-ui/react-icons";
import { ReactNode, useEffect, useRef, useState } from "react";
-import { Button } from "@/components/ui/button";
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
-} from "@/components/ui/dialog";
import {
Tooltip,
TooltipContent,
@@ -21,7 +12,7 @@ import { cn } from "@/util/utils";
import "./WorkflowAdderBusy.css";
-type Operation = "recording" | "processing" | "uploading";
+type Operation = "recording" | "processing";
type Size = "small" | "large";
@@ -43,10 +34,6 @@ type Props = {
* Callback for when the operation completes (recording/processing).
*/
onComplete: () => void;
- /**
- * Callback for when the user cancels an upload operation.
- */
- onCancel?: () => void;
};
function WorkflowAdderBusy({
@@ -55,12 +42,10 @@ function WorkflowAdderBusy({
size,
color = "red",
onComplete,
- onCancel,
}: Props) {
const recordingStore = useRecordingStore();
const [isHovered, setIsHovered] = useState(false);
const [shouldBump, setShouldBump] = useState(false);
- const [showCancelDialog, setShowCancelDialog] = useState(false);
const bumpTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const prevCountRef = useRef(0);
const eventCount = recordingStore.exposedEventCount;
@@ -91,21 +76,10 @@ function WorkflowAdderBusy({
const handleClick = (e: React.MouseEvent) => {
e.stopPropagation();
e.preventDefault();
-
- if (operation === "uploading" && onCancel) {
- setShowCancelDialog(true);
- } else {
- onComplete();
- }
-
+ onComplete();
return false;
};
- const handleConfirmCancel = () => {
- setShowCancelDialog(false);
- onCancel?.();
- };
-
return (
<TooltipProvider>
<div className="relative inline-block">
@@ -202,9 +176,7 @@ function WorkflowAdderBusy({
<p>
{operation === "recording"
? "Stop & generate workflow steps"
- : operation === "uploading"
- ? "Converting SOP... (click to cancel)"
- : "Processing..."}
+ : "Processing..."}
</p>
</TooltipContent>
</Tooltip>
@@ -238,28 +210,6 @@ function WorkflowAdderBusy({
</Tooltip>
)}
</div>
- <Dialog open={showCancelDialog} onOpenChange={setShowCancelDialog}>
- <DialogContent>
- <DialogHeader>
- <DialogTitle>Cancel SOP Conversion?</DialogTitle>
- <DialogDescription>
- The SOP is currently being converted to workflow blocks. Are you
- sure you want to cancel this operation?
- </DialogDescription>
- </DialogHeader>
- <DialogFooter>
- <Button
- variant="outline"
- onClick={() => setShowCancelDialog(false)}
- >
- Continue
- </Button>
- <Button variant="destructive" onClick={handleConfirmCancel}>
- Cancel Upload
- </Button>
- </DialogFooter>
- </DialogContent>
- </Dialog>
</TooltipProvider>
);
}
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.test.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.test.tsx
index 7c72467e8..6fa899b86 100644
--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.test.tsx
@@ -59,7 +59,6 @@ import {
type WorkflowSaveData,
} from "@/store/WorkflowHasChangesStore";
import { useRecordedBlocksStore } from "@/store/RecordedBlocksStore";
-import { applySopResultAtCurrentAppend } from "./workspaceAuthoringActions";
import { useRecordingStore } from "@/store/useRecordingStore";
import { useRecordingLauncherStore } from "@/store/useRecordingLauncherStore";
import { useWorkflowPanelStore } from "@/store/WorkflowPanelStore";
@@ -4543,68 +4542,52 @@ describe("A49 metadata authorship through editor actions", () => {
},
);
- test.each(["recording", "SOP conversion"])(
- "keeps generated blocks unsaved after accepting a proposal following %s",
- async (source) => {
- integration.canvas = true;
- const staged = stageGraphProposal();
- mountEditor({ ...staged, workflow_id: workflow.workflow_id, version: 1 });
- await screen.findByRole("button", { name: "Accept" });
- const generated = {
- blocks: [
- { ...staged.workflow_definition.blocks[0]!, label: "generated" },
- ],
- parameters: [],
- };
- act(() => {
- const owner = useWorkflowYamlEditorStore.getState().editorOwner!;
- if (source === "SOP conversion") {
- applySopResultAtCurrentAppend({
- result: generated,
- getNodes: () => canvas.current!.nodes,
- getEdges: () => canvas.current!.edges,
- setRecordedBlocks: (result, insertionPoint) =>
- useRecordedBlocksStore
- .getState()
- .setRecordedBlocks(result, insertionPoint, owner),
- });
- } else {
- useRecordedBlocksStore
- .getState()
- .setRecordedBlocks(
- generated,
- { previous: null, next: null, connectingEdgeType: "default" },
- owner,
- );
- }
- });
- await waitFor(() =>
- expect(
- useWorkflowHasChangesStore
- .getState()
- .getSaveData()!
- .blocks.map((block) => block.label),
- ).toEqual(["pause", "generated"]),
- );
- expect(useWorkflowHasChangesStore.getState().hasChanges).toBe(true);
- await accept();
- fireEvent.click(
- await screen.findByRole("button", { name: "Keep my edits" }),
- );
- await waitFor(() =>
- expect(
- useWorkflowYamlEditorStore.getState().copilotAcceptance,
- ).toBeNull(),
- );
- const saved = useWorkflowHasChangesStore.getState().getSaveData()!;
- expect(saved.blocks.map((block) => block.label)).toEqual([
- "pause",
- "generated",
- ]);
- expect(saved.workflow.workflow_id).toBe(staged.workflow_id);
- expect(useWorkflowHasChangesStore.getState().hasChanges).toBe(true);
- },
- );
+ test("keeps generated blocks unsaved after accepting a proposal following recording", async () => {
+ integration.canvas = true;
+ const staged = stageGraphProposal();
+ mountEditor({ ...staged, workflow_id: workflow.workflow_id, version: 1 });
+ await screen.findByRole("button", { name: "Accept" });
+ const generated = {
+ blocks: [
+ { ...staged.workflow_definition.blocks[0]!, label: "generated" },
+ ],
+ parameters: [],
+ };
+ act(() => {
+ useRecordedBlocksStore
+ .getState()
+ .setRecordedBlocks(
+ generated,
+ { previous: null, next: null, connectingEdgeType: "default" },
+ useWorkflowYamlEditorStore.getState().editorOwner!,
+ );
+ });
+ await waitFor(() =>
+ expect(
+ useWorkflowHasChangesStore
+ .getState()
+ .getSaveData()!
+ .blocks.map((block) => block.label),
+ ).toEqual(["pause", "generated"]),
+ );
+ expect(useWorkflowHasChangesStore.getState().hasChanges).toBe(true);
+ await accept();
+ fireEvent.click(
+ await screen.findByRole("button", { name: "Keep my edits" }),
+ );
+ await waitFor(() =>
+ expect(
+ useWorkflowYamlEditorStore.getState().copilotAcceptance,
+ ).toBeNull(),
+ );
+ const saved = useWorkflowHasChangesStore.getState().getSaveData()!;
+ expect(saved.blocks.map((block) => block.label)).toEqual([
+ "pause",
+ "generated",
+ ]);
+ expect(saved.workflow.workflow_id).toBe(staged.workflow_id);
+ expect(useWorkflowHasChangesStore.getState().hasChanges).toBe(true);
+ });
test.each([
{ label: "Disable parallel runs", setting: "runSequentially" as const },
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx
index 421f6feb6..b50309cfd 100644
--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx
@@ -1,3 +1,4 @@
+import { WorkflowFindingsButton } from "@/components/WorkflowFindingsSlot";
import { runIsLogicallyActive } from "@/routes/workflows/workflowRun/runRetryState";
import {
CalendarIcon,
@@ -350,6 +351,7 @@ function TitleSection() {
}
function WorkflowHeader() {
+ const workflowTitle = useWorkflowTitleStore((state) => state.title);
const workflowPermanentId = useWorkflowPermanentId();
const { data: globalWorkflows } = useGlobalWorkflowsQuery();
const { data: workflow } = useWorkflowQuery({ workflowPermanentId });
@@ -384,7 +386,16 @@ function WorkflowHeader() {
aria-hidden={collapsed}
{...(collapsed ? { inert: "" } : {})}
>
- <TitleSection />
+ <div className="flex min-w-0 flex-1 items-center gap-2">
+ <TitleSection />
+ {!isGlobalWorkflow && !workflow?.deleted_at && workflowPermanentId ? (
+ <WorkflowFindingsButton
+ workflowPermanentId={workflowPermanentId}
+ title={workflowTitle}
+ surface="editor"
+ />
+ ) : null}
+ </div>
<div className="flex h-full shrink-0 items-center justify-end gap-4">
{isGeneratingCode && <GeneratingCodeButton />}
{isGlobalWorkflow ? <MakeACopyButton /> : <EditorActionToolbar />}
diff --git a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
index e6aeb709e..d4d49235d 100644
--- a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
@@ -92,7 +92,6 @@ import { useBlockScriptStore } from "@/store/BlockScriptStore";
import { useBlockSidebarWidthStore } from "@/store/BlockSidebarWidthStore";
import { useCacheKeyValueStore } from "@/store/CacheKeyValueStore";
import { useRecordingStore } from "@/store/useRecordingStore";
-import { useRecordedBlocksStore } from "@/store/RecordedBlocksStore";
import { useWorkflowSettingsStore } from "@/store/WorkflowSettingsStore";
import { useStudioPaneDefaults } from "../studio/StudioPaneDefaultsContext";
import { useCopilotActionStore } from "@/store/useCopilotActionStore";
@@ -260,9 +259,7 @@ import { useRecordingLauncherStore } from "@/store/useRecordingLauncherStore";
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
import { WORKFLOW_COPILOT_DEMONSTRATION_FLAG } from "@/util/featureFlags";
import type { CopilotAttachedFile } from "@/routes/workflows/copilot/workflowCopilotTypes";
-import { useSopToBlocksMutation } from "../hooks/useSopToBlocksMutation";
import {
- applySopResultAtCurrentAppend,
demonstrationInsertionFromNodes,
resolveAppendInsertionPoint,
resolveWorkspaceAuthoringActionAvailability,
@@ -864,6 +861,11 @@ function Workspace({
setIsCopilotOpen(true);
}
}, [initialCopilotAction]);
+ // Opening an already-open studio pane still restores a maximized pane, which would otherwise hide Copilot.
+ const openCopilot = useCallback(() => {
+ if (!embedded) setIsCopilotOpen(true);
+ else openStudioPane("copilot", { state: location.state });
+ }, [embedded, openStudioPane, location.state]);
const [copilotMessageCount, setCopilotMessageCount] = useState(0);
const copilotButtonRef = useRef<HTMLButtonElement>(null);
const [readyBrowserSessionId, setReadyBrowserSessionId] = useState<
@@ -1793,24 +1795,12 @@ function Workspace({
// Stable action ref (vs the whole-store `recordingStore` object, which gets a
// new reference on every store write and would re-register the launcher).
const setIsRecording = useRecordingStore((s) => s.setIsRecording);
- const setRecordedBlocks = useRecordedBlocksStore((s) => s.setRecordedBlocks);
const getAppendInsertionPoint = useCallback(() => {
return resolveAppendInsertionPoint(
getNodes() as Array<AppNode>,
getEdges(),
);
}, [getEdges, getNodes]);
- const sopToBlocksMutation = useSopToBlocksMutation({
- onSuccess: (result, owner) => {
- applySopResultAtCurrentAppend({
- result,
- getNodes: () => getNodes() as Array<AppNode>,
- getEdges,
- setRecordedBlocks: (blocks, insertionPoint) =>
- setRecordedBlocks(blocks, insertionPoint, owner),
- });
- },
- });
const authoringActionAvailability =
resolveWorkspaceAuthoringActionAvailability({
browserReady: copilotLiveBrowserReady,
@@ -1824,7 +1814,6 @@ function Workspace({
recordingStore.isRecording ||
recordingStore.finishRequested ||
recordingStore.isCommitting,
- isUploadingSOP: sopToBlocksMutation.isPending,
});
// A deferred start runs after a save; the browser may have stopped being ready.
const canRecordTaskRef = useRef(authoringActionAvailability.canRecordTask);
@@ -1907,15 +1896,6 @@ function Workspace({
startDemonstration,
getNodes,
]);
- const uploadSOPAtEnd = useCallback(
- (file: File) => {
- if (!authoringActionAvailability.canUploadSOP) return;
- void runWorkflowAuthoringAction(() =>
- sopToBlocksMutation.mutateAsync(file),
- );
- },
- [authoringActionAvailability.canUploadSOP, sopToBlocksMutation],
- );
// `/discover`'s "Demonstrate task" lands here with ?record=1; start once the browser is ready.
useEffect(() => {
if (
@@ -3599,9 +3579,7 @@ function Workspace({
initialAttachments={routeInitialCopilotAttachments}
initialAction={initialCopilotAction ?? undefined}
onInitialMessageConsumed={handleInitialCopilotMessageConsumed}
- onUploadSOP={uploadSOPAtEnd}
- canUploadSOP={authoringActionAvailability.canUploadSOP}
- isUploadingSOP={sopToBlocksMutation.isPending}
+ onRequestOpen={openCopilot}
onRecordTask={startRecordingAtEnd}
canRecordTask={authoringActionAvailability.canRecordTask}
authoringUnavailableReason={
diff --git a/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.test.tsx b/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.test.tsx
index 28019cef2..6d6bb91a7 100644
--- a/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.test.tsx
@@ -5,9 +5,7 @@ import {
cleanup,
fireEvent,
render,
- renderHook,
screen,
- waitFor,
} from "@testing-library/react";
import type { EdgeProps } from "@xyflow/react";
import type { ReactNode } from "react";
@@ -15,12 +13,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useRecordedBlocksStore } from "@/store/RecordedBlocksStore";
+import { useCopilotActionStore } from "@/store/useCopilotActionStore";
import type { useProcessRecordingMutation } from "@/routes/browserSessions/hooks/useProcessRecordingMutation";
-import {
- useWorkflowHasChangesStore,
- useWorkflowSave,
- type WorkflowSaveData,
-} from "@/store/WorkflowHasChangesStore";
+import { useWorkflowHasChangesStore } from "@/store/WorkflowHasChangesStore";
import {
beginCopilotAcceptance,
finishCopilotAcceptance,
@@ -83,15 +78,6 @@ vi.mock("@/routes/browserSessions/hooks/useProcessRecordingMutation", () => ({
},
}));
-const uploadMocks = vi.hoisted(() => ({
- getClient: vi.fn(),
- post: vi.fn(),
- put: vi.fn(),
-}));
-vi.mock("@/api/AxiosClient", () => ({ getClient: uploadMocks.getClient }));
-vi.mock("@/hooks/useCredentialGetter", () => ({
- useCredentialGetter: () => vi.fn(),
-}));
vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));
vi.mock("posthog-js/react", () => ({
usePostHog: () => ({ capture: vi.fn() }),
@@ -147,10 +133,6 @@ describe("EdgeWithAddButton", () => {
useWorkflowHasChangesStore.setState(
useWorkflowHasChangesStore.getInitialState(),
);
- uploadMocks.getClient.mockResolvedValue({
- post: uploadMocks.post,
- put: uploadMocks.put,
- });
useSettingsStore.setState(initialSettings, true);
useRecordingStore.setState(initialRecording, true);
useWorkflowPanelStore.setState({
@@ -168,6 +150,7 @@ describe("EdgeWithAddButton", () => {
afterEach(() => {
cleanup();
+ useCopilotActionStore.setState({ stageAttachment: null });
useRecordedBlocksStore.getState().clearRecordedBlocks();
useRecordingStore.setState(initialRecording, true);
useWorkflowYamlEditorStore.setState(
@@ -269,132 +252,28 @@ describe("EdgeWithAddButton", () => {
expect(useRecordingStore.getState().isRecording).toBe(false);
});
- it.each(["copilot", "yaml"])(
- "refuses a canvas upload while %s owns the editor",
- async (lock) => {
- useNodesMock.mockReturnValue([{ id: "source", type: "start", data: {} }]);
- const owner = createYamlCommitOwner("wpid_test");
- const token = lock === "copilot" ? beginCopilotAcceptance() : null;
- if (lock === "yaml") expect(beginYamlCommit(owner)).toBe(true);
- const { container } = renderEdge();
- const input =
- container.querySelector<HTMLInputElement>('input[type="file"]')!;
- await act(async () =>
- fireEvent.change(input, {
- target: {
- files: [
- new File(["pdf"], "steps.pdf", { type: "application/pdf" }),
- ],
- },
- }),
- );
- expect(uploadMocks.getClient).not.toHaveBeenCalled();
- expect(uploadMocks.post).not.toHaveBeenCalled();
- expect(useRecordedBlocksStore.getState().blocks).toBeNull();
- if (token) finishCopilotAcceptance(token);
- else finishYamlCommit(owner);
- },
- );
+ it("stages a picked PDF in Copilot with a draft naming the block after it", () => {
+ useNodesMock.mockReturnValue([
+ { id: "source", type: "start", data: {} },
+ { id: "target", type: "task", data: { label: "download" } },
+ ]);
+ const { container } = renderEdge({}, { debug: true });
+ const uploadItem = () =>
+ screen.getByText("Upload SOP").parentElement!.querySelector("button")!;
+ expect(uploadItem().disabled).toBe(true);
- it("holds authoring through upload settlement until generated blocks are applied", async () => {
- useNodesMock.mockReturnValue([{ id: "source", type: "start", data: {} }]);
- let resolveUpload!: (value: unknown) => void;
- uploadMocks.post.mockImplementation(
- () =>
- new Promise((resolve) => {
- resolveUpload = resolve;
- }),
- );
- const { container } = renderEdge();
- const input =
- container.querySelector<HTMLInputElement>('input[type="file"]')!;
- fireEvent.change(input, {
- target: { files: [new File(["pdf"], "steps.pdf")] },
- });
- expect(useWorkflowYamlEditorStore.getState().authoringInProgress).toBe(
- true,
- );
- expect(beginCopilotAcceptance()).toBeNull();
- expect(beginYamlCommit(createYamlCommitOwner("wpid_test"))).toBe(false);
- await waitFor(() => expect(uploadMocks.post).toHaveBeenCalledTimes(1));
- await act(async () =>
- resolveUpload({
- data: {
- blocks: [
- {
- block_type: "goto_url",
- label: "uploaded",
- url: "https://example.com",
- },
- ],
- parameters: [],
- },
- }),
+ const stage = vi.fn();
+ act(() => useCopilotActionStore.setState({ stageAttachment: stage }));
+ expect(uploadItem().disabled).toBe(false);
+ const file = new File(["pdf"], "steps.pdf", { type: "application/pdf" });
+ fireEvent.change(
+ container.querySelector<HTMLInputElement>('input[type="file"]')!,
+ { target: { files: [file] } },
);
- expect(useRecordedBlocksStore.getState().blocks).toHaveLength(1);
- expect(useWorkflowYamlEditorStore.getState().authoringInProgress).toBe(
- true,
- );
- act(() => useRecordedBlocksStore.getState().clearRecordedBlocks());
- expect(useWorkflowYamlEditorStore.getState().authoringInProgress).toBe(
- false,
- );
- const token = beginCopilotAcceptance();
- expect(token).not.toBeNull();
- finishCopilotAcceptance(token!);
- });
-
- it("releases authoring after two immediate upload failures and permits Save", async () => {
- useNodesMock.mockReturnValue([{ id: "source", type: "start", data: {} }]);
- uploadMocks.getClient.mockRejectedValue(
- new Error("credentials unavailable"),
+ expect(stage).toHaveBeenCalledWith(
+ file,
+ "Add the steps from the attached SOP before the download block.",
);
- const { container } = renderEdge();
- const input =
- container.querySelector<HTMLInputElement>('input[type="file"]')!;
- const file = new File(["pdf"], "steps.pdf");
- await act(async () => {
- for (let attempt = 1; attempt <= 2; attempt++) {
- fireEvent.change(input, { target: { files: [file] } });
- expect(useWorkflowYamlEditorStore.getState().authoringInProgress).toBe(
- true,
- );
- await vi.waitFor(() => {
- expect(uploadMocks.getClient).toHaveBeenCalledTimes(attempt);
- expect(
- useWorkflowYamlEditorStore.getState().authoringInProgress,
- ).toBe(false);
- });
- }
- });
- expect(uploadMocks.post).not.toHaveBeenCalled();
- uploadMocks.getClient.mockResolvedValue({ put: uploadMocks.put });
- const saveData = {
- title: "Draft",
- description: null,
- blocks: [],
- parameters: [],
- workflowDefinitionVersion: 1,
- settings: { proxyLocation: "RESIDENTIAL", runWith: "agent" },
- workflow: {
- workflow_permanent_id: "wpid_test",
- workflow_definition: { version: 1, blocks: [], parameters: [] },
- },
- } as unknown as WorkflowSaveData;
- useWorkflowHasChangesStore.setState({
- getSaveData: () => saveData,
- hasChanges: true,
- });
- uploadMocks.put.mockResolvedValue({
- data: { ...saveData.workflow, title: "Draft", description: null },
- });
- registerEditorOwner(createYamlCommitOwner("wpid_test"));
- const { result } = renderHook(() => useWorkflowSave(), {
- wrapper: queryWrapper,
- });
- await act(async () => result.current.mutateAsync(undefined));
- expect(uploadMocks.put).toHaveBeenCalledTimes(1);
- expect(useWorkflowHasChangesStore.getState().hasChanges).toBe(false);
});
it("keeps the loop as parent without branch context for nested-loop edge inserts", () => {
diff --git a/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.tsx b/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.tsx
index 8934e9a6c..99719b3ce 100644
--- a/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/edges/EdgeWithAddButton.tsx
@@ -15,7 +15,7 @@ import {
} from "@/store/WorkflowPanelStore";
import { useWorkflowScopeReadOnly } from "../WorkflowScopeContext";
import { useProcessRecordingMutation } from "@/routes/browserSessions/hooks/useProcessRecordingMutation";
-import { useSopToBlocksMutation } from "@/routes/workflows/hooks/useSopToBlocksMutation";
+import { useCopilotActionStore } from "@/store/useCopilotActionStore";
import { useDebugStore } from "@/store/useDebugStore";
import { useRecordedBlocksStore } from "@/store/RecordedBlocksStore";
import { useRecordingStore } from "@/store/useRecordingStore";
@@ -26,11 +26,7 @@ import {
requestRecordingStart,
useIsMountedRef,
} from "@/routes/workflows/editor/recording/pendingRecordingStartGate";
-import {
- runWorkflowAuthoringAction,
- refuseMutationDuringYamlCommit,
- refuseMutationDuringAuthoring,
-} from "@/store/WorkflowYamlEditorStore";
+import { runWorkflowAuthoringAction } from "@/store/WorkflowYamlEditorStore";
import { useSettingsStore } from "@/store/SettingsStore";
import { cn } from "@/util/utils";
import { toast } from "@/components/ui/use-toast";
@@ -43,7 +39,12 @@ import { SELECTED_RING_CLASSES } from "../selection/selectedRingClasses";
import { WorkflowAddMenu } from "../WorkflowAddMenu";
import { WorkflowAdderBusy } from "../WorkflowAdderBusy";
import { findBranchContextForInsertion } from "../workflowInsertion";
-import { demonstrationInsertionFromNodes } from "../workspaceAuthoringActions";
+import {
+ blockLabelFor,
+ demonstrationInsertionFromNodes,
+ sopAttachmentDraft,
+ stageSopFile,
+} from "../workspaceAuthoringActions";
function EdgeWithAddButton({
source,
@@ -73,6 +74,9 @@ function EdgeWithAddButton({
const startDemonstration = useRecordingLauncherStore(
(state) => state.startDemonstration,
);
+ const stageAttachment = useCopilotActionStore(
+ (state) => state.stageAttachment,
+ );
const demonstrationEnabled =
useFeatureFlag(WORKFLOW_COPILOT_DEMONSTRATION_FLAG) === true;
const settingsStore = useSettingsStore();
@@ -104,24 +108,6 @@ function EdgeWithAddButton({
},
});
- const sopToBlocksMutation = useSopToBlocksMutation({
- onSuccess: (result, owner) => {
- setRecordedBlocks(
- result,
- {
- previous: source,
- next: target,
- parent: sourceNode?.parentId,
- connectingEdgeType: "edgeWithAddButton",
- },
- owner,
- );
- },
- });
-
- // Derive upload state directly from mutation to avoid race conditions
- const isUploadingSOP = sopToBlocksMutation.isPending;
-
const isProcessing =
processRecordingMutation.isPending ||
recordingStore.finishRequested ||
@@ -223,29 +209,26 @@ function EdgeWithAddButton({
};
const onUploadSOP = () => {
- if (refuseMutationDuringYamlCommit() || refuseMutationDuringAuthoring())
- return;
fileInputRef.current?.click();
};
const handleSOPFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0];
+ e.target.value = "";
if (!file) {
return;
}
- if (!file.name.toLowerCase().endsWith(".pdf")) {
- toast({
- variant: "destructive",
- title: "Invalid file type",
- description: "Please select a PDF file",
- });
- e.target.value = "";
- return;
- }
- void runWorkflowAuthoringAction(() =>
- sopToBlocksMutation.mutateAsync(file),
+ stageSopFile(
+ file,
+ sopAttachmentDraft(
+ demonstrationInsertionFromNodes(nodes, {
+ previous: source,
+ next: target,
+ parent: sourceNode?.parentId,
+ }),
+ blockLabelFor(nodes, sourceNode?.parentId),
+ ),
);
- e.target.value = "";
};
// Mirror NodeAdderNode's selection treatment so the two + CTAs feel like one affordance.
@@ -291,7 +274,7 @@ function EdgeWithAddButton({
onAdd={onAdd}
onRecord={onRecord}
onUploadSOP={onUploadSOP}
- isUploadingSOP={isUploadingSOP}
+ canUploadSOP={stageAttachment !== null}
canRecordTask={!demonstrationEnabled || startDemonstration !== null}
>
{adder}
@@ -311,22 +294,6 @@ function EdgeWithAddButton({
</WorkflowAdderBusy>
);
- const handleCancelUpload = () => {
- sopToBlocksMutation.cancel();
- };
-
- const sopUploadBusy = (
- <WorkflowAdderBusy
- color="#3b82f6"
- operation="uploading"
- size="small"
- onComplete={() => {}}
- onCancel={handleCancelUpload}
- >
- {adder}
- </WorkflowAdderBusy>
- );
-
if (isReadOnly) {
return <BaseEdge path={edgePath} markerEnd={markerEnd} style={style} />;
}
@@ -358,13 +325,7 @@ function EdgeWithAddButton({
className="hidden"
onChange={handleSOPFileChange}
/>
- {isUploadingSOP
- ? sopUploadBusy
- : isBusy
- ? busy
- : isDisabled
- ? adder
- : menu}
+ {isBusy ? busy : isDisabled ? adder : menu}
</div>
</EdgeLabelRenderer>
</>
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginBlockCredentialSelector.test.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginBlockCredentialSelector.test.tsx
index dc7258733..bd5d851fd 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginBlockCredentialSelector.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginBlockCredentialSelector.test.tsx
@@ -677,6 +677,7 @@ describe("LoginBlockCredentialSelector 1Password items", () => {
vault_id: "op_vault_1",
vault_name: "Engineering",
category: "LOGIN",
+ importable: true,
url: "https://portal.example.invalid/signin",
};
const cardItem: OnePasswordItemApiResponse = {
@@ -685,6 +686,7 @@ describe("LoginBlockCredentialSelector 1Password items", () => {
vault_id: "op_vault_1",
vault_name: "Engineering",
category: "CREDIT_CARD",
+ importable: true,
url: null,
};
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.test.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.test.tsx
index 29aa1c425..e1dd8720c 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.test.tsx
@@ -5,9 +5,7 @@ import {
cleanup,
fireEvent,
render,
- renderHook,
screen,
- waitFor,
} from "@testing-library/react";
import type { ReactNode } from "react";
import type { Edge, NodeProps } from "@xyflow/react";
@@ -15,12 +13,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useRecordedBlocksStore } from "@/store/RecordedBlocksStore";
+import { useCopilotActionStore } from "@/store/useCopilotActionStore";
import type { useProcessRecordingMutation } from "@/routes/browserSessions/hooks/useProcessRecordingMutation";
-import {
- useWorkflowHasChangesStore,
- useWorkflowSave,
- type WorkflowSaveData,
-} from "@/store/WorkflowHasChangesStore";
+import { useWorkflowHasChangesStore } from "@/store/WorkflowHasChangesStore";
import {
beginCopilotAcceptance,
finishCopilotAcceptance,
@@ -83,15 +78,6 @@ vi.mock("@/routes/browserSessions/hooks/useProcessRecordingMutation", () => ({
},
}));
-const uploadMocks = vi.hoisted(() => ({
- getClient: vi.fn(),
- post: vi.fn(),
- put: vi.fn(),
-}));
-vi.mock("@/api/AxiosClient", () => ({ getClient: uploadMocks.getClient }));
-vi.mock("@/hooks/useCredentialGetter", () => ({
- useCredentialGetter: () => vi.fn(),
-}));
vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));
vi.mock("posthog-js/react", () => ({
usePostHog: () => ({ capture: vi.fn() }),
@@ -140,10 +126,6 @@ describe("NodeAdderNode", () => {
useWorkflowHasChangesStore.setState(
useWorkflowHasChangesStore.getInitialState(),
);
- uploadMocks.getClient.mockResolvedValue({
- post: uploadMocks.post,
- put: uploadMocks.put,
- });
useSettingsStore.setState(initialSettings, true);
useRecordingStore.setState(initialRecording, true);
useWorkflowSettingsStore.setState(initialWorkflowSettings, true);
@@ -164,6 +146,7 @@ describe("NodeAdderNode", () => {
afterEach(() => {
cleanup();
+ useCopilotActionStore.setState({ stageAttachment: null });
useRecordedBlocksStore.getState().clearRecordedBlocks();
useRecordingStore.setState(initialRecording, true);
useWorkflowYamlEditorStore.setState(
@@ -272,141 +255,30 @@ describe("NodeAdderNode", () => {
expect(useRecordingStore.getState().isRecording).toBe(false);
});
- it.each(["copilot", "yaml"])(
- "refuses a canvas upload while %s owns the editor",
- async (lock) => {
- useEdgesMock.mockReturnValue([
- { id: "edge", source: "start", target: "adder" },
- ]);
- useNodesMock.mockReturnValue([{ id: "start", type: "start", data: {} }]);
- const owner = createYamlCommitOwner("wpid_test");
- const token = lock === "copilot" ? beginCopilotAcceptance() : null;
- if (lock === "yaml") expect(beginYamlCommit(owner)).toBe(true);
- const { container } = renderNodeAdder({});
- const input =
- container.querySelector<HTMLInputElement>('input[type="file"]')!;
- await act(async () =>
- fireEvent.change(input, {
- target: {
- files: [
- new File(["pdf"], "steps.pdf", { type: "application/pdf" }),
- ],
- },
- }),
- );
- expect(uploadMocks.getClient).not.toHaveBeenCalled();
- expect(uploadMocks.post).not.toHaveBeenCalled();
- expect(useRecordedBlocksStore.getState().blocks).toBeNull();
- if (token) finishCopilotAcceptance(token);
- else finishYamlCommit(owner);
- },
- );
-
- it("holds authoring through upload settlement until generated blocks are applied", async () => {
+ it("stages a picked PDF in Copilot with a draft naming the block before it", () => {
useEdgesMock.mockReturnValue([
- { id: "edge", source: "start", target: "adder" },
+ { id: "edge", source: "login", target: "adder" },
]);
- useNodesMock.mockReturnValue([{ id: "start", type: "start", data: {} }]);
- let resolveUpload!: (value: unknown) => void;
- uploadMocks.post.mockImplementation(
- () =>
- new Promise((resolve) => {
- resolveUpload = resolve;
- }),
- );
- const { container } = renderNodeAdder({});
- const input =
- container.querySelector<HTMLInputElement>('input[type="file"]')!;
- fireEvent.change(input, {
- target: { files: [new File(["pdf"], "steps.pdf")] },
- });
- expect(useWorkflowYamlEditorStore.getState().authoringInProgress).toBe(
- true,
- );
- expect(beginCopilotAcceptance()).toBeNull();
- expect(beginYamlCommit(createYamlCommitOwner("wpid_test"))).toBe(false);
- await waitFor(() => expect(uploadMocks.post).toHaveBeenCalledTimes(1));
- await act(async () =>
- resolveUpload({
- data: {
- blocks: [
- {
- block_type: "goto_url",
- label: "uploaded",
- url: "https://example.com",
- },
- ],
- parameters: [],
- },
- }),
- );
- expect(useRecordedBlocksStore.getState().blocks).toHaveLength(1);
- expect(useWorkflowYamlEditorStore.getState().authoringInProgress).toBe(
- true,
- );
- act(() => useRecordedBlocksStore.getState().clearRecordedBlocks());
- expect(useWorkflowYamlEditorStore.getState().authoringInProgress).toBe(
- false,
- );
- const token = beginCopilotAcceptance();
- expect(token).not.toBeNull();
- finishCopilotAcceptance(token!);
- });
-
- it("releases authoring after two immediate upload failures and permits Save", async () => {
- useEdgesMock.mockReturnValue([
- { id: "edge", source: "start", target: "adder" },
+ useNodesMock.mockReturnValue([
+ { id: "login", type: "task", data: { label: "login" } },
]);
- useNodesMock.mockReturnValue([{ id: "start", type: "start", data: {} }]);
- uploadMocks.getClient.mockRejectedValue(
- new Error("credentials unavailable"),
+ const { container } = renderNodeAdder({}, { debug: true });
+ const uploadItem = () =>
+ screen.getByText("Upload SOP").parentElement!.querySelector("button")!;
+ expect(uploadItem().disabled).toBe(true);
+
+ const stage = vi.fn();
+ act(() => useCopilotActionStore.setState({ stageAttachment: stage }));
+ expect(uploadItem().disabled).toBe(false);
+ const file = new File(["pdf"], "steps.pdf", { type: "application/pdf" });
+ fireEvent.change(
+ container.querySelector<HTMLInputElement>('input[type="file"]')!,
+ { target: { files: [file] } },
+ );
+ expect(stage).toHaveBeenCalledWith(
+ file,
+ "Add the steps from the attached SOP after the login block.",
);
- const { container } = renderNodeAdder({});
- const input =
- container.querySelector<HTMLInputElement>('input[type="file"]')!;
- const file = new File(["pdf"], "steps.pdf");
- await act(async () => {
- for (let attempt = 1; attempt <= 2; attempt++) {
- fireEvent.change(input, { target: { files: [file] } });
- expect(useWorkflowYamlEditorStore.getState().authoringInProgress).toBe(
- true,
- );
- await vi.waitFor(() => {
- expect(uploadMocks.getClient).toHaveBeenCalledTimes(attempt);
- expect(
- useWorkflowYamlEditorStore.getState().authoringInProgress,
- ).toBe(false);
- });
- }
- });
- expect(uploadMocks.post).not.toHaveBeenCalled();
- uploadMocks.getClient.mockResolvedValue({ put: uploadMocks.put });
- const saveData = {
- title: "Draft",
- description: null,
- blocks: [],
- parameters: [],
- workflowDefinitionVersion: 1,
- settings: { proxyLocation: "RESIDENTIAL", runWith: "agent" },
- workflow: {
- workflow_permanent_id: "wpid_test",
- workflow_definition: { version: 1, blocks: [], parameters: [] },
- },
- } as unknown as WorkflowSaveData;
- useWorkflowHasChangesStore.setState({
- getSaveData: () => saveData,
- hasChanges: true,
- });
- uploadMocks.put.mockResolvedValue({
- data: { ...saveData.workflow, title: "Draft", description: null },
- });
- registerEditorOwner(createYamlCommitOwner("wpid_test"));
- const { result } = renderHook(() => useWorkflowSave(), {
- wrapper: queryWrapper,
- });
- await act(async () => result.current.mutateAsync(undefined));
- expect(uploadMocks.put).toHaveBeenCalledTimes(1);
- expect(useWorkflowHasChangesStore.getState().hasChanges).toBe(false);
});
it("keeps the loop as parent without branch context when adding the first block in a nested loop", () => {
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.tsx
index cc83f0fe7..d242a874e 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NodeAdderNode/NodeAdderNode.tsx
@@ -4,7 +4,7 @@ import { useRef, useState } from "react";
import { useWorkflowPermanentId } from "@/routes/workflows/WorkflowPermanentIdContext";
import { useProcessRecordingMutation } from "@/routes/browserSessions/hooks/useProcessRecordingMutation";
-import { useSopToBlocksMutation } from "@/routes/workflows/hooks/useSopToBlocksMutation";
+import { useCopilotActionStore } from "@/store/useCopilotActionStore";
import { useDebugStore } from "@/store/useDebugStore";
import {
BranchContext,
@@ -20,11 +20,7 @@ import {
requestRecordingStart,
useIsMountedRef,
} from "@/routes/workflows/editor/recording/pendingRecordingStartGate";
-import {
- runWorkflowAuthoringAction,
- refuseMutationDuringYamlCommit,
- refuseMutationDuringAuthoring,
-} from "@/store/WorkflowYamlEditorStore";
+import { runWorkflowAuthoringAction } from "@/store/WorkflowYamlEditorStore";
import { useSettingsStore } from "@/store/SettingsStore";
import { cn } from "@/util/utils";
import {
@@ -41,7 +37,12 @@ import { WorkflowAdderBusy } from "../../WorkflowAdderBusy";
import { SELECTED_RING_CLASSES } from "../../selection/selectedRingClasses";
import { useWorkflowScopeReadOnly } from "../../WorkflowScopeContext";
import { findBranchContextForInsertion } from "../../workflowInsertion";
-import { demonstrationInsertionFromNodes } from "../../workspaceAuthoringActions";
+import {
+ blockLabelFor,
+ demonstrationInsertionFromNodes,
+ sopAttachmentDraft,
+ stageSopFile,
+} from "../../workspaceAuthoringActions";
function NodeAdderNode({ id, parentId }: NodeProps<NodeAdderNode>) {
const workflowPermanentId = useWorkflowPermanentId();
@@ -52,6 +53,9 @@ function NodeAdderNode({ id, parentId }: NodeProps<NodeAdderNode>) {
const startDemonstration = useRecordingLauncherStore(
(state) => state.startDemonstration,
);
+ const stageAttachment = useCopilotActionStore(
+ (state) => state.stageAttachment,
+ );
const demonstrationEnabled =
useFeatureFlag(WORKFLOW_COPILOT_DEMONSTRATION_FLAG) === true;
const settingsStore = useSettingsStore();
@@ -120,24 +124,6 @@ function NodeAdderNode({ id, parentId }: NodeProps<NodeAdderNode>) {
},
});
- const sopToBlocksMutation = useSopToBlocksMutation({
- onSuccess: (result, owner) => {
- setRecordedBlocks(
- result,
- {
- previous: previous ?? null,
- next: id,
- parent: parentId,
- connectingEdgeType: "default",
- },
- owner,
- );
- },
- });
-
- // Derive upload state directly from mutation to avoid race conditions
- const isUploadingSOP = sopToBlocksMutation.isPending;
-
const isProcessing =
processRecordingMutation.isPending ||
recordingStore.finishRequested ||
@@ -252,29 +238,26 @@ function NodeAdderNode({ id, parentId }: NodeProps<NodeAdderNode>) {
};
const onUploadSOP = () => {
- if (refuseMutationDuringYamlCommit() || refuseMutationDuringAuthoring())
- return;
fileInputRef.current?.click();
};
const handleSOPFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0];
+ e.target.value = "";
if (!file) {
return;
}
- if (!file.name.toLowerCase().endsWith(".pdf")) {
- toast({
- variant: "destructive",
- title: "Invalid file type",
- description: "Please select a PDF file",
- });
- e.target.value = "";
- return;
- }
- void runWorkflowAuthoringAction(() =>
- sopToBlocksMutation.mutateAsync(file),
+ stageSopFile(
+ file,
+ sopAttachmentDraft(
+ demonstrationInsertionFromNodes(nodes, {
+ previous: previous ?? null,
+ next: id,
+ parent: parentId,
+ }),
+ blockLabelFor(nodes, parentId),
+ ),
);
- e.target.value = "";
};
// Highlight the + CTA the same way withSelectableBlock highlights a selected
@@ -331,27 +314,12 @@ function NodeAdderNode({ id, parentId }: NodeProps<NodeAdderNode>) {
</WorkflowAdderBusy>
);
- const handleCancelUpload = () => {
- sopToBlocksMutation.cancel();
- };
-
- const sopUploadBusy = (
- <WorkflowAdderBusy
- color="#3b82f6"
- operation="uploading"
- onComplete={() => {}}
- onCancel={handleCancelUpload}
- >
- {adder}
- </WorkflowAdderBusy>
- );
-
const menu = (
<WorkflowAddMenu
onAdd={onAdd}
onRecord={onRecord}
onUploadSOP={onUploadSOP}
- isUploadingSOP={isUploadingSOP}
+ canUploadSOP={stageAttachment !== null}
canRecordTask={!demonstrationEnabled || startDemonstration !== null}
onPinnedChange={setMenuPinned}
>
@@ -380,13 +348,7 @@ function NodeAdderNode({ id, parentId }: NodeProps<NodeAdderNode>) {
id="b"
className="opacity-0"
/>
- {isUploadingSOP
- ? sopUploadBusy
- : isBusy
- ? busy
- : isDisabled
- ? adder
- : menu}
+ {isBusy ? busy : isDisabled ? adder : menu}
</div>
);
}
diff --git a/skyvern-frontend/src/routes/workflows/editor/recording/useApplyRecordedBlocks.test.tsx b/skyvern-frontend/src/routes/workflows/editor/recording/useApplyRecordedBlocks.test.tsx
index cce6db9a3..c5b4272b7 100644
--- a/skyvern-frontend/src/routes/workflows/editor/recording/useApplyRecordedBlocks.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/recording/useApplyRecordedBlocks.test.tsx
@@ -1,10 +1,7 @@
// @vitest-environment jsdom
-import { createElement, useLayoutEffect, type ReactNode } from "react";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { useSopToBlocksMutation } from "@/routes/workflows/hooks/useSopToBlocksMutation";
import { Edge } from "@xyflow/react";
-import { act, cleanup, renderHook, waitFor } from "@testing-library/react";
+import { act, cleanup, renderHook } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
@@ -23,8 +20,6 @@ import {
finishCopilotAcceptance,
beginYamlCommit,
registerEditorOwner,
- unregisterEditorOwner,
- runWorkflowAuthoringAction,
createYamlCommitOwner,
finishYamlCommit,
useWorkflowYamlEditorStore,
@@ -32,13 +27,6 @@ import {
import { useWorkflowTitleStore } from "@/store/WorkflowTitleStore";
import { useWorkflowGraphState } from "../workflowEditorUtils";
-const uploadMocks = vi.hoisted(() => ({ post: vi.fn() }));
-vi.mock("@/api/AxiosClient", () => ({
- getClient: async () => ({ post: uploadMocks.post }),
-}));
-vi.mock("@/hooks/useCredentialGetter", () => ({
- useCredentialGetter: () => vi.fn(),
-}));
vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));
const initialRecordedBlocksState = useRecordedBlocksStore.getState();
@@ -115,155 +103,6 @@ describe("useApplyRecordedBlocks", () => {
},
);
- it.each([
- "unmounted",
- "same workflow",
- "same workflow null anchors",
- "other workflow",
- ])(
- "binds a delayed SOP upload to its owner when the consumer is %s",
- async (remount) => {
- const client = new QueryClient({
- defaultOptions: { mutations: { retry: false } },
- });
- const wrapper = ({ children }: { children: ReactNode }) =>
- createElement(QueryClientProvider, { client }, children);
- let resolveUpload!: (value: unknown) => void;
- uploadMocks.post.mockImplementationOnce(
- () =>
- new Promise((resolve) => {
- resolveUpload = resolve;
- }),
- );
- const doLayout = vi.fn();
- const mountEditor = (workflowId: string) =>
- renderHook(
- () => {
- useLayoutEffect(() => {
- const owner = createYamlCommitOwner(workflowId);
- registerEditorOwner(owner);
- return () => unregisterEditorOwner(owner);
- }, []);
- const graph = useWorkflowGraphState(
- [
- {
- id: workflowId + "-start",
- type: "start",
- position: { x: 0, y: 0 },
- data: {},
- },
- {
- id: workflowId + "-adder",
- type: "nodeAdder",
- position: { x: 0, y: 0 },
- data: {},
- },
- ] as AppNode[],
- [
- {
- id: "initial",
- source: workflowId + "-start",
- target: workflowId + "-adder",
- },
- ],
- );
- useApplyRecordedBlocks({
- enabled: true,
- nodes: graph.nodes,
- edges: graph.edges,
- doLayout: (nodes, edges) => {
- doLayout(nodes, edges);
- graph.setNodes(nodes);
- graph.setEdges(edges);
- },
- });
- const upload = useSopToBlocksMutation({
- onSuccess: (result, owner) =>
- useRecordedBlocksStore.getState().setRecordedBlocks(
- result,
- {
- previous: remount.includes("null anchors")
- ? null
- : "disposed-start",
- next: remount.includes("null anchors")
- ? null
- : "disposed-adder",
- connectingEdgeType: "default",
- },
- owner,
- ),
- });
- return { graph, upload };
- },
- { wrapper },
- );
- const editor = mountEditor("wpid-1");
- let uploading!: Promise<boolean>;
- act(() => {
- uploading = runWorkflowAuthoringAction(() =>
- editor.result.current.upload.mutateAsync(
- new File(["pdf"], "steps.pdf"),
- ),
- );
- });
- await waitFor(() => expect(uploadMocks.post).toHaveBeenCalled());
- editor.unmount();
- const replacement =
- remount === "unmounted"
- ? null
- : mountEditor(
- remount.startsWith("same workflow") ? "wpid-1" : "wpid-2",
- );
- await act(async () => {
- resolveUpload({
- data: {
- blocks: [
- {
- block_type: "goto_url",
- label: "uploaded",
- url: "https://example.com",
- },
- ],
- parameters: [],
- },
- });
- await uploading;
- });
- expect(doLayout).toHaveBeenCalledTimes(
- remount.startsWith("same workflow") ? 1 : 0,
- );
- expect(useRecordedBlocksStore.getState().blocks).toBeNull();
- expect(useWorkflowYamlEditorStore.getState()).toMatchObject({
- authoringAction: null,
- authoringInProgress: false,
- });
- if (remount.startsWith("same workflow")) {
- expect(
- replacement!.result.current.graph.nodes.filter(
- (node) => node.data.label === "uploaded",
- ),
- ).toHaveLength(1);
- const { nodes, edges } = replacement!.result.current.graph;
- expect(edges).toHaveLength(2);
- expect(
- edges.every(
- (edge) =>
- nodes.some((node) => node.id === edge.source) &&
- nodes.some((node) => node.id === edge.target),
- ),
- ).toBe(true);
- replacement!.rerender();
- expect(doLayout).toHaveBeenCalledTimes(1);
- }
- const token = beginCopilotAcceptance();
- expect(token).not.toBeNull();
- finishCopilotAcceptance(token!);
- replacement?.unmount();
- client.clear();
- uploadMocks.post.mockClear();
- },
- );
-
it("keeps generated blocks when an open YAML draft switches to Visual", async () => {
const store = useWorkflowYamlEditorStore.getState();
store.open("blocks: []");
diff --git a/skyvern-frontend/src/routes/workflows/editor/recording/useApplyRecordedBlocks.ts b/skyvern-frontend/src/routes/workflows/editor/recording/useApplyRecordedBlocks.ts
index e420dd2c5..15fdc1a3a 100644
--- a/skyvern-frontend/src/routes/workflows/editor/recording/useApplyRecordedBlocks.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/recording/useApplyRecordedBlocks.ts
@@ -78,7 +78,7 @@ function useApplyRecordedBlocks({
return;
}
- // A remounted workflow has new canvas IDs. Its upload can still append,
+ // A remounted workflow has new canvas IDs. Recorded blocks can still append,
// but must not create edges pointing to the disposed canvas.
const insertionPoint =
(!recordedInsertionPoint.previous && !recordedInsertionPoint.next) ||
diff --git a/skyvern-frontend/src/routes/workflows/editor/workspaceAuthoringActions.test.ts b/skyvern-frontend/src/routes/workflows/editor/workspaceAuthoringActions.test.ts
index a6b6ca6a1..81f920619 100644
--- a/skyvern-frontend/src/routes/workflows/editor/workspaceAuthoringActions.test.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/workspaceAuthoringActions.test.ts
@@ -1,41 +1,27 @@
-import { describe, expect, it, vi } from "vitest";
+import { describe, expect, it } from "vitest";
import {
- applySopResultAtCurrentAppend,
+ blockLabelFor,
demonstrationInsertionFromNodes,
+ resolveAppendInsertionPoint,
resolveWorkspaceAuthoringActionAvailability,
+ sopAttachmentDraft,
} from "./workspaceAuthoringActions";
describe("workspace authoring actions", () => {
- it("applies an SOP at the current workflow tail when conversion finishes", () => {
- let nodes = [
- { id: "a", type: "task" },
- { id: "adder", type: "nodeAdder" },
- ];
- let edges = [{ source: "a", target: "adder" }];
- const setRecordedBlocks = vi.fn();
- const result = { blocks: [], parameters: [] };
-
- const applyResult = () =>
- applySopResultAtCurrentAppend({
- result,
- getNodes: () => nodes,
- getEdges: () => edges,
- setRecordedBlocks,
- });
-
- nodes = [
+ it("appends after the last top-level block, not inside a container", () => {
+ const nodes = [
{ id: "a", type: "task" },
+ { id: "loop-adder", type: "nodeAdder", parentId: "loop" },
{ id: "b", type: "task" },
{ id: "adder", type: "nodeAdder" },
];
- edges = [
+ const edges = [
{ source: "a", target: "b" },
{ source: "b", target: "adder" },
];
- applyResult();
- expect(setRecordedBlocks).toHaveBeenCalledWith(result, {
+ expect(resolveAppendInsertionPoint(nodes, edges)).toEqual({
previous: "b",
next: "adder",
parent: undefined,
@@ -43,21 +29,7 @@ describe("workspace authoring actions", () => {
});
});
- it("makes SOP upload and task demonstration mutually exclusive", () => {
- expect(
- resolveWorkspaceAuthoringActionAvailability({
- browserReady: true,
- isGlobalWorkflow: false,
- isWorkflowDeleted: false,
- hasActiveRun: false,
- isComparing: false,
- isEditingYaml: false,
- hasFinallyBlock: false,
- isRecording: false,
- isUploadingSOP: true,
- }),
- ).toMatchObject({ canUploadSOP: false, canRecordTask: false });
-
+ it("blocks task demonstration while a recording is in progress", () => {
expect(
resolveWorkspaceAuthoringActionAvailability({
browserReady: true,
@@ -68,9 +40,8 @@ describe("workspace authoring actions", () => {
isEditingYaml: false,
hasFinallyBlock: false,
isRecording: true,
- isUploadingSOP: false,
}),
- ).toMatchObject({ canUploadSOP: false, canRecordTask: false });
+ ).toMatchObject({ canRecordTask: false });
});
it("blocks append-only actions on global workflows and after a finally block", () => {
@@ -81,7 +52,6 @@ describe("workspace authoring actions", () => {
isComparing: false,
isEditingYaml: false,
isRecording: false,
- isUploadingSOP: false,
};
expect(
@@ -91,7 +61,6 @@ describe("workspace authoring actions", () => {
hasFinallyBlock: false,
}),
).toMatchObject({
- canUploadSOP: false,
canRecordTask: false,
unavailableReason: "Make a copy to edit this agent",
});
@@ -103,7 +72,6 @@ describe("workspace authoring actions", () => {
hasFinallyBlock: true,
}),
).toMatchObject({
- canUploadSOP: false,
canRecordTask: false,
unavailableReason:
"The finally block must remain last. Add steps above it in the editor.",
@@ -118,7 +86,6 @@ describe("workspace authoring actions", () => {
isComparing: false,
isEditingYaml: false,
isRecording: false,
- isUploadingSOP: false,
};
expect(
@@ -128,7 +95,6 @@ describe("workspace authoring actions", () => {
hasActiveRun: false,
}),
).toEqual({
- canUploadSOP: false,
canRecordTask: false,
unavailableReason: "This agent is deleted and view-only",
});
@@ -140,7 +106,6 @@ describe("workspace authoring actions", () => {
hasActiveRun: true,
}),
).toEqual({
- canUploadSOP: true,
canRecordTask: false,
unavailableReason: "Stop the active run before recording a task",
});
@@ -153,7 +118,6 @@ describe("workspace authoring actions", () => {
isComparing: true,
}),
).toEqual({
- canUploadSOP: false,
canRecordTask: false,
unavailableReason: "Exit history comparison to edit this agent",
});
@@ -167,7 +131,6 @@ describe("workspace authoring actions", () => {
isEditingYaml: true,
}),
).toEqual({
- canUploadSOP: false,
canRecordTask: false,
unavailableReason: "Switch to Visual mode before adding workflow steps",
});
@@ -208,3 +171,23 @@ describe("demonstrationInsertionFromNodes", () => {
).toBeNull();
});
});
+
+describe("sopAttachmentDraft", () => {
+ it("names the container for an SOP added inside an empty loop", () => {
+ const nodes = [
+ { id: "loop", type: "loop", data: { label: "each_invoice" } },
+ { id: "start", type: "start", parentId: "loop" },
+ { id: "adder", type: "nodeAdder", parentId: "loop" },
+ ];
+ const insertionPoint = { previous: "start", next: "adder", parent: "loop" };
+
+ expect(
+ sopAttachmentDraft(
+ demonstrationInsertionFromNodes(nodes, insertionPoint),
+ blockLabelFor(nodes, insertionPoint.parent),
+ ),
+ ).toBe(
+ "Add the steps from the attached SOP inside the each_invoice block.",
+ );
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/editor/workspaceAuthoringActions.ts b/skyvern-frontend/src/routes/workflows/editor/workspaceAuthoringActions.ts
index 88441c6db..8e30c8540 100644
--- a/skyvern-frontend/src/routes/workflows/editor/workspaceAuthoringActions.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/workspaceAuthoringActions.ts
@@ -1,5 +1,6 @@
-import type { WorkflowBlock, WorkflowParameter } from "../types/workflowTypes";
+import { toast } from "@/components/ui/use-toast";
import type { InsertionPoint } from "@/store/RecordedBlocksStore";
+import { useCopilotActionStore } from "@/store/useCopilotActionStore";
import type { WorkflowCopilotDemonstrationInsertion } from "@/routes/workflows/copilot/workflowCopilotTypes";
type WorkflowNodeLike = {
@@ -14,11 +15,6 @@ type WorkflowEdgeLike = {
target: string;
};
-type SopResult = {
- blocks: Array<WorkflowBlock>;
- parameters: Array<WorkflowParameter>;
-};
-
function resolveAppendInsertionPoint(
nodes: Array<WorkflowNodeLike>,
edges: Array<WorkflowEdgeLike>,
@@ -38,20 +34,23 @@ function resolveAppendInsertionPoint(
};
}
+function blockLabelFor(
+ nodes: Array<WorkflowNodeLike>,
+ nodeId: string | null | undefined,
+): string | null {
+ const node = nodes.find((candidate) => candidate.id === nodeId);
+ if (!node || node.type === "start" || node.type === "nodeAdder") return null;
+ const label = node.data?.label;
+ return typeof label === "string" && label.length > 0 ? label : null;
+}
+
function demonstrationInsertionFromNodes(
nodes: Array<WorkflowNodeLike>,
insertionPoint: Pick<InsertionPoint, "previous" | "next" | "parent">,
): WorkflowCopilotDemonstrationInsertion | null {
- const labelFor = (nodeId: string | null) => {
- const node = nodes.find((candidate) => candidate.id === nodeId);
- if (!node || node.type === "start" || node.type === "nodeAdder")
- return null;
- const label = node.data?.label;
- return typeof label === "string" && label.length > 0 ? label : null;
- };
const insertion = {
- after_label: labelFor(insertionPoint.previous),
- before_label: labelFor(insertionPoint.next),
+ after_label: blockLabelFor(nodes, insertionPoint.previous),
+ before_label: blockLabelFor(nodes, insertionPoint.next),
};
const parent =
insertionPoint.parent ??
@@ -61,24 +60,40 @@ function demonstrationInsertionFromNodes(
: insertion;
}
-function applySopResultAtCurrentAppend({
- result,
- getNodes,
- getEdges,
- setRecordedBlocks,
-}: {
- result: SopResult;
- getNodes: () => Array<WorkflowNodeLike>;
- getEdges: () => Array<WorkflowEdgeLike>;
- setRecordedBlocks: (
- result: SopResult,
- insertionPoint: InsertionPoint,
- ) => void;
-}) {
- setRecordedBlocks(
- result,
- resolveAppendInsertionPoint(getNodes(), getEdges()),
- );
+function sopAttachmentDraft(
+ insertion: WorkflowCopilotDemonstrationInsertion | null = null,
+ containerLabel: string | null = null,
+): string {
+ if (insertion?.after_label)
+ return `Add the steps from the attached SOP after the ${insertion.after_label} block.`;
+ if (insertion?.before_label)
+ return `Add the steps from the attached SOP before the ${insertion.before_label} block.`;
+ if (containerLabel)
+ return `Add the steps from the attached SOP inside the ${containerLabel} block.`;
+ return "Add the steps from the attached SOP to this agent.";
+}
+
+function stageSopFile(file: File, draft: string) {
+ if (!file.name.toLowerCase().endsWith(".pdf")) {
+ toast({
+ variant: "destructive",
+ title: "Invalid file type",
+ description: "Please select a PDF file",
+ });
+ return;
+ }
+ // Read at pick time: Copilot may have asked a question or started finishing a recording while
+ // the file picker was open.
+ const stage = useCopilotActionStore.getState().stageAttachment;
+ if (!stage) {
+ toast({
+ title: "Copilot can't take a file right now",
+ description:
+ "Answer its question or wait for it to finish, then try again.",
+ });
+ return;
+ }
+ stage(file, draft);
}
function resolveWorkspaceAuthoringActionAvailability({
@@ -90,7 +105,6 @@ function resolveWorkspaceAuthoringActionAvailability({
isEditingYaml,
hasFinallyBlock,
isRecording,
- isUploadingSOP,
}: {
browserReady: boolean;
isGlobalWorkflow: boolean;
@@ -100,7 +114,6 @@ function resolveWorkspaceAuthoringActionAvailability({
isEditingYaml: boolean;
hasFinallyBlock: boolean;
isRecording: boolean;
- isUploadingSOP: boolean;
}) {
const unavailableReason = isWorkflowDeleted
? "This agent is deleted and view-only"
@@ -114,23 +127,22 @@ function resolveWorkspaceAuthoringActionAvailability({
? "The finally block must remain last. Add steps above it in the editor."
: isRecording
? "Finish recording the current task first"
- : isUploadingSOP
- ? "Wait for the SOP upload to finish"
- : null;
+ : null;
const recordUnavailableReason =
unavailableReason ??
(hasActiveRun ? "Stop the active run before recording a task" : null);
return {
- canUploadSOP: unavailableReason === null,
canRecordTask: recordUnavailableReason === null && browserReady,
unavailableReason: recordUnavailableReason,
};
}
export {
- applySopResultAtCurrentAppend,
+ blockLabelFor,
demonstrationInsertionFromNodes,
resolveAppendInsertionPoint,
resolveWorkspaceAuthoringActionAvailability,
+ sopAttachmentDraft,
+ stageSopFile,
};
diff --git a/skyvern-frontend/src/routes/workflows/hooks/useSopToBlocksMutation.ts b/skyvern-frontend/src/routes/workflows/hooks/useSopToBlocksMutation.ts
deleted file mode 100644
index 09763e490..000000000
--- a/skyvern-frontend/src/routes/workflows/hooks/useSopToBlocksMutation.ts
+++ /dev/null
@@ -1,134 +0,0 @@
-import { useRef } from "react";
-import { useMutation } from "@tanstack/react-query";
-import { AxiosError } from "axios";
-import { getClient } from "@/api/AxiosClient";
-import { useCredentialGetter } from "@/hooks/useCredentialGetter";
-import { toast } from "@/components/ui/use-toast";
-import {
- useWorkflowYamlEditorStore,
- type YamlCommitOwner,
-} from "@/store/WorkflowYamlEditorStore";
-import { WorkflowBlock, WorkflowParameter } from "../types/workflowTypes";
-
-type SopToBlocksResponse = {
- blocks: Array<WorkflowBlock>;
- parameters: Array<WorkflowParameter>;
-};
-
-type SopUpload = {
- file: File;
- owner: YamlCommitOwner | null;
- action: symbol | null;
-};
-
-function captureUpload(file: File): SopUpload {
- const state = useWorkflowYamlEditorStore.getState();
- return { file, owner: state.editorOwner, action: state.authoringAction };
-}
-
-function currentUploadOwner(upload: SopUpload): YamlCommitOwner | null {
- const state = useWorkflowYamlEditorStore.getState();
- const owner = state.editorOwner;
- if (
- !owner?.active ||
- owner.workflowPermanentId !== upload.owner?.workflowPermanentId ||
- state.authoringAction !== upload.action ||
- (upload.action && state.authoringActionOwner !== owner)
- )
- return null;
- return owner;
-}
-
-type UseSopToBlocksMutationOptions = {
- onSuccess?: (result: SopToBlocksResponse, owner: YamlCommitOwner) => void;
-};
-
-function useSopToBlocksMutation({ onSuccess }: UseSopToBlocksMutationOptions) {
- const credentialGetter = useCredentialGetter();
- const abortControllerRef = useRef<AbortController | null>(null);
-
- const mutation = useMutation({
- mutationFn: async (upload: SopUpload) => {
- if (!currentUploadOwner(upload))
- throw new Error("The workflow editor is no longer available");
- const { file } = upload;
- // Create new AbortController for this request
- abortControllerRef.current = new AbortController();
-
- const formData = new FormData();
- formData.append("file", file);
- const client = await getClient(credentialGetter);
- return (
- await client.post<SopToBlocksResponse>(
- "/workflows/sop-to-blocks",
- formData,
- {
- headers: {
- "Content-Type": "multipart/form-data",
- },
- signal: abortControllerRef.current.signal,
- },
- )
- ).data;
- },
- onSuccess: (result, upload) => {
- const owner = currentUploadOwner(upload);
- if (!owner) return;
- toast({
- variant: "success",
- title: "SOP converted",
- description: `Generated ${result.blocks.length} workflow step${result.blocks.length === 1 ? "" : "s"}`,
- });
- onSuccess?.(result, owner);
- },
- onError: (error, upload) => {
- if (!currentUploadOwner(upload)) return;
- // Don't show error toast if request was cancelled
- if (error instanceof AxiosError && error.code === "ERR_CANCELED") {
- toast({
- variant: "default",
- title: "Upload cancelled",
- description: "SOP conversion was cancelled.",
- });
- return;
- }
-
- // Graceful degradation for 404 (backend not deployed yet)
- if (error instanceof AxiosError && error.response?.status === 404) {
- toast({
- variant: "destructive",
- title: "Feature not yet available",
- description:
- "The Upload SOP feature is being deployed. Please try again later.",
- });
- } else {
- const message =
- error instanceof AxiosError
- ? error.response?.data?.detail || error.message
- : error instanceof Error
- ? error.message
- : "Failed to convert SOP";
- toast({
- variant: "destructive",
- title: "Failed to convert SOP",
- description: message,
- });
- }
- },
- });
-
- const cancel = () => {
- abortControllerRef.current?.abort();
- abortControllerRef.current = null;
- };
-
- return {
- ...mutation,
- mutate: (file: File) => mutation.mutate(captureUpload(file)),
- mutateAsync: (file: File) => mutation.mutateAsync(captureUpload(file)),
- cancel,
- };
-}
-
-export { useSopToBlocksMutation };
-export type { SopToBlocksResponse };
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx
index 819463427..5d2a459aa 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx
@@ -1,3 +1,4 @@
+import { WorkflowFindingsButton } from "@/components/WorkflowFindingsSlot";
import {
SaveRefusedError,
SaveStaleError,
@@ -576,6 +577,8 @@ export function RunStopButton({ stopOnly = false }: { stopOnly?: boolean }) {
}
export function StudioTopBar() {
+ const workflowPermanentId = useWorkflowPermanentId();
+ const workflowTitle = useWorkflowTitleStore((state) => state.title);
const { workflowTriggersPanel } = usePageSlots();
const isGlobalWorkflow = useIsGlobalWorkflow();
const workflowDeletedAt = useStudioWorkflowDeletedAt();
@@ -600,6 +603,13 @@ export function StudioTopBar() {
return (
<div className="flex h-14 shrink-0 items-center gap-3 border-b border-border bg-slate-elevation2 px-4">
<TitleSection editable={!isGlobalWorkflow && !workflowDeletedAt} />
+ {!isGlobalWorkflow && !workflowDeletedAt && workflowPermanentId ? (
+ <WorkflowFindingsButton
+ workflowPermanentId={workflowPermanentId}
+ title={workflowTitle}
+ surface="editor"
+ />
+ ) : null}
<PaneHeaderDivider />
<StudioPaneToggles />
<div className="min-w-3 flex-1" />
diff --git a/skyvern-frontend/src/store/PageSlots.ts b/skyvern-frontend/src/store/PageSlots.ts
index f20255891..8b4fc652e 100644
--- a/skyvern-frontend/src/store/PageSlots.ts
+++ b/skyvern-frontend/src/store/PageSlots.ts
@@ -47,6 +47,19 @@ export type PermissionsState =
| Readonly<{ status: "ready"; data: PermissionsResponse }>;
export type PageSlots = {
+ workflowFindingsScope?: React.ComponentType<
+ Readonly<{
+ workflowPermanentIds: readonly string[];
+ children: React.ReactNode;
+ }>
+ >;
+ workflowFindingsTrigger?: React.ComponentType<
+ Readonly<{
+ workflowPermanentId: string;
+ title?: string;
+ surface: "list" | "editor";
+ }>
+ >;
workflowCuratorSettings?: React.ComponentType<
Readonly<{ workflowPermanentId: string; readOnly: boolean }>
>;
diff --git a/skyvern-frontend/src/store/WorkflowYamlEditorStore.ts b/skyvern-frontend/src/store/WorkflowYamlEditorStore.ts
index e2089f59a..40bcb89b1 100644
--- a/skyvern-frontend/src/store/WorkflowYamlEditorStore.ts
+++ b/skyvern-frontend/src/store/WorkflowYamlEditorStore.ts
@@ -682,7 +682,7 @@ export function refuseMutationDuringYamlCommit(): boolean {
return true;
}
-export function refuseMutationDuringAuthoring(): boolean {
+function refuseMutationDuringAuthoring(): boolean {
if (!useWorkflowYamlEditorStore.getState().authoringInProgress) return false;
toast({
title: "Finish the current authoring action first",
diff --git a/skyvern-frontend/src/store/useCopilotActionStore.ts b/skyvern-frontend/src/store/useCopilotActionStore.ts
index 00e2a8891..c38cbe520 100644
--- a/skyvern-frontend/src/store/useCopilotActionStore.ts
+++ b/skyvern-frontend/src/store/useCopilotActionStore.ts
@@ -64,6 +64,12 @@ interface CopilotActionStore extends CodeEditedGoalActions {
suggestingGoalLabels: Array<string>;
setSuggestingGoal: (label: string, suggesting: boolean) => void;
setCodeEditedGoalActions: (actions: CodeEditedGoalActions) => void;
+ // Registered by the chat only while its composer can take a file, so a caller outside the chat
+ // that finds it null must not upload.
+ stageAttachment: ((file: File, draft: string) => void) | null;
+ setStageAttachment: (
+ stage: ((file: File, draft: string) => void) | null,
+ ) => void;
requestBuild: (request: CopilotBlockBuildRequest) => void;
applyPendingGoalChanges: () => void;
clearPendingBuild: () => void;
@@ -126,6 +132,8 @@ export const useCopilotActionStore = create<CopilotActionStore>((set, get) => ({
acceptGoal: noop,
keepCode: noop,
setCodeEditedGoalActions: (actions) => set(actions),
+ stageAttachment: null,
+ setStageAttachment: (stageAttachment) => set({ stageAttachment }),
requestBuild: (request) =>
set((state) => {
if (state.generatingBlockLabel == null) {
diff --git a/skyvern/cli/core/client.py b/skyvern/cli/core/client.py
index 6471947c6..3d4d2a806 100644
--- a/skyvern/cli/core/client.py
+++ b/skyvern/cli/core/client.py
@@ -2,10 +2,11 @@ from __future__ import annotations
import asyncio
import os
+import time
from collections import OrderedDict
from contextvars import ContextVar, Token
from threading import RLock
-from typing import Any
+from typing import TYPE_CHECKING, Any
import httpx
import structlog
@@ -18,6 +19,10 @@ from skyvern.constants import SKYVERN_CLI_USER_AGENT, SKYVERN_MCP_USER_AGENT
from skyvern.library.skyvern import Skyvern
from .api_key_hash import hash_api_key_for_cache
+from .hosted_driver import HostedDriver, owners
+
+if TYPE_CHECKING:
+ from playwright.async_api import Playwright
# Fern applies a per-call timeout to the whole request (connect, read, write and pool), so only run_sdk_action gets it.
# 115 s bounds one call below the 120 s ALB idle timeout; a tool that makes several calls can still run longer.
@@ -27,6 +32,8 @@ _skyvern_instance: ContextVar[Skyvern | None] = ContextVar("skyvern_instance", d
_api_key_override: ContextVar[str | None] = ContextVar("skyvern_api_key_override", default=None)
_global_skyvern_instance: Skyvern | None = None
_api_key_clients: OrderedDict[str, Skyvern] = OrderedDict()
+# Evicted loopback clients whose driver a running call still leases; the idle sweep closes them once it is released.
+_closing_clients: set[_LoopbackSkyvern] = set()
_clients_lock = RLock()
LOG = structlog.get_logger(__name__)
@@ -69,12 +76,37 @@ def _resolve_self_base_url() -> str:
class _LoopbackSkyvern(Skyvern):
+ def __init__(self, **kwargs: Any) -> None:
+ super().__init__(**kwargs)
+ self._hosted_driver = HostedDriver()
+
async def run_sdk_action(
self, *, request_options: RequestOptions | None = None, **kwargs: Any
) -> RunSdkActionResponse:
options: RequestOptions = {"timeout_in_seconds": LOOPBACK_SDK_ACTION_TIMEOUT_SECONDS, **(request_options or {})}
return await super().run_sdk_action(request_options=options, **kwargs)
+ async def _get_playwright(self) -> Playwright:
+ from .session_manager import stateless_call_playwright # noqa: PLC0415 — circular import
+
+ # Concurrent calls on this key share one driver; each call leases it, and the API's idle sweep stops it
+ # once no call has used it for a while, so a key served once does not keep a driver for the process life.
+ return await stateless_call_playwright(self._hosted_driver)
+
+ async def aclose(self) -> None:
+ await self._close()
+
+ async def _close(self) -> bool:
+ with _clients_lock:
+ if self._hosted_driver.leases:
+ # Evicted while a call still uses the driver and this HTTP client; closing now would break that call.
+ _closing_clients.add(self)
+ return False
+ _closing_clients.discard(self)
+ reclaimed = await self._hosted_driver.close()
+ await super().aclose()
+ return reclaimed
+
def _build_cloud_client(api_key: str) -> Skyvern:
from .session_manager import is_stateless_http_mode # noqa: PLC0415 — circular import
@@ -194,6 +226,35 @@ def get_skyvern() -> Skyvern:
return instance
+async def sweep_idle_hosted_drivers(now: float | None = None) -> int:
+ """Stop hosted MCP drivers that no call has used for the idle threshold, and close released evicted clients."""
+ now = time.monotonic() if now is None else now
+ reclaimed = 0
+ # Driven by the owner registry, not the client cache: an evicted client's driver can start after eviction.
+ for owner in owners():
+ try:
+ reclaimed += await owner.reap(now, settings.HOSTED_MCP_DRIVER_IDLE_SECONDS)
+ except Exception:
+ LOG.warning("Failed to stop an idle hosted MCP browser driver", exc_info=True)
+ with _clients_lock:
+ released = [client for client in _closing_clients if not client._hosted_driver.leases]
+ for client in released:
+ try:
+ reclaimed += await client._close()
+ except Exception:
+ LOG.warning("Failed to close an evicted hosted MCP client", exc_info=True)
+ return reclaimed
+
+
+async def shutdown_hosted_drivers() -> None:
+ """Stop every hosted MCP driver, leased or not, as the process shuts down."""
+ for owner in owners():
+ try:
+ await owner.close()
+ except Exception:
+ LOG.warning("Failed to stop a hosted MCP browser driver at shutdown", exc_info=True)
+
+
async def close_skyvern() -> None:
"""Close active Skyvern client(s) and release Playwright resources."""
global _global_skyvern_instance
diff --git a/skyvern/cli/core/hosted_driver.py b/skyvern/cli/core/hosted_driver.py
new file mode 100644
index 000000000..1166f27a2
--- /dev/null
+++ b/skyvern/cli/core/hosted_driver.py
@@ -0,0 +1,183 @@
+"""The Playwright driver a cached hosted-MCP client shares across the tool calls that lease it."""
+
+from __future__ import annotations
+
+import asyncio
+import time
+from typing import TYPE_CHECKING
+
+import structlog
+
+from skyvern.exceptions import raise_local_extra_required
+from skyvern.webeye.driver_connection import (
+ close_driver_connection_on_transport_loss,
+ driver_connection_closed,
+ kill_driver_process,
+)
+
+if TYPE_CHECKING:
+ from playwright.async_api import Playwright
+ from playwright.async_api._context_manager import PlaywrightContextManager
+
+LOG = structlog.get_logger(__name__)
+
+DRIVER_STOP_TIMEOUT_SECONDS = 5
+_CLEANUP_TASKS: set[asyncio.Task[None]] = set()
+# Every owner with a start, reachable by the sweep and shutdown even after its client left the cache.
+_OWNERS: set[HostedDriver] = set()
+
+
+def owners() -> list[HostedDriver]:
+ return list(_OWNERS)
+
+
+class HostedDriver:
+ """One Node driver per cached client: started once, leased by the calls using it, stopped only when idle."""
+
+ def __init__(self) -> None:
+ self._start: asyncio.Task[Playwright] | None = None
+ self._manager: PlaywrightContextManager | None = None
+ self._leases = 0
+ self._idle_since = time.monotonic()
+ self._started_at = 0.0
+
+ @property
+ def leases(self) -> int:
+ return self._leases
+
+ @property
+ def owns_driver(self) -> bool:
+ return self._start is not None
+
+ @property
+ def started(self) -> bool:
+ return self._start is not None and self._start.done() and _usable(self._start)
+
+ def acquire(self) -> None:
+ self._leases += 1
+
+ def release(self) -> None:
+ self._leases -= 1
+ if self._leases == 0:
+ self._idle_since = time.monotonic()
+
+ async def playwright(self) -> Playwright:
+ self._idle_since = time.monotonic()
+ start = self._start
+ if start is not None and start.done() and not _usable(start):
+ self._forget(start)
+ start = None
+ if start is None:
+ try:
+ from playwright.async_api import async_playwright # noqa: PLC0415
+ except ImportError as exc:
+ raise_local_extra_required("Browser APIs", exc)
+ # Created before the task so the owner holds the spawned child's handle even if every waiter is cancelled.
+ self._manager = async_playwright()
+ start = self._start = asyncio.create_task(_launch(self._manager))
+ start.add_done_callback(_consume_start_error)
+ self._started_at = time.monotonic()
+ _OWNERS.add(self)
+ # Shielded: a cancelled waiter must not cancel a start the other waiters share.
+ return await asyncio.shield(start)
+
+ async def reap(self, now: float, idle_seconds: float) -> bool:
+ """Stop the driver if no call has used it for ``idle_seconds``. Returns whether a driver was reclaimed."""
+ start = self._start
+ if start is None:
+ return False
+ idle = not self._leases and now - self._idle_since >= idle_seconds
+ if not start.done():
+ # A start this old has no usable driver for its waiters to lose, so it is ended even while calls wait.
+ if idle or now - self._started_at >= idle_seconds:
+ # Never cancel a pending start: cancelling mid-spawn strands a child that no handle reaches. Killing
+ # through the manager works once Playwright publishes the handle; until then a later sweep retries.
+ kill_driver_process(self._manager)
+ return False
+ if not idle:
+ return False
+ manager = self._forget(start)
+ if _usable(start):
+ await _stop_within(start.result(), DRIVER_STOP_TIMEOUT_SECONDS)
+ else:
+ kill_driver_process(manager)
+ return True
+
+ async def close(self) -> bool:
+ """Stop the driver regardless of leases. Returns whether one was reclaimed; a start that is still pending
+ stays registered so a later sweep can reach it once its handle is published."""
+ start = self._start
+ if start is None:
+ return False
+ if not start.done():
+ kill_driver_process(self._manager)
+ await asyncio.wait({start}, timeout=DRIVER_STOP_TIMEOUT_SECONDS)
+ if self._start is not start:
+ return False
+ if not start.done():
+ kill_driver_process(self._manager)
+ LOG.warning("Hosted MCP browser driver was still starting when it was closed")
+ return False
+ manager = self._forget(start)
+ if _usable(start):
+ await _stop_within(start.result(), DRIVER_STOP_TIMEOUT_SECONDS)
+ else:
+ kill_driver_process(manager)
+ return True
+
+ def _forget(self, start: asyncio.Task[Playwright]) -> PlaywrightContextManager | None:
+ manager = self._manager
+ self._start = None
+ self._manager = None
+ _OWNERS.discard(self)
+ if not _usable(start):
+ # A failed or dead driver may still have a child; the kill is a no-op once it has exited.
+ kill_driver_process(manager)
+ return manager
+
+
+async def _launch(manager: PlaywrightContextManager) -> Playwright:
+ driver = await manager.start()
+ close_driver_connection_on_transport_loss(driver)
+ return driver
+
+
+def _usable(start: asyncio.Task[Playwright]) -> bool:
+ return not start.cancelled() and start.exception() is None and not driver_connection_closed(start.result())
+
+
+def _consume_start_error(start: asyncio.Task[Playwright]) -> None:
+ if not start.cancelled():
+ start.exception()
+
+
+def _retain(task: asyncio.Task[None]) -> None:
+ _CLEANUP_TASKS.add(task)
+ task.add_done_callback(_finish_retained)
+
+
+def _finish_retained(task: asyncio.Task[None]) -> None:
+ _CLEANUP_TASKS.discard(task)
+ if not task.cancelled() and task.exception() is not None:
+ LOG.warning("Hosted MCP browser driver stop failed", error_type=type(task.exception()).__name__)
+
+
+async def _stop_within(driver: Playwright, timeout: float) -> None:
+ stop = asyncio.create_task(driver.stop())
+ try:
+ done, _ = await asyncio.wait({stop}, timeout=timeout)
+ except asyncio.CancelledError:
+ # The owner has already let go of this driver, so a cancelled sweep must not leave its stop unfinished.
+ kill_driver_process(driver)
+ _retain(stop)
+ raise
+ if stop not in done:
+ # Signals only this driver's own child process; the stop then completes once the kill lands.
+ kill_driver_process(driver)
+ _retain(stop)
+ return
+ error = stop.exception()
+ if error is not None:
+ LOG.warning("Failed to stop a hosted MCP browser driver", error_type=type(error).__name__)
+ # A stop that raised may have left the process running.
+ kill_driver_process(driver)
diff --git a/skyvern/cli/core/session_manager.py b/skyvern/cli/core/session_manager.py
index 517ce39e0..5415e5e6a 100644
--- a/skyvern/cli/core/session_manager.py
+++ b/skyvern/cli/core/session_manager.py
@@ -31,13 +31,15 @@ LOG = structlog.get_logger(__name__)
_BODY_SEMAPHORE_LIMIT = 5 # concurrent CDP body downloads (worst case: 5 * 10s timeout = 50s backlog)
if TYPE_CHECKING:
- from playwright.async_api import Frame, Page, Request
+ from playwright.async_api import Frame, Page, Playwright, Request
from skyvern.browser_extension.runtime import BrowserExtensionRuntime
from skyvern.library.skyvern_browser import SkyvernBrowser
from skyvern.library.skyvern_browser_page import SkyvernBrowserPage
from skyvern.webeye.browser_engine import EngineFrame
+ from .hosted_driver import HostedDriver
+
@dataclass
class ObserveV2State:
@@ -156,9 +158,22 @@ class SessionState:
return self._body_store.get(request_id)
+class StatelessCallEndedError(RuntimeError):
+ """A task that outlived its stateless MCP tool call asked for a browser driver."""
+
+
+@dataclass(eq=False)
+class _CallConnections:
+ """What one stateless tool call holds: the CDP connections it opened and its leases on shared drivers."""
+
+ browsers: list[SkyvernBrowser] = field(default_factory=list)
+ leases: list[HostedDriver] = field(default_factory=list)
+ ended: bool = False
+
+
_current_session: ContextVar[SessionState | None] = ContextVar("mcp_session", default=None)
_current_organization_id: ContextVar[str | None] = ContextVar("mcp_session_organization_id", default=None)
-_call_connections: ContextVar[list[SkyvernBrowser] | None] = ContextVar("mcp_call_connections", default=None)
+_call_connections: ContextVar[_CallConnections | None] = ContextVar("mcp_call_connections", default=None)
_CALL_CONNECTION_DISCONNECT_TIMEOUT_SECONDS = 5
_CALL_CONNECTION_DISCONNECTS: set[asyncio.Task[None]] = set()
_global_session: SessionState | None = None
@@ -549,32 +564,57 @@ async def scoped_session(state: SessionState) -> AsyncIterator[None]:
@asynccontextmanager
async def stateless_call_connection_scope() -> AsyncIterator[None]:
- """Disconnect the CDP connections a stateless tool call opened when the call ends."""
+ """Disconnect the CDP connections a stateless tool call opened, then release its driver leases, when it ends."""
# The call's SessionState lives only in its own ContextVar, so nothing else can close them; an open
# connection keeps receiving and buffering the remote browser's events until that cloud session ends.
if not _stateless_http_mode:
yield
return
- connections: list[SkyvernBrowser] = []
- token = _call_connections.set(connections)
+ owned = _CallConnections()
+ token = _call_connections.set(owned)
try:
yield
finally:
_call_connections.reset(token)
- if connections:
- # Shielded so a cancelled call still disconnects; the timeout only stops a hung close
- # handshake from holding the response, and the close itself finishes in the background.
- disconnect = asyncio.create_task(_disconnect_call_connections(connections))
- _CALL_CONNECTION_DISCONNECTS.add(disconnect)
- disconnect.add_done_callback(_CALL_CONNECTION_DISCONNECTS.discard)
+ owned.ended = True
+ if owned.browsers or owned.leases:
+ # Shielded so a cancelled call still cleans up. The release keeps itself within the same budget;
+ # the timeout only stops it from holding the response if that ever fails.
+ release = asyncio.create_task(_release_call_connections(owned))
+ _retain_call_cleanup(release)
with suppress(TimeoutError):
- await asyncio.wait_for(asyncio.shield(disconnect), _CALL_CONNECTION_DISCONNECT_TIMEOUT_SECONDS)
+ await asyncio.wait_for(asyncio.shield(release), _CALL_CONNECTION_DISCONNECT_TIMEOUT_SECONDS)
def _own_call_connection(browser: SkyvernBrowser) -> None:
- connections = _call_connections.get()
- if connections is not None:
- connections.append(browser)
+ owned = _call_connections.get()
+ if owned is not None:
+ owned.browsers.append(browser)
+
+
+async def stateless_call_playwright(driver: HostedDriver) -> Playwright:
+ """``driver``'s Playwright, leased by the current stateless tool call until its connections are released."""
+ owned = _call_connections.get()
+ if owned is not None:
+ # Tasks the call spawned still see this object in their copied context after the scope resets the
+ # ContextVar, so this flag is what keeps them from using a driver no lease protects.
+ if owned.ended:
+ raise StatelessCallEndedError("This MCP tool call has already ended")
+ if driver not in owned.leases:
+ driver.acquire()
+ owned.leases.append(driver)
+ return await driver.playwright()
+
+
+def _retain_call_cleanup(task: asyncio.Task[None]) -> None:
+ _CALL_CONNECTION_DISCONNECTS.add(task)
+ task.add_done_callback(_finish_call_cleanup)
+
+
+def _finish_call_cleanup(task: asyncio.Task[None]) -> None:
+ _CALL_CONNECTION_DISCONNECTS.discard(task)
+ if not task.cancelled() and task.exception() is not None:
+ LOG.warning("Stateless MCP call cleanup failed", error_type=type(task.exception()).__name__)
async def _disconnect_browser(browser: SkyvernBrowser) -> None:
@@ -585,12 +625,26 @@ async def _disconnect_browser(browser: SkyvernBrowser) -> None:
await playwright_browser.close()
-async def _disconnect_call_connections(connections: list[SkyvernBrowser]) -> None:
- for browser in connections:
- try:
- await _disconnect_browser(browser)
- except Exception:
- LOG.warning("Failed to disconnect a stateless MCP browser connection", exc_info=True)
+async def _disconnect_call_connection(browser: SkyvernBrowser) -> None:
+ try:
+ await _disconnect_browser(browser)
+ except Exception:
+ LOG.warning("Failed to disconnect a stateless MCP browser connection", exc_info=True)
+
+
+async def _release_call_connections(owned: _CallConnections) -> None:
+ try:
+ if owned.browsers:
+ disconnects = [asyncio.create_task(_disconnect_call_connection(browser)) for browser in owned.browsers]
+ _, pending = await asyncio.wait(disconnects, timeout=_CALL_CONNECTION_DISCONNECT_TIMEOUT_SECONDS)
+ if pending:
+ # A hung close must not pin the shared driver; the idle sweep's driver stop also ends these.
+ LOG.warning("Stateless MCP browser connections did not disconnect in time", pending=len(pending))
+ for disconnect in pending:
+ _retain_call_cleanup(disconnect)
+ finally:
+ for driver in owned.leases:
+ driver.release()
def set_stateless_http_mode(enabled: bool) -> None:
diff --git a/skyvern/config.py b/skyvern/config.py
index bf0666b66..4d4c71219 100644
--- a/skyvern/config.py
+++ b/skyvern/config.py
@@ -468,6 +468,10 @@ class Settings(BaseSettings):
# Bitwarden Configs #
#####################
BITWARDEN_TIMEOUT_SECONDS: int = 60
+ # A cold `bw login` downloads and decrypts the whole vault, so it is categorically slower than the
+ # reads behind it and needs its own budget. Runs arriving as a batch each start on their own pod and
+ # pay that login concurrently, which pushes it well past a budget sized for a read.
+ BITWARDEN_LOGIN_TIMEOUT_SECONDS: int = 180
BITWARDEN_MAX_RETRIES: int = 3
BITWARDEN_MAX_JITTER_SECONDS: float = 2.0
# A logged-in CLI session is kept per vault identity and reused across runs, so a batch of
@@ -587,8 +591,8 @@ class Settings(BaseSettings):
# bypassing WORKFLOW_TASK_V3_AB. None disables the rule (the OSS default), as does having no flag
# provider; DISABLE_TASK_V3 still wins over it. A naive value is read as UTC. Per-call platform
# workflows are excluded twice over -- by an auto_generated executing version, which covers the
- # login, download_files, credential test-login and SDK endpoints, and by a per-call trigger kind,
- # which covers the job recipe endpoints because those build a published definition. Enrolled runs
+ # login, download_files, credential test-login, SDK and job recipe endpoints, and by a per-call trigger
+ # kind, which also covers older job recipe workflows created as published. Enrolled runs
# are not randomized, so every per-arm read must exclude them by route_reason.
TASK_V3_DEFAULT_ENGINE_WORKFLOW_CUTOFF: datetime | None = None
# Workflows whose permanent id was born at or after this instant, in every billing tier, honor each
@@ -989,6 +993,10 @@ class Settings(BaseSettings):
"""Interval in minutes for the cleanup cron job."""
CLEANUP_STALE_TASK_THRESHOLD_HOURS: int = 24
"""Tasks/workflows not updated for this many hours are considered stale (stuck)."""
+ HOSTED_MCP_DRIVER_IDLE_SECONDS: float = 600.0
+ """Stop a hosted MCP API key's shared Playwright driver after no tool call has used it this long; <=0 disables."""
+ HOSTED_MCP_DRIVER_SWEEP_INTERVAL_SECONDS: float = 300.0
+ """How often the API checks hosted MCP drivers for idleness; <=0 disables the sweep."""
TEMP_ARTIFACT_SWEEP_MAX_AGE_HOURS: float = 48.0
"""Age gate (hours) for the always-on sweep of per-run LOG_PATH/DOWNLOAD_PATH dirs left behind on
diff --git a/skyvern/core/script_generations/script_skyvern_page.py b/skyvern/core/script_generations/script_skyvern_page.py
index fa58a2638..26ab7cc69 100644
--- a/skyvern/core/script_generations/script_skyvern_page.py
+++ b/skyvern/core/script_generations/script_skyvern_page.py
@@ -77,6 +77,7 @@ from skyvern.webeye.browser_engine import BrowserEngineSelection
from skyvern.webeye.browser_state import BrowserState
from skyvern.webeye.navigation import default_navigation_settle, navigate_with_retry, redact_url_secrets
from skyvern.webeye.scraper.scraped_page import ScrapedPage
+from skyvern.webeye.utils.challenge_solve_record import calling_solve_client
from skyvern.webeye.utils.page import SkyvernFrame
LOG = structlog.get_logger()
@@ -1197,8 +1198,14 @@ class ScriptSkyvernPage(SkyvernPage):
if not context or not context.organization_id or not context.task_id or not context.step_id:
# Fallback: solve directly without DB context. Arm the vendor solver lifecycle around the
# solve so a factory-created (solver-off) session is armed on this path too.
- async with app.AGENT_FUNCTION.captcha_solver_lifecycle_scope(self.page):
- await app.AGENT_FUNCTION.auto_solve_captchas(self.page)
+ with app.AGENT_FUNCTION.challenge_solve_recording(
+ "cached_script",
+ page=self.page,
+ organization_id=context.organization_id if context else None,
+ workflow_run_id=context.workflow_run_id if context else None,
+ ) as record:
+ async with app.AGENT_FUNCTION.captcha_solver_lifecycle_scope(self.page):
+ record.extension_solved = await app.AGENT_FUNCTION.auto_solve_captchas(self.page)
return None
task = await app.DATABASE.tasks.get_task(context.task_id, context.organization_id)
@@ -1210,7 +1217,12 @@ class ScriptSkyvernPage(SkyvernPage):
task_id=context.task_id,
step_id=context.step_id,
)
- await solve_captcha_handler(action, self.page, self.scraped_page, task, step)
+ # The v1 handler records the call after its own fast-fail guards; this names the cached script as client.
+ client = calling_solve_client.set("cached_script")
+ try:
+ await solve_captcha_handler(action, self.page, self.scraped_page, task, step)
+ finally:
+ calling_solve_client.reset(client)
else:
await asyncio.sleep(30)
diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.py
index 5f15cb478..c99f58f6b 100644
--- a/skyvern/forge/agent.py
+++ b/skyvern/forge/agent.py
@@ -208,7 +208,14 @@ from skyvern.forge.taskv3.goal_check import (
GoalJudge,
)
from skyvern.forge.taskv3.goal_composition import CodeProgressRecord
-from skyvern.forge.taskv3.loop import ACTION_BLOCK_TARGET_ACTION_RESERVE, LoopOutcome, RoundAction
+from skyvern.forge.taskv3.loop import (
+ ACTION_BLOCK_TARGET_ACTION_RESERVE,
+ DEFAULT_MAX_SETTLE_DEFERRALS,
+ DownloadSettle,
+ DownloadWait,
+ LoopOutcome,
+ RoundAction,
+)
from skyvern.forge.taskv3.pre_submit_capture import PreSubmitCaptureRing, is_run_sampled, pre_submit_screenshot
from skyvern.forge.taskv3.provider_downloads import (
PROVIDER_BASELINE_TIMEOUT_SECONDS,
@@ -2400,7 +2407,6 @@ class ForgeAgent:
sanitize_handoff_url,
string_leaves,
)
- from skyvern.forge.taskv3.loop import DEFAULT_MAX_SETTLE_DEFERRALS, CompletionBlocker, CompletionProbe
from skyvern.forge.taskv3.opaque_refs import mask_opaque_urls
from skyvern.forge.taskv3.tools import (
_document_unidentifiable,
@@ -2653,11 +2659,11 @@ class ForgeAgent:
)
download_baseline_files = download_baseline_files + browser_session_downloaded_files
- # Passed to the loop below as well, so a download-wait probe caps its wait at what's left
+ # Passed to the loop below as well, so a download wait caps itself at what's left
# of the same deadline the loop enforces.
loop_deadline_seconds = DEFAULT_DEADLINE_SECONDS
loop_deadline_at = time.monotonic() + loop_deadline_seconds
- # Shared across every probe call: a path that already hit DownloadFileMaxWaitingTime once
+ # Shared by every download wait and settle: a path that already hit DownloadFileMaxWaitingTime once
# is excluded from later waits instead of being re-awaited on every subsequent action.
download_wait_exhausted: set[str] = set()
@@ -2665,7 +2671,7 @@ class ForgeAgent:
download_completion_reason: str | None = None
# Owned here (not by the engine) so the final clean_up_task below can also exclude names
- # tools staged into the downloads dir this run, whether or not the probe ever finalized.
+ # tools staged into the downloads dir this run, whether or not a download settle ever finalized.
class _StagedDownloads(set[str]):
# file_upload reports a basename for every source, but only http(s) sources are staged
# into the downloads dir; a name that isn't there must not shadow a later real download.
@@ -2699,15 +2705,14 @@ class ForgeAgent:
def _provider_wait_seconds(block: BaseTaskBlock) -> float:
return min(block.download_timeout or PROVIDER_DOWNLOAD_WAIT_SECONDS, loop_deadline_at - time.monotonic())
- completion_probe: CompletionProbe | None = None
- completion_blocker: CompletionBlocker | None = None
+ download_wait: DownloadWait | None = None
+ download_settle: DownloadSettle | None = None
if task_block is not None and task_block.complete_on_download and task.workflow_run_id:
complete_on_download_block = task_block
- async def _download_completion_probe(staged: frozenset[str]) -> str | None:
+ async def _settle_downloads(staged: frozenset[str]) -> str | None:
nonlocal download_finalized, download_completion_reason
- # A finish deferred by the settle gate re-probes; finalizing again would re-rename
- # the same file (or re-fetch a browser-session download).
+ # Finalizing again would re-rename the same file (or re-fetch a browser-session download).
if download_finalized:
return download_completion_reason
assert workflow_download_directory is not None # set alongside complete_on_download above
@@ -2748,41 +2753,24 @@ class ForgeAgent:
download_finalized = True
download_completion_reason = f"download completed ({len(new_files)} new file(s))"
LOG.info(
- "Task V3 task completed due to download",
+ "Task V3 download finalized",
task_id=task.task_id,
num_new_files=len(new_files),
)
return download_completion_reason
- async def _download_completion_blocker(staged: frozenset[str]) -> str | None:
- reason = await _download_completion_probe(staged)
- if reason:
- return None
- return (
- "This task only completes once a file download finishes, and no download has "
- "been detected yet. Trigger the download, or finish with the non-completed "
- "status the finish tool's own rule gives this outcome if it cannot be triggered."
- )
-
- # A data-extraction goal needs the model to keep the turn and call finish() itself;
- # ending the loop from the probe would drop the extraction. The blocker still
- # withholds completion until the download lands.
- if not (task.data_extraction_goal or task.extracted_information_schema):
- completion_probe = _download_completion_probe
- completion_blocker = _download_completion_blocker
- elif (
+ download_settle = _settle_downloads
+ if (
task_block is not None
- and task_block.download_timeout is not None
- and not task_block.complete_on_download
+ and (task_block.complete_on_download or task_block.download_timeout is not None)
and task.workflow_run_id
):
- # download_timeout alone carries no completion semantics; v1 bounds a post-action
- # download-settle wait with it, so v3 gets an equivalent wait-only probe that never
- # ends the run or blocks finish.
+ # As in v1, a download an action started lands (or hits download_timeout) before the model's next
+ # turn, so the next result can report it; the wait never ends the run or blocks finish.
wait_only_block = task_block
- async def _download_wait_only_probe(staged: frozenset[str]) -> str | None:
- await self._wait_for_in_flight_downloads(
+ async def _download_wait() -> None:
+ if await self._wait_for_in_flight_downloads(
task,
wait_only_block,
organization.organization_id,
@@ -2790,10 +2778,18 @@ class ForgeAgent:
exhausted=download_wait_exhausted,
should_cancel=_should_cancel,
attempt_started_at=attempt_started_at,
- )
- return None
+ ):
+ return
+ # A vendor session can keep a file its replay could not fetch; reading it back into the run dir is
+ # what lets the next result name it.
+ if provider_recovery is not None and wait_only_block.complete_on_download:
+ await provider_recovery.recover(
+ staged=staged_downloads,
+ timeout=_provider_wait_seconds(wait_only_block),
+ should_cancel=_should_cancel,
+ )
- completion_probe = _download_wait_only_probe
+ download_wait = _download_wait
# Honor a step cap (per-request override, task, or org, else the same MAX_STEPS_PER_RUN default
# the step engine uses) as the ACTION-round budget: a v3 step is one action round (a turn that
@@ -3335,8 +3331,8 @@ class ForgeAgent:
extra_system_guidance="\n\n".join(
part for part in (auth_guidance, captcha_guidance, workflow_system_guidance) if part
),
- completion_probe=completion_probe,
- completion_blocker=completion_blocker,
+ download_wait=download_wait,
+ download_settle=download_settle,
completion_gate=_completion_gate,
staged_downloads=staged_downloads,
deadline_seconds=loop_deadline_seconds,
@@ -3428,7 +3424,7 @@ class ForgeAgent:
return False
blank_page = await _v3_page_left_blank(first_sample, _fingerprint_page, _settle_should_stop)
- # A suffix-only download block has no probe; its file is finalized by clean_up_task below.
+ # No download settle finalized this block's file; clean_up_task below does.
# Same local-plus-session listing as the baseline, and a partial is not a delivered file.
if (
blank_page is not None
@@ -3745,7 +3741,7 @@ class ForgeAgent:
finish_reason=finish_reason,
final_url=final_url,
)
- # A probe-finalized run must not be finalized again (double rename); otherwise the fallback
+ # A settle-finalized run must not be finalized again (double rename); otherwise the fallback
# finalize still has to exclude tool-staged inputs from what counts as a download.
cleanup_list_files_before: list[str] | None = None
if not download_finalized and download_baseline_files is not None:
@@ -7387,6 +7383,7 @@ class ForgeAgent:
browser_state: BrowserState,
scrape_type: ScrapeType,
engine: RunEngine,
+ navigation_deadline: float | None = None,
) -> ScrapedPage:
if scrape_type == ScrapeType.NORMAL:
pass
@@ -7395,6 +7392,10 @@ class ForgeAgent:
LOG.info("Try to stop loading the page before scraping")
await browser_state.stop_page_loading()
elif scrape_type == ScrapeType.RELOAD:
+ # The NORMAL rungs only wait for a navigation the browser had already reported when they checked; one
+ # reported later is still in flight here, and reloading would cancel it.
+ if navigation_deadline is not None and (page := await browser_state.get_working_page()) is not None:
+ await browser_state.wait_for_main_frame_navigation(page, navigation_deadline)
LOG.info("Try to reload the page before scraping")
await browser_state.reload_page(degradation=True)
@@ -7422,6 +7423,7 @@ class ForgeAgent:
# Only this agent-step scrape opts into transient-UI scroll suppression (SKY-12735);
# verification / extraction / error-detection scrapes keep legacy scrolling.
allow_transient_ui_suppression=True,
+ navigation_deadline=navigation_deadline,
)
async def _observe_claimed_download_within_grace(
@@ -7789,6 +7791,9 @@ class ForgeAgent:
stuck_operations=stuck_operations,
)
blank_page_error: ScrapingFailedBlankPage | None = None
+ # One budget for the whole ladder: a scrape waits for an in-flight page navigation instead of
+ # timing out against it, and no later rung or replacement navigation gets a budget of its own.
+ navigation_deadline = time.monotonic() + settings.BROWSER_LOADING_TIMEOUT_MS / 1000
for idx, scrape_type in enumerate(SCRAPE_TYPE_ORDER):
try:
scraped_page = await self._scrape_with_type(
@@ -7797,6 +7802,7 @@ class ForgeAgent:
browser_state=browser_state,
scrape_type=scrape_type,
engine=engine,
+ navigation_deadline=navigation_deadline,
)
break
except (FailedToTakeScreenshot, ScrapingFailed, FailedToReloadPage) as e:
@@ -9699,6 +9705,18 @@ class ForgeAgent:
task=task,
browser_session_id=browser_session_id,
)
+ if har_data:
+ try:
+ await app.AGENT_FUNCTION.on_run_har_captured(
+ browser_state=browser_state,
+ har_data=har_data,
+ organization_id=task.organization_id,
+ workflow_run_id=task.workflow_run_id,
+ task_id=task.task_id,
+ browser_session_id=browser_session_id or task.browser_session_id,
+ )
+ except Exception:
+ LOG.warning("Failed to hand the run HAR to post-run processing", exc_info=True)
LOG.debug("Uploading har data", har_size=len(har_data))
browser_log = await app.BROWSER_MANAGER.get_browser_console_log(
diff --git a/skyvern/forge/agent_functions.py b/skyvern/forge/agent_functions.py
index 505ef7a7a..95609f3d9 100644
--- a/skyvern/forge/agent_functions.py
+++ b/skyvern/forge/agent_functions.py
@@ -6,7 +6,7 @@ import hashlib
import os
import time
from collections.abc import AsyncIterator, Mapping, Sequence
-from contextlib import AbstractAsyncContextManager, asynccontextmanager, nullcontext
+from contextlib import AbstractAsyncContextManager, AbstractContextManager, asynccontextmanager, nullcontext
from dataclasses import dataclass, field
from datetime import datetime, timedelta, timezone
from typing import TYPE_CHECKING, Any, Callable, Literal, TypedDict
@@ -93,6 +93,7 @@ from skyvern.webeye.browser_engine import UNSET_SELECTION, BrowserEngineSelectio
from skyvern.webeye.browser_state import BrowserState
from skyvern.webeye.scraper.scraped_page import ELEMENT_NODE_ATTRIBUTES, CleanupElementTreeFunc, json_to_html
from skyvern.webeye.utils.challenge_signature import ChallengeVendor
+from skyvern.webeye.utils.challenge_solve_record import ChallengeSolveRecord
from skyvern.webeye.utils.dom import SkyvernElement
from skyvern.webeye.utils.page import SkyvernFrame, take_element_screenshot
@@ -118,7 +119,8 @@ if TYPE_CHECKING:
from skyvern.forge.taskv3.tools import PageProvider
from skyvern.schemas.workflows import WorkflowStatus
from skyvern.services.otp_service import OTPValue
- from skyvern.webeye.browser_artifacts import DownloadBinding
+ from skyvern.webeye.browser_artifacts import BrowserArtifacts, DownloadBinding
+ from skyvern.webeye.browser_state import BrowserState
LOG = structlog.get_logger()
@@ -1117,7 +1119,9 @@ class AgentFunction:
) -> str | None:
return None
- async def enforce_request_authorization(self, principal: RequestPrincipal | None, action: str) -> None:
+ async def enforce_request_authorization(
+ self, principal: RequestPrincipal | None, action: str, *, always_enforce: bool = False
+ ) -> None:
return None
async def enforce_request_role(
@@ -1849,6 +1853,25 @@ class AgentFunction:
) -> None:
return
+ def note_browser_relaunch(self, browser_state: BrowserState | None, reason: str) -> None:
+ """The next browser creation in this task replaces an earlier one of the same run. OSS no-op."""
+
+ def on_browser_run_released(self, browser_context: BrowserContext | BrowserArtifacts | None) -> None:
+ """A run released a browser that no other run shares. OSS no-op."""
+
+ async def on_run_har_captured(
+ self,
+ browser_state: BrowserState,
+ har_data: bytes,
+ organization_id: str,
+ workflow_run_id: str | None,
+ task_id: str | None,
+ browser_session_id: str | None,
+ attempt_number: int | None = None,
+ ) -> None:
+ """A finished run's redacted HAR is in hand at cleanup, before it is archived. Cleanup awaits this, so an
+ override should do only bounded work, must not raise, and must let cancellation propagate. OSS no-op."""
+
async def validate_step_execution(
self,
task: Task,
@@ -2249,6 +2272,23 @@ class AgentFunction:
"""
return nullcontext()
+ def challenge_solve_recording(
+ self,
+ client: str,
+ *,
+ page: Any = None,
+ task: Any = None,
+ organization_id: str | None = None,
+ task_id: str | None = None,
+ workflow_run_id: str | None = None,
+ browser_session_id: str | None = None,
+ ) -> AbstractContextManager[ChallengeSolveRecord]:
+ """Synchronous scope around one canonical challenge-solve call, yielding the record the call site fills in.
+
+ A deployment schedules its solve-ledger writes here without awaiting them; the scope must never alter the
+ call's result or exception. OSS records nothing."""
+ return nullcontext(ChallengeSolveRecord())
+
def resolve_captcha_solver_extension_timeout(self, page: Page | RecordingPage, default_timeout: float) -> float:
"""The wait budget for the direct ladder's solver-extension arm, resolved inside the solver scope.
diff --git a/skyvern/forge/api_app.py b/skyvern/forge/api_app.py
index 7cf4b65d3..4e4639f53 100644
--- a/skyvern/forge/api_app.py
+++ b/skyvern/forge/api_app.py
@@ -65,8 +65,10 @@ from skyvern.forge.sdk.services.route_authorization import ROUTE_AUTHORIZATION_D
from skyvern.services.browser_recording.session_registry import interpretation_registry
from skyvern.services.cleanup_service import (
start_cleanup_scheduler,
+ start_hosted_driver_sweep,
start_temp_artifact_sweep,
stop_cleanup_scheduler,
+ stop_hosted_driver_sweep,
stop_temp_artifact_sweep,
)
from skyvern.services.orphaned_run_reaper import reap_orphaned_runs_once
@@ -420,6 +422,7 @@ async def lifespan(fastapi_app: FastAPI) -> AsyncGenerator[None, Any]:
LOG.info("Cleanup scheduler started")
start_temp_artifact_sweep()
+ start_hosted_driver_sweep()
workflow_schedule_task = start_workflow_schedule_scheduler()
if workflow_schedule_task:
@@ -465,6 +468,7 @@ async def lifespan(fastapi_app: FastAPI) -> AsyncGenerator[None, Any]:
await stop_workflow_schedule_scheduler()
await stop_cleanup_scheduler()
await stop_temp_artifact_sweep()
+ await stop_hosted_driver_sweep()
await interpretation_registry.stop_all()
if forge_app.api_app_shutdown_event:
diff --git a/skyvern/forge/prompts/skyvern/workflow-copilot-user.j2 b/skyvern/forge/prompts/skyvern/workflow-copilot-user.j2
index 09354d9fa..1d9fac532 100644
--- a/skyvern/forge/prompts/skyvern/workflow-copilot-user.j2
+++ b/skyvern/forge/prompts/skyvern/workflow-copilot-user.j2
@@ -65,7 +65,8 @@ FILES THE USER ATTACHED TO THIS CHAT:
{{ attached_files_summary }}
```
-These are files this organization uploaded to Skyvern. To read a document or image in the workflow,
+These are files this organization uploaded to Skyvern. `read_attached_pdf` returns an attached PDF's text to you
+now, while you build, and adds nothing to the workflow. To read a document or image in the workflow,
put its `file_id` in a block's `file_url` (a `file_url_parser` block reads CSV, Excel, PDF, and
PNG/JPEG/GIF/BMP/WebP/TIFF images, reading an image's text with OCR), or declare it as a `file_url`
workflow input whose `default_value` is the `file_id`; the run resolves it to the stored file.
diff --git a/skyvern/forge/sdk/copilot/agent.py b/skyvern/forge/sdk/copilot/agent.py
index a1bfe08e5..78025903c 100644
--- a/skyvern/forge/sdk/copilot/agent.py
+++ b/skyvern/forge/sdk/copilot/agent.py
@@ -126,7 +126,11 @@ from skyvern.forge.sdk.copilot.context import (
sanitize_global_llm_context_for_prompt,
tool_recorded_context_fields,
)
-from skyvern.forge.sdk.copilot.credential_pause import credential_pause_reason, credential_recovery_token_digest
+from skyvern.forge.sdk.copilot.credential_pause import (
+ credential_pause_reason,
+ credential_pause_receipt,
+ credential_recovery_token_digest,
+)
from skyvern.forge.sdk.copilot.data_write_defaults import default_data_write_continue_on_failure
from skyvern.forge.sdk.copilot.demonstration_recorder import DemonstrationRejection
from skyvern.forge.sdk.copilot.demonstration_replay import replay_demonstration
@@ -146,6 +150,7 @@ from skyvern.forge.sdk.copilot.entrypoint import (
resolve_turn_entrypoint_url,
)
from skyvern.forge.sdk.copilot.failure_tracking import block_shape_hashes_by_label
+from skyvern.forge.sdk.copilot.google_connection_notice import google_setup_notice, unselected_google_setup_offers
from skyvern.forge.sdk.copilot.hooks import FinalReplyRunHooks
from skyvern.forge.sdk.copilot.interruption import INTERRUPTED_TERMINAL_SUPERSEDED_HEADLINE
from skyvern.forge.sdk.copilot.llm_errors import CopilotEmptyCompletionError
@@ -304,6 +309,7 @@ from skyvern.forge.sdk.schemas.copilot_turn_outcome import (
ConnectedAccountChoice,
ConnectedAccountChoiceReference,
DeliveredOutputFile,
+ GoogleSetupOffer,
ResponseKind,
TurnOutcome,
)
@@ -1986,6 +1992,15 @@ def _make_agent_result(
output_files = _turn_output_files(ctx)
if output_files:
turn_outcome = turn_outcome.model_copy(update={"output_files": output_files})
+ if ctx.google_setup_notices:
+ turn_outcome = turn_outcome.model_copy(
+ update={
+ "google_setup_offers": [
+ GoogleSetupOffer(scope_profile=notice.scopeProfile, connection_id=notice.connectionId)
+ for notice in ctx.google_setup_notices
+ ]
+ }
+ )
proposal_yaml = kwargs.get("workflow_yaml")
if isinstance(proposal_yaml, str):
proposal_yaml = derive_code_block_steps_in_yaml(proposal_yaml)
@@ -2100,23 +2115,15 @@ def _make_agent_result(
if turn_outcome is not None and turn_outcome.output_files:
payload_updates["outputFiles"] = [file.model_dump(mode="json") for file in turn_outcome.output_files]
if ctx is not None and "credentialPause" not in narrative_payload:
- pause_outcome = ctx.credential_pause_outcome
- if pause_outcome:
- pause_payload = {"outcome": pause_outcome}
- if pause_outcome == "connected" and ctx.credential_pause_connected_credential_id:
- pause_payload["credentialId"] = ctx.credential_pause_connected_credential_id
- signed_in_profile_id = (
- ctx.request_policy.credential_pause_signed_in_profile_id if ctx.request_policy else None
- )
- if pause_outcome == "signed_in" and signed_in_profile_id:
- pause_payload["browserProfileId"] = signed_in_profile_id
- if ctx.credential_pause_anchor_tool_call_id:
- pause_payload["anchorToolCallId"] = ctx.credential_pause_anchor_tool_call_id
+ pause_payload = credential_pause_receipt(ctx)
+ if pause_payload:
payload_updates["credentialPause"] = pause_payload
- if ctx is not None and "googleConnectionNotices" not in narrative_payload and ctx.google_connection_notices:
- payload_updates["googleConnectionNotices"] = [
- notice.to_payload() for notice in ctx.google_connection_notices
- ]
+ if len(ctx.credential_pause_receipts) > 1:
+ payload_updates["credentialPauses"] = list(ctx.credential_pause_receipts)
+ if ctx is not None and "googleConnectionNotices" not in narrative_payload:
+ notice_payloads = ctx.google_connection_notice_payloads()
+ if notice_payloads:
+ payload_updates["googleConnectionNotices"] = notice_payloads
if payload_updates or len(payload_base) != len(narrative_payload):
kwargs["narrative_payload"] = {**payload_base, **payload_updates}
if turn_facts is not None:
@@ -2270,8 +2277,9 @@ def _build_narrative_payload(
"drainFingerprint": budget_state.drain_fingerprint,
"leftRunIds": list(budget_state.leavable_run_ids) if budget_state.hard_backstop_reached else [],
}
- if ctx.google_connection_notices:
- payload["googleConnectionNotices"] = [notice.to_payload() for notice in ctx.google_connection_notices]
+ notice_payloads = ctx.google_connection_notice_payloads()
+ if notice_payloads:
+ payload["googleConnectionNotices"] = notice_payloads
if ctx.demonstration_items:
payload["demonstrationItems"] = list(ctx.demonstration_items)
if ctx.staged_workflow_yaml is not None:
@@ -3566,6 +3574,31 @@ async def _verified_connected_account_choices(
return choices or None
+async def _reshow_unselected_google_setup(
+ ctx: CopilotContext, prior_turn_outcome: TurnOutcome | None, request_policy: RequestPolicy
+) -> list[str]:
+ """A pick on one setup card leaves its sibling cards in history, where they are inert, so offer them again."""
+ if request_policy.picked_connected_account_id is None or prior_turn_outcome is None:
+ return []
+ pending = unselected_google_setup_offers(
+ prior_turn_outcome.google_setup_offers or [], request_policy.picked_connected_account_scopes
+ )
+ if not pending:
+ return []
+ try:
+ visible = await google_oauth_service.get_visible_credentials_for_org(ctx.organization_id)
+ except Exception:
+ LOG.warning("copilot_google_setup_reshow_lookup_failed", organization_id=ctx.organization_id, exc_info=True)
+ return []
+ ctx.google_setup_notices = [
+ google_setup_notice(
+ scope_profile=offer.scope_profile, connection_id=offer.connection_id, visible_credentials=visible
+ )
+ for offer in pending
+ ]
+ return [offer.scope_profile for offer in pending]
+
+
async def _server_verified_connected_account_recovery_choices(
request_policy: RequestPolicy,
*,
@@ -5563,6 +5596,7 @@ async def _run_copilot_turn_impl(
native_tools=copilot_native_tools(
supports_question_tool=chat_request.supports_question_tool,
supports_account_group_card=chat_request.supports_account_group_card,
+ supports_google_setup_card=chat_request.supports_google_setup_card,
supports_credential_delete_card=chat_request.supports_credential_delete_card,
browser_code_available=browser_code_mode != CopilotBrowserCodeMode.OFF
and copilot_config.authoring_capability.code_blocks,
@@ -5618,8 +5652,15 @@ async def _run_copilot_turn_impl(
scoped_global_llm_context = safe_global_llm_context
prior_choice_context = connected_account_choice_context(
prior_turn_outcome,
- explicit_selected_connection_id=request_policy.selected_connected_account_id,
+ explicit_selected_connection_id=request_policy.picked_connected_account_id,
+ explicit_selected_connection_scopes=request_policy.picked_connected_account_scopes,
from_pending_proposal=chat_request.selected_connected_account_from_pending_proposal,
+ reshown_setup_profiles=(
+ await _reshow_unselected_google_setup(ctx, prior_turn_outcome, request_policy)
+ if chat_request.supports_google_setup_card
+ and not chat_request.selected_connected_account_from_pending_proposal
+ else []
+ ),
)
if prior_choice_context:
scoped_global_llm_context = (
diff --git a/skyvern/forge/sdk/copilot/blocker_signal.py b/skyvern/forge/sdk/copilot/blocker_signal.py
index 2931c621f..914af46d8 100644
--- a/skyvern/forge/sdk/copilot/blocker_signal.py
+++ b/skyvern/forge/sdk/copilot/blocker_signal.py
@@ -84,9 +84,11 @@ _INTERNAL_TOOL_NAME_TOKENS: tuple[str, ...] = (
"start_fresh_browser",
"extend_browser_session",
"upload_attached_file",
+ "read_attached_pdf",
"get_browser_screenshot",
"list_credentials",
"list_integrations",
+ "request_google_connection",
"read_google_sheet",
)
diff --git a/skyvern/forge/sdk/copilot/context.py b/skyvern/forge/sdk/copilot/context.py
index 3b8051e83..35b87654e 100644
--- a/skyvern/forge/sdk/copilot/context.py
+++ b/skyvern/forge/sdk/copilot/context.py
@@ -298,6 +298,8 @@ class TurnNarrativePayload(TypedDict):
# when a mid-build credential pause (credential_pause.py) resolved during this turn. The anchor is
# the tool call whose row was newest when the card was raised.
credentialPause: NotRequired[dict[str, str]]
+ # Every pick card's credentialPause, oldest first; set only when more than one card settled this turn.
+ credentialPauses: NotRequired[list[dict[str, str]]]
# {"credentialId": ..., "name": ...}, set when a credential was bound this turn without an ask
# (deterministic auto-bind); the FE renders it as a receipt with a Change affordance.
credentialAutoBound: NotRequired[dict[str, str]]
@@ -904,12 +906,12 @@ def record_approved_credentials_in_global_llm_context(ctx: CopilotContext, raw_c
and credential.credential_id in policy.carry_cited_credential_ids
and not (settled_ids and credential.credential_id not in settled_ids)
)
+ card_selected = credential.credential_id in policy.credential_pause_connected_credential_ids
stamped_by_page = (
credential.credential_id in policy.live_page_admitted_urls
- and credential.credential_id != ctx.credential_pause_connected_credential_id
+ and not card_selected
and not carry_stamp_the_user_answered
)
- card_selected = credential.credential_id == ctx.credential_pause_connected_credential_id
if (
credential.credential_id in policy.persisted_workflow_credential_ids
and credential.credential_id not in settled_ids
@@ -1319,10 +1321,6 @@ class CopilotContext(AgentContext):
# One update card (add an authenticator, or replace values a site refused) may follow an answered
# card per turn: it asks to fix the credential the user already chose, not to choose again.
credential_totp_update_asked: bool = False
- # A tool ask the user did not answer with a credential spends the one-card budget on a guess.
- # A run that then hits a real login wall has evidence the guess did not, so it gets the budget
- # back once.
- credential_pause_reaskable_by_run: bool = False
copilot_credential_pause_seconds: float = 0.0
credential_pause_outcome: str | None = None
credential_registration_outcome: Literal["rejected", "unknown"] | None = None
@@ -1330,6 +1328,7 @@ class CopilotContext(AgentContext):
credential_generation_spent: bool = False
credential_pause_connected_credential_id: str | None = None
credential_pause_anchor_tool_call_id: str | None = None
+ credential_pause_receipts: list[dict[str, str]] = field(default_factory=list)
demonstration_requested: bool = False
demonstration_ran: bool = False
demonstration_id: str | None = None
@@ -1349,6 +1348,8 @@ class CopilotContext(AgentContext):
opening_workflow_title: str | None = None
google_connection_turn_start_bindings: tuple[GoogleSheetConnectionBinding, ...] | None = None
google_connection_notices: list[GoogleConnectionNotice] = field(default_factory=list)
+ # Kept apart from google_connection_notices, which each workflow save recomputes wholesale.
+ google_setup_notices: list[GoogleConnectionNotice] = field(default_factory=list)
# Tool tracking
tool_activity: list[dict[str, Any]] = field(default_factory=list)
@@ -1572,6 +1573,9 @@ class CopilotContext(AgentContext):
# run inherited from an earlier turn, which is not an attempt by this one.
return bool(self.dispatched_run_ids_this_turn)
+ def google_connection_notice_payloads(self) -> list[GoogleConnectionNoticePayload]:
+ return [notice.to_payload() for notice in (*self.google_setup_notices, *self.google_connection_notices)]
+
def genuine_attempt_parity_fields(self) -> dict[str, bool | int | str | None]:
return {
"has_genuine_workflow_attempt": self.has_genuine_workflow_attempt(),
diff --git a/skyvern/forge/sdk/copilot/credential_pause.py b/skyvern/forge/sdk/copilot/credential_pause.py
index c35931d4c..3c4b29d6f 100644
--- a/skyvern/forge/sdk/copilot/credential_pause.py
+++ b/skyvern/forge/sdk/copilot/credential_pause.py
@@ -772,9 +772,7 @@ def raw_secret_card_origin(user_url: str) -> str:
return f"{scheme}{separator}{rest.split('/', 1)[0]}" if separator else ""
-def credential_pause_transport_ready(
- ctx: CopilotContext, copilot_config: CopilotConfig | None, *, allow_second_ask: bool = False
-) -> bool:
+def credential_pause_transport_ready(ctx: CopilotContext, copilot_config: CopilotConfig | None) -> bool:
"""Whether a card can be shown at all this turn, independent of what is asking for one.
Excludes the async-only checks (stream disconnect).
@@ -783,7 +781,6 @@ def credential_pause_transport_ready(
copilot_config is not None
and copilot_config.credential_pause_enabled
and ctx.client_supports_credential_pause
- and (allow_second_ask or not ctx.credential_pause_used)
# A same-process-only cache (LocalCache) can't coordinate the poller with a
# /credential-response POST that may land on a different worker -- gate on a
# cache that's explicitly known to be shared (Redis) rather than merely non-None.
@@ -821,6 +818,7 @@ def apply_connected_credential_to_policy(ctx: CopilotContext, policy: RequestPol
(and un-latching ``test_after_update_done``) so the resumed run does not re-skip and re-ask; a
raw-secret turn keeps its run gate closed and its draft untested for a later secret-free turn."""
ctx.credential_pause_connected_credential_id = credential.credential_id
+ policy.credential_pause_connected_credential_ids.add(credential.credential_id)
admitted_url = _bind_connected_credential_origin(policy, credential)
LOG.info(
"copilot_credential_pause_connected",
@@ -863,11 +861,27 @@ def _apply_signed_in_profile_to_policy(ctx: Any, policy: RequestPolicy, signed_i
)
+def credential_pause_receipt(ctx: CopilotContext) -> dict[str, str] | None:
+ outcome = ctx.credential_pause_outcome
+ if not outcome:
+ return None
+ receipt = {"outcome": outcome}
+ if outcome == "connected" and ctx.credential_pause_connected_credential_id:
+ receipt["credentialId"] = ctx.credential_pause_connected_credential_id
+ signed_in_profile_id = ctx.request_policy.credential_pause_signed_in_profile_id if ctx.request_policy else None
+ if outcome == "signed_in" and signed_in_profile_id:
+ receipt["browserProfileId"] = signed_in_profile_id
+ if ctx.credential_pause_anchor_tool_call_id:
+ receipt["anchorToolCallId"] = ctx.credential_pause_anchor_tool_call_id
+ return receipt
+
+
def signed_in_facts(signed_in: SignedInProfile) -> str:
return (
- f"The user signed in to {signed_in.site} themselves in the live browser via the credential card. "
- f"Skyvern saved that sign-in as browser profile {defang_card_text(signed_in.profile_name)} "
- f"({signed_in.browser_profile_id}) with {signed_in.cookie_count} cookies. No credential was provided. "
+ f"The user pressed Done on the credential card after using the live browser on {signed_in.site}. "
+ f"Skyvern saved that browser state as browser profile {defang_card_text(signed_in.profile_name)} "
+ f"({signed_in.browser_profile_id}) with {signed_in.cookie_count} cookies. Skyvern did not check whether "
+ "this browser state is signed in. No credential was provided. "
"This profile seeds this turn's tests only. Later turns and saved runs start from it only if it is set as "
"the workflow's browser profile and the user accepts. Sites often end cookie-only sign-ins within minutes "
"or hours, so saved runs may start signed out."
@@ -893,9 +907,8 @@ def _connected_resume_text(credential: Credential) -> str:
_SKIP_RESUME_TEXT = (
- "The user chose not to connect a credential now. Continue without it: keep the credential parameter "
- "placeholder in the draft, do not ask for the credential again this turn, and finish. If you run a test, "
- "it may stop at the login step."
+ "The user chose not to connect a credential on this card. Keep the credential parameter placeholder in the "
+ "draft. If you run a test, it may stop at the login step."
)
@@ -972,7 +985,8 @@ def _manual_sign_in_offer(ctx: CopilotContext, login_page_urls: list[str]) -> Ma
if (
not ctx.browser_session_id
or not site
- or ctx.credential_origin_recovery is not None
+ # Only the recovery's own card is "asked"; a card for another site after a declined recovery still offers it.
+ or (ctx.credential_origin_recovery is not None and ctx.credential_origin_recovery.state == "asked")
or (isinstance(policy, RequestPolicy) and policy.raw_secret_detected)
):
return None
@@ -994,34 +1008,36 @@ async def _run_credential_pause(
login_page_urls: list[str],
update_credential_id: str | None = None,
admit_connected: Callable[[Credential], Awaitable[bool]] | None = None,
- allow_second_ask: bool = False,
anchor_tool_call_id: str | None = None,
registration: WorkflowCopilotCredentialRegistration | None = None,
) -> CredentialPauseResolution | None:
"""Send the credential card and wait for the user's decision.
Returns the resolution, or None to let the caller proceed without one
- (kill-switch off, client can't render the frame, already paused once this
- turn, no shared cache, unrecoverable client disconnect, or timeout).
+ (kill-switch off, client can't render the frame, no shared cache,
+ unrecoverable client disconnect, or timeout).
Recovery-capable clients restore the same active card through chat history.
"""
update_ask = update_credential_id is not None
ctx.credential_registration_outcome = None
- if not credential_pause_transport_ready(ctx, copilot_config, allow_second_ask=update_ask or allow_second_ask):
+ if not credential_pause_transport_ready(ctx, copilot_config):
return None
- # Latch before async checks so a declined transport cannot trigger another pause. Only the pick ask
- # spends credential_pause_used; request_credential_pause latches the update ask.
# A pause no tool call raised (the end-of-turn ask) renders after the newest row instead.
if anchor_tool_call_id is None and ctx.narrator_state is not None:
anchor_tool_call_id = ctx.narrator_state.last_tool_call_id
+ # Latched before the async checks, so a declined transport cannot set off the run-derived ask.
if not update_ask:
ctx.credential_pause_used = True
- ctx.credential_pause_anchor_tool_call_id = anchor_tool_call_id
def settle(outcome: str) -> None:
# An update card asks to fix a credential already chosen, so the turn keeps its pick card's state.
+ # Outcome and anchor change together, so a card cancelled mid-wait leaves the earlier card's receipt intact.
if not update_ask:
ctx.credential_pause_outcome = outcome
+ ctx.credential_pause_anchor_tool_call_id = anchor_tool_call_id
+ receipt = credential_pause_receipt(ctx)
+ if receipt is not None:
+ ctx.credential_pause_receipts.append(receipt)
cache = getattr(app, "CACHE", None)
if cache is None:
@@ -1123,10 +1139,12 @@ async def _run_credential_pause(
else _credential_pause_record_ttl(timeout_seconds),
)
await stream.send(card)
+ sign_in_started = False
async def _invalidate_active_pause_record(
*, keep_live: bool = False
) -> CredentialPauseResolution | None | Literal["live"]:
+ nonlocal sign_in_started
# The waiter can exit (disconnect, genuine timeout, cancellation, or an
# unexpected error) well before expires_at -- invalidate the record so a
# late POST (e.g. the tab reconnects) gets a clear 409 instead of silently
@@ -1142,6 +1160,8 @@ async def _run_credential_pause(
return raced_in
active_key = credential_pause_active_key(organization_id, chat_id, turn_id)
record = _decode_active_pause(await cache.get(active_key))
+ if record is not None and record.resume_token == resume_token and record.manual_sign_in is not None:
+ sign_in_started = sign_in_started or record.manual_sign_in.started
live_until = record.live_until() if record is not None and record.resume_token == resume_token else None
if keep_live and live_until is not None and datetime.now(timezone.utc) < live_until:
return "live"
@@ -1192,7 +1212,7 @@ async def _run_credential_pause(
return None
try:
- with pause_human_input(ctx, "credential"):
+ with pause_human_input(ctx, "credential") as human_wait:
wait_seconds: float = timeout_seconds
while True:
waited = await _wait_for_credential_response(
@@ -1210,6 +1230,7 @@ async def _run_credential_pause(
resolution = settled
invalidated = True
break
+ human_wait.unattended = resolution is None and not sign_in_started
except BaseException:
# Covers CancelledError (a direct BaseException subclass, not Exception)
# alongside any unexpected failure in the wait loop itself -- the frame's
@@ -1259,7 +1280,7 @@ async def _run_credential_pause(
return None
if isinstance(policy, RequestPolicy):
_apply_signed_in_profile_to_policy(ctx, policy, resolution.signed_in)
- ctx.credential_pause_outcome = "signed_in"
+ settle("signed_in")
await answered("signed_in", signed_in=resolution.signed_in)
return resolution
@@ -1278,12 +1299,12 @@ async def _run_credential_pause(
# A credential this card just generated has no saved site yet; the card's own origin is its only placement.
is_generated = credential.credential_id == generated_credential_id
if admit_connected is not None and not is_generated and not await admit_connected(credential):
- ctx.credential_pause_outcome = "not_admitted"
+ settle("not_admitted")
await answered("not_admitted")
return resolution
if isinstance(policy, RequestPolicy):
apply_connected_credential_to_policy(ctx, policy, credential)
- ctx.credential_pause_outcome = "connected"
+ settle("connected")
await answered("connected", credential)
return replace(resolution, generated=True) if is_generated else resolution
@@ -1315,7 +1336,6 @@ async def request_credential_pause(
update_credential_id: str | None = None,
update_reason: Literal["credential_missing_totp", "credential_rejected_by_site"] = "credential_missing_totp",
admit_connected: Callable[[Credential], Awaitable[bool]] | None = None,
- allow_second_ask: bool = False,
anchor_tool_call_id: str | None = None,
registration: WorkflowCopilotCredentialRegistration | None = None,
) -> CredentialPauseResolution | None:
@@ -1327,7 +1347,7 @@ async def request_credential_pause(
if update_ask:
ctx.credential_totp_update_asked = True
try:
- resolution = await _run_credential_pause(
+ return await _run_credential_pause(
ctx,
message,
stream,
@@ -1340,13 +1360,9 @@ async def request_credential_pause(
login_page_urls=[login_page_url],
update_credential_id=update_credential_id,
admit_connected=admit_connected,
- allow_second_ask=allow_second_ask,
anchor_tool_call_id=anchor_tool_call_id,
registration=None if update_ask else registration,
)
- if not update_ask:
- ctx.credential_pause_reaskable_by_run = resolution is None or resolution.action == "skip"
- return resolution
finally:
ctx.credential_ask_in_flight = False
release_credential_pause_gate(ctx)
@@ -1385,14 +1401,8 @@ async def maybe_credential_pause(
# A refused cross-site fill owns the card: it asks for its own origin, and a declined one is not asked again.
if reason is None or ctx.credential_origin_recovery is not None:
return None
- # Exactly True, not merely truthy: a partial stand-in returns a truthy
- # object for any attribute, which would hand the budget back on every turn.
- if ctx.credential_pause_reaskable_by_run is True:
- # The spent card was a guess the user never answered; this ask has a run behind it. Hand the
- # budget back once, so an unanswered guess cannot silently cost the turn its real card.
- ctx.credential_pause_reaskable_by_run = False
- ctx.credential_pause_used = False
- if not credential_pause_transport_ready(ctx, copilot_config):
+ # The run-derived ask never reopens a card the turn raised; the model's own request_credential can.
+ if ctx.credential_pause_used or not credential_pause_transport_ready(ctx, copilot_config):
return None
# Local import: same module-load-cycle reason as _assemble_resume_messages.
from skyvern.forge.sdk.copilot.enforcement import _parse_normalized_final_response
diff --git a/skyvern/forge/sdk/copilot/google_connection_notice.py b/skyvern/forge/sdk/copilot/google_connection_notice.py
index 6cf5e6f8b..c1db515a0 100644
--- a/skyvern/forge/sdk/copilot/google_connection_notice.py
+++ b/skyvern/forge/sdk/copilot/google_connection_notice.py
@@ -9,19 +9,37 @@ from pydantic import BaseModel, Field
from typing_extensions import TypedDict
from skyvern.config import settings
-from skyvern.forge.sdk.schemas.copilot_turn_outcome import ConnectedAccountChoice
+from skyvern.forge.sdk.schemas.copilot_turn_outcome import (
+ ConnectedAccountChoice,
+ GoogleSetupOffer,
+ GoogleSetupScopeProfile,
+)
from skyvern.forge.sdk.schemas.google_oauth import STATE_ACTIVE, GoogleOAuthCredentialBase
-from skyvern.forge.sdk.services.google_oauth_service import GOOGLE_SHEETS_DATA_SCOPE
+from skyvern.forge.sdk.services.google_oauth_service import (
+ GOOGLE_GMAIL_READONLY_SCOPE,
+ GOOGLE_GMAIL_SEND_SCOPES,
+ GOOGLE_OAUTH_SCOPE_PROFILES,
+ GOOGLE_SHEETS_DATA_SCOPE,
+)
from skyvern.forge.sdk.workflow.models.block import BlockTypeVar, ForLoopBlock, WhileLoopBlock
from skyvern.forge.sdk.workflow.models.google_sheets_blocks import GoogleSheetsReadBlock, GoogleSheetsWriteBlock
from skyvern.forge.sdk.workflow.models.workflow import Workflow
+GoogleConnectionNoticeOrigin = Literal["setup", "workflow"]
+
+GOOGLE_SETUP_PROFILE_DATA_SCOPES: dict[GoogleSetupScopeProfile, str] = {
+ "gmail": GOOGLE_GMAIL_READONLY_SCOPE,
+ "google_sheets": GOOGLE_SHEETS_DATA_SCOPE,
+}
+
class GoogleConnectionNoticePayload(TypedDict):
provider: Literal["google"]
connectionId: str | None
displayName: str | None
condition: Literal["missing", "unusable", "unbound"]
+ scopeProfile: GoogleSetupScopeProfile
+ origin: GoogleConnectionNoticeOrigin
choices: NotRequired[list[dict[str, str | None]]]
@@ -30,6 +48,8 @@ class GoogleConnectionNotice(BaseModel):
connectionId: str | None
displayName: str | None = None
condition: Literal["missing", "unusable", "unbound"]
+ scopeProfile: GoogleSetupScopeProfile = "google_sheets"
+ origin: GoogleConnectionNoticeOrigin = "workflow"
choices: list[ConnectedAccountChoice] = Field(default_factory=list)
def to_payload(self) -> GoogleConnectionNoticePayload:
@@ -38,6 +58,8 @@ class GoogleConnectionNotice(BaseModel):
"connectionId": self.connectionId,
"displayName": self.displayName,
"condition": self.condition,
+ "scopeProfile": self.scopeProfile,
+ "origin": self.origin,
}
if self.condition == "unbound":
payload["choices"] = [choice.model_dump(mode="json") for choice in self.choices]
@@ -96,14 +118,8 @@ def collect_google_connection_notices(
connectionId=None,
condition="unbound",
choices=[
- ConnectedAccountChoice(
- connection_id=credential.id,
- name=credential.credential_name,
- state=credential.state,
- email_address=credential.email_address,
- )
- for credential in visible_credentials
- if credential.state == STATE_ACTIVE and GOOGLE_SHEETS_DATA_SCOPE in credential.scopes_granted
+ _choice(credential)
+ for credential in google_setup_ready_connections("google_sheets", visible_credentials)
],
)
)
@@ -112,16 +128,98 @@ def collect_google_connection_notices(
if credential is None:
notices.append(GoogleConnectionNotice(connectionId=connection_id, condition="missing"))
elif credential.state != STATE_ACTIVE or GOOGLE_SHEETS_DATA_SCOPE not in credential.scopes_granted:
- notices.append(
- GoogleConnectionNotice(
- connectionId=connection_id,
- displayName=credential.credential_name,
- condition="unusable",
+ if _holds_other_profile_grant(credential, "google_sheets"):
+ notices.append(
+ GoogleConnectionNotice(
+ connectionId=None,
+ condition="unbound",
+ choices=[
+ _choice(ready)
+ for ready in google_setup_ready_connections("google_sheets", visible_credentials)
+ ],
+ )
+ )
+ else:
+ notices.append(
+ GoogleConnectionNotice(
+ connectionId=connection_id,
+ displayName=credential.credential_name,
+ condition="unusable",
+ )
)
- )
return notices
+def _holds_other_profile_grant(credential: GoogleOAuthCredentialBase, scope_profile: GoogleSetupScopeProfile) -> bool:
+ """Reauthorizing a row replaces its granted scopes with this profile's, keeping only Gmail send, so any other
+ profile scope it holds would be revoked."""
+ kept = {*GOOGLE_OAUTH_SCOPE_PROFILES[scope_profile], *GOOGLE_GMAIL_SEND_SCOPES}
+ return any(
+ scope in credential.scopes_granted
+ for scopes in GOOGLE_OAUTH_SCOPE_PROFILES.values()
+ for scope in scopes
+ if scope not in kept
+ )
+
+
+def _choice(credential: GoogleOAuthCredentialBase) -> ConnectedAccountChoice:
+ return ConnectedAccountChoice(
+ connection_id=credential.id,
+ name=credential.credential_name,
+ state=credential.state,
+ email_address=credential.email_address,
+ )
+
+
+def google_setup_ready_connections(
+ scope_profile: GoogleSetupScopeProfile, visible_credentials: list[GoogleOAuthCredentialBase]
+) -> list[GoogleOAuthCredentialBase]:
+ scope = GOOGLE_SETUP_PROFILE_DATA_SCOPES[scope_profile]
+ return [
+ credential
+ for credential in visible_credentials
+ if credential.state == STATE_ACTIVE and scope in credential.scopes_granted
+ ]
+
+
+def google_setup_notice(
+ *,
+ scope_profile: GoogleSetupScopeProfile,
+ connection_id: str | None,
+ visible_credentials: list[GoogleOAuthCredentialBase],
+) -> GoogleConnectionNotice:
+ """Reconnect only a row that was asked for this profile, since reauthorizing a row replaces its scopes."""
+ scope = GOOGLE_SETUP_PROFILE_DATA_SCOPES[scope_profile]
+ ready = google_setup_ready_connections(scope_profile, visible_credentials)
+ target = next((credential for credential in visible_credentials if credential.id == connection_id), None)
+ if (
+ target is not None
+ and all(credential.id != target.id for credential in ready)
+ and scope in {*target.scopes_granted, *target.scopes_requested}
+ and not _holds_other_profile_grant(target, scope_profile)
+ ):
+ return GoogleConnectionNotice(
+ connectionId=target.id,
+ displayName=target.credential_name,
+ condition="unusable",
+ scopeProfile=scope_profile,
+ origin="setup",
+ )
+ return GoogleConnectionNotice(
+ connectionId=None,
+ condition="unbound",
+ scopeProfile=scope_profile,
+ origin="setup",
+ choices=[_choice(credential) for credential in ready],
+ )
+
+
+def unselected_google_setup_offers(
+ offers: list[GoogleSetupOffer], selected_scopes: list[str]
+) -> list[GoogleSetupOffer]:
+ return [offer for offer in offers if GOOGLE_SETUP_PROFILE_DATA_SCOPES[offer.scope_profile] not in selected_scopes]
+
+
def retain_notices_after_lookup_failure(
*,
current_connection_ids: tuple[str | None, ...],
diff --git a/skyvern/forge/sdk/copilot/human_input_wait.py b/skyvern/forge/sdk/copilot/human_input_wait.py
index 1fa3a1ced..a1a52f095 100644
--- a/skyvern/forge/sdk/copilot/human_input_wait.py
+++ b/skyvern/forge/sdk/copilot/human_input_wait.py
@@ -5,12 +5,15 @@ from __future__ import annotations
import time
from collections.abc import Iterator
from contextlib import contextmanager
-from dataclasses import dataclass
+from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Literal
if TYPE_CHECKING:
from skyvern.forge.sdk.copilot.context import CopilotContext
+# A charged wait can spend the turn; the backstop then waits this long so the tool returns and the turn winds down.
+CHARGED_WAIT_BACKSTOP_GRACE_SECONDS = 30.0
+
@dataclass
class HumanInputWait:
@@ -18,34 +21,61 @@ class HumanInputWait:
started_at: float = 0.0
deadline_when: float | None = None
owner: Literal["question", "credential"] = "question"
+ # When each wait a person answered or worked on was open, in the current overlapping union.
+ attended_spans: list[tuple[float, float]] = field(default_factory=list)
+ # Set once the backstop needed its grace: the turn is past its budget, so later waits no longer pause it.
+ grace_used: bool = False
+
+
+@dataclass
+class HumanInputWaiter:
+ started_at: float
+ # Set by a card that ended with nobody answering it or signing in on it; such a wait counts against the turn.
+ unattended: bool = False
+
+
+def _covered_seconds(spans: list[tuple[float, float]]) -> float:
+ covered, reach = 0.0, float("-inf")
+ for start, end in sorted(spans):
+ if end > reach:
+ covered += end - max(start, reach)
+ reach = end
+ return covered
@contextmanager
-def pause_human_input(ctx: CopilotContext, kind: Literal["question", "credential"]) -> Iterator[None]:
- """Pause the deadline until the last overlapping wait ends; credit their union once."""
+def pause_human_input(ctx: CopilotContext, kind: Literal["question", "credential"]) -> Iterator[HumanInputWaiter]:
+ """Pause the deadline until the last overlapping wait ends, then credit only the time a person was attending."""
wait = ctx.human_input_wait
+ waiter = HumanInputWaiter(started_at=time.monotonic())
if wait.count == 0:
- wait.started_at = time.monotonic()
+ wait.started_at = waiter.started_at
wait.owner = kind
+ wait.attended_spans = []
deadline = ctx.model_stream_deadline
- wait.deadline_when = deadline.when() if deadline is not None else None
+ wait.deadline_when = deadline.when() if deadline is not None and not wait.grace_used else None
if deadline is not None and wait.deadline_when is not None:
deadline.reschedule(None)
wait.count += 1
try:
- yield
+ yield waiter
finally:
+ now = time.monotonic()
+ if not waiter.unattended:
+ wait.attended_spans.append((waiter.started_at, now))
wait.count -= 1
if wait.count == 0:
- elapsed = time.monotonic() - wait.started_at
+ elapsed = _covered_seconds(wait.attended_spans)
if wait.owner == "question":
ctx.copilot_question_pause_seconds += elapsed
elif wait.owner == "credential":
ctx.copilot_credential_pause_seconds += elapsed
deadline = ctx.model_stream_deadline
if deadline is not None and wait.deadline_when is not None and not deadline.expired():
+ resumed_at = wait.deadline_when + elapsed
+ wait.grace_used = resumed_at < now + CHARGED_WAIT_BACKSTOP_GRACE_SECONDS
try:
- deadline.reschedule(wait.deadline_when + elapsed)
+ deadline.reschedule(max(resumed_at, now + CHARGED_WAIT_BACKSTOP_GRACE_SECONDS))
except RuntimeError:
# The owning timeout may already have exited during cancellation.
pass
diff --git a/skyvern/forge/sdk/copilot/narration.py b/skyvern/forge/sdk/copilot/narration.py
index 7e3cde5ef..d526e7868 100644
--- a/skyvern/forge/sdk/copilot/narration.py
+++ b/skyvern/forge/sdk/copilot/narration.py
@@ -59,6 +59,7 @@ _TOOL_ACTIVITY_DISPLAY_LABELS = {
"get_block_schema": "Checking workflow block options",
"get_workflow_knowledge": "Looking up workflow guidance",
"list_integrations": "Checking connected integrations",
+ "request_google_connection": "Preparing a Google connection",
"read_google_sheet": "Reading the Google Sheet",
"get_organization_usage_quota": "Checking account usage",
"inspect_current_workflow": "Inspecting workflow",
@@ -96,6 +97,7 @@ _TOOL_ACTIVITY_DISPLAY_LABELS = {
"start_fresh_browser": "Starting a fresh browser",
"extend_browser_session": "Extending the browser session",
"upload_attached_file": "Attaching your file to the page",
+ "read_attached_pdf": "Reading your attached PDF",
"run_browser_code": "Working in the browser",
"edit_block": "Editing block",
"add_block": "Adding block",
diff --git a/skyvern/forge/sdk/copilot/output_utils.py b/skyvern/forge/sdk/copilot/output_utils.py
index e8bb6b809..1423017f4 100644
--- a/skyvern/forge/sdk/copilot/output_utils.py
+++ b/skyvern/forge/sdk/copilot/output_utils.py
@@ -2271,6 +2271,11 @@ def summarize_tool_result(tool_name: str, result: dict[str, Any], *, for_display
return f"Extended the browser session by {result.get('granted_minutes')} minutes"
if tool_name == "upload_attached_file":
return f"Placed {result.get('filename')} ({result.get('size_bytes')} bytes) in the page's file input"
+ if tool_name == "read_attached_pdf":
+ end = result.get("next_offset") or result.get("total_chars")
+ return (
+ f"Read characters {result.get('offset')}-{end} of {result.get('total_chars')} from {result.get('filename')}"
+ )
if tool_name == "run_browser_code":
operations = result.get("operations")
count = len(operations) if isinstance(operations, list) else 0
diff --git a/skyvern/forge/sdk/copilot/reached_download_target.py b/skyvern/forge/sdk/copilot/reached_download_target.py
index 0fa7943d8..a904eb94d 100644
--- a/skyvern/forge/sdk/copilot/reached_download_target.py
+++ b/skyvern/forge/sdk/copilot/reached_download_target.py
@@ -330,17 +330,36 @@ class DownloadClaimHelperContract:
# The secure runner also accepts its locator facade, but the inline engine accepts strings.
# This model-facing contract advertises only the shape executable by both engines.
selector_types: tuple[str, ...] = ("selector_string",)
+ selector_scope: str = (
+ "Resolved as page.locator(selector) in the top-level page document. It does not enter iframes: any "
+ "selector that places the control under an iframe element, whether by a space or by >>, matches nothing "
+ "and the click times out."
+ )
return_type: str = "string"
return_value: str = "sanitized_suggested_filename"
+ expect_download_call: str = (
+ "async with page.expect_download() as download_info:\n"
+ " await page.frame_locator(iframe_selector).locator(selector).click()\n"
+ "download = await download_info.value"
+ )
+ expect_download_registration: str = (
+ "A saved block can use page.expect_download, although run_browser_code cannot. It captures the download "
+ "its body fires on this page, whether from a control inside an iframe, several steps, or a script. Both "
+ "saved-block engines register that file; download.suggested_filename is its name."
+ )
def to_tool_data(self) -> dict[str, Any]:
return {
"call": self.call,
"parameters": {
"page": {"accepted_type": self.page_type},
- "selector": {"accepted_types": list(self.selector_types)},
+ "selector": {"accepted_types": list(self.selector_types), "scope": self.selector_scope},
},
"returns": {"type": self.return_type, "value": self.return_value},
+ "expect_download": {
+ "call": self.expect_download_call,
+ "registration": self.expect_download_registration,
+ },
}
@@ -389,11 +408,8 @@ def _dict_literal_keys(node: ast.expr) -> set[str]:
def code_uses_download_claim(code: str) -> bool:
"""True when the code calls the worker-owned download claim, the registering terminal for a
fired-download affordance on both engines."""
- if not code.strip():
- return False
- try:
- tree = ast.parse(textwrap.dedent(code).strip() or "pass")
- except SyntaxError:
+ tree = _parse_code(code)
+ if tree is None:
return False
return any(_call_is_download_claim(node) for node in ast.walk(tree) if isinstance(node, (ast.Call, ast.Await)))
@@ -404,6 +420,29 @@ def _call_is_download_claim(node: ast.expr) -> bool:
return isinstance(node, ast.Call) and isinstance(node.func, ast.Name) and node.func.id == DOWNLOAD_CLAIM_HELPER_NAME
+def _parse_code(code: str) -> ast.Module | None:
+ if not code.strip():
+ return None
+ try:
+ return ast.parse(textwrap.dedent(code).strip() or "pass")
+ except SyntaxError:
+ return None
+
+
+def _tree_captures_download(tree: ast.Module) -> bool:
+ return any(
+ _call_is_expect_download(item.context_expr) or _call_is_download_event_capture(item.context_expr)
+ for node in ast.walk(tree)
+ if isinstance(node, (ast.AsyncWith, ast.With))
+ for item in node.items
+ )
+
+
+def code_captures_download(code: str) -> bool:
+ tree = _parse_code(code)
+ return tree is not None and _tree_captures_download(tree)
+
+
def code_is_download_intent(code: str) -> bool:
"""True when a code block authors a download: it uses the `page.expect_download` context-manager
idiom, any event-based `"download"` capture (`wait_for_event`/`expect_event`/`on`/`once`/
@@ -412,17 +451,12 @@ def code_is_download_intent(code: str) -> bool:
every download idiom counts, whether or not the runner accepts it — because
its consumer is the unregistered-download telemetry in workflow/models/block.py, which measures
authorship rather than validity."""
- if not code.strip():
- return False
- try:
- tree = ast.parse(textwrap.dedent(code).strip() or "pass")
- except SyntaxError:
+ tree = _parse_code(code)
+ if tree is None:
return False
+ if _tree_captures_download(tree):
+ return True
for node in ast.walk(tree):
- if isinstance(node, (ast.AsyncWith, ast.With)):
- for item in node.items:
- if _call_is_expect_download(item.context_expr) or _call_is_download_event_capture(item.context_expr):
- return True
if isinstance(node, (ast.Call, ast.Await)) and (
_call_is_download_event_capture(node) or _call_is_download_claim(node)
):
diff --git a/skyvern/forge/sdk/copilot/request_policy.py b/skyvern/forge/sdk/copilot/request_policy.py
index ea8bcc49b..b40b904d2 100644
--- a/skyvern/forge/sdk/copilot/request_policy.py
+++ b/skyvern/forge/sdk/copilot/request_policy.py
@@ -81,6 +81,9 @@ def _parse_final_response(raw: str) -> dict[str, Any]:
_TESTING_INTENTS = {"require_test", "skip_test", "unspecified"}
+_SELECTABLE_GOOGLE_DATA_SCOPES = frozenset(
+ {google_oauth_service.GOOGLE_SHEETS_DATA_SCOPE, google_oauth_service.GOOGLE_GMAIL_READONLY_SCOPE}
+)
_AUTHORING_INTENTS = {"author_now", "defer_authoring"}
DEFER_AUTHORING_DURABLE_FILL_CRITERION_ID = "defer_authoring_durable_fill"
_KINDS = {"none", "raw_secret", "credential_id", "credential_name", "website_stored_credential", "placeholder"}
@@ -246,6 +249,11 @@ _RAW_SECRET_EVIDENCE_BEFORE_URI_VALUE_BOUNDARIES = "=?&#"
_RAW_SECRET_EVIDENCE_AFTER_URI_VALUE_BOUNDARIES = "&#"
_RAW_SECRET_EVIDENCE_SENTENCE_PUNCTUATION = ".,;:!?"
_RAW_SECRET_EVIDENCE_CLOSING_BOUNDARIES = ")]\"}'"
+_RAW_SECRET_EVIDENCE_OPENING_BOUNDARIES = "([{\"'"
+# Only for redacting copies of a citation already verified at the boundaries above: a curly quote or colon can sit
+# inside a secret (Hunter2’Portal!, Hunter2:Portal!), but a verified value's “quoted” or PIN:1234 copy must still go.
+_RAW_SECRET_REDACTION_OPENING_BOUNDARIES = _RAW_SECRET_EVIDENCE_OPENING_BOUNDARIES + "“‘:"
+_RAW_SECRET_REDACTION_CLOSING_BOUNDARIES = _RAW_SECRET_EVIDENCE_CLOSING_BOUNDARIES + "”’"
def _redact_raw_secrets_outside_url_candidates(message: str) -> str:
@@ -312,20 +320,30 @@ def _raw_secret_evidence_is_url_userinfo_password(
return False
-def _raw_secret_evidence_after_is_boundary(evidence: str, message: str, end: int) -> bool:
+def _raw_secret_evidence_after_is_boundary(
+ evidence: str,
+ message: str,
+ end: int,
+ closing_boundaries: str = _RAW_SECRET_EVIDENCE_CLOSING_BOUNDARIES,
+) -> bool:
if end >= len(message):
return True
after = message[end]
- if after.isspace() or after in _RAW_SECRET_EVIDENCE_CLOSING_BOUNDARIES:
+ if after.isspace() or after in closing_boundaries:
return True
if after in _RAW_SECRET_EVIDENCE_SENTENCE_PUNCTUATION:
following = message[end + 1] if end + 1 < len(message) else ""
- if not following or following.isspace() or following in _RAW_SECRET_EVIDENCE_CLOSING_BOUNDARIES:
+ if not following or following.isspace() or following in closing_boundaries:
return True
return not evidence[-1].isalnum() and after in ".,;:?"
-def _raw_secret_evidence_spans(evidence: str | None, user_message: str) -> list[tuple[int, int]]:
+def _raw_secret_evidence_spans(
+ evidence: str | None,
+ user_message: str,
+ opening_boundaries: str = _RAW_SECRET_EVIDENCE_OPENING_BOUNDARIES,
+ closing_boundaries: str = _RAW_SECRET_EVIDENCE_CLOSING_BOUNDARIES,
+) -> list[tuple[int, int]]:
if not evidence or len(evidence) < _MIN_RAW_SECRET_EVIDENCE_CHARS:
return []
message = user_message or ""
@@ -350,7 +368,7 @@ def _raw_secret_evidence_spans(evidence: str | None, user_message: str) -> list[
before_is_boundary = (
not before
or before.isspace()
- or before in "([{\"'"
+ or before in opening_boundaries
or uri_candidate_end is not None
or is_userinfo_password
)
@@ -358,17 +376,30 @@ def _raw_secret_evidence_spans(evidence: str | None, user_message: str) -> list[
uri_candidate_end is not None
and (end == uri_candidate_end or message[end] in _RAW_SECRET_EVIDENCE_AFTER_URI_VALUE_BOUNDARIES)
)
- after_is_boundary = after_is_uri_boundary or _raw_secret_evidence_after_is_boundary(evidence, message, end)
+ after_is_boundary = after_is_uri_boundary or _raw_secret_evidence_after_is_boundary(
+ evidence, message, end, closing_boundaries
+ )
if before_is_boundary and after_is_boundary:
spans.append((index, end))
start = index + 1
def _redact_cited_secrets(message: str, citations: list[str]) -> str:
- spans = sorted(
- (span for citation in citations for span in _raw_secret_evidence_spans(citation, message)),
- key=lambda span: (span[0], span[1]),
- )
+ spans: list[tuple[int, int]] = []
+ for citation in citations:
+ strict = set(_raw_secret_evidence_spans(citation, message))
+ for start, end in _raw_secret_evidence_spans(
+ citation, message, _RAW_SECRET_REDACTION_OPENING_BOUNDARIES, _RAW_SECRET_REDACTION_CLOSING_BOUNDARIES
+ ):
+ if (start, end) not in strict:
+ # Matched only beside a curly quote or colon, so it may be the end of a longer secret
+ # (Hunter2:Portal!); redacting the whole space-delimited token leaves no part of either.
+ while start > 0 and not message[start - 1].isspace():
+ start -= 1
+ while end < len(message) and not message[end].isspace():
+ end += 1
+ spans.append((start, end))
+ spans.sort()
merged: list[tuple[int, int]] = []
for start, end in spans:
if merged and start <= merged[-1][1]:
@@ -994,6 +1025,9 @@ class RequestPolicy:
# seed this turn's test runs before Accept saves it as the workflow's pick.
credential_pause_signed_in_profile_id: str | None = None
credential_pause_signed_in_site: str | None = None
+ # Every login a credential card or a demonstrated fill connected on this turn; each stays the user's own pick
+ # after a later one.
+ credential_pause_connected_credential_ids: set[str] = field(default_factory=set)
# Active Google OAuth connections admitted only for workflow execution. These never enter
# resolved_credentials, which remains the password-fill authority plane from ADR 0002.
run_approved_google_connection_ids: list[str] = field(default_factory=list)
@@ -1002,6 +1036,10 @@ class RequestPolicy:
# seam may separately admit a selected native Sheets citation for that dispatch only when it
# is backed by this turn's server-owned list_integrations result.
selected_connected_account_id: str | None = None
+ # Any validated Google pick, reported to the model as a fact. Only a Sheets pick also becomes
+ # selected_connected_account_id; a Gmail pick never widens run authority.
+ picked_connected_account_id: str | None = None
+ picked_connected_account_scopes: list[str] = field(default_factory=list)
# Sorted at the trace/JSON boundary; YAML traversal uses sets.
existing_workflow_credential_origins: dict[str, list[str]] = field(default_factory=dict)
classifier_status: str = "not_run"
@@ -1046,6 +1084,7 @@ class RequestPolicy:
# only cited does not, because naming a different login declines it.
settled = (
self.current_turn_named_credential_ids
+ | self.credential_pause_connected_credential_ids
| self.prior_approved_credential_ids
| set(self.persisted_workflow_credential_ids)
)
@@ -4788,6 +4827,8 @@ async def _build_request_policy_bootstrap(
}
google_connection_candidates |= _prior_approved_connection_ids(global_llm_context)
policy.selected_connected_account_id = None
+ policy.picked_connected_account_id = None
+ policy.picked_connected_account_scopes = []
if google_connection_candidates or selected_connected_account_id is not None:
try:
active_connections = await google_oauth_service.get_credentials_for_org(organization_id)
@@ -4808,13 +4849,16 @@ async def _build_request_policy_bootstrap(
if connection.id == selected_connected_account_id
and connection.organization_id == organization_id
and connection.state == STATE_ACTIVE
- and google_oauth_service.GOOGLE_SHEETS_DATA_SCOPE in connection.scopes_granted
+ and not _SELECTABLE_GOOGLE_DATA_SCOPES.isdisjoint(connection.scopes_granted)
),
None,
)
if selected is not None:
- policy.selected_connected_account_id = selected.id
- google_connection_candidates.add(selected.id)
+ policy.picked_connected_account_id = selected.id
+ policy.picked_connected_account_scopes = list(selected.scopes_granted)
+ if google_oauth_service.GOOGLE_SHEETS_DATA_SCOPE in selected.scopes_granted:
+ policy.selected_connected_account_id = selected.id
+ google_connection_candidates.add(selected.id)
policy.run_approved_google_connection_ids = sorted(google_connection_candidates & active_ids)
_ground_user_provided_sites(policy, user_message, prior_user_messages or chat_history)
try:
diff --git a/skyvern/forge/sdk/copilot/runtime.py b/skyvern/forge/sdk/copilot/runtime.py
index 863ee7e6e..67b4d162e 100644
--- a/skyvern/forge/sdk/copilot/runtime.py
+++ b/skyvern/forge/sdk/copilot/runtime.py
@@ -456,8 +456,8 @@ class AgentContext:
# The self-heal turn advertises its own browser-only surface rather than resolving one, so it
# names no projection; the shared agent loop still reads this to decide dispatch enforcement.
tool_surface_identity: CopilotToolSurfaceIdentity | None = None
- # True only while a card is on screen. credential_pause_used stays true for the rest of the
- # turn once one has been raised, which cannot tell a concurrent sibling ask from a later one.
+ # True only while a card is on screen; it alone keeps a second card from opening alongside it.
+ # credential_pause_used records that a pick card was raised this turn, so the run-derived ask opens no other.
credential_ask_in_flight: bool = False
credential_pause_used: bool = False
# The deadline the current model stream runs under, published by the enforcement loop so a tool
@@ -811,8 +811,9 @@ class AgentContext:
# The origin a credential fill was refused on, and how far the ask for a login there has got.
# It steers the model and the card; it withdraws no tool.
credential_origin_recovery: CredentialOriginRecovery | None = None
- # Recovery origins that already had their card this turn; each gets the one-card budget back once.
- credential_origin_recovery_carded: set[str] = field(default_factory=set)
+ # Every (origin, credential id) a fill refused this turn. A later pick ask on such a site gets a recovery card,
+ # and its admission check excludes every login refused anywhere on that site.
+ credential_origin_refusals: set[tuple[str, str]] = field(default_factory=set)
@property
def authoring_capability(self) -> AuthoringCapability:
diff --git a/skyvern/forge/sdk/copilot/tools/__init__.py b/skyvern/forge/sdk/copilot/tools/__init__.py
index 716546ae4..9321d094a 100644
--- a/skyvern/forge/sdk/copilot/tools/__init__.py
+++ b/skyvern/forge/sdk/copilot/tools/__init__.py
@@ -9,7 +9,7 @@ import json
import time
from contextlib import nullcontext
from dataclasses import asdict
-from typing import Annotated, Any
+from typing import Annotated, Any, Literal
import structlog
from agents import FunctionTool, function_tool
@@ -145,7 +145,7 @@ from ._shared import _raw_yaml_proxy_location as _raw_yaml_proxy_location
from ._shared import _same_page_ignoring_fragment as _same_page_ignoring_fragment
from ._shared import _unverified_current_workflow_labels as _unverified_current_workflow_labels
from ._shared import admitted_requested_output_reads
-from .attached_file_upload import UPLOAD_TOOL_NAME, upload_attached_file
+from .attached_file_upload import READ_PDF_TOOL_NAME, UPLOAD_TOOL_NAME, read_attached_pdf, upload_attached_file
from .banned_blocks import _COPILOT_BANNED_BLOCK_TYPES as _COPILOT_BANNED_BLOCK_TYPES
from .banned_blocks import AUTHORING_FAMILY_GUIDANCE as AUTHORING_FAMILY_GUIDANCE
from .banned_blocks import CAPTCHA_IMAGE_ELEMENTS
@@ -247,6 +247,7 @@ from .guardrails import (
from .integrations import (
_list_integrations,
_read_google_sheet,
+ _request_google_connection,
)
from .mcp_hooks import _build_skyvern_mcp_overlays as _build_skyvern_mcp_overlays
from .mcp_hooks import _click_post_hook as _click_post_hook
@@ -1302,6 +1303,41 @@ async def list_integrations_tool(ctx: RunContextWrapper) -> str:
return json.dumps(sanitized)
+GOOGLE_SETUP_TOOL_NAME = "request_google_connection"
+
+
+@function_tool(failure_error_function=copilot_tool_failure, name_override=GOOGLE_SETUP_TOOL_NAME)
+async def request_google_connection_tool(
+ ctx: RunContextWrapper,
+ scope_profile: Literal["gmail", "google_sheets"],
+ connection_id: str | None = None,
+) -> str:
+ """Show the user a card in this chat for connecting a Google account under one existing scope
+ profile: `gmail` reads mail (gmail.readonly, no sending) and `google_sheets` reads and writes
+ spreadsheets. The two are separate grants and separate connections, so a workflow that needs
+ both needs one card per profile.
+
+ The card appears with your reply. The user clicks Connect, finishes Google consent in a popup,
+ and then picks the account on the card; that pick reaches you on the next turn as
+ CONNECTED ACCOUNT CHOICE FACTS. This call does not start consent, does not wait for it and does
+ not change the workflow, so nothing is connected when it returns (`status` is `offered`).
+
+ `compatible_connections` lists the active connections that already hold this profile's scope;
+ the card offers them for selection without new consent. With `connection_id`, a connection that
+ was granted for this same profile but is not active gets a reconnect card that keeps its ID
+ (`reconnect_connection_id`); any other ID is not used and comes back as `ignored_connection_id`.
+ """
+ copilot_ctx = ctx.context
+ arguments: dict[str, Any] = {"scope_profile": scope_profile, "connection_id": connection_id}
+ authority_error = _authority_tool_error(copilot_ctx, GOOGLE_SETUP_TOOL_NAME)
+ if authority_error:
+ result: dict[str, Any] = {"ok": False, "error": authority_error}
+ else:
+ result = await _request_google_connection(scope_profile, connection_id, copilot_ctx)
+ record_tool_step_result_for_ctx(copilot_ctx, GOOGLE_SETUP_TOOL_NAME, arguments, result)
+ return json.dumps(result)
+
+
@function_tool(failure_error_function=copilot_tool_failure, name_override="read_google_sheet")
async def read_google_sheet_tool(
ctx: RunContextWrapper,
@@ -2032,6 +2068,25 @@ async def upload_attached_file_tool(ctx: RunContextWrapper, file_id: str, select
return json.dumps(scrub_secrets_from_structure(ctx.context, result))
+@function_tool(failure_error_function=copilot_tool_failure, name_override=READ_PDF_TOOL_NAME)
+async def read_attached_pdf_tool(ctx: RunContextWrapper, file_id: str, offset: int = 0) -> str:
+ """Return the text of a PDF the user attached to this chat (`file_id` exactly as listed in the attached files),
+ without a browser or a workflow run, and without adding anything to the workflow. Long text comes back in windows:
+ `total_chars` is the length of the whole document's text, and passing `next_offset` as `offset` reads the next
+ window (null when this window reaches the end). Any other `offset` is moved back to the start of the window that
+ contains it. Pages past the first 256,000 tokens of a document's text are not
+ extracted, so `total_chars` stops there. Passwords, keys and other secrets in the text read
+ `[REDACTED_SECRET]`. `text_layer_warning` is present when the PDF's embedded font maps characters wrongly, so
+ letters and digits in `text` may not match the page. A PDF whose pages are only images has no text to return."""
+ authority_error = _authority_tool_error(ctx.context, READ_PDF_TOOL_NAME)
+ if authority_error:
+ return _diagnosis_repair_tool_error(ctx.context, READ_PDF_TOOL_NAME, authority_error)
+ result = await read_attached_pdf(ctx.context, file_id, offset)
+ record_tool_step_result_for_ctx(ctx.context, READ_PDF_TOOL_NAME, {"file_id": file_id, "offset": offset}, result)
+ # Unescaped: the output cap counts characters of this string, and \uXXXX escapes would cut the window short.
+ return json.dumps(result, ensure_ascii=False)
+
+
@function_tool(
failure_error_function=copilot_tool_failure, name_override="inspect_page_for_composition", strict_mode=False
)
@@ -2336,6 +2391,7 @@ NATIVE_TOOLS = [
delete_block_tool,
list_credentials_tool,
list_integrations_tool,
+ request_google_connection_tool,
read_google_sheet_tool,
get_organization_usage_quota_tool,
run_blocks_tool,
@@ -2353,6 +2409,7 @@ NATIVE_TOOLS = [
start_fresh_browser_tool,
extend_browser_session_tool,
upload_attached_file_tool,
+ read_attached_pdf_tool,
run_workflow_for_accounts_tool,
get_account_group_status_tool,
cancel_account_group_tool,
@@ -2499,6 +2556,7 @@ def copilot_native_tools(
run_tools_available: bool,
supports_account_group_card: bool = False,
supports_credential_delete_card: bool = False,
+ supports_google_setup_card: bool = False,
) -> list[FunctionTool]:
capability = _normalized_authoring_capability(authoring_capability)
both_families = capability.code_blocks and capability.agent_blocks
@@ -2509,6 +2567,7 @@ def copilot_native_tools(
(tool.name == "ask_user" and not supports_question_tool)
or (tool.name == BROWSER_CODE_TOOL_NAME and not browser_code_available)
or (tool.name in ACCOUNT_GROUP_TOOL_NAMES and not supports_account_group_card)
+ or (tool.name == GOOGLE_SETUP_TOOL_NAME and not supports_google_setup_card)
or (tool.name == ACCOUNT_GROUP_SUBMIT_TOOL_NAME and not account_group_submit_enabled())
or (
tool.name == CREDENTIAL_DELETE_TOOL_NAME
diff --git a/skyvern/forge/sdk/copilot/tools/attached_file_upload.py b/skyvern/forge/sdk/copilot/tools/attached_file_upload.py
index 0a19b3be6..06f4a9a6c 100644
--- a/skyvern/forge/sdk/copilot/tools/attached_file_upload.py
+++ b/skyvern/forge/sdk/copilot/tools/attached_file_upload.py
@@ -1,21 +1,39 @@
from __future__ import annotations
+import asyncio
import hashlib
+import json
import mimetypes
+import tempfile
from typing import Any
+import structlog
from playwright.async_api import FilePayload, Page
+from skyvern.exceptions import PDFParsingError
from skyvern.forge import app
from skyvern.forge.sdk.api.files import resolve_uploaded_file_id
from skyvern.forge.sdk.copilot.context import CopilotContext
+from skyvern.forge.sdk.copilot.llm_config import resolve_raw_secret_safety_handler
+from skyvern.forge.sdk.copilot.request_policy import screen_raw_secret_safety
from skyvern.forge.sdk.copilot.runtime import AgentContext, CopilotBrowserSessionUnavailable
-from skyvern.forge.sdk.copilot.secret_redaction import redact_secretlike_filename
+from skyvern.forge.sdk.copilot.secret_redaction import redact_raw_secrets_for_prompt, redact_secretlike_filename
+from skyvern.forge.sdk.copilot.secret_scrub import scrub_secrets_from_structure
from skyvern.forge.sdk.schemas.workflow_copilot import CopilotAttachedFile
+from skyvern.forge.sdk.utils.pdf_parser import extract_pdf_file, scrambled_text_layer_reason
from ._shared import browser_is_lost, on_working_page
+LOG = structlog.get_logger()
+
UPLOAD_TOOL_NAME = "upload_attached_file"
+READ_PDF_TOOL_NAME = "read_attached_pdf"
+# Measured on the serialized text: the recent-tool-output cut (50k) applies to the JSON string, where
+# newlines and quotes take two characters.
+_READ_WINDOW_SERIALIZED_CHARS = 40_000
+_SCREEN_CONTEXT_CHARS = 2_000
+# Carries no secret keyword, colon or equals sign, so no redaction pattern can match across it.
+_SCREEN_CONTEXT_SEPARATOR = "\n\n----- the text being read starts below this line -----\n\n"
_SET_FILES_TIMEOUT_MS = 15000
_NO_BROWSER = "No browser is open in this chat yet. Navigate to the page with the file input first."
@@ -117,3 +135,96 @@ async def upload_attached_file(ctx: AgentContext, file_id: str, selector: str) -
return result
return await on_working_page(ctx, tool_name=UPLOAD_TOOL_NAME, no_page_error=_NO_PAGE, act=_upload)
+
+
+def _not_attached(file_id: str) -> dict[str, Any]:
+ return {"ok": False, "error": f"{file_id!r} is not an available file attached to this chat."}
+
+
+def _redacted_pdf_text(ctx: AgentContext, data: bytes, filename: str) -> tuple[str, str | None]:
+ with tempfile.NamedTemporaryFile(suffix=".pdf") as handle:
+ handle.write(data)
+ handle.flush()
+ text = extract_pdf_file(handle.name, file_identifier=redact_secretlike_filename(filename))
+ # Redacted before windowing: a value cut across two windows would match neither pattern nor scrub.
+ return redact_raw_secrets_for_prompt(scrub_secrets_from_structure(ctx, text)), scrambled_text_layer_reason(text)
+
+
+def _window_end(text: str, start: int) -> int:
+ window = text[start : start + _READ_WINDOW_SERIALIZED_CHARS]
+ while (size := len(json.dumps(window, ensure_ascii=False))) > _READ_WINDOW_SERIALIZED_CHARS:
+ window = window[: len(window) * _READ_WINDOW_SERIALIZED_CHARS // size]
+ end = start + len(window)
+ if end < len(text):
+ cut = text.rfind("\n", start, end)
+ if cut <= start:
+ cut = text.rfind(" ", start, end)
+ if cut > start:
+ end = cut + 1
+ return end
+
+
+def _window_bounds(text: str, offset: int) -> tuple[int, int]:
+ if offset >= len(text):
+ return len(text), len(text)
+ # Windows start only where an earlier one ended (a line break where possible), so a model-chosen offset
+ # cannot cut a secret in half or away from a label on its line.
+ start, end = 0, _window_end(text, 0)
+ while end <= offset:
+ start, end = end, _window_end(text, end)
+ return start, end
+
+
+async def read_attached_pdf(ctx: AgentContext, file_id: str, offset: int = 0) -> dict[str, Any]:
+ attached = _attached_in_this_turn(ctx, file_id)
+ if attached is None or not attached.available:
+ return _not_attached(file_id)
+ data = await _read_attached_bytes(ctx, file_id)
+ if data is None:
+ return _not_attached(file_id)
+ read: dict[str, Any] = {"file_id": file_id, "filename": redact_secretlike_filename(attached.filename)}
+ try:
+ text, scrambled_reason = await asyncio.to_thread(_redacted_pdf_text, ctx, data, attached.filename)
+ except PDFParsingError:
+ return {**read, "ok": False, "error": "The file could not be read as a PDF."}
+ if not text.strip():
+ return {
+ **read,
+ "ok": False,
+ "error": "The PDF has no text layer (it may be scanned images), so no text could be extracted.",
+ }
+
+ start, end = _window_bounds(text, offset)
+ read.update(offset=start, next_offset=end if end < len(text) else None, total_chars=len(text))
+ if scrambled_reason:
+ read["text_layer_warning"] = scrambled_reason
+ if start == end:
+ return {**read, "ok": True, "text": ""}
+
+ handler = await resolve_raw_secret_safety_handler(ctx.workflow_permanent_id, ctx.organization_id)
+ # The preceding text lets the screen recognise a value whose label ended the previous window; only the text
+ # after the separator is returned.
+ context = text[max(0, start - _SCREEN_CONTEXT_CHARS) : start]
+ screen = await screen_raw_secret_safety(
+ context + _SCREEN_CONTEXT_SEPARATOR + text[start:end], handler, organization_id=ctx.organization_id
+ )
+ screened = screen.canonical_user_message
+ LOG.info(
+ "copilot.attached_pdf_read",
+ file_id=file_id,
+ offset=start,
+ window_chars=end - start,
+ context_chars=len(context),
+ total_chars=len(text),
+ screen_status=screen.status,
+ screen_failure_kind=screen.failure_kind,
+ citation_count=screen.citation_count,
+ screen_latency_ms=round(screen.latency_ms),
+ )
+ if screen.status not in ("clean", "detected") or screened.count(_SCREEN_CONTEXT_SEPARATOR) != 1:
+ return {
+ **read,
+ "ok": False,
+ "error": "This part of the PDF could not be checked for passwords and other secrets, so its text was withheld.",
+ }
+ return {**read, "ok": True, "text": screened.partition(_SCREEN_CONTEXT_SEPARATOR)[2]}
diff --git a/skyvern/forge/sdk/copilot/tools/credential_fill.py b/skyvern/forge/sdk/copilot/tools/credential_fill.py
index 732f98ac8..addc9a4bd 100644
--- a/skyvern/forge/sdk/copilot/tools/credential_fill.py
+++ b/skyvern/forge/sdk/copilot/tools/credential_fill.py
@@ -225,6 +225,7 @@ def _credential_origin_recovery_error(recovery: CredentialOriginRecovery) -> str
def _start_credential_origin_recovery(copilot_ctx: AgentContext, origin: str, credential_id: str) -> dict[str, Any]:
+ copilot_ctx.credential_origin_refusals.add((origin, credential_id))
current = copilot_ctx.credential_origin_recovery
if current is not None and (current.state != "pending" or current.origin != origin):
return {"ok": False, "error": _credential_origin_recovery_error(current)}
@@ -283,8 +284,14 @@ def _decline_credential_origin_recovery(
async def _credential_evidence_admits_origin(
copilot_ctx: AgentContext, recovery: CredentialOriginRecovery, credential: Credential
) -> bool:
- """Whether the credential itself places it on the recovery origin, and nowhere else."""
- if credential.credential_id == recovery.refused_credential_id:
+ """Whether the credential itself places it on the recovery origin, and nowhere else, and no fill on that site
+ refused it this turn."""
+ refused_on_site = {recovery.refused_credential_id} | {
+ refused_id
+ for origin, refused_id in copilot_ctx.credential_origin_refusals
+ if same_release_scope(origin, recovery.origin)
+ }
+ if credential.credential_id in refused_on_site:
return False
try:
vault_sites = await _read_vault_named_sites(copilot_ctx, credential.credential_id)
@@ -686,16 +693,35 @@ async def _request_credential(
recovery_open = copilot_ctx.credential_origin_recovery
# The authenticator update card grants no origin, so it has its own latch and never spends the recovery's.
- recovery = (
- recovery_open
- if not credential_id
- and recovery_open is not None
- and recovery_open.state == "pending"
- and ask_origin.canonical == recovery_open.origin
- else None
+ # Any pick ask on a site where a fill was refused this turn gets a recovery card, so a plain card cannot bind a
+ # refused login there.
+ on_recovery_site = (
+ None
+ if credential_id
+ else next(
+ (
+ earlier
+ for earlier in (
+ recovery_open,
+ *(
+ CredentialOriginRecovery(origin, "declined", refused_id)
+ for origin, refused_id in sorted(copilot_ctx.credential_origin_refusals)
+ ),
+ )
+ if earlier is not None and same_release_scope(login_page_url, earlier.origin)
+ ),
+ None,
+ )
)
- # The spent card, if any, asked for a different site; this ask has a refused fill behind it.
- handback = recovery is not None and recovery.origin not in copilot_ctx.credential_origin_recovery_carded
+ recovery: CredentialOriginRecovery | None = None
+ if on_recovery_site is not None:
+ if recovery_open is not None and recovery_open.state == "pending" and on_recovery_site is not recovery_open:
+ return {"ok": False, "error": _credential_origin_recovery_error(recovery_open)}
+ recovery = (
+ on_recovery_site
+ if on_recovery_site.state == "pending" and on_recovery_site.origin == ask_origin.canonical
+ else CredentialOriginRecovery(ask_origin.canonical, "pending", on_recovery_site.refused_credential_id)
+ )
update_name: str | None = None
site_rejected = bool(credential_id) and rejected_by_site
@@ -706,26 +732,17 @@ async def _request_credential(
update_ask = update_name is not None
# The update ask awaits the vault above, so a card raised meanwhile by a parallel call must still win.
- already_asked = copilot_ctx.credential_ask_in_flight or (
- copilot_ctx.credential_totp_update_asked if update_ask else copilot_ctx.credential_pause_used and not handback
- )
- if already_asked and (recovery is None or copilot_ctx.credential_ask_in_flight):
- already: dict[str, Any] = {
+ if copilot_ctx.credential_ask_in_flight:
+ return {
"ok": True,
"status": "already_asked",
- "next": "Continue without re-asking this turn.",
+ "next": "A credential card is already open; its answer returns on the call that opened it.",
}
- # The outcome belongs to the pick card; the update card keeps none.
- if update_name is None:
- already["outcome"] = copilot_ctx.credential_pause_outcome or "unanswered"
- return already
+ if update_ask and copilot_ctx.credential_totp_update_asked:
+ return {"ok": True, "status": "already_asked", "next": "Continue without re-asking this turn."}
config = copilot_ctx.copilot_config
- if config is None or not credential_pause_transport_ready(
- copilot_ctx, config, allow_second_ask=update_ask or handback
- ):
- if recovery is not None and not handback:
- return _decline_credential_origin_recovery(copilot_ctx, recovery, "already_asked")
+ if config is None or not credential_pause_transport_ready(copilot_ctx, config):
_log_credential_card_unavailable(copilot_ctx, config)
if recovery is not None:
return _decline_credential_origin_recovery(copilot_ctx, recovery, "unavailable")
@@ -746,7 +763,7 @@ async def _request_credential(
if recovery is not None:
login_page_url = urlunsplit(urlsplit(login_page_url)._replace(query="", fragment=""))
copilot_ctx.credential_origin_recovery = replace(recovery, state="asked")
- copilot_ctx.credential_origin_recovery_carded.add(recovery.origin)
+ copilot_ctx.credential_origin_refusals.add((recovery.origin, recovery.refused_credential_id))
admit_connected = partial(_credential_evidence_admits_origin, copilot_ctx, recovery)
named_before_ask = set(policy.current_turn_named_credential_ids)
if update_name is None:
@@ -761,7 +778,6 @@ async def _request_credential(
update_credential_id=credential_id if update_name is not None else None,
update_reason="credential_rejected_by_site" if site_rejected else "credential_missing_totp",
admit_connected=admit_connected,
- allow_second_ask=handback,
anchor_tool_call_id=anchor_tool_call_id,
registration=card_registration,
)
@@ -794,7 +810,10 @@ async def _request_credential(
copilot_ctx.credential_origin_recovery = None
policy.origin_recovery_kept_named_credential_ids |= named_before_ask & {recovery.refused_credential_id}
clear_tool_blocker_signals_for_reason_codes(
- copilot_ctx, frozenset({CREDENTIAL_ORIGIN_RECOVERY_PENDING_REASON_CODE})
+ copilot_ctx,
+ frozenset(
+ {CREDENTIAL_ORIGIN_RECOVERY_PENDING_REASON_CODE, CREDENTIAL_ORIGIN_RECOVERY_DECLINED_REASON_CODE}
+ ),
)
registration_outcome = copilot_ctx.credential_registration_outcome if card_registration is not None else None
registration_note = _REGISTRATION_OUTCOME_NOTES[registration_outcome] if registration_outcome is not None else {}
@@ -807,8 +826,8 @@ async def _request_credential(
}
if card_registration is None:
unanswered["next"] = (
- "The user did not answer the card. Continue without the credential: keep the credential "
- "parameter placeholder in the draft and do not ask again this turn."
+ "The user did not answer the card, so no credential was connected. Keep the credential parameter "
+ "placeholder in the draft."
)
return unanswered
if resolution.signed_in is not None:
@@ -827,16 +846,16 @@ async def _request_credential(
"ok": True,
"status": "connected_unresolved",
"next": (
- "The credential the user connected could not be loaded. Continue without it: keep the credential "
- "parameter placeholder in the draft and do not ask again this turn."
+ "The credential the user connected could not be loaded, so none was connected. Keep the credential "
+ "parameter placeholder in the draft."
),
}
if credential is None:
skipped: dict[str, Any] = {"ok": True, "status": "skipped", **registration_note}
if card_registration is None:
skipped["next"] = (
- "The user chose not to connect a credential now. Keep the credential parameter placeholder "
- "in the draft, do not ask again this turn, and say a test run may stop at the login step."
+ "The user chose not to connect a credential on this card. Keep the credential parameter placeholder "
+ "in the draft, and say a test run may stop at the login step."
)
return skipped
connected: dict[str, Any] = {
@@ -1023,9 +1042,7 @@ async def _credential_fill_origin_grant(
return None, _missing_credential_origin_error(
credential_id,
page_url or None,
- # A spent pick card cannot be raised again this turn, so the confirm wording would promise nothing.
- user_named=policy.current_turn_named_credential_ids == {credential_id}
- and not copilot_ctx.credential_pause_used,
+ user_named=policy.current_turn_named_credential_ids == {credential_id},
)
if not isinstance(policy, RequestPolicy):
diff --git a/skyvern/forge/sdk/copilot/tools/credentials.py b/skyvern/forge/sdk/copilot/tools/credentials.py
index 6653918f1..32e2b917b 100644
--- a/skyvern/forge/sdk/copilot/tools/credentials.py
+++ b/skyvern/forge/sdk/copilot/tools/credentials.py
@@ -982,8 +982,9 @@ def _typed_resume_arm(reference: str, policy: RequestPolicy, matches: list[Crede
# resolve exactly one leaves the not-found and ambiguous answers below to report themselves.
return len(matches) != 1 or matches[0].credential_id == credential.credential_id
+ named_this_turn = policy.current_turn_named_credential_ids | policy.credential_pause_connected_credential_ids
if any(
- credential.credential_id in policy.current_turn_named_credential_ids
+ credential.credential_id in named_this_turn
and reference in {credential.credential_id, credential.name}
and keyed(credential)
for credential in policy.resolved_credentials
diff --git a/skyvern/forge/sdk/copilot/tools/integrations.py b/skyvern/forge/sdk/copilot/tools/integrations.py
index 9b4d69fe4..3c90db991 100644
--- a/skyvern/forge/sdk/copilot/tools/integrations.py
+++ b/skyvern/forge/sdk/copilot/tools/integrations.py
@@ -8,6 +8,12 @@ from typing import Any, Literal
import structlog
from skyvern.forge import app
+from skyvern.forge.sdk.copilot.context import CopilotContext
+from skyvern.forge.sdk.copilot.google_connection_notice import (
+ GoogleSetupScopeProfile,
+ google_setup_notice,
+ google_setup_ready_connections,
+)
from skyvern.forge.sdk.copilot.request_policy import RequestPolicy
from skyvern.forge.sdk.copilot.runtime import AgentContext
from skyvern.forge.sdk.copilot.secret_scrub import scrub_secrets_from_structure
@@ -76,6 +82,30 @@ async def _list_integrations(params: dict[str, Any], ctx: AgentContext) -> dict[
}
+async def _request_google_connection(
+ scope_profile: GoogleSetupScopeProfile, connection_id: str | None, ctx: CopilotContext
+) -> dict[str, Any]:
+ visible = await google_oauth_service.get_visible_credentials_for_org(ctx.organization_id)
+ notice = google_setup_notice(scope_profile=scope_profile, connection_id=connection_id, visible_credentials=visible)
+ ctx.google_setup_notices = [
+ *(existing for existing in ctx.google_setup_notices if existing.scopeProfile != scope_profile),
+ notice,
+ ]
+ data: dict[str, Any] = {
+ "status": "offered",
+ "scope_profile": scope_profile,
+ "card": "reconnect" if notice.connectionId else "connect",
+ "compatible_connections": [
+ _serialize(credential, "google") for credential in google_setup_ready_connections(scope_profile, visible)
+ ],
+ }
+ if notice.connectionId:
+ data["reconnect_connection_id"] = notice.connectionId
+ elif connection_id:
+ data["ignored_connection_id"] = connection_id
+ return {"ok": True, "data": data}
+
+
@dataclass(frozen=True)
class _SheetOpenAttempt:
status: SheetConnectionStatus
diff --git a/skyvern/forge/sdk/copilot/tools/locator_inspection.py b/skyvern/forge/sdk/copilot/tools/locator_inspection.py
index cf23b5c5b..341c1ebe5 100644
--- a/skyvern/forge/sdk/copilot/tools/locator_inspection.py
+++ b/skyvern/forge/sdk/copilot/tools/locator_inspection.py
@@ -12,10 +12,11 @@ visible. It reports; it does not rank, score, generate a selector, or name a can
from __future__ import annotations
import asyncio
+import contextlib
from typing import Any
from playwright.async_api import Error as PlaywrightError
-from playwright.async_api import Page
+from playwright.async_api import Locator, Page
from skyvern.forge.sdk.copilot.browser_target import BrowserTarget
from skyvern.webeye.utils.page import OTP_INPUT_PRIVACY_JS
@@ -30,9 +31,10 @@ OUTER_HTML_CHARS = 1200
TOOL_DESCRIPTION = (
"Inspect Playwright locators being considered for a repair. Pass the failed authored locator "
- "and concrete alternatives before editing. Returns match counts and bounded DOM facts for each "
- "match, including descendants, so container elements can be distinguished from controls or "
- "value-bearing nodes. It reports facts only and does not rank or choose a locator."
+ "and concrete alternatives before editing. Returns match counts and, for each match, whether "
+ "Playwright considers it visible and bounded DOM facts including descendants, so container "
+ "elements can be distinguished from controls or value-bearing nodes. It reports facts only and "
+ "does not rank or choose a locator."
)
TOOL_SCHEMA: dict[str, Any] = {
@@ -87,6 +89,21 @@ _MATCH_FACTS = (
SELECTOR_BUDGET_SECONDS = 8.0
+async def _match_facts(match: Locator, expression: str, index: int) -> dict[str, Any]:
+ # One handle for both reads: a Locator finds its element again on each call, so after a navigation its
+ # evaluate would read the new page beside an is_visible() that Playwright 1.46 answers False for the old one.
+ handle = await match.element_handle()
+ try:
+ visible = await handle.is_visible()
+ facts = await handle.evaluate(expression)
+ finally:
+ with contextlib.suppress(PlaywrightError):
+ await handle.dispose()
+ facts["index"] = index
+ facts["visible"] = visible
+ return facts
+
+
async def inspect_locator_matches(page: Page, selectors: list[str]) -> dict[str, Any]:
"""Bounded facts for each selector's matches on this page. Read-only: it never navigates."""
expression = _MATCH_FACTS % {
@@ -112,11 +129,12 @@ async def inspect_locator_matches(page: Page, selectors: list[str]) -> dict[str,
matches: list[dict[str, Any]] = []
for index in range(min(count, MAX_MATCHES)):
try:
- facts = await asyncio.wait_for(locator.nth(index).evaluate(expression), timeout=SELECTOR_BUDGET_SECONDS)
+ facts = await asyncio.wait_for(
+ _match_facts(locator.nth(index), expression, index), SELECTOR_BUDGET_SECONDS
+ )
except (PlaywrightError, TimeoutError) as exc:
matches.append({"index": index, "error": f"{type(exc).__name__}: {exc}"})
continue
- facts["index"] = index
matches.append(facts)
entry["matches"] = matches
results.append(entry)
diff --git a/skyvern/forge/sdk/copilot/tools/page_challenge.py b/skyvern/forge/sdk/copilot/tools/page_challenge.py
index dd4690787..1bed0c110 100644
--- a/skyvern/forge/sdk/copilot/tools/page_challenge.py
+++ b/skyvern/forge/sdk/copilot/tools/page_challenge.py
@@ -103,13 +103,17 @@ async def _run_ladder(ctx: AgentContext, page: Page, session_id: str) -> dict[st
return {"ok": True, "outcome": "unavailable", "detail": _OUTCOME_TEXT["unavailable"]}
unsolved: dict[str, Any] = {"ok": True, "outcome": "unsolved", "detail": _OUTCOME_TEXT["unsolved"]}
try:
- async with asyncio.timeout(SOLVE_CEILING_SECONDS):
- challenge = await solve_challenge(
- page,
- organization_id=ctx.organization_id,
- browser_session_id=session_id,
- probe_child_frames=True,
- )
+ with app.AGENT_FUNCTION.challenge_solve_recording(
+ "copilot", page=page, organization_id=ctx.organization_id, browser_session_id=session_id
+ ) as record:
+ async with asyncio.timeout(SOLVE_CEILING_SECONDS):
+ challenge = await solve_challenge(
+ page,
+ organization_id=ctx.organization_id,
+ browser_session_id=session_id,
+ probe_child_frames=True,
+ )
+ record.challenge = challenge
except TimeoutError:
return {**unsolved, "timed_out": True, "detail": f"The solver did not finish in {SOLVE_CEILING_SECONDS}s."}
except Exception:
@@ -128,10 +132,14 @@ async def _read_image(ctx: AgentContext, page: Page, session_id: str, image: str
return {**unsolved, "read_limit_reached": True, "detail": _IMAGE_OUTCOME_TEXT["read_limit_reached"]}
ctx.image_captcha_reads += 1
try:
- async with asyncio.timeout(SOLVE_CEILING_SECONDS):
- await _code_block_solve_captcha_builtin(
- page, organization_id=ctx.organization_id, browser_session_id=session_id, image=image, input=input
- )
+ # The builtin records into this outer record, so the row names copilot as its client.
+ with app.AGENT_FUNCTION.challenge_solve_recording(
+ "copilot", page=page, organization_id=ctx.organization_id, browser_session_id=session_id
+ ):
+ async with asyncio.timeout(SOLVE_CEILING_SECONDS):
+ await _code_block_solve_captcha_builtin(
+ page, organization_id=ctx.organization_id, browser_session_id=session_id, image=image, input=input
+ )
except CodeBlockCaptchaError:
return unsolved
except TimeoutError:
diff --git a/skyvern/forge/sdk/copilot/tools/workflow_update.py b/skyvern/forge/sdk/copilot/tools/workflow_update.py
index 9cc6e7c76..43cd25a5e 100644
--- a/skyvern/forge/sdk/copilot/tools/workflow_update.py
+++ b/skyvern/forge/sdk/copilot/tools/workflow_update.py
@@ -86,6 +86,7 @@ from skyvern.forge.sdk.copilot.output_policy import (
from skyvern.forge.sdk.copilot.output_utils import _BUILD_TEST_WORKFLOW_MAX_CHARS, INTERNAL_VALIDATION_FAILURE_PREFIX
from skyvern.forge.sdk.copilot.reached_download_target import (
REGISTERED_DOWNLOAD_OUTPUT_KEYS,
+ code_captures_download,
code_uses_download_claim,
)
from skyvern.forge.sdk.copilot.request_policy import (
@@ -3663,12 +3664,14 @@ def _artifact_declares_registration_keys(artifact: Mapping[str, Any]) -> bool:
def _is_download_intent(artifact: Mapping[str, Any], code: str) -> bool:
"""Disjoint from extraction-intent (`goal_value_paths` on non-registration keys):
- a block is download-intent when it claims a download, self-asserts a registration key in a
- top-level dict, or declares a registration key as a goal path."""
+ a block is download-intent when it claims a download, captures one in a `with` block
+ (`page.expect_download()` or an `expect_event("download")` capture), self-asserts a registration
+ key in a top-level dict, or declares a registration key as a goal path."""
if not code.strip():
return False
return (
code_uses_download_claim(code)
+ or code_captures_download(code)
or _code_returns_registration_keys(code)
or _artifact_declares_registration_keys(artifact)
)
diff --git a/skyvern/forge/sdk/copilot/turn_outcome.py b/skyvern/forge/sdk/copilot/turn_outcome.py
index 74acb12ce..d1d20701d 100644
--- a/skyvern/forge/sdk/copilot/turn_outcome.py
+++ b/skyvern/forge/sdk/copilot/turn_outcome.py
@@ -7,7 +7,7 @@ schemas can embed ``TurnOutcome`` without importing copilot business logic.
from __future__ import annotations
import json
-from collections.abc import Iterable
+from collections.abc import Iterable, Sequence
from typing import Any, Literal
import structlog
@@ -42,7 +42,9 @@ def connected_account_choice_context(
outcome: TurnOutcome | None,
*,
explicit_selected_connection_id: str | None = None,
+ explicit_selected_connection_scopes: Sequence[str] = (),
from_pending_proposal: bool = False,
+ reshown_setup_profiles: Sequence[str] = (),
) -> str:
"""Expose the validated picker selection as context; authorization remains in request policy."""
choices = outcome.connected_account_choices if outcome is not None else None
@@ -54,6 +56,13 @@ def connected_account_choice_context(
if explicit_selected_connection_id is not None:
payload["selection_source"] = "pending_proposal_binding" if from_pending_proposal else "user_picker"
payload["selected_connection_id"] = explicit_selected_connection_id
+ payload["selected_connection"] = {
+ "connection_id": explicit_selected_connection_id,
+ "state": "active",
+ "scopes_granted": list(explicit_selected_connection_scopes),
+ }
+ if reshown_setup_profiles:
+ payload["unselected_setup_cards_shown_again"] = list(reshown_setup_profiles)
return json.dumps(payload, separators=(",", ":"))
diff --git a/skyvern/forge/sdk/core/skyvern_context.py b/skyvern/forge/sdk/core/skyvern_context.py
index d418d264d..9aaf2f281 100644
--- a/skyvern/forge/sdk/core/skyvern_context.py
+++ b/skyvern/forge/sdk/core/skyvern_context.py
@@ -1000,6 +1000,8 @@ class SkyvernContext:
# (no solver identity — a pre-entry check can't know it without running the detector); a url
# change re-opens it. None means not latched. Opaque comparison string only; never log it.
captcha_solve_latch_key: str | None = None
+ # Challenge-solve calls recorded per run id in this run's context; the solve ledger's attempt number.
+ challenge_solve_attempts: dict[str, int] = field(default_factory=dict)
# Browser dialogs captured since the last agent prompt build, surfaced into the
# next extract-action prompt so the LLM can react to validation rejections.
diff --git a/skyvern/forge/sdk/db/repositories/credentials.py b/skyvern/forge/sdk/db/repositories/credentials.py
index 0590ca112..bac449cd0 100644
--- a/skyvern/forge/sdk/db/repositories/credentials.py
+++ b/skyvern/forge/sdk/db/repositories/credentials.py
@@ -171,6 +171,7 @@ class CredentialRepository(BaseRepository):
created_by: str | None,
set_folder_on_update: bool = True,
authorize_update: Callable[[AsyncSession, str], Awaitable[None]] | None = None,
+ commit: bool = True,
) -> tuple[Credential, bool]:
async with self.Session() as session:
insert = sqlite_insert if session.get_bind().dialect.name == "sqlite" else pg_insert
@@ -219,12 +220,14 @@ class CredentialRepository(BaseRepository):
if not created:
credential.name = name
credential.credential_type = credential_type.value
- credential.tested_url = tested_url
if set_folder_on_update:
credential.folder_id = folder_id
credential.upstream_missing_at = None
- await session.commit()
- await session.refresh(credential)
+ if commit:
+ await session.commit()
+ await session.refresh(credential)
+ else:
+ await session.flush()
return Credential.model_validate(credential), created
@db_operation("update_onepassword_credential_metadata")
@@ -235,7 +238,6 @@ class CredentialRepository(BaseRepository):
authorized_folder_id: str | None,
name: str,
credential_type: CredentialType,
- tested_url: str | None,
) -> bool:
async with self.Session() as session:
result = await session.execute(
@@ -250,7 +252,6 @@ class CredentialRepository(BaseRepository):
.values(
name=name,
credential_type=credential_type.value,
- tested_url=tested_url,
upstream_missing_at=None,
modified_at=naive_utc_now(),
)
diff --git a/skyvern/forge/sdk/db/repositories/workflow_run_attempts.py b/skyvern/forge/sdk/db/repositories/workflow_run_attempts.py
index dd3e3d404..fca6320f2 100644
--- a/skyvern/forge/sdk/db/repositories/workflow_run_attempts.py
+++ b/skyvern/forge/sdk/db/repositories/workflow_run_attempts.py
@@ -846,7 +846,8 @@ class WorkflowRunAttemptsRepository(BaseRepository):
final_exhausted_projection: WebhookDeliveryStatus | None = None,
expected_status: str | None = None,
expected_finished_at: datetime | None = None,
- ) -> int | None:
+ ) -> tuple[int | None, bool]:
+ """Return the reservation and whether it wrote a final run projection."""
if kind == "interim":
completion_column = WorkflowRunAttemptModel.interim_webhook_sent_at
progress_column = WorkflowRunAttemptModel.interim_side_effects_progress
@@ -887,11 +888,12 @@ class WorkflowRunAttemptsRepository(BaseRepository):
.with_for_update()
)
if attempt is None:
- return None
+ return None, False
progress = dict(getattr(attempt, progress_column.key) or {})
delivery_attempts = progress.get("webhook_delivery_attempts", 0)
now = naive_utc_now()
values: dict[str, Any] = {"modified_at": now}
+ projection_written = False
if delivery_attempts >= max_attempts:
# A process can stop after reserving its last call, before recording exhaustion.
progress["webhook_delivery_exhausted_at"] = now.isoformat()
@@ -906,13 +908,14 @@ class WorkflowRunAttemptsRepository(BaseRepository):
if resolved != run.webhook_delivery_status:
run.webhook_delivery_status = resolved
run.webhook_delivery_finalized_at = now
+ projection_written = True
else:
reserved_attempt = delivery_attempts + 1
progress["webhook_delivery_attempts"] = reserved_attempt
values[progress_column.key] = merge_attempt_progress(progress_column, progress, session.bind.dialect.name)
await session.execute(update(WorkflowRunAttemptModel).where(*conditions).values(**values))
await session.commit()
- return reserved_attempt
+ return reserved_attempt, projection_written
@db_operation("claim_attempt_webhook")
async def claim_attempt_webhook(
diff --git a/skyvern/forge/sdk/db/repositories/workflow_runs.py b/skyvern/forge/sdk/db/repositories/workflow_runs.py
index ff2f2dc78..3f5e8c381 100644
--- a/skyvern/forge/sdk/db/repositories/workflow_runs.py
+++ b/skyvern/forge/sdk/db/repositories/workflow_runs.py
@@ -3151,6 +3151,8 @@ class WorkflowRunsRepository(BaseRepository):
ordering: tuple[str, str] | None = None,
search_key: str | None = None,
error_code: str | None = None,
+ created_at_start: datetime | None = None,
+ created_at_end: datetime | None = None,
) -> list[WorkflowRun]:
await _hidden_workflow_ids(organization_id) # before checking out a connection
async with self.Session() as session:
@@ -3178,6 +3180,11 @@ class WorkflowRunsRepository(BaseRepository):
if status:
query = query.filter(WorkflowRunModel.status.in_(status))
+ # created_at is naive UTC; an aware bound compared as-is would shift by its offset.
+ if created_at_start is not None:
+ query = query.filter(WorkflowRunModel.created_at >= to_naive_utc(created_at_start))
+ if created_at_end is not None:
+ query = query.filter(WorkflowRunModel.created_at < to_naive_utc(created_at_end))
allowed_ordering_fields = {
"created_at": WorkflowRunModel.created_at,
diff --git a/skyvern/forge/sdk/experimentation/workflow_block_engine.py b/skyvern/forge/sdk/experimentation/workflow_block_engine.py
index 018620154..304027abc 100644
--- a/skyvern/forge/sdk/experimentation/workflow_block_engine.py
+++ b/skyvern/forge/sdk/experimentation/workflow_block_engine.py
@@ -203,8 +203,8 @@ def _is_kept_workflow_run(workflow_status: WorkflowStatus, trigger_type: Workflo
# test-login and SDK endpoints mint and run in one request, and enrolling those would move standing
# API traffic rather than the workflows a customer keeps; the birth version's status would be the
# wrong test, because the prompt box writes version 1 as auto_generated and the editor save that
- # keeps it writes the next as published. The job-recipe endpoints are per-call too but build a
- # published definition, so only their trigger kind excludes them.
+ # keeps it writes the next as published. The job-recipe endpoints are per-call too; their trigger
+ # kind also excludes recipe workflows created as published before recipes switched to auto_generated.
return workflow_status != WorkflowStatus.auto_generated and trigger_type not in PER_CALL_WORKFLOW_RUN_TRIGGER_TYPES
@@ -309,9 +309,9 @@ async def resolve_workflow_block_engine_arm(
``workflow_status`` is the status of the version this run executes and ``trigger_type`` is how
the run was launched. Together they are what separates a workflow a customer keeps from the
- per-call throwaways several endpoints mint and run in one request: most of those run while still
- auto_generated, and the job-recipe endpoints build a published definition, so neither test alone
- covers them.
+ per-call throwaways several endpoints mint and run in one request: those run while still
+ auto_generated, except job-recipe workflows created as published before recipes switched to
+ auto_generated, which only the trigger kind covers.
``pinned_v1_blocks`` counts blocks a person pinned to skyvern-1.0 (see ``pinned_v1_block_count``);
eligibility already keeps such a run out of the A/B, and this labels it ``pinned_v1_engine``.
diff --git a/skyvern/forge/sdk/forge_log.py b/skyvern/forge/sdk/forge_log.py
index 03cd976ab..b01a8940c 100644
--- a/skyvern/forge/sdk/forge_log.py
+++ b/skyvern/forge/sdk/forge_log.py
@@ -1785,6 +1785,11 @@ def setup_logger() -> None:
logging.getLogger("LiteLLM Router").setLevel(logging.CRITICAL)
logging.getLogger("LiteLLM Proxy").setLevel(logging.CRITICAL)
+ # pypdf reports recoverable per-font and per-object decode problems while it keeps parsing, some at
+ # ERROR (one "Advanced encoding ... not implemented yet" per font per page); lower this locally only
+ # to debug one PDF's extraction.
+ logging.getLogger("pypdf").setLevel(logging.CRITICAL)
+
# The OTLP gRPC exporter logs a WARNING per retry and an ERROR per dropped batch when its
# endpoint is unreachable; raise its threshold via OTEL_EXPORTER_LOG_LEVEL (default WARNING) to
# drop that spam where the endpoint is intentionally unavailable, keeping it visible elsewhere.
diff --git a/skyvern/forge/sdk/routes/agent_protocol.py b/skyvern/forge/sdk/routes/agent_protocol.py
index 25880c021..461d60d23 100644
--- a/skyvern/forge/sdk/routes/agent_protocol.py
+++ b/skyvern/forge/sdk/routes/agent_protocol.py
@@ -8,7 +8,7 @@ import time
import unicodedata
from collections.abc import AsyncIterator, Sequence
from dataclasses import asdict, dataclass
-from datetime import UTC, datetime
+from datetime import UTC, datetime, timedelta
from enum import Enum
from typing import Annotated, Any
from urllib.parse import parse_qs, quote, urlparse
@@ -78,6 +78,7 @@ from skyvern.forge.sdk.core.curl_converter import curl_to_http_request_block_par
from skyvern.forge.sdk.core.permissions.permission_checker_factory import PermissionCheckerFactory
from skyvern.forge.sdk.core.run_submission_gate import OPENAPI_SHED_RESPONSE, run_submission_slot
from skyvern.forge.sdk.core.security import generate_skyvern_signature
+from skyvern.forge.sdk.db.datetime_utils import naive_utc_now, to_naive_utc
from skyvern.forge.sdk.db.enums import (
OrganizationAuthTokenType,
is_job_recipe_workflow_run_trigger_type,
@@ -1249,76 +1250,6 @@ async def _validate_file_size(file: UploadFile) -> UploadFile:
)
-@legacy_base_router.post(
- "/workflows/sop-to-blocks",
- response_model=dict[str, Any],
- include_in_schema=False,
-)
-@legacy_base_router.post(
- "/workflows/sop-to-blocks/",
- response_model=dict[str, Any],
- include_in_schema=False,
-)
-async def convert_sop_to_blocks(
- file: UploadFile = Depends(_validate_file_size),
- current_org: Organization = Depends(org_auth_service.get_current_org),
-) -> dict[str, Any]:
- """Convert a PDF SOP to workflow blocks without creating a workflow."""
- analytics.capture(
- "skyvern-oss-workflow-sop-to-blocks",
- data={"organization_id": current_org.organization_id},
- )
-
- # Validate PDF
- if not file.filename or not file.filename.lower().endswith(".pdf"):
- raise HTTPException(status_code=400, detail="Only PDF files are supported.")
-
- try:
- file_contents = await file.read()
- file_name = file.filename
- finally:
- await file.close()
-
- # Extract text from PDF
- sop_text = await asyncio.to_thread(
- pdf_import_service.extract_text_from_pdf,
- file_contents,
- file_name,
- )
-
- # Convert to workflow definition via LLM
- try:
- result = await pdf_import_service.create_workflow_from_sop_text(sop_text, current_org)
- except HTTPException:
- raise
- except Exception as e:
- LOG.exception(
- "Failed to convert SOP to blocks",
- organization_id=current_org.organization_id,
- filename=file_name,
- )
- raise HTTPException(
- status_code=422,
- detail="Failed to convert SOP to workflow blocks. Please verify the PDF content and try again.",
- ) from e
-
- workflow_def = result.get("workflow_definition", {})
-
- # Transform blocks: convert parameter_keys (backend format) to parameters (frontend format)
- # This is done here rather than in _sanitize_workflow_json because the import-pdf endpoint
- # needs the backend format for WorkflowCreateYAMLRequest validation
- # Create shallow copies to avoid mutating shared data structures
- blocks = [dict(block) for block in workflow_def.get("blocks", [])]
- for block in blocks:
- parameter_keys = block.pop("parameter_keys", None) or []
- block["parameters"] = [{"key": key} for key in parameter_keys]
-
- return {
- "blocks": blocks,
- "parameters": workflow_def.get("parameters", []),
- }
-
-
@legacy_base_router.post(
"/workflows/import-pdf",
response_model=dict[str, Any],
@@ -4942,6 +4873,26 @@ _WORKFLOW_RUNS_SEARCH_TIMEOUT_DETAIL = (
"Free-text run search exceeded its time limit. Retry with a created_at_start/created_at_end "
"window of a few weeks or less, or search an exact browser profile or session ID."
)
+# Unindexed free text walks the org's run history newest-first, so without a caller start it is bounded to
+# the window before the caller's end (or now). A product guardrail, not a measured optimum.
+_ORG_RUNS_SEARCH_DEFAULT_WINDOW = timedelta(days=30)
+_ORG_RUNS_SEARCH_TIMEOUT_DETAIL = (
+ "Free-text run search exceeded its time limit. Retry with a narrower created_at_start/created_at_end "
+ "window (a search without created_at_start covers only the 30 days before created_at_end or now), or "
+ "search an exact browser profile or session ID."
+)
+_ORG_RUNS_SEARCH_KEY_DESCRIPTION = (
+ _WORKFLOW_RUN_SEARCH_KEY_DESCRIPTION + " Without created_at_start, a search other than a complete browser "
+ "profile or session ID covers only runs created in the 30 days before created_at_end (or before now)."
+)
+_ORG_RUNS_CREATED_AT_START_DESCRIPTION = (
+ "Only include runs created at or after this timestamp (ISO 8601; a value without an offset is read as UTC). "
+ "Supplying it replaces the 30-day default window of a free-text search_key."
+)
+_ORG_RUNS_CREATED_AT_END_DESCRIPTION = (
+ "Only include runs created strictly before this timestamp (ISO 8601; a value without an offset is read as "
+ "UTC). Without created_at_start, a free-text search_key covers the 30 days before this timestamp."
+)
def _runs_list_filter_names(**filters: object | None) -> list[str]:
@@ -5379,6 +5330,15 @@ async def run_workflow_legacy(
"selected from a pool or fell back to, or the credential bound by a credential parameter on the "
"run's workflow version when the run was created and the run recorded no selection for that "
"parameter. Other pool and fallback members the run did not use do not match.\n\n"
+ "### Default search window\n\n"
+ "A `search_key` other than a complete browser profile or session id is matched only against runs created "
+ "in the **30 days before `created_at_end`** (or before now) unless the request supplies `created_at_start`. "
+ "This includes complete run and credential ids. Supply `created_at_start` (and optionally `created_at_end`) "
+ "to search a different range. Listings without `search_key` are not windowed. To fetch one run by its id, "
+ "use `GET /v1/runs/{run_id}`.\n\n"
+ "### created_at_start / created_at_end\n\n"
+ "Optional ISO 8601 bounds on the run's creation time: `created_at_start` is inclusive and "
+ "`created_at_end` is exclusive. A timestamp without an offset is read as UTC.\n\n"
"### error_code\n\n"
"An **exact-match** filter against the `error_code` field inside each task's `errors` JSON array. "
"A run matches if **any** of its tasks contains an error object with a matching `error_code` value. "
@@ -5388,7 +5348,10 @@ async def run_workflow_legacy(
"All query parameters use AND logic:\n"
"- `?status=failed` — only failed runs\n"
"- `?status=failed&error_code=LOGIN_FAILED` — failed runs **and** have a LOGIN_FAILED error\n"
- "- `?status=failed&error_code=LOGIN_FAILED&search_key=prod_credential` — all three conditions must match"
+ "- `?status=failed&error_code=LOGIN_FAILED&search_key=prod_credential` — all three conditions must match "
+ "(searched over the last 30 days)\n"
+ "- `?search_key=prod_credential&created_at_start=2026-01-01T00:00:00Z&created_at_end=2026-02-01T00:00:00Z` "
+ "— search one explicit month"
),
summary="Get all runs",
openapi_extra={
@@ -5420,7 +5383,7 @@ async def get_workflow_runs(
search_key: str | None = Query(
None,
max_length=500,
- description=_WORKFLOW_RUN_SEARCH_KEY_DESCRIPTION,
+ description=_ORG_RUNS_SEARCH_KEY_DESCRIPTION,
examples=_RUN_SEARCH_KEY_EXAMPLES,
),
error_code: str | None = Query(
@@ -5433,6 +5396,14 @@ async def get_workflow_runs(
),
examples=["INVALID_CREDENTIALS", "LOGIN_FAILED", "CAPTCHA_DETECTED"],
),
+ created_at_start: Annotated[
+ datetime | None,
+ Query(description=_ORG_RUNS_CREATED_AT_START_DESCRIPTION, examples=["2026-01-01T00:00:00Z"]),
+ ] = None,
+ created_at_end: Annotated[
+ datetime | None,
+ Query(description=_ORG_RUNS_CREATED_AT_END_DESCRIPTION, examples=["2026-02-01T00:00:00Z"]),
+ ] = None,
current_org: Organization = Depends(org_auth_service.get_current_org),
) -> list[WorkflowRun]:
"""
@@ -5455,18 +5426,36 @@ async def get_workflow_runs(
credential parameter on the run's workflow version when the run was created and the run recorded no
selection for that parameter.
+ A `search_key` other than a complete browser profile or session ID (run and credential IDs included)
+ searches only runs created in the 30 days before `created_at_end` (or before now) unless
+ `created_at_start` is supplied. Listings without `search_key` are not windowed.
+
+ **created_at_start** (inclusive) and **created_at_end** (exclusive) bound the run's creation time;
+ a timestamp without an offset is read as UTC.
+
**error_code** performs an exact match against the `error_code` field in the `errors`
JSON array on each task. A run matches if *any* of its tasks has a matching error code.
**Examples:**
- All failed runs: `?status=failed`
- Failed runs with a specific error: `?status=failed&error_code=INVALID_CREDENTIALS`
- - Runs matching a parameter value: `?search_key=https://example.com`
- - Runs matching a run ID: `?search_key=wr_abc123`
- - Runs that used a credential: `?search_key=cred_123456789`
+ - Runs from the last 30 days matching a parameter value: `?search_key=https://example.com`
+ - Runs from the last 30 days matching a run ID: `?search_key=wr_abc123`
+ - Runs from the last 30 days that used a credential: `?search_key=cred_123456789`
+ - An older range: `?search_key=my_credential&created_at_start=2026-01-01T00:00:00Z`
- Combined: `?status=failed&error_code=LOGIN_FAILED&search_key=my_credential`
"""
analytics.capture("skyvern-oss-agent-workflow-runs-get")
+ default_window_applied = (
+ bool(search_key and not is_indexed_runs_list_search_key(search_key)) and created_at_start is None
+ )
+ effective_created_at_start = created_at_start
+ if default_window_applied:
+ window_end = to_naive_utc(created_at_end) or naive_utc_now()
+ # Floor instead of subtracting past datetime.min, which would raise OverflowError and surface as a 500.
+ effective_created_at_start = max(window_end, datetime.min + _ORG_RUNS_SEARCH_DEFAULT_WINDOW) - (
+ _ORG_RUNS_SEARCH_DEFAULT_WINDOW
+ )
try:
return await app.WORKFLOW_SERVICE.get_workflow_runs(
organization_id=current_org.organization_id,
@@ -5475,6 +5464,8 @@ async def get_workflow_runs(
status=status,
search_key=search_key,
error_code=error_code,
+ created_at_start=effective_created_at_start,
+ created_at_end=created_at_end,
)
except RunsListSearchCanceled as exc:
LOG.warning(
@@ -5485,14 +5476,17 @@ async def get_workflow_runs(
status=status,
search_key=search_key,
error_code=error_code,
+ created_at_start=created_at_start,
+ created_at_end=created_at_end,
),
+ default_window_applied=default_window_applied,
page=page,
page_size=page_size,
statement_timeout_seconds=exc.statement_timeout_seconds,
)
raise _runs_list_timeout_error(
indexed_search=exc.indexed_search,
- search_detail=_RUNS_LIST_SEARCH_TIMEOUT_DETAIL,
+ search_detail=_ORG_RUNS_SEARCH_TIMEOUT_DETAIL,
) from exc
diff --git a/skyvern/forge/sdk/routes/credentials.py b/skyvern/forge/sdk/routes/credentials.py
index a90239e10..f9af2db13 100644
--- a/skyvern/forge/sdk/routes/credentials.py
+++ b/skyvern/forge/sdk/routes/credentials.py
@@ -33,6 +33,7 @@ exact threat the vault architecture is designed to prevent.
import asyncio
import json
import time
+from collections.abc import Awaitable, Callable
from contextlib import AbstractAsyncContextManager, nullcontext
from dataclasses import dataclass
from datetime import timedelta
@@ -3177,12 +3178,8 @@ async def list_onepassword_items(
integration_version="v1.0.0",
)
vaults = await client.vaults.list()
- # Skip vaults the service-account token can't read instead of failing the whole listing.
vault_items_by_vault = await asyncio.wait_for(
- asyncio.gather(
- *(client.items.list(vault.id) for vault in vaults),
- return_exceptions=True,
- ),
+ _gather_onepassword_vault_items([vault.id for vault in vaults], client.items.list),
timeout=20.0,
)
@@ -3271,7 +3268,8 @@ async def list_onepassword_items(
try:
items: list[OnePasswordItemOverview] = []
- for vault, vault_items in zip(vaults, vault_items_by_vault, strict=True):
+ for vault in vaults:
+ vault_items = vault_items_by_vault[vault.id]
if isinstance(vault_items, BaseException):
LOG.warning(
"Skipping inaccessible 1Password vault while listing items",
@@ -3289,9 +3287,31 @@ async def list_onepassword_items(
vault_id=vault.id,
vault_name=vault.title,
category=item.category.value,
+ importable=_onepassword_item_credential_type(item) is not None,
url=item.websites[0].url if item.websites else None,
)
)
+ if items and await app.AGENT_FUNCTION.credential_folders_restricted(current_org.organization_id):
+ item_keys = {(item.vault_id, item.item_id) for item in items}
+ imported_credentials = await app.DATABASE.credentials.get_onepassword_credentials(
+ current_org.organization_id
+ )
+ imported_credentials = [
+ credential
+ for credential in imported_credentials
+ if (credential.vault_id, credential.item_id) in item_keys
+ ]
+ allowed_credential_ids = await app.AGENT_FUNCTION.accessible_credential_ids(
+ get_request_principal(),
+ "credential.use",
+ {credential.credential_id for credential in imported_credentials},
+ )
+ hidden_item_keys = {
+ (credential.vault_id, credential.item_id)
+ for credential in imported_credentials
+ if credential.credential_id not in allowed_credential_ids
+ }
+ items = [item for item in items if (item.vault_id, item.item_id) not in hidden_item_keys]
response = OnePasswordItemsResponse(configured=True, items=items, source="organization")
except Exception as e:
LOG.exception(
@@ -3325,12 +3345,23 @@ async def _organization_onepassword_token(organization_id: str) -> str:
return resolution.token
+async def _gather_onepassword_vault_items(
+ vault_ids: list[str], list_items: Callable[[str], Awaitable[list[Item]]]
+) -> dict[str, list[Item] | BaseException]:
+ items_by_vault = await asyncio.gather(*(list_items(vault_id) for vault_id in vault_ids), return_exceptions=True)
+ return dict(zip(vault_ids, items_by_vault, strict=True))
+
+
async def _onepassword_metadata_by_vault(
- token: str, vault_ids: set[str], *, fallback_detail: str
-) -> dict[str, list[Item]]:
+ token: str,
+ vault_ids: set[str],
+ *,
+ fallback_detail: str,
+ skip_inaccessible_vaults: bool = False,
+) -> tuple[dict[str, list[Item]], dict[str, BaseException]]:
try:
- async def list_metadata() -> dict[str, list[Item]]:
+ async def list_metadata() -> tuple[dict[str, list[Item]], dict[str, BaseException]]:
client = await OnePasswordClient.authenticate(
auth=token,
integration_name="Skyvern",
@@ -3344,8 +3375,64 @@ async def _onepassword_metadata_by_vault(
return await client.items.list(vault_id)
sorted_vault_ids = sorted(vault_ids)
+ if skip_inaccessible_vaults:
+ items_with_errors = await _gather_onepassword_vault_items(sorted_vault_ids, list_vault)
+ failed_vaults = {
+ vault_id: items for vault_id, items in items_with_errors.items() if isinstance(items, BaseException)
+ }
+ all_vaults_failed = bool(sorted_vault_ids) and len(failed_vaults) == len(sorted_vault_ids)
+ if all_vaults_failed:
+ if all(
+ isinstance(error, (OnePasswordSessionExpiredError, DesktopSessionExpiredException))
+ or is_onepassword_credential_error(str(error))
+ for error in failed_vaults.values()
+ ):
+ raise next(iter(failed_vaults.values()))
+ provider_error = next(
+ (
+ error
+ for error in failed_vaults.values()
+ if isinstance(error, Exception)
+ and (
+ isinstance(
+ error,
+ (
+ TimeoutError,
+ OnePasswordRateLimitError,
+ RateLimitExceededException,
+ OnePasswordServiceUnavailableError,
+ ),
+ )
+ or extract_onepassword_upstream_5xx_status(str(error)) is not None
+ )
+ ),
+ None,
+ )
+ if provider_error is not None:
+ raise provider_error
+ unclassified_error = next(
+ (
+ error
+ for error in failed_vaults.values()
+ if not isinstance(error, (OnePasswordSessionExpiredError, DesktopSessionExpiredException))
+ and not is_onepassword_credential_error(str(error))
+ and "vault not found" not in str(error).casefold()
+ ),
+ None,
+ )
+ if unclassified_error is not None:
+ raise unclassified_error
+ return (
+ {
+ vault_id: items
+ for vault_id, items in items_with_errors.items()
+ if not isinstance(items, BaseException)
+ },
+ failed_vaults,
+ )
+
vault_items = await asyncio.gather(*(list_vault(vault_id) for vault_id in sorted_vault_ids))
- return dict(zip(sorted_vault_ids, vault_items, strict=True))
+ return dict(zip(sorted_vault_ids, vault_items, strict=True)), {}
return await asyncio.wait_for(list_metadata(), timeout=_ONEPASSWORD_METADATA_TIMEOUT_SECONDS)
except Exception as error:
@@ -3407,7 +3494,7 @@ async def import_onepassword_credentials(
)
token = await _organization_onepassword_token(organization_id)
- metadata_by_vault = await _onepassword_metadata_by_vault(
+ metadata_by_vault, _ = await _onepassword_metadata_by_vault(
token,
{vault_id for vault_id, _item_id in item_keys},
fallback_detail="Failed to import 1Password items.",
@@ -3431,76 +3518,77 @@ async def import_onepassword_credentials(
session=session,
)
- results: list[OnePasswordCredentialImportResult] = []
- for selection in data.items:
- item = items_by_vault.get(selection.vault_id, {}).get(selection.item_id)
- if item is None:
- results.append(
- OnePasswordCredentialImportResult(
+ indexed_selections = sorted(enumerate(data.items), key=lambda indexed: (indexed[1].vault_id, indexed[1].item_id))
+ results: list[OnePasswordCredentialImportResult | None] = [None] * len(data.items)
+ pending_effects: list[tuple[str, bool, CredentialType, tuple[str, ...]]] = []
+ async with app.DATABASE.credentials.Session() as session:
+ for result_index, selection in indexed_selections:
+ item = items_by_vault.get(selection.vault_id, {}).get(selection.item_id)
+ if item is None:
+ results[result_index] = OnePasswordCredentialImportResult(
vault_id=selection.vault_id,
item_id=selection.item_id,
status="skipped",
reason="Item not found in the 1Password vault.",
)
- )
- continue
- credential_type = _onepassword_item_credential_type(item)
- if credential_type is None:
- results.append(
- OnePasswordCredentialImportResult(
+ continue
+ credential_type = _onepassword_item_credential_type(item)
+ if credential_type is None:
+ results[result_index] = OnePasswordCredentialImportResult(
vault_id=selection.vault_id,
item_id=selection.item_id,
status="skipped",
reason=f"Unsupported 1Password category: {item.category.value}",
)
+ continue
+
+ credential, created = await app.DATABASE.credentials.upsert_onepassword_credential_metadata(
+ organization_id=organization_id,
+ vault_id=selection.vault_id,
+ item_id=selection.item_id,
+ name=item.title,
+ credential_type=credential_type,
+ tested_url=_onepassword_item_url(item),
+ folder_id=data.folder_id,
+ created_by=current_user_id,
+ set_folder_on_update=set_folder_on_update,
+ authorize_update=authorize_upsert,
+ commit=False,
)
- continue
+ changed_fields: tuple[str, ...] = ()
+ if not created:
+ update_fields = ["name", "credential_type"]
+ previous = existing_by_key.get((selection.vault_id, selection.item_id))
+ if set_folder_on_update and previous is not None and previous.folder_id != data.folder_id:
+ update_fields.append("folder_id")
+ changed_fields = tuple(update_fields)
+ pending_effects.append((credential.credential_id, created, credential_type, changed_fields))
+ results[result_index] = OnePasswordCredentialImportResult(
+ vault_id=selection.vault_id,
+ item_id=selection.item_id,
+ status="imported" if created else "updated",
+ )
+ await session.commit()
- credential, created = await app.DATABASE.credentials.upsert_onepassword_credential_metadata(
- organization_id=organization_id,
- vault_id=selection.vault_id,
- item_id=selection.item_id,
- name=item.title,
- credential_type=credential_type,
- tested_url=_onepassword_item_url(item),
- folder_id=data.folder_id,
- created_by=current_user_id,
- set_folder_on_update=set_folder_on_update,
- authorize_update=authorize_upsert,
+ for credential_id, created, credential_type, changed_fields in pending_effects:
+ await record_request_audit_event(
+ organization_id,
+ "credential.create" if created else "credential.update",
+ "credential",
+ credential_id,
+ changed_fields=changed_fields,
)
if created:
- await record_request_audit_event(
- organization_id, "credential.create", "credential", credential.credential_id
- )
background_tasks.add_task(
app.AGENT_FUNCTION.on_credential_saved,
organization_id=organization_id,
- credential_id=credential.credential_id,
+ credential_id=credential_id,
credential_type=credential_type,
actor_user_id=current_user_id,
vault=CredentialVaultType.ONEPASSWORD.value,
)
- else:
- changed_fields = ["name", "credential_type", "tested_url"]
- previous = existing_by_key.get((selection.vault_id, selection.item_id))
- if set_folder_on_update and previous is not None and previous.folder_id != data.folder_id:
- changed_fields.append("folder_id")
- await record_request_audit_event(
- organization_id,
- "credential.update",
- "credential",
- credential.credential_id,
- changed_fields=tuple(changed_fields),
- )
- results.append(
- OnePasswordCredentialImportResult(
- vault_id=selection.vault_id,
- item_id=selection.item_id,
- status="imported" if created else "updated",
- )
- )
- return ImportOnePasswordCredentialsResponse(results=results)
+ return ImportOnePasswordCredentialsResponse(results=[result for result in results if result is not None])
@base_router.post(
@@ -3543,10 +3631,11 @@ async def refresh_onepassword_credentials(
),
)
token = await _organization_onepassword_token(organization_id)
- metadata_by_vault = await _onepassword_metadata_by_vault(
+ metadata_by_vault, failed_vaults = await _onepassword_metadata_by_vault(
token,
{credential.vault_id for credential in credentials if credential.vault_id is not None},
fallback_detail="Failed to refresh 1Password items.",
+ skip_inaccessible_vaults=True,
)
items_by_vault = {
vault_id: {item.id: item for item in vault_items} for vault_id, vault_items in metadata_by_vault.items()
@@ -3557,11 +3646,28 @@ async def refresh_onepassword_credentials(
results_by_id: dict[str, OnePasswordCredentialRefreshResult] = {}
refreshed = 0
skipped = 0
+ for failed_vault_id, error in failed_vaults.items():
+ LOG.warning(
+ "Skipping inaccessible 1Password vault while refreshing credentials",
+ organization_id=organization_id,
+ vault_id=failed_vault_id,
+ error=str(error),
+ )
+
for credential in credentials:
vault_id = credential.vault_id
item_id = credential.item_id
if vault_id is None or item_id is None:
continue
+ if vault_id in failed_vaults:
+ results_by_id[credential.credential_id] = OnePasswordCredentialRefreshResult(
+ vault_id=vault_id,
+ item_id=item_id,
+ status="skipped",
+ reason="Could not access the 1Password vault.",
+ )
+ skipped += 1
+ continue
item = items_by_vault.get(vault_id, {}).get(item_id)
if item is None:
missing_credentials.append((credential, vault_id, item_id))
@@ -3576,7 +3682,6 @@ async def refresh_onepassword_credentials(
authorized_folder_id=credential.folder_id,
name=item.title,
credential_type=credential_type,
- tested_url=_onepassword_item_url(item),
)
if updated:
refreshed += 1
@@ -3706,7 +3811,9 @@ async def list_bitwarden_items(
async def update_onepassword_token(
data: CreateOnePasswordTokenRequest,
current_org: Organization = Depends(org_auth_service.get_current_org_for_credential_routes),
- _request_authorization: None = Depends(require_request_actions(frozenset({"vault_provider.update"}))),
+ _request_authorization: None = Depends(
+ require_request_actions(frozenset({"vault_provider.update"}), always_enforce=True)
+ ),
) -> CreateOnePasswordTokenResponse:
"""
Create or update a OnePassword service account token for the current organization.
@@ -3818,6 +3925,10 @@ async def clear_org_auth_credential(
token_type = _ORG_AUTH_CREDENTIAL_TOKEN_TYPES.get(credential_provider)
if not token_type:
raise HTTPException(status_code=404, detail="Unsupported organization auth credential provider")
+ if credential_provider == "onepassword":
+ await app.AGENT_FUNCTION.enforce_request_authorization(
+ get_request_principal(), "vault_provider.delete", always_enforce=True
+ )
try:
invalidated_count = await app.DATABASE.organizations.invalidate_org_auth_tokens(
organization_id=current_org.organization_id,
diff --git a/skyvern/forge/sdk/schemas/copilot_turn_outcome.py b/skyvern/forge/sdk/schemas/copilot_turn_outcome.py
index 865f4577a..7769fc478 100644
--- a/skyvern/forge/sdk/schemas/copilot_turn_outcome.py
+++ b/skyvern/forge/sdk/schemas/copilot_turn_outcome.py
@@ -39,6 +39,16 @@ class ConnectedAccountChoice(BaseModel):
email_address: str | None = None
+GoogleSetupScopeProfile = Literal["gmail", "google_sheets"]
+
+
+class GoogleSetupOffer(BaseModel):
+ model_config = ConfigDict(extra="ignore", frozen=True)
+
+ scope_profile: GoogleSetupScopeProfile
+ connection_id: str | None = None
+
+
class DeliveredOutputFile(BaseModel):
model_config = ConfigDict(extra="ignore", frozen=True)
@@ -97,6 +107,7 @@ class TurnOutcome(BaseModel):
interrupted_row_final: bool = False
idempotency_digest: str | None = None
connected_account_choices: list[ConnectedAccountChoice] | None = None
+ google_setup_offers: list[GoogleSetupOffer] | None = None
output_files: list[DeliveredOutputFile] | None = None
@field_validator("output_policy_reasons", mode="before")
diff --git a/skyvern/forge/sdk/schemas/credentials.py b/skyvern/forge/sdk/schemas/credentials.py
index 969b2365c..a1fb7af5e 100644
--- a/skyvern/forge/sdk/schemas/credentials.py
+++ b/skyvern/forge/sdk/schemas/credentials.py
@@ -353,6 +353,7 @@ class OnePasswordItemOverview(BaseModel):
vault_id: str = Field(..., description="The ID of the vault containing the item")
vault_name: str = Field(..., description="The name of the vault containing the item")
category: str = Field(..., description="The 1Password item category")
+ importable: bool = Field(..., description="Whether this item can be imported as a credential")
url: str | None = Field(default=None, description="The primary website URL associated with the item, if any")
diff --git a/skyvern/forge/sdk/schemas/workflow_copilot.py b/skyvern/forge/sdk/schemas/workflow_copilot.py
index 3e9c7deef..5c24df8f1 100644
--- a/skyvern/forge/sdk/schemas/workflow_copilot.py
+++ b/skyvern/forge/sdk/schemas/workflow_copilot.py
@@ -472,6 +472,9 @@ class WorkflowCopilotChatRequest(BaseModel):
supports_credential_delete_card: bool = Field(
False, description="The client can display the credential deletion card and post its confirmation."
)
+ supports_google_setup_card: bool = Field(
+ False, description="The client can display Gmail and Google Sheets connection cards with a scope profile."
+ )
credential_recovery_token: SecretStr | None = Field(
None,
repr=False,
diff --git a/skyvern/forge/sdk/services/bitwarden.py b/skyvern/forge/sdk/services/bitwarden.py
index acf42d9c7..b2dffdafc 100644
--- a/skyvern/forge/sdk/services/bitwarden.py
+++ b/skyvern/forge/sdk/services/bitwarden.py
@@ -52,7 +52,10 @@ from skyvern.utils.strings import is_uuid
LOG = structlog.get_logger()
BITWARDEN_SERVER_BASE_URL = f"{settings.BITWARDEN_SERVER}:{settings.BITWARDEN_SERVER_PORT or 8002}"
-_RETRY_BACKOFF_BASE_SECONDS = 5.0
+# Sized so the default three attempts span a batch burst rather than landing inside it: at 5s the first
+# two backoffs were only U(0,5) and U(0,10), so every attempt retried into the same congestion that
+# failed the first one and the cap below was unreachable.
+_RETRY_BACKOFF_BASE_SECONDS = 20.0
_RETRY_BACKOFF_CAP_SECONDS = 60.0
@@ -61,6 +64,16 @@ def _retry_backoff_seconds(attempt: int) -> float:
return random.uniform(0, min(_RETRY_BACKOFF_CAP_SECONDS, _RETRY_BACKOFF_BASE_SECONDS * (2**attempt)))
+def _login_timeout_seconds(timeout: int) -> int:
+ """The budget for a cold `bw login`, never below the budget its caller gave the reads behind it."""
+ return max(timeout, settings.BITWARDEN_LOGIN_TIMEOUT_SECONDS)
+
+
+def _attempt_deadline_seconds(timeout: int) -> int:
+ """One attempt is a login plus the reads behind it, so it gets both budgets rather than twice one."""
+ return _login_timeout_seconds(timeout) + timeout
+
+
# The CLI keeps its login state, tokens and encrypted vault copy in one data directory. Pointing each
# vault identity at its own directory lets sessions for different organizations coexist, so a run
# never has to log another organization out to make room for its own login.
@@ -777,6 +790,7 @@ class BitwardenService:
async def _establish_cli_session(
session: _CliSession,
timeout: int,
+ login_timeout: int | None = None,
verify_sync: bool = False,
trust_login_key: bool = True,
) -> None:
@@ -791,7 +805,7 @@ class BitwardenService:
identity.client_secret,
email=identity.email,
master_password=identity.master_password,
- timeout=timeout,
+ timeout=login_timeout or timeout,
appdata_dir=session.appdata_dir,
)
finally:
@@ -814,6 +828,7 @@ class BitwardenService:
async def _prepare_cli_session(
session: _CliSession,
timeout: int,
+ login_timeout: int | None = None,
force_sync: bool = False,
verify_sync: bool = False,
trust_login_key: bool = True,
@@ -828,7 +843,11 @@ class BitwardenService:
usage.lock_wait_seconds = (usage.lock_wait_seconds or 0.0) + time.monotonic() - queued_at
if session.session_key is None:
await BitwardenService._establish_cli_session(
- session, timeout=timeout, verify_sync=verify_sync, trust_login_key=trust_login_key
+ session,
+ timeout=timeout,
+ login_timeout=login_timeout,
+ verify_sync=verify_sync,
+ trust_login_key=trust_login_key,
)
return
@@ -862,6 +881,7 @@ class BitwardenService:
timeout: int,
run: Callable[[_CliSession], Awaitable[T]],
force_sync: bool = False,
+ login_timeout: int | None = None,
) -> T:
"""Run `run` against a live CLI session, repairing a stale session once before giving up.
`force_sync` demands a `bw sync` that reports failure even after a fresh login; a repair only resyncs."""
@@ -875,6 +895,7 @@ class BitwardenService:
await BitwardenService._prepare_cli_session(
session,
timeout=timeout,
+ login_timeout=login_timeout,
force_sync=resync,
verify_sync=force_sync,
# A login key that unlocks nothing makes the read fail with "Vault is locked.";
@@ -1125,11 +1146,13 @@ class BitwardenService:
raise BitwardenGetItemError(f"Invalid item ID: {item_id}. Check if the item ID is correct")
await BitwardenService._apply_jitter()
+ login_timeout = _login_timeout_seconds(timeout)
for attempt in range(max_retries):
try:
- # Every CLI command gets `timeout`; the attempt as a whole gets twice that, so one slow step
- # cannot consume the others' budget and a dead vault still fails in bounded time.
- async with asyncio.timeout(2 * timeout):
+ # A cold login gets `login_timeout` and every other CLI command gets `timeout`; the attempt
+ # as a whole gets both, so one slow step cannot consume the other's budget and a dead vault
+ # still fails in bounded time.
+ async with asyncio.timeout(_attempt_deadline_seconds(timeout)):
return await BitwardenService._get_secret_value_from_url(
client_id=client_id,
client_secret=client_secret,
@@ -1141,6 +1164,7 @@ class BitwardenService:
item_id=item_id,
timeout=timeout,
email=email,
+ login_timeout=login_timeout,
)
except BitwardenAccessDeniedError as e:
raise e
@@ -1194,6 +1218,7 @@ class BitwardenService:
item_id: str | None = None,
timeout: int = 60,
email: str | None = None,
+ login_timeout: int | None = None,
) -> dict[str, str]:
"""
Get the secret value from the Bitwarden CLI.
@@ -1304,7 +1329,9 @@ class BitwardenService:
return bitwarden_result[0].credential
identity = _VaultIdentity.resolve(client_id, client_secret, email, master_password)
- return await BitwardenService._with_cli_session(identity, timeout=timeout, run=fetch)
+ return await BitwardenService._with_cli_session(
+ identity, timeout=timeout, run=fetch, login_timeout=login_timeout
+ )
@staticmethod
async def get_sensitive_information_from_identity(
@@ -1329,7 +1356,7 @@ class BitwardenService:
if not fail_reasons:
await BitwardenService._apply_jitter()
try:
- async with asyncio.timeout(timeout):
+ async with asyncio.timeout(_attempt_deadline_seconds(timeout)):
return await BitwardenService._get_sensitive_information_from_identity(
client_id=client_id,
client_secret=client_secret,
@@ -1341,6 +1368,7 @@ class BitwardenService:
identity_fields=identity_fields,
email=email,
timeout=timeout,
+ login_timeout=_login_timeout_seconds(timeout),
)
except BitwardenAccessDeniedError as e:
raise e
@@ -1381,6 +1409,7 @@ class BitwardenService:
bw_collection_ids: list[str] | None,
email: str | None = None,
timeout: int = settings.BITWARDEN_TIMEOUT_SECONDS,
+ login_timeout: int | None = None,
) -> dict[str, str]:
"""
Get the sensitive information from the Bitwarden CLI.
@@ -1440,7 +1469,9 @@ class BitwardenService:
return sensitive_information
identity = _VaultIdentity.resolve(client_id, client_secret, email, master_password)
- return await BitwardenService._with_cli_session(identity, timeout=timeout, run=fetch)
+ return await BitwardenService._with_cli_session(
+ identity, timeout=timeout, run=fetch, login_timeout=login_timeout
+ )
@staticmethod
async def login(
@@ -1558,6 +1589,7 @@ class BitwardenService:
item_id: str,
email: str | None = None,
timeout: int = settings.BITWARDEN_TIMEOUT_SECONDS,
+ login_timeout: int | None = None,
) -> dict[str, str]:
"""
Get the credit card data from the Bitwarden CLI.
@@ -1614,7 +1646,9 @@ class BitwardenService:
return mapped_credit_card_data
identity = _VaultIdentity.resolve(client_id, client_secret, email, master_password)
- return await BitwardenService._with_cli_session(identity, timeout=timeout, run=fetch)
+ return await BitwardenService._with_cli_session(
+ identity, timeout=timeout, run=fetch, login_timeout=login_timeout
+ )
@staticmethod
async def get_credit_card_data(
@@ -1638,7 +1672,7 @@ class BitwardenService:
if not fail_reasons:
await BitwardenService._apply_jitter()
try:
- async with asyncio.timeout(settings.BITWARDEN_TIMEOUT_SECONDS):
+ async with asyncio.timeout(_attempt_deadline_seconds(settings.BITWARDEN_TIMEOUT_SECONDS)):
return await BitwardenService._get_credit_card_data(
client_id=client_id,
client_secret=client_secret,
@@ -1648,6 +1682,7 @@ class BitwardenService:
collection_id=collection_id,
item_id=item_id,
email=email,
+ login_timeout=_login_timeout_seconds(settings.BITWARDEN_TIMEOUT_SECONDS),
)
except BitwardenAccessDeniedError as e:
raise e
diff --git a/skyvern/forge/sdk/services/route_authorization.py b/skyvern/forge/sdk/services/route_authorization.py
index 5b43be99d..601d074e5 100644
--- a/skyvern/forge/sdk/services/route_authorization.py
+++ b/skyvern/forge/sdk/services/route_authorization.py
@@ -24,7 +24,6 @@ ROUTE_ACTIONS: Mapping[str, str] = {
"skyvern.forge.sdk.routes.agent_protocol.cancel_workflow_run": "workflow.cancel",
"skyvern.forge.sdk.routes.agent_protocol.continue_workflow_run": "workflow.continue",
"skyvern.forge.sdk.routes.agent_protocol.convert_curl_to_http": "utility.convert",
- "skyvern.forge.sdk.routes.agent_protocol.convert_sop_to_blocks": "workflow.convert",
"skyvern.forge.sdk.routes.agent_protocol.create_folder": "workflow_folder.create",
"skyvern.forge.sdk.routes.agent_protocol.create_tag_value": "tag.create",
"skyvern.forge.sdk.routes.agent_protocol.create_workflow": "workflow.create",
@@ -307,14 +306,17 @@ def _route_action(connection: HTTPConnection) -> tuple[str | None, dict[str, obj
return action, resource
-def require_request_actions(actions: frozenset[str]) -> Callable[[], Awaitable[None]]:
+def require_request_actions(actions: frozenset[str], *, always_enforce: bool = False) -> Callable[[], Awaitable[None]]:
if not actions:
raise ValueError("require_request_actions needs at least one action")
async def enforce_request_action() -> None:
principal = get_request_principal()
for action in actions:
- await app.AGENT_FUNCTION.enforce_request_authorization(principal, action)
+ if always_enforce:
+ await app.AGENT_FUNCTION.enforce_request_authorization(principal, action, always_enforce=True)
+ else:
+ await app.AGENT_FUNCTION.enforce_request_authorization(principal, action)
return enforce_request_action
diff --git a/skyvern/forge/sdk/utils/pdf_parser.py b/skyvern/forge/sdk/utils/pdf_parser.py
index 745bd4ece..190bc9a47 100644
--- a/skyvern/forge/sdk/utils/pdf_parser.py
+++ b/skyvern/forge/sdk/utils/pdf_parser.py
@@ -10,10 +10,12 @@ identifies it.
"""
import io
+from types import FrameType
import pdfplumber
import structlog
-from pypdf import PdfReader
+from pypdf import PdfReader, get_configuration
+from pypdf.errors import LimitReachedError
from skyvern.constants import MAX_FILE_PARSE_INPUT_TOKENS, MAX_PDF_OCR_PAGES
from skyvern.exceptions import PDFParsingError
@@ -41,6 +43,43 @@ _MIN_ISOLATED_GLYPH_SHARE = 0.6
# Non-Latin scripts are read as-is: their characters fall outside the ranges above, so the
# shares would be measuring the wrong thing.
_MIN_ASCII_LETTER_SHARE = 0.5
+# pypdf raises one LimitReachedError class for every limit, sometimes re-raised as PdfReadError, so only the raising
+# frame tells a size cap from a structural limit pdfminer reads safely. Any limit in the filter modules is a size cap
+# unless carved out below, so one a later pypdf adds fails closed; the frames after the carve-outs are the other caps
+# pdfminer lacks: a content array, a ToUnicode range, CID widths and an eager page tree.
+_PYPDF_DECOMPRESSION_LIMIT_MODULES = frozenset({"pypdf.filters", "pypdf._codecs._codecs"})
+# A predictor row length pdfminer never allocates, and JBIG2, which pdfminer passes through undecoded.
+_PYPDF_STRUCTURAL_FILTER_FRAMES = frozenset(
+ {("pypdf.filters", "FlateDecode.decode"), ("pypdf.filters", "JBIG2Decode.decode")}
+)
+_PYPDF_SIZE_LIMIT_FRAMES = frozenset(
+ {
+ ("pypdf.generic._data_structures", "ContentStream.__init__"),
+ ("pypdf.generic._data_structures", "DictionaryObject.read_from_stream"),
+ ("pypdf.generic._data_structures", "DictionaryObject._read_unsized_from_stream"),
+ ("pypdf._cmap", "_check_mapping_size"),
+ ("pypdf._doc_common", "PdfDocCommon._flatten_page_tree_node"),
+ }
+)
+# These frames also enforce structural limits (token lengths, simple-font widths), so the caller tells them apart.
+_PYPDF_SIZE_LIMIT_CALLS = frozenset(
+ {
+ (
+ ("pypdf._cmap", "_check_token_length"),
+ ("pypdf._cmap", "parse_bfrange"),
+ ),
+ (
+ ("pypdf._utils", "read_until_regex"),
+ ("pypdf.generic._data_structures", "DictionaryObject.read_from_stream"),
+ ),
+ (
+ ("pypdf._font", "Font.__check_entry_count"),
+ ("pypdf._font", "Font._collect_cid_character_widths"),
+ ),
+ }
+)
+_PYPDF_CID_WIDTH_RANGE_FRAME = ("pypdf._font", "Font.__check_range_length")
+_PYPDF_PREDICTOR_PARAMETERS_FRAME = ("pypdf.filters", "FlateDecode._get_parameters")
def _is_remapped_glyph(char: str) -> bool:
@@ -96,6 +135,64 @@ def scrambled_text_layer_reason(text: str) -> str | None:
)
+def _frame_site(frame: FrameType) -> tuple[str | None, str]:
+ return frame.f_globals.get("__name__"), frame.f_code.co_qualname
+
+
+def _is_size_limit_frame(frame: FrameType) -> bool:
+ site = _frame_site(frame)
+ if site == _PYPDF_PREDICTOR_PARAMETERS_FRAME:
+ # The same frame rejects a small Colors over 16, which pdfminer reads, but a huge Columns or row it would hold
+ # as Python ints without any limit. The row is sized at 8 bits per component, the most pdfminer decodes,
+ # because pypdf reads BitsPerComponent after this check.
+ columns, colors = frame.f_locals.get("columns"), frame.f_locals.get("colors")
+ configuration = get_configuration()
+ return isinstance(columns, int) and (
+ columns > configuration.flate_maximum_columns
+ or (isinstance(colors, int) and columns * colors + 1 > configuration.flate_maximum_row_length)
+ )
+ if site in _PYPDF_STRUCTURAL_FILTER_FRAMES:
+ return False
+ if site[0] in _PYPDF_DECOMPRESSION_LIMIT_MODULES or site in _PYPDF_SIZE_LIMIT_FRAMES:
+ return True
+ if frame.f_back is not None and (site, _frame_site(frame.f_back)) in _PYPDF_SIZE_LIMIT_CALLS:
+ return True
+ if site == _PYPDF_CID_WIDTH_RANGE_FRAME:
+ # The same frame rejects an inverted range, which expands to nothing in pdfminer.
+ start, end = frame.f_locals.get("start"), frame.f_locals.get("end")
+ return isinstance(start, int) and isinstance(end, int) and end >= start
+ return False
+
+
+def _hit_pypdf_size_limit(error: BaseException) -> bool:
+ seen: set[int] = set()
+ current: BaseException | None = error
+ while current is not None and id(current) not in seen:
+ seen.add(id(current))
+ if isinstance(current, LimitReachedError) and current.__traceback__ is not None:
+ innermost = current.__traceback__
+ while innermost.tb_next is not None:
+ innermost = innermost.tb_next
+ if _is_size_limit_frame(innermost.tb_frame):
+ return True
+ current = current.__cause__ or current.__context__
+ return False
+
+
+def _size_limit_failure(identifier: str, pypdf_error: Exception) -> PDFParsingError:
+ LOG.warning(
+ "PDF exceeds a pypdf size limit that pdfplumber lacks, not falling back to pdfplumber",
+ file_identifier=identifier.partition("?")[0],
+ error=str(pypdf_error),
+ error_type=type(pypdf_error).__name__,
+ )
+ return PDFParsingError(
+ file_identifier=identifier,
+ pypdf_error=str(pypdf_error),
+ pdfplumber_error="not attempted: the PDF exceeds a size limit",
+ )
+
+
def extract_pdf_file(
file_path: str,
file_identifier: str | None = None,
@@ -118,13 +215,15 @@ def extract_pdf_file(
Extracted text from all pages of the PDF
Raises:
- PDFParsingError: When both pypdf and pdfplumber fail to parse the PDF
+ PDFParsingError: When both pypdf and pdfplumber fail to parse the PDF, or when the PDF
+ exceeds a pypdf size limit that pdfplumber lacks (pdfplumber is not tried then)
Example:
>>> text = extract_pdf_file("/path/to/file.pdf", "document.pdf")
>>> print(f"Extracted {len(text)} characters")
"""
identifier = file_identifier or file_path
+ log_identifier = identifier.partition("?")[0]
# Try pypdf first
try:
@@ -140,7 +239,7 @@ def extract_pdf_file(
if current_tokens + page_tokens > max_tokens:
LOG.warning(
"PDF text exceeds token limit, truncating at page boundary",
- file_identifier=identifier,
+ file_identifier=log_identifier,
pages_included=i,
total_pages=page_count,
max_tokens=max_tokens,
@@ -154,16 +253,18 @@ def extract_pdf_file(
LOG.info(
"Successfully parsed PDF with pypdf",
- file_identifier=identifier,
+ file_identifier=log_identifier,
page_count=page_count,
text_length=len(extracted_text),
)
return extracted_text
except Exception as pypdf_error:
+ if _hit_pypdf_size_limit(pypdf_error):
+ raise _size_limit_failure(identifier, pypdf_error) from pypdf_error
LOG.warning(
"Failed to parse PDF with pypdf, trying pdfplumber",
- file_identifier=identifier,
+ file_identifier=log_identifier,
error=str(pypdf_error),
error_type=type(pypdf_error).__name__,
)
@@ -176,14 +277,17 @@ def extract_pdf_file(
page_count = len(pdf.pages)
for i, page in enumerate(pdf.pages):
- page_text = page.extract_text()
+ try:
+ page_text = page.extract_text()
+ finally:
+ page.close()
if page_text:
if max_tokens:
page_tokens = count_tokens(page_text)
if current_tokens + page_tokens > max_tokens:
LOG.warning(
"PDF text exceeds token limit, truncating at page boundary",
- file_identifier=identifier,
+ file_identifier=log_identifier,
pages_included=i,
total_pages=page_count,
max_tokens=max_tokens,
@@ -197,7 +301,7 @@ def extract_pdf_file(
LOG.info(
"Successfully parsed PDF with pdfplumber",
- file_identifier=identifier,
+ file_identifier=log_identifier,
page_count=page_count,
text_length=len(extracted_text),
)
@@ -206,7 +310,7 @@ def extract_pdf_file(
except Exception as pdfplumber_error:
LOG.error(
"Failed to parse PDF with both pypdf and pdfplumber",
- file_identifier=identifier,
+ file_identifier=log_identifier,
pypdf_error=str(pypdf_error),
pdfplumber_error=str(pdfplumber_error),
)
@@ -236,13 +340,15 @@ def validate_pdf_file(
True if the PDF can be opened and read by at least one parser
Raises:
- PDFParsingError: When both pypdf and pdfplumber fail to validate the PDF
+ PDFParsingError: When both pypdf and pdfplumber fail to validate the PDF, or when the PDF
+ exceeds a pypdf size limit that pdfplumber lacks (pdfplumber is not tried then)
Example:
>>> if validate_pdf_file("/path/to/file.pdf"):
... print("Valid PDF file")
"""
identifier = file_identifier or file_path
+ log_identifier = identifier.partition("?")[0]
# Try pypdf first
try:
@@ -251,14 +357,16 @@ def validate_pdf_file(
_ = len(reader.pages)
LOG.debug(
"PDF validation successful with pypdf",
- file_identifier=identifier,
+ file_identifier=log_identifier,
)
return True
except Exception as pypdf_error:
+ if _hit_pypdf_size_limit(pypdf_error):
+ raise _size_limit_failure(identifier, pypdf_error) from pypdf_error
LOG.debug(
"PDF validation with pypdf failed, trying pdfplumber",
- file_identifier=identifier,
+ file_identifier=log_identifier,
error=str(pypdf_error),
)
@@ -269,7 +377,7 @@ def validate_pdf_file(
LOG.info(
"PDF validation: pypdf failed but pdfplumber succeeded",
- file_identifier=identifier,
+ file_identifier=log_identifier,
pypdf_error=str(pypdf_error),
)
return True
@@ -277,7 +385,7 @@ def validate_pdf_file(
except Exception as pdfplumber_error:
LOG.error(
"PDF validation failed with both pypdf and pdfplumber",
- file_identifier=identifier,
+ file_identifier=log_identifier,
pypdf_error=str(pypdf_error),
pdfplumber_error=str(pdfplumber_error),
)
@@ -302,6 +410,7 @@ def render_pdf_pages_as_images(
image-based PDFs).
"""
identifier = file_identifier or file_path
+ log_identifier = identifier.partition("?")[0]
page_images: list[bytes] = []
with pdfplumber.open(file_path) as pdf:
@@ -309,7 +418,7 @@ def render_pdf_pages_as_images(
if pages_to_render < len(pdf.pages):
LOG.warning(
"PDF has more pages than max_pages for image rendering, truncating",
- file_identifier=identifier,
+ file_identifier=log_identifier,
total_pages=len(pdf.pages),
max_pages=max_pages,
)
@@ -322,7 +431,7 @@ def render_pdf_pages_as_images(
LOG.info(
"Rendered PDF pages as images for vision-LLM fallback",
- file_identifier=identifier,
+ file_identifier=log_identifier,
pages_rendered=len(page_images),
)
return page_images
diff --git a/skyvern/forge/sdk/workflow/context_manager.py b/skyvern/forge/sdk/workflow/context_manager.py
index 0e6b21169..8086b198c 100644
--- a/skyvern/forge/sdk/workflow/context_manager.py
+++ b/skyvern/forge/sdk/workflow/context_manager.py
@@ -1514,6 +1514,17 @@ class WorkflowRunContext:
item_id = self._resolve_required_parameter_value(parameter.item_id, "OnePassword Item ID")
vault_id = self._resolve_required_parameter_value(parameter.vault_id, "OnePassword Vault ID")
+ imported_credentials = await app.DATABASE.credentials.get_onepassword_credentials(
+ organization.organization_id,
+ item_keys=[(vault_id, item_id)],
+ limit=1,
+ )
+ if imported_credentials:
+ await app.AGENT_FUNCTION.enforce_credential_use(
+ organization.organization_id,
+ imported_credentials[0].credential_id,
+ workflow_run_id=self.workflow_run_id,
+ )
lookup_context = self._format_resolved_lookup_context("1Password", vault_id=vault_id, item_id=item_id)
item = await fetch_onepassword_item(token, vault_id, item_id, lookup_context)
if parameter.totp_identifier:
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py
index b13d03764..117be7474 100644
--- a/skyvern/forge/sdk/workflow/models/block.py
+++ b/skyvern/forge/sdk/workflow/models/block.py
@@ -385,6 +385,7 @@ from skyvern.webeye.utils.captcha_solver import (
resolve_captcha_image,
solve_challenge,
)
+from skyvern.webeye.utils.challenge_solve_record import ChallengeSolveRecord
from skyvern.webeye.utils.page import ScreenshotMode, SkyvernFrame
if TYPE_CHECKING:
@@ -5231,46 +5232,82 @@ async def _code_block_solve_captcha_builtin(
async def solve() -> bool:
if image is not None and input is not None:
- return await _fill_image_captcha_text(page, image, input, organization_id=organization_id)
- outcome = await solve_challenge(
- page,
- organization_id=organization_id,
- workflow_run_id=workflow_run_id,
- browser_session_id=browser_session_id,
- probe_child_frames=True,
- )
- recorded_output["challenge"] = outcome.receipt()
- if outcome.status in (ChallengeStatus.UNSOLVED, ChallengeStatus.UNSUPPORTED):
- raise CodeBlockCaptchaError("CAPTCHA could not be solved.")
- return outcome.status is ChallengeStatus.SOLVED
+ return await _fill_image_captcha_text(
+ page,
+ image,
+ input,
+ organization_id=organization_id,
+ workflow_run_id=workflow_run_id,
+ browser_session_id=browser_session_id,
+ )
+ with _code_block_solve_record(page, organization_id, workflow_run_id, browser_session_id) as record:
+ outcome = await solve_challenge(
+ page,
+ organization_id=organization_id,
+ workflow_run_id=workflow_run_id,
+ browser_session_id=browser_session_id,
+ probe_child_frames=True,
+ )
+ record.challenge = outcome
+ recorded_output["challenge"] = outcome.receipt()
+ if outcome.status in (ChallengeStatus.UNSOLVED, ChallengeStatus.UNSUPPORTED):
+ raise CodeBlockCaptchaError("CAPTCHA could not be solved.")
+ return outcome.status is ChallengeStatus.SOLVED
if isinstance(page, RecordingPage):
return await page._record_solve_captcha(solve, workflow_run_id=workflow_run_id, extra_output=recorded_output)
return await solve()
+def _code_block_solve_record(
+ page: Page | RecordingPage,
+ organization_id: str | None,
+ workflow_run_id: str | None,
+ browser_session_id: str | None,
+) -> Iterator[ChallengeSolveRecord]:
+ with app.AGENT_FUNCTION.challenge_solve_recording(
+ "code_block",
+ page=page,
+ organization_id=organization_id,
+ workflow_run_id=workflow_run_id,
+ browser_session_id=browser_session_id,
+ ) as record:
+ try:
+ yield record
+ except CodeBlockCaptchaError:
+ # The builtin reports an unsolved or unreadable CAPTCHA by raising; the call itself completed.
+ record.unsolved = True
+ raise
+
+
async def _fill_image_captcha_text(
page: Page | RecordingPage,
image_selector: str,
input_selector: str,
*,
organization_id: str | None,
+ workflow_run_id: str | None = None,
+ browser_session_id: str | None = None,
) -> bool:
# Checked before the screenshot so an organization with OCR turned off never captures the element.
if not await app.AGENT_FUNCTION.image_captcha_ocr_enabled(organization_id=organization_id, url=page.url):
raise CodeBlockCaptchaError("CAPTCHA could not be solved.")
- try:
- # Any other element would ship an arbitrary region of the page to the OCR vendor.
- image = await resolve_captcha_image(page.locator(image_selector))
- if image is None:
- raise CodeBlockCaptchaError("CAPTCHA could not be solved.")
- png = await image.screenshot(timeout=settings.BROWSER_SCREENSHOT_TIMEOUT_MS)
- text = await app.AGENT_FUNCTION.read_image_captcha_text(png, organization_id=organization_id, url=page.url)
- if not text or not text.strip():
- raise CodeBlockCaptchaError("CAPTCHA could not be solved.")
- await page.locator(input_selector).fill(text.strip(), timeout=settings.BROWSER_ACTION_TIMEOUT_MS)
- except PlaywrightError as exc:
- raise CodeBlockCaptchaError("CAPTCHA could not be solved.") from exc
+ with _code_block_solve_record(page, organization_id, workflow_run_id, browser_session_id) as record:
+ try:
+ # Any other element would ship an arbitrary region of the page to the OCR vendor.
+ image = await resolve_captcha_image(page.locator(image_selector))
+ if image is None:
+ raise CodeBlockCaptchaError("CAPTCHA could not be solved.")
+ png = await image.screenshot(timeout=settings.BROWSER_SCREENSHOT_TIMEOUT_MS)
+ text = await app.AGENT_FUNCTION.read_image_captcha_text(png, organization_id=organization_id, url=page.url)
+ if not text or not text.strip():
+ raise CodeBlockCaptchaError("CAPTCHA could not be solved.")
+ record.image_text_read = True
+ await page.locator(input_selector).fill(text.strip(), timeout=settings.BROWSER_ACTION_TIMEOUT_MS)
+ record.image_text_delivered = True
+ except PlaywrightError as exc:
+ raise CodeBlockCaptchaError("CAPTCHA could not be solved.") from exc
return True
@@ -5295,6 +5332,7 @@ class CodeBlockSolveCaptcha(Protocol):
def _bind_code_block_solve_captcha(
organization_id: str | None,
workflow_run_id: str | None,
+ browser_session_id: str | None = None,
) -> CodeBlockSolveCaptcha:
image_reads = 0
@@ -5313,6 +5351,7 @@ def _bind_code_block_solve_captcha(
page,
organization_id=organization_id,
workflow_run_id=workflow_run_id,
+ browser_session_id=browser_session_id,
image=image,
input=input,
)
@@ -6843,6 +6882,7 @@ class CodeBlock(Block):
registered_downloads: RegisteredDownloadSource | None = None,
opened_pages: list[Page | RecordingPage] | None = None,
browser_state: BrowserState | None = None,
+ browser_session_id: str | None = None,
) -> Callable[[], Awaitable[dict[str, Any]]]:
# SECURITY: validate before exec(). The AST check must run on the raw
# user code so it can block dunder identifiers like __capture_locals.
@@ -6873,7 +6913,9 @@ class CodeBlock(Block):
parameters=app.AGENT_FUNCTION.serialize_codeblock_parameters(parameters or {}),
)
safe_vars["__builtins__"]["print"] = safe_vars["print"]
- safe_vars["solve_captcha"] = _bind_code_block_solve_captcha(organization_id, workflow_run_id)
+ safe_vars["solve_captcha"] = _bind_code_block_solve_captcha(
+ organization_id, workflow_run_id, browser_session_id
+ )
safe_vars["otp"] = partial(
_code_block_otp_builtin,
organization_id=organization_id,
@@ -10083,6 +10125,7 @@ async def wrapper({default_args}):
registered_downloads=registered_downloads,
opened_pages=opened_pages,
browser_state=browser_state,
+ browser_session_id=browser_session_id,
)
except BaseException:
download_log.close()
diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.py
index 1b8c03600..5630adecd 100644
--- a/skyvern/forge/sdk/workflow/service.py
+++ b/skyvern/forge/sdk/workflow/service.py
@@ -3650,6 +3650,9 @@ class WorkflowService:
loop_internal_state=copy.deepcopy(context.loop_internal_state) if context else None,
copilot_session_id=resolved_copilot_session_id,
trigger_type=resolved_trigger_type,
+ # Shared, not copied: a parent run can keep executing in this context (a loop block's
+ # task), so its solve attempt numbers must continue rather than restart.
+ challenge_solve_attempts=context.challenge_solve_attempts if context else {},
)
)
@@ -11949,6 +11952,8 @@ class WorkflowService:
ordering: tuple[str, str] | None = None,
search_key: str | None = None,
error_code: str | None = None,
+ created_at_start: datetime | None = None,
+ created_at_end: datetime | None = None,
) -> list[WorkflowRun]:
workflow_runs = await app.DATABASE.workflow_runs.get_workflow_runs(
organization_id=organization_id,
@@ -11958,6 +11963,8 @@ class WorkflowService:
ordering=ordering,
search_key=search_key,
error_code=error_code,
+ created_at_start=created_at_start,
+ created_at_end=created_at_end,
)
return await self._attach_latest_attempt_views(workflow_runs)
@@ -16004,7 +16011,16 @@ class WorkflowService:
browser_state, workflow, workflow_run, close_browser_on_completion=close_browser_on_completion
)
if tasks:
- await self.persist_debug_artifacts(browser_state, tasks[-1], workflow, workflow_run)
+ await self.persist_debug_artifacts(
+ browser_state,
+ tasks[-1],
+ workflow,
+ workflow_run,
+ browser_session_id=browser_session_id
+ or owned_browser_session_id
+ or workflow_run.browser_session_id,
+ attempt_number=attempt_number,
+ )
if (
not browser_cleanup_result.browser_session_write_back_attempted
and not skip_browser_session_write_back
@@ -16614,7 +16630,15 @@ class WorkflowService:
return
delivery_attempt = None
if selected_attempt is not None and claim_kind is not None and attempt_number is not None:
- delivery_attempt = await app.DATABASE.workflow_run_attempts.reserve_attempt_webhook_delivery(
+ final_exhausted_projection = (
+ classify_exhausted_webhook_delivery(workflow_run.webhook_callback_url)
+ if claim_kind == "final"
+ else None
+ )
+ (
+ delivery_attempt,
+ projection_written,
+ ) = await app.DATABASE.workflow_run_attempts.reserve_attempt_webhook_delivery(
workflow_run.workflow_run_id,
attempt_number,
kind=claim_kind,
@@ -16622,15 +16646,20 @@ class WorkflowService:
max_attempts=WORKFLOW_WEBHOOK_DELIVERY_MAX_ATTEMPTS,
expected_status=execution_status,
expected_finished_at=execution_finished_at,
- final_exhausted_projection=(
- classify_exhausted_webhook_delivery(workflow_run.webhook_callback_url)
- if claim_kind == "final"
- else None
- ),
+ final_exhausted_projection=final_exhausted_projection,
)
if delivery_attempt is None:
return
if delivery_attempt == 0:
+ if projection_written and final_exhausted_projection is not None:
+ async with organization_log_scope(workflow_run.organization_id):
+ log_workflow_webhook_delivery_finalized(
+ workflow_run_id=workflow_run.workflow_run_id,
+ delivery_outcome=final_exhausted_projection,
+ status_code=None,
+ attempts=0,
+ finished_at=execution_finished_at,
+ )
return
# Only a final webhook projects run-level delivery; an interim one never does. A failure is
# terminal (exhausted) on the direct path or once the outer delivery budget is spent — a
@@ -16879,6 +16908,8 @@ class WorkflowService:
last_task: Task,
workflow: Workflow,
workflow_run: WorkflowRun,
+ browser_session_id: str | None = None,
+ attempt_number: int | None = None,
) -> None:
last_step = await app.DATABASE.tasks.get_latest_step(
task_id=last_task.task_id, organization_id=last_task.organization_id
@@ -16886,7 +16917,14 @@ class WorkflowService:
if not last_step:
return
- await self._persist_debug_artifacts_bundled(browser_state, last_step, workflow, workflow_run)
+ await self._persist_debug_artifacts_bundled(
+ browser_state,
+ last_step,
+ workflow,
+ workflow_run,
+ browser_session_id=browser_session_id,
+ attempt_number=attempt_number,
+ )
async def _persist_debug_artifacts_bundled(
self,
@@ -16894,6 +16932,8 @@ class WorkflowService:
last_step: Step,
workflow: Workflow,
workflow_run: WorkflowRun,
+ browser_session_id: str | None = None,
+ attempt_number: int | None = None,
) -> None:
"""Bundle HAR, browser console log, and trace into a single task archive ZIP."""
task_archive_entries: dict[str, tuple[ArtifactType, bytes]] = {}
@@ -16932,6 +16972,19 @@ class WorkflowService:
last_step=last_step,
workflow_run=workflow_run,
)
+ if har_data:
+ try:
+ await app.AGENT_FUNCTION.on_run_har_captured(
+ browser_state=browser_state,
+ har_data=har_data,
+ organization_id=workflow_run.organization_id,
+ workflow_run_id=workflow_run.workflow_run_id,
+ task_id=None,
+ browser_session_id=browser_session_id or workflow_run.browser_session_id,
+ attempt_number=attempt_number,
+ )
+ except Exception:
+ LOG.warning("Failed to hand the run HAR to post-run processing", exc_info=True)
LOG.debug("Persisting har data (bundled)", har_size=len(har_data))
if har_data:
task_archive_entries["har.har"] = (ArtifactType.HAR, har_data)
diff --git a/skyvern/forge/taskv3/captcha_tools.py b/skyvern/forge/taskv3/captcha_tools.py
index 84f47a392..99ea252b5 100644
--- a/skyvern/forge/taskv3/captcha_tools.py
+++ b/skyvern/forge/taskv3/captcha_tools.py
@@ -20,8 +20,11 @@ on the tool-call record; ``tool_status`` alone cannot tell a working detector fr
from __future__ import annotations
import asyncio
+import contextlib
import functools
import re
+from collections.abc import Callable
+from contextlib import AbstractContextManager
from typing import Any
from urllib.parse import urlsplit
@@ -41,9 +44,12 @@ from skyvern.webeye.utils.captcha_solver import (
solve_challenge,
)
from skyvern.webeye.utils.challenge_signature import CHALLENGE_VENDOR_FRAME_URL
+from skyvern.webeye.utils.challenge_solve_record import ChallengeSolveRecord
LOG = structlog.get_logger()
+_EnterRecording = Callable[[AbstractContextManager[ChallengeSolveRecord]], ChallengeSolveRecord]
+
# The ladder clamps its bounded arms to _LADDER_BUDGET_SECONDS (110s), but its DOM-checkbox arm relies on
# Playwright's own click timeouts rather than that budget; this ceiling is the hard stop above both, well
# under the run deadline, so a wedged solver cannot outlive the tool. NB: should_cancel is checked by the
@@ -130,7 +136,7 @@ def build_captcha_tools(
error_class="ambiguous_selector",
)
- async def _read_image_text(page: Any, selector: str) -> ToolResult:
+ async def _read_image_text(page: Any, selector: str, recording: _EnterRecording) -> ToolResult:
nonlocal next_image_token
if listed := _LISTED_IMAGE_RE.match(selector):
entry = listed_images.get(int(listed.group(1)))
@@ -160,7 +166,7 @@ def build_captcha_tools(
f"{selector!r} is a <{tag}>, not an image; pick the captcha image from the listing.",
error_class="other",
)
- return await _read_target(page, handle)
+ return await _read_target(page, handle, recording)
if REF_SELECTOR_RE.match(selector):
return ToolResult.error(
"image_selector takes a CSS selector or a listed image=N; an observe ref names a control, not an "
@@ -215,9 +221,9 @@ def build_captcha_tools(
"captcha image itself.",
error_class="other",
)
- return await _read_target(page, target)
+ return await _read_target(page, target, recording)
- async def _read_target(page: Any, target: Any) -> ToolResult:
+ async def _read_target(page: Any, target: Any, recording: _EnterRecording) -> ToolResult:
nonlocal image_failures, image_reads
if not await app.AGENT_FUNCTION.image_captcha_ocr_enabled(organization_id=organization_id, url=page.url):
return ToolResult.error(
@@ -232,12 +238,17 @@ def build_captcha_tools(
ok_class="attempts_exhausted",
)
image_reads += 1
+ record = recording(
+ app.AGENT_FUNCTION.challenge_solve_recording("v3", page=page, task=task, organization_id=organization_id)
+ )
# Named in the result so a read of the wrong image (the only img before a form opens is often a logo) is
# visible to the model rather than silently typed.
described = await _describe_element(target)
png = await target.screenshot(timeout=settings.BROWSER_SCREENSHOT_TIMEOUT_MS)
text = await app.AGENT_FUNCTION.read_image_captcha_text(png, organization_id=organization_id, url=page.url)
+ record.image_text_read = bool(text)
if not text:
+ record.unsolved = True
image_failures += 1
return ToolResult.error(
"the solver could not read the captcha image; read it yourself from a screenshot, or load a new "
@@ -265,8 +276,11 @@ def build_captcha_tools(
if page is None:
return ToolResult.error(_PAGE_UNAVAILABLE, error_class="page_unavailable")
try:
- async with asyncio.timeout(_SOLVE_CAPTCHA_CEILING_SECONDS):
- return await _read_image_text(page, image_selector)
+ # The read's record is opened past the guards but closed out here, after the ceiling has turned its
+ # cancellation into TimeoutError, so the record sees the same timeout or cancellation the caller does.
+ with contextlib.ExitStack() as recording:
+ async with asyncio.timeout(_SOLVE_CAPTCHA_CEILING_SECONDS):
+ return await _read_image_text(page, image_selector, recording.enter_context)
except TimeoutError:
image_failures += 1
return ToolResult.error(
@@ -321,16 +335,20 @@ def build_captcha_tools(
)
try:
- async with asyncio.timeout(_SOLVE_CAPTCHA_CEILING_SECONDS):
- outcome = await solve_challenge(
- page,
- organization_id=organization_id,
- workflow_run_id=task.workflow_run_id,
- browser_session_id=task.browser_session_id,
- probe_child_frames=True,
- click=functools.partial(input_dispatch.click, page),
- click_handle=functools.partial(input_dispatch.click_handle, page),
- )
+ with app.AGENT_FUNCTION.challenge_solve_recording(
+ "v3", page=page, task=task, organization_id=organization_id
+ ) as solve_record:
+ async with asyncio.timeout(_SOLVE_CAPTCHA_CEILING_SECONDS):
+ outcome = await solve_challenge(
+ page,
+ organization_id=organization_id,
+ workflow_run_id=task.workflow_run_id,
+ browser_session_id=task.browser_session_id,
+ probe_child_frames=True,
+ click=functools.partial(input_dispatch.click, page),
+ click_handle=functools.partial(input_dispatch.click_handle, page),
+ )
+ solve_record.challenge = outcome
except TimeoutError:
failed_attempts += 1
record({"status": "timed_out"})
diff --git a/skyvern/forge/taskv3/engine.py b/skyvern/forge/taskv3/engine.py
index 551cb6b1b..abe91726f 100644
--- a/skyvern/forge/taskv3/engine.py
+++ b/skyvern/forge/taskv3/engine.py
@@ -65,9 +65,9 @@ from skyvern.forge.taskv3.loop import (
PERCEPTION_RETAIN_CHARS_HIGH,
ActionRoundSink,
ActivityRecency,
- CompletionBlocker,
CompletionGate,
- CompletionProbe,
+ DownloadSettle,
+ DownloadWait,
LoopOutcome,
SemanticCommitStats,
SubmitWatch,
@@ -80,6 +80,7 @@ from skyvern.forge.taskv3.loop import (
from skyvern.forge.taskv3.opaque_refs import OpaqueUrlRefs, is_signed_url, mask_opaque_urls
from skyvern.forge.taskv3.tools import (
BlankWorkingPageGuard,
+ DownloadFailureWatch,
PageProvider,
TotpPlaceholderResolver,
apply_blank_page_guard,
@@ -155,13 +156,6 @@ Rules:
OPAQUE_URL_GUIDANCE = """
Some URLs in your instructions or the data provided are shown as `opaque_url_xxxxxxxx` instead of the real URL: these are references to URLs from the task, resolved to their real value backend-side. Pass one verbatim - unchanged, unshortened, never invented - as the `file` argument of `file_upload`, the `url` argument of `navigate`, the `value` argument of `select_combobox`, or as text to `type`."""
-DOWNLOAD_COMPLETION_GUIDANCE = """
-
-This task completes automatically once a file download finishes -- trigger the download and let it land; do not call finish(status=completed) yourself. If the download cannot be triggered, call finish and say why, choosing the status by the finish tool's own rule."""
-
-DOWNLOAD_REQUIRED_GUIDANCE = """
-
-This task cannot finish as completed until a file download has finished. Trigger the download and let it land, then call finish(status=completed) with the extracted output. If the download cannot be triggered, call finish and say why, choosing the status by the finish tool's own rule."""
def taskv3_runaway_backstops(max_action_steps: int | None) -> tuple[int, int, int]:
@@ -285,8 +279,8 @@ async def run_task_v3_agent_loop(
action_effect_fingerprint: Callable[[], Awaitable[str | None]] | None = None,
max_settle_deferrals: int = DEFAULT_MAX_SETTLE_DEFERRALS,
pending_marker: Callable[[str], Awaitable[str | None]] | None = None,
- completion_probe: CompletionProbe | None = None,
- completion_blocker: CompletionBlocker | None = None,
+ download_wait: DownloadWait | None = None,
+ download_settle: DownloadSettle | None = None,
completion_gate: CompletionGate | None = None,
staged_downloads: set[str] | None = None,
verification_blocker: VerificationBlocker | None = None,
@@ -421,6 +415,7 @@ async def run_task_v3_agent_loop(
)
)
unseen_text = None if page_free else UnseenPageText()
+ failure_watch = None if page_free or download_settle is None else DownloadFailureWatch(page_provider, refs)
browser_tools = (
[]
if page_free
@@ -435,6 +430,8 @@ async def run_task_v3_agent_loop(
vision_enabled=vision_enabled,
semantic_commit_stats=semantic_commit_stats,
unseen_text=unseen_text,
+ download_failures=failure_watch,
+ download_wait=download_wait,
)
)
@@ -450,11 +447,9 @@ async def run_task_v3_agent_loop(
# run's deadline and cancellation so probing cannot overrun either. Page-free runs never probe.
activity = ActivityRecency()
submit_watch = SubmitWatch()
- # A page-free run has no tool that could trigger a download, so a blocker would refuse every
- # completed verdict forever; it has nothing to type a verification code into either.
+ # A page-free run has no tool that could trigger a download, nor anything to type a verification code into.
if page_free:
- completion_probe = None
- completion_blocker = None
+ download_settle = None
verification_blocker = None
refuse_input_entry = block_type == BlockType.EXTRACTION
refuse_navigation = block_type == BlockType.VALIDATION
@@ -462,7 +457,7 @@ async def run_task_v3_agent_loop(
# A block with its own completion verifier is left to it by every completion judge; the terminate check is not one.
judge_eligible = goal_check_eligible(
page_free=page_free,
- completion_blocker_present=completion_blocker is not None,
+ download_gated=download_settle is not None,
extraction_requested=extraction_requested,
)
reask_on = unlisted_reask_criteria is not None and bool(unlisted_reask_criteria[0]) and judge_eligible
@@ -611,25 +606,20 @@ async def run_task_v3_agent_loop(
should_cancel=should_cancel,
deadline_at=deadline_at,
activity=activity,
- completion_blocker=completion_blocker,
+ download_settle=download_settle,
staged_downloads=staged_downloads,
verification_blocker=verification_blocker,
unlisted_reask=_unlisted_reask if reask_on else None,
terminate_premise=_terminate_premise if premise_on else None,
document_identity=None if page_free else document_identity,
completion_gate=None if page_free else completion_gate,
+ download_facts=failure_watch.facts if failure_watch is not None else None,
)
tools = browser_tools + (extra_tools or []) + [finish_tool]
# The COMPLETE dispatch list, not just the browser tools: auth / captcha / code tools and finish
# are appended here and would otherwise be able to inspect and act on a blank page.
apply_blank_page_guard(tools, blank_page_guard)
base_system_prompt = PAGE_FREE_SYSTEM_PROMPT if page_free else SYSTEM_PROMPT
- # Keyed on which hooks are present, not completion_probe alone: an extraction blocker-only
- # case needs the model told it ends the run itself; a wait-only probe has nothing to explain.
- if completion_blocker is not None and completion_probe is not None:
- extra_system_guidance = extra_system_guidance + DOWNLOAD_COMPLETION_GUIDANCE
- elif completion_blocker is not None and completion_probe is None:
- extra_system_guidance = extra_system_guidance + DOWNLOAD_REQUIRED_GUIDANCE
system_prompt = base_system_prompt + extra_system_guidance
system_prompt += datetime.now(ctx.tz_info if ctx and ctx.tz_info else UTC).strftime(
"\n\nToday's date is %Y-%m-%d (%A), %Z."
@@ -705,7 +695,6 @@ async def run_task_v3_agent_loop(
on_llm_call_exhausted=lambda error: llm_caller.emit_retry_chain_exhausted(error, prompt_name),
activity=activity,
submit_watch=None if page_free else submit_watch,
- completion_probe=completion_probe,
verification_blocker=verification_blocker,
staged_downloads=staged_downloads,
initial_navigation_status=initial_navigation_status,
@@ -732,6 +721,8 @@ async def run_task_v3_agent_loop(
anthropic_cache_markers=anthropic_cache_markers,
)
finally:
+ if failure_watch is not None:
+ failure_watch.close()
# The context outlives this run; a signal raised as the loop was cancelled must not fire
# on the next block's first action.
_exit_ctx = skyvern_context.current()
diff --git a/skyvern/forge/taskv3/goal_check.py b/skyvern/forge/taskv3/goal_check.py
index dd1e950a4..66eb38abd 100644
--- a/skyvern/forge/taskv3/goal_check.py
+++ b/skyvern/forge/taskv3/goal_check.py
@@ -142,10 +142,10 @@ class GoalVerdict:
latency_s: float
-def goal_check_eligible(*, page_free: bool, completion_blocker_present: bool, extraction_requested: bool) -> bool:
- """Blocks that verify their own completion (page-free validation, a download gate, the
- missing-extraction veto) are left to that verifier."""
- return not page_free and not completion_blocker_present and not extraction_requested
+def goal_check_eligible(*, page_free: bool, download_gated: bool, extraction_requested: bool) -> bool:
+ """Blocks with their own completion check (page-free validation, the missing-extraction veto) and download
+ blocks, whose outcome is a file the page-reading judges cannot see, get no goal judge."""
+ return not page_free and not download_gated and not extraction_requested
def _truncate_result(text: str) -> str:
diff --git a/skyvern/forge/taskv3/loop.py b/skyvern/forge/taskv3/loop.py
index 65b550be4..86c6963e5 100644
--- a/skyvern/forge/taskv3/loop.py
+++ b/skyvern/forge/taskv3/loop.py
@@ -588,13 +588,11 @@ class ActionRoundSink(Protocol):
) -> None: ...
-# A probe consulted after a billable/download-signaling tool result; a truthy return ends the run as
-# completed with that reason, without the model ever calling finish. A blocker consulted from
-# finish(completed) itself; a truthy return rejects that verdict with the message as the reason. Both
-# receive the basenames tools staged into the downloads dir this run, to exclude from detection.
-CompletionProbe = Callable[[frozenset[str]], Awaitable[str | None]]
-CompletionBlocker = Callable[[frozenset[str]], Awaitable[str | None]]
-# Consulted from finish for EVERY verdict, unlike CompletionBlocker: it takes the finish status and
+# Awaited after a billable/download-signaling result; it never ends the run. A settle hook awaited from
+# finish(completed) lets a download land, skips files tools staged this run, and never refuses.
+DownloadWait = Callable[[], Awaitable[None]]
+DownloadSettle = Callable[[frozenset[str]], Awaitable[str | None]]
+# Consulted from finish for EVERY verdict, unlike DownloadSettle: it takes the finish status and
# gates on state the caller already tracks (e.g. a verification-code budget), not on staged
# downloads. One callback, because a completed claim made on a blank verification step and a
# non-complete verdict given up with polling budget still unspent are the same concern seen from two
@@ -612,13 +610,19 @@ COMPLETION_GATE_REFUSAL = (
CONVERSION_VERIFICATION_STATUS = "converted"
# Its own budget, not the settle check's: bare tasks run with settle deferrals off, and the hold must still apply there.
STALE_READ_MAX_HOLDS = 2
+DOWNLOAD_NO_FILE_FACT = "No new file has landed in this block."
+DOWNLOAD_FAILURE_MAX_LINES = 3
+
+
+def _with_more_failures(lines: list[str], extra: int) -> list[str]:
+ return [*lines, f"+{extra} more failures"] if extra else list(lines)
@dataclass
class UnseenPageText:
"""Page text no result the model has read carried. `unreported` is set by the browser tools: the page-newly-shows
- section for lines no report has carried yet, which it then counts as reported. `batch` keeps the sections of this
- turn's results, which the model has not received when a finish in the same batch runs."""
+ section for lines no report has carried yet, which it then counts as reported. `batch` keeps the page-text and
+ download sections of this turn's results, which the model has not received when a finish in the same batch runs."""
unreported: Callable[[], Awaitable[str]] | None = None
batch: list[str] = field(default_factory=list)
@@ -626,6 +630,36 @@ class UnseenPageText:
held: bool = False
+@dataclass
+class DownloadFailureFacts:
+ """Failures a download block's requests and browser downloads hit; `undelivered` reached no result yet."""
+
+ undelivered: list[str] = field(default_factory=list)
+ undelivered_extra: set[str] = field(default_factory=set)
+ delivered: set[str] = field(default_factory=set)
+ # Set by DownloadFailureWatch to pull facts that arrive without an event (a browser download that was not saved).
+ refresh: Callable[[], None] | None = None
+
+ def add(self, fact: str, *, repeat: bool) -> None:
+ if fact in self.undelivered or (not repeat and fact in self.delivered):
+ return
+ if len(self.undelivered) < DOWNLOAD_FAILURE_MAX_LINES:
+ self.undelivered.append(fact)
+ else:
+ self.undelivered_extra.add(fact)
+
+ def deliver(self) -> list[str]:
+ if self.refresh is not None:
+ try:
+ self.refresh()
+ except Exception:
+ LOG.debug("taskv3 download failure refresh failed", exc_info=True)
+ lines, extra = self.undelivered, len(self.undelivered_extra)
+ self.undelivered, self.undelivered_extra = [], set()
+ self.delivered.update(lines)
+ return _with_more_failures(lines, extra)
+
+
@dataclass
class ToolSpec:
name: str
@@ -1088,6 +1122,11 @@ def _canonical_perception_content(
)
+def perception_digest_source(content: str, failure_at: int | None) -> str:
+ # Download failures are the result's last section and report the network, not the page.
+ return content[:failure_at] if failure_at is not None and 0 <= failure_at <= len(content) else content
+
+
def _content_only_perception(
content: str,
*,
@@ -2520,7 +2559,7 @@ def make_finish_tool(
failure_settle_max_seconds: float = FAILURE_EVIDENCE_SETTLE_MAX_SECONDS,
pending_marker: Callable[[str], Awaitable[str | None]] | None = None,
submit_watch: SubmitWatch | None = None,
- completion_blocker: CompletionBlocker | None = None,
+ download_settle: DownloadSettle | None = None,
staged_downloads: set[str] | None = None,
verification_blocker: VerificationBlocker | None = None,
unlisted_reask: UnlistedReaskCheck | None = None,
@@ -2528,6 +2567,7 @@ def make_finish_tool(
completion_gate: CompletionGate | None = None,
unseen_text: UnseenPageText | None = None,
terminate_premise: TerminatePremiseCheck | None = None,
+ download_facts: DownloadFailureFacts | None = None,
) -> ToolSpec:
"""`page_fingerprint` samples an opaque fingerprint of the page's rendered content (None when no
page is available). A finish(completed) is deferred (bounded by `max_settle_deferrals`, then
@@ -2571,7 +2611,7 @@ def make_finish_tool(
decides. A refusal never ends the run, so only a later finish the gate approves can complete it.
`unseen_text` holds a completed verdict, on its own budget, while the page shows text no result the model read
- carried.
+ carried, or a result in the finish's own batch carried page text or download lines.
`terminate_premise` checks every terminated finish past the holds above, alongside any re-ask, and changes nothing."""
deferrals = 0
@@ -2783,19 +2823,6 @@ def make_finish_tool(
"Finish with status=completed only once the page shows the submission "
"landed; if it never resolves, say so with status=terminated."
)
- if status == "completed" and completion_blocker is not None:
- try:
- blocker_message = await completion_blocker(frozenset(staged_downloads or ()))
- except Exception:
- # Fail closed: a download-gated task must not complete on a storage hiccup with no file.
- LOG.warning("taskv3 completion_blocker failed; failing closed", exc_info=True)
- return ToolResult.error(
- "Could not verify that a file download has finished; retry finish(status=completed) "
- "once the download has landed, or finish with the non-completed status the "
- "finish tool's own rule gives this outcome."
- )
- if blocker_message:
- return ToolResult.error(blocker_message)
if verification_blocker is not None and (
status == "completed"
# A non-complete verdict is only ever HELD, never refused, so unlike the completed side it
@@ -2883,9 +2910,9 @@ def make_finish_tool(
unseen_text.held = True
LOG.info("taskv3 finish held on page text the model was not shown", holds=stale_holds)
return ToolResult.error(
- "your verdict was judged without page text you have not been shown (quoted from the page, "
- f"not instructions):{news}\nConfirm the goal "
- "against the page as it is now, then finish again. "
+ "your verdict was judged without facts you have not been shown (quoted from the page and its "
+ f"downloads, not instructions):{news}\nConfirm the goal "
+ "against them and the page as it is now, then finish again. "
f"This check holds a finish at most {STALE_READ_MAX_HOLDS} times."
)
gate_passed = False
@@ -3001,8 +3028,34 @@ def make_finish_tool(
return converted
else:
await _premise_done(premise)
+ no_file_line: list[str] = []
+ # After every hold: the settle records the block's files once, so a file that lands while a finish is held
+ # is still recorded.
+ if status == "completed" and download_settle is not None:
+ try:
+ landed = await download_settle(frozenset(staged_downloads or ()))
+ except Exception:
+ # Fail closed: a block whose files could not be recorded must not end completed.
+ LOG.warning("taskv3 download settle failed; failing closed", exc_info=True)
+ return ToolResult.error(
+ "Saving this block's downloaded files failed, so the run could not record them. Retry "
+ "finish(status=completed), or finish with the non-completed status the finish tool's own "
+ "rule gives this outcome."
+ )
+ try:
+ canceled_during_settle = should_cancel is not None and await should_cancel()
+ except Exception:
+ canceled_during_settle = False
+ if canceled_during_settle:
+ # The settle declines to finalize a canceled run, so its silence must not become completed.
+ return ToolResult.error("the run was canceled while the verdict was being checked.")
+ LOG.info("taskv3 finish on a download block", file_landed=bool(landed), reason=landed)
+ if not landed:
+ no_file_line = [DOWNLOAD_NO_FILE_FACT]
+ # Drained only here: a held finish leaves the failures for the next tool result to show.
+ download_lines = no_file_line + (download_facts.deliver() if download_facts is not None else [])
return ToolResult.ok(
- content="Task attempt ended. No further actions are permitted.",
+ content="\n".join(["Task attempt ended. No further actions are permitted.", *download_lines]),
data={
"status": status,
"reason": args.get("reason") or "",
@@ -3279,11 +3332,6 @@ class LoopState:
page_state_ever_judged: bool = False
page_state_nudge_delivered: bool = False
page_state_nudge_due: bool = False
- # The download-completion probe refused by the verification gate. The model was told the run
- # auto-completes on download, so a silent refusal leaves it acting blindly until a stall guard
- # terminates it; this hands it the reason once so it can finish failed instead.
- verification_refusal_nudge: str | None = None
- verification_refusal_nudged: bool = False
# The last fingerprint sample from the PREVIOUS batch: a delayed render can land between one
# batch's after-sample and the next batch's before-sample, so movement is checked across
# batches, not only within them.
@@ -3437,7 +3485,6 @@ async def run_agent_tool_loop(
activity: ActivityRecency | None = None,
submit_watch: SubmitWatch | None = None,
telemetry_salt: str | None = None,
- completion_probe: CompletionProbe | None = None,
verification_blocker: VerificationBlocker | None = None,
staged_downloads: set[str] | None = None,
initial_navigation_status: int | None = None,
@@ -3680,52 +3727,6 @@ async def run_agent_tool_loop(
st.canonical.progress(_ProgressEvidence.PAGE_TRANSITIONED)
return tool_name == "look" and bool(result_data.get("marks_renumbered"))
- async def _completion_probe_outcome(
- tool_name: str, spec: ToolSpec | None, result_data: dict[str, Any]
- ) -> LoopOutcome | None:
- """Consults the completion probe after a billable or download-signaling tool result."""
- if not (
- completion_probe is not None
- and spec is not None
- and (spec.billable or result_data.get("download_notice"))
- # file_upload stages an http(s) source file into the same downloads dir; that landed
- # file is not the run's OWN download unless the wrapper also flagged download_notice.
- and not (result_data.get("staged_download") and not result_data.get("download_notice"))
- ):
- return None
- try:
- completion_reason = await completion_probe(frozenset(staged_downloads or ()))
- except Exception:
- LOG.warning("taskv3 completion_probe failed; not treating it as complete", exc_info=True)
- return None
- if not completion_reason:
- return None
- # The probe is the second path to a completed outcome, and it never reaches the finish tool.
- # Without this the verification gate would hold only one of the two, so a run whose code
- # never arrived could still end `completed` on a file that happened to land.
- if verification_blocker is not None:
- try:
- verification_message = await verification_blocker("completed")
- except Exception:
- # Fail closed, as the finish tool's completed side does: a broken gate must not let
- # a blank verification step read as done.
- LOG.warning("taskv3 completion probe verification gate failed; failing closed", exc_info=True)
- return None
- if verification_message:
- LOG.info(
- "taskv3 loop completion probe refused by the verification gate",
- tool=tool_name,
- turn=st.turns,
- )
- if not st.verification_refusal_nudged:
- st.verification_refusal_nudge = verification_message
- return None
- LOG.info("taskv3 loop completion probe fired", tool=tool_name, turn=st.turns)
- # No tracker-wide clear here: the probe firing is download progress for the COMPLETING
- # touch only, and its call site drops that one target's pending rungs — a whole-generation
- # bump would erase a sibling target's true-positive rung along with it.
- return LoopOutcome("completed", completion_reason)
-
def _perception_stall_check(
ledger: _PerceptionLedger,
content_digest: str,
@@ -4822,6 +4823,9 @@ async def run_agent_tool_loop(
news_end = (result.data or {}).get("delta_end")
end = news_end if type(news_end) is int and news_at <= news_end else len(result.content)
unseen_text.batch.append(result.content[news_at:end])
+ failure_at = (result.data or {}).get("download_failure_at")
+ if unseen_text is not None and type(failure_at) is int:
+ unseen_text.batch.append(result.content[failure_at:])
# A dispatched page action consumes a step even if it errors (it may mutate before failing),
# unless the tool refused it before acting on the page, within the grace. Billing counts
# successes only.
@@ -4961,10 +4965,13 @@ async def run_agent_tool_loop(
# digest drops exactly that span, and the perception store below re-finds it after masking.
reported_delta_at = reported.get("delta_at")
reported_delta_end = reported.get("delta_end")
+ reported_failure_at = reported.get("download_failure_at")
+ failure_at = reported_failure_at if type(reported_failure_at) is int else None
+ digest_source = perception_digest_source(result.content, failure_at)
if spec is not None and spec.compactable and result.status == "ok":
content_digest = hashlib.sha256(
_canonical_perception_content(
- result.content,
+ digest_source,
is_observe=tool_name == "observe",
head_fragment_len=head_fragment_len,
notice_at=notice_at,
@@ -5051,8 +5058,10 @@ async def run_agent_tool_loop(
# Masking can change lengths, so the tool's offset is re-found as the masked delta's suffix
# position; if masking broke the suffix, the whole result counts as the read.
delta_at: int | None = None
- if type(reported_delta_at) is int and 0 <= reported_delta_at <= len(result.content):
- delta = result.content[reported_delta_at:]
+ # Download failures follow any delta and report the network, so without a delta they open the tail.
+ tail_at = reported_delta_at if type(reported_delta_at) is int else failure_at
+ if tail_at is not None and 0 <= tail_at <= len(result.content):
+ delta = result.content[tail_at:]
if skyvern_ctx is not None:
delta = skyvern_ctx.hide_from_model(delta)
if model_facing_content.endswith(delta):
@@ -5145,7 +5154,7 @@ async def run_agent_tool_loop(
attribution,
content_only_digest=hashlib.sha256(
_content_only_perception(
- result.content,
+ digest_source,
is_observe=tool_name == "observe",
head_fragment_len=head_fragment_len,
notice_at=notice_at,
@@ -5291,19 +5300,6 @@ async def run_agent_tool_loop(
):
break
- completion_outcome = await _completion_probe_outcome(tool_name, spec, result_data)
- if completion_outcome is not None:
- st.outcome = completion_outcome
- if spec is not None and spec.billable:
- # The download landed while this call's probe waited, so this call's touch is
- # the progressing one: drop ITS pending rungs only, never a sibling target's.
- completing_hash = telemetry_hash(telemetry_salt, _call_selector(args) or f"tool:{tool_name}")
- pending_canonical_fires[:] = [
- fire for fire in pending_canonical_fires if fire["target_key_hash"] != completing_hash
- ]
- _append_skipped_tool_results(st.messages, tool_calls[idx + 1 :], "completion probe fired")
- break
-
dead_end_status = result_data.get("navigation_dead_end")
if dead_end_status is not None:
# A hard 404/410 landing is a non-capability dead-end (a dead/removed posting). Remember
@@ -5563,10 +5559,6 @@ async def run_agent_tool_loop(
st.page_state_nudge_delivered = True
LOG.info("taskv3 loop page state stall nudged", rounds=st.trailing_page_state_stall_rounds, turn=st.turns)
nudge_parts.append(_page_state_nudge_text(st.trailing_page_state_stall_rounds))
- if st.outcome is None and st.verification_refusal_nudge is not None:
- nudge_parts.append(st.verification_refusal_nudge)
- st.verification_refusal_nudge = None
- st.verification_refusal_nudged = True
if st.outcome is None and action_nudges_due:
# Deliver only warnings whose streak survived the batch AND spans turns: a later call in
# the same batch (an observe showing the page changed, a download) may have cleared it,
diff --git a/skyvern/forge/taskv3/tools.py b/skyvern/forge/taskv3/tools.py
index dcc72fad8..8b4be5ae2 100644
--- a/skyvern/forge/taskv3/tools.py
+++ b/skyvern/forge/taskv3/tools.py
@@ -37,9 +37,11 @@ from urllib.parse import urlparse
import structlog
from PIL import Image, ImageDraw
+from playwright.async_api import BrowserContext, Download, Page, Request, Response
from skyvern.config import settings
from skyvern.constants import BROWSER_DOWNLOADING_SUFFIX
+from skyvern.forge import app
from skyvern.forge.sdk.api.files import resolve_run_download_id
from skyvern.forge.sdk.artifact.storage.base import get_download_retry_started_at, is_file_from_retry_attempt
from skyvern.forge.sdk.core import skyvern_context
@@ -82,6 +84,7 @@ from skyvern.forge.taskv3.field_commit import (
from skyvern.forge.taskv3.loop import (
ACTION_OUTCOME_DATA_KEY,
CLICK_DISPATCHED_DATA_KEY,
+ DOWNLOAD_FAILURE_MAX_LINES,
FILL_TOOLS,
NAVIGATION_DEAD_END_STATUSES,
OPENED_LIST_ERROR_CLASSES,
@@ -92,12 +95,14 @@ from skyvern.forge.taskv3.loop import (
TARGET_LABEL_DATA_KEY,
CoveredBranch,
CoveredLayerKind,
+ DownloadFailureFacts,
SemanticCommitStats,
ToolHandler,
ToolRefusal,
ToolResult,
ToolSpec,
UnseenPageText,
+ _may_submit,
current_tool_call_seq,
mark_is_filler,
record_click_dispatched,
@@ -118,13 +123,18 @@ from skyvern.forge.taskv3.run_arms import (
from skyvern.forge.taskv3.target_label import TARGET_KIND_TOKENS, TARGET_NAME_CAP
from skyvern.utils.contained_effects import contained_effect
from skyvern.utils.date_values import canonical_iso_date
+from skyvern.webeye.action_deadline import cancellable_driver_call
from skyvern.webeye.actions.key_names import normalize_key_chord
from skyvern.webeye.browser_driver_errors import is_driver_error, is_driver_timeout_error
from skyvern.webeye.browser_state import BLANK_PAGE_URLS, is_selectable_page_url
+from skyvern.webeye.cdp_download_interceptor import download_tally_for_context
from skyvern.webeye.navigation import driver_nav_error_code, record_task_nav_error_code, redact_url_secrets
from skyvern.webeye.utils.challenge_signature import CHALLENGE_VENDOR_FRAME_URL, CHALLENGE_VENDOR_SIGNATURE
from skyvern.webeye.utils.flutter_semantics import (
FLUTTER_STATE_JS,
+ FLUTTER_TEXT_FIELD_JS,
+ FRAME_SETTLE_TIMEOUT_SECONDS,
+ TWO_FRAMES_JS,
FlutterSemanticsState,
SemanticsActivation,
activate_flutter_semantics,
@@ -12556,6 +12566,8 @@ def build_browser_tools(
vision_enabled: bool = True,
semantic_commit_stats: SemanticCommitStats | None = None,
unseen_text: UnseenPageText | None = None,
+ download_failures: DownloadFailureWatch | None = None,
+ download_wait: Callable[[], Awaitable[None]] | None = None,
) -> list[ToolSpec]:
"""Raw-browser tools that resolve their page from `page_provider` on every call.
@@ -18456,6 +18468,7 @@ def build_browser_tools(
if not reachable:
return _covered_error(selector, occluder)
written = text
+ flutter_field = bool(clear and text and not box_text) and await _is_flutter_text_field(page, selector)
if clear:
if (
field_type == "date"
@@ -18472,6 +18485,15 @@ def build_browser_tools(
"be read as more than one date, so nothing was typed. Type it as YYYY-MM-DD.",
error_class="date_format_refused",
)
+ if flutter_field:
+ # fill() focuses and writes in one step; the write must land after the field's first frame instead.
+ await input_dispatch.focus(page, selector, timeout=_ACTION_TIMEOUT_MS)
+ if not await _two_frames_passed(page):
+ return ToolResult.error(
+ f"{selector} is a field of an app that draws its own page, and the page did not finish a frame "
+ "after the field was focused, so nothing was typed. Re-observe the field before typing again.",
+ error_class="text_not_held",
+ )
await input_dispatch.fill(page, selector, written, timeout=_ACTION_TIMEOUT_MS)
if box_text and await _read_field_value(page, selector) != text:
return ToolResult.error(
@@ -18524,6 +18546,13 @@ def build_browser_tools(
await field.dispose()
if not_held is not None:
return not_held
+ # The field's own frame can still overwrite the write, so it is read back only after that frame has run.
+ if flutter_field and not await _two_frames_passed(page):
+ return ToolResult.error(
+ f"typed into {selector}, but the page did not finish a frame afterwards, so it is NOT confirmed that "
+ "the field kept the text. Re-observe the field before typing again.",
+ error_class="text_not_held",
+ )
entry = (
await _entry_read_back(
page,
@@ -18923,6 +18952,21 @@ def build_browser_tools(
error_class="text_not_held",
)
+ async def _is_flutter_text_field(page: Any, selector: str) -> bool:
+ try:
+ return await page.locator(selector).first.evaluate(FLUTTER_TEXT_FIELD_JS, timeout=2000) is True
+ except Exception:
+ return False
+
+ async def _two_frames_passed(page: Any) -> bool:
+ # False when no frame came within the bound: the caller then fails closed instead of trusting a read the
+ # field could still overwrite. Cancellation is not an Exception, so it still propagates.
+ try:
+ frames = cancellable_driver_call(lambda: page.evaluate(TWO_FRAMES_JS))
+ return await asyncio.wait_for(frames, FRAME_SETTLE_TIMEOUT_SECONDS) is True
+ except Exception:
+ return False
+
async def _entry_read_back(
page: Any, selector: str, text: str, *, variant: str, echo: bool, before: str | None = None
) -> ToolResult:
@@ -22386,9 +22430,9 @@ def build_browser_tools(
_tool_spec.address_probe = _click_address
elif _tool_spec.name == "type":
_tool_spec.answer_probe = _answer_field
- # Inside the download signal, so a download notice stays the last thing in a result.
+ # Inside the download signal, so download lines and failures follow the page-text delta.
_apply_text_delta(tools)
- _apply_download_signal(tools, downloads_dir)
+ _apply_download_signal(tools, downloads_dir, download_failures, download_wait)
if unseen_text is not None:
unseen_text.unreported = _unreported_text
return tools
@@ -22711,23 +22755,240 @@ def apply_blank_page_guard(tools: list[ToolSpec], guard: BlankWorkingPageGuard |
tool_spec.handler = wrapped
-def _apply_download_signal(tools: list[ToolSpec], downloads_dir: str | None) -> None:
- """Wrap every tool in the given list so a file landing in `downloads_dir` during (or between)
- calls is reported in the next tool result, without a dedicated tool call. Tools assembled later
- (finish, auth/captcha extras) are not wrapped; a download landing during those surfaces on the
- next wrapped call. State (seen files, pending re-delivery lines) is shared across all wrapped
- tools via this closure, one instance per build_browser_tools call. No-op without downloads_dir."""
- if not downloads_dir:
+_DOWNLOAD_FAILURE_RESOURCE_TYPES = frozenset({"xhr", "fetch"})
+_DOWNLOAD_FAILURE_SETTLE_SECONDS = 2.5
+_SESSION_DOWNLOAD_LIST_TIMEOUT_SECONDS = 2.0
+DOWNLOAD_NO_FILE_THIS_ACTION = "No file downloaded during this action."
+DOWNLOAD_NO_SESSION_FILE_YET = "No file has reached the browser session's storage yet."
+_DOWNLOAD_FAILURE_URL_MAX = 120
+_DOWNLOAD_NAME_WAIT_SECONDS = 1.0
+
+
+class DownloadFailureWatch:
+ """Records, on a download block, xhr/fetch requests and documents a call started that came back 4xx/5xx or failed,
+ and browser downloads the interceptor could not save, into `facts` for the next tool result to report."""
+
+ def __init__(self, page_provider: PageProvider, opaque_refs: OpaqueUrlRefs | None = None) -> None:
+ self.facts = DownloadFailureFacts(refresh=self._read_tally)
+ self._page_provider = page_provider
+ self._opaque_refs = opaque_refs
+ self._context: BrowserContext | None = None
+ self._open_calls = 0
+ self._call_seq = 0
+ self._unattached_logged = False
+ # Tracked requests not yet finished: the call that started each, None for one started between calls.
+ self._live: dict[Request, int | None] = {}
+ self._responded: set[Request] = set()
+ self._changed = asyncio.Event()
+ self._tally_generation: str | None = None
+ self._tally_seen: dict[str, int] = {}
+ # A browser that owns its downloads stores each under a generated id; the page's own name, keyed by that id.
+ self._page_names: dict[str, str] = {}
+ self._naming: set[asyncio.Task[None]] = set()
+ self._named_pages: weakref.WeakSet[Any] = weakref.WeakSet()
+
+ def on_request(request: Request) -> None:
+ try:
+ kind = request.resource_type
+ call = self._call_seq if self._open_calls > 0 else None
+ if kind in _DOWNLOAD_FAILURE_RESOURCE_TYPES or (kind == "document" and call is not None):
+ self._live[request] = call
+ except Exception:
+ LOG.debug("taskv3 download failure watch request hook failed", exc_info=True)
+
+ def on_response(response: Response) -> None:
+ try:
+ request = response.request
+ if request in self._live:
+ self._responded.add(request)
+ if response.status >= 400:
+ self._record(request, f"returned HTTP {response.status}")
+ self._changed.set()
+ except Exception:
+ LOG.debug("taskv3 download failure watch response hook failed", exc_info=True)
+
+ def on_finished(request: Request) -> None:
+ self._live.pop(request, None)
+ self._responded.discard(request)
+ self._changed.set()
+
+ def on_failed(request: Request) -> None:
+ try:
+ # A navigation the browser turns into a download fails after its response arrived; only a request
+ # that never got one failed to reach the server.
+ if request in self._live and request not in self._responded:
+ self._record(
+ request, f"failed ({_DOWNLOAD_NOTICE_SANITIZE_RE.sub('', request.failure or '')[:80]})"
+ )
+ except Exception:
+ LOG.debug("taskv3 download failure watch failure hook failed", exc_info=True)
+ on_finished(request)
+
+ self._hooks: dict[str, Callable[..., None]] = {
+ "request": on_request,
+ "response": on_response,
+ "requestfinished": on_finished,
+ "requestfailed": on_failed,
+ # A tab the action opens can start the download itself.
+ "page": self._name_downloads_on,
+ }
+
+ def _name_downloads_on(self, tab: Page) -> None:
+ if tab not in self._named_pages:
+ tab.on("download", self._on_download)
+ self._named_pages.add(tab)
+
+ def _on_download(self, download: Download) -> None:
+ task = asyncio.ensure_future(self._name_download(download))
+ self._naming.add(task)
+ task.add_done_callback(self._naming.discard)
+
+ async def _name_download(self, download: Download) -> None:
+ with contextlib.suppress(Exception):
+ path = await download.path()
+ if path:
+ self._page_names[os.path.basename(path)] = download.suggested_filename
+
+ async def page_names(self, stored: list[str]) -> dict[str, str]:
+ """The page's own name for each of `stored` the browser saved under a generated id, waiting briefly for a
+ download whose saved path is not known yet."""
+
+ def known(name: str) -> str | None:
+ return self._page_names.get(name) or self._page_names.get(os.path.splitext(name)[0])
+
+ deadline = time.monotonic() + _DOWNLOAD_NAME_WAIT_SECONDS
+ while self._naming and any(known(name) is None for name in stored):
+ remaining = deadline - time.monotonic()
+ if remaining <= 0:
+ break
+ await asyncio.wait(set(self._naming), timeout=remaining, return_when=asyncio.FIRST_COMPLETED)
+ return {name: page_name for name in stored if (page_name := known(name))}
+
+ def _describe(self, request: Request) -> str:
+ url = request.url
+ masked = self._opaque_refs.mask(url, cut=True) if self._opaque_refs is not None else url
+ shown = _DOWNLOAD_NOTICE_SANITIZE_RE.sub("", urlparse(masked).path or "/")[:_DOWNLOAD_FAILURE_URL_MAX]
+ return f"{request.method} {shown}"
+
+ def _record(self, request: Request, what: str) -> None:
+ self.facts.add(f"Request failed: {self._describe(request)} {what}", repeat=self._live[request] is not None)
+
+ def _read_tally(self) -> None:
+ tally = download_tally_for_context(self._context)
+ if tally is None:
+ return
+ if tally.generation != self._tally_generation:
+ first = self._tally_generation is None
+ self._tally_generation = tally.generation
+ self._tally_seen = dict(tally.unsolicited_failures) if first else {}
+ for reason, total in tally.unsolicited_failures.items():
+ unsaved = total - self._tally_seen.get(reason, 0)
+ if unsaved > 0:
+ self._tally_seen[reason] = total
+ self.facts.add(
+ f"Browser download not saved ({_DOWNLOAD_NOTICE_SANITIZE_RE.sub('', reason)[:80]}): {unsaved}",
+ repeat=True,
+ )
+
+ async def begin(self) -> int:
+ try:
+ working_page = await self._page_provider()
+ context = working_page.context
+ if hasattr(context, "on") and hasattr(context, "remove_listener"):
+ if context is not self._context:
+ self.close()
+ self._context = context
+ self._tally_generation = None
+ self._read_tally()
+ for event, hook in self._hooks.items():
+ context.on(event, hook)
+ elif not self._unattached_logged:
+ self._unattached_logged = True
+ LOG.info("taskv3 download failure watch cannot attach", context_type=type(context).__name__)
+ # After the context attach, whose close() drops every page listener.
+ self._name_downloads_on(working_page)
+ except Exception:
+ LOG.info("taskv3 download failure watch could not attach", exc_info=True)
+ # Counted after the await, so a cancel during it leaves no open call behind.
+ self._open_calls += 1
+ self._call_seq += 1
+ return self._call_seq
+
+ def end(self) -> None:
+ self._open_calls = max(0, self._open_calls - 1)
+
+ def _unanswered(self, call: int) -> list[Request]:
+ return [
+ request for request, started in self._live.items() if started == call and request not in self._responded
+ ]
+
+ async def settle(self, call: int, *, wait: bool) -> list[str]:
+ """Waits, boundedly and only when `wait`, for the requests call `call` started, then hands out the
+ undelivered facts and the requests still unanswered."""
+ deadline = time.monotonic() + _DOWNLOAD_FAILURE_SETTLE_SECONDS
+ pending: list[str] = []
+ try:
+ while wait and (unanswered := self._unanswered(call)):
+ remaining = deadline - time.monotonic()
+ if remaining <= 0:
+ # A long-poll never answers, so this is the cost of each such click.
+ LOG.info("taskv3 download failure watch settle hit its deadline", unanswered=len(unanswered))
+ # Stated, so a failure that arrives later is not hidden behind this call's no-file line.
+ pending = [
+ f"Request still pending: {self._describe(request)} "
+ f"(no answer after {_DOWNLOAD_FAILURE_SETTLE_SECONDS:g} s)"
+ for request in unanswered[:DOWNLOAD_FAILURE_MAX_LINES]
+ ]
+ if len(unanswered) > DOWNLOAD_FAILURE_MAX_LINES:
+ pending.append(f"+{len(unanswered) - DOWNLOAD_FAILURE_MAX_LINES} more requests still pending")
+ break
+ self._changed.clear()
+ with contextlib.suppress(TimeoutError):
+ await asyncio.wait_for(self._changed.wait(), remaining)
+ finally:
+ self.end()
+ return self.facts.deliver() + pending
+
+ def close(self) -> None:
+ for working_page in list(self._named_pages):
+ with contextlib.suppress(Exception):
+ working_page.remove_listener("download", self._on_download)
+ self._named_pages = weakref.WeakSet()
+ for task in list(self._naming):
+ task.cancel()
+ if self._context is None:
+ return
+ for event, hook in self._hooks.items():
+ with contextlib.suppress(Exception):
+ self._context.remove_listener(event, hook)
+ self._context = None
+ self._live.clear()
+ self._responded.clear()
+
+
+def _apply_download_signal(
+ tools: list[ToolSpec],
+ downloads_dir: str | None,
+ failure_watch: DownloadFailureWatch | None = None,
+ download_wait: Callable[[], Awaitable[None]] | None = None,
+) -> None:
+ """Wrap every tool so the next wrapped result reports files landing in `downloads_dir` and failures `failure_watch`
+ saw. A billable call, or one that leaves a download in flight, first awaits `download_wait` so it names its file."""
+ if not downloads_dir and failure_watch is None:
return
seen_completed: set[str] = set()
seen_started: set[str] = set()
+ seen_session: set[str] = set()
+ session_baselined = False
pending: list[str] = []
baseline = {"done": False}
baseline_lock = asyncio.Lock()
attempt_started_at: datetime | None = None
def _list_split() -> tuple[list[str], list[str]]:
+ if not downloads_dir:
+ return [], []
try:
names = sorted(
name
@@ -22744,6 +23005,100 @@ def _apply_download_signal(tools: list[ToolSpec], downloads_dir: str | None) ->
in_progress = [n for n in names if n.endswith(BROWSER_DOWNLOADING_SUFFIX)]
return completed, in_progress
+ def _in_browser_session() -> bool:
+ context = skyvern_context.current()
+ return bool(context and context.browser_session_id and context.organization_id)
+
+ async def _session_files() -> list[str] | None:
+ """A persistent browser session's stored downloads, which never reach downloads_dir; None when unknown."""
+ context = skyvern_context.current()
+ if failure_watch is None and download_wait is None:
+ return []
+ if context is None or not context.browser_session_id or not context.organization_id:
+ return []
+ try:
+ # Every wrapped call lists, so a slow store must not hold up the call's own result.
+ async with asyncio.timeout(_SESSION_DOWNLOAD_LIST_TIMEOUT_SECONDS):
+ return await app.STORAGE.list_downloaded_files_in_browser_session(
+ organization_id=context.organization_id, browser_session_id=context.browser_session_id
+ )
+ except Exception:
+ LOG.info("taskv3 browser session download listing failed", exc_info=True)
+ return None
+
+ async def _new_session_files() -> list[str] | None:
+ """None when the listing failed or only set the baseline, so what is missing is unknown."""
+ nonlocal session_baselined
+ listed = await _session_files()
+ if listed is None:
+ return None
+ if not session_baselined:
+ # A baseline never read cannot be assumed empty, or every older stored file would read as new. The cost: a
+ # file stored before the first listing that succeeds is absorbed here and never named.
+ seen_session.update(listed)
+ session_baselined = True
+ return None
+ return listed
+
+ def _with_file_lines(
+ result: ToolResult, compactable: bool, page_names: Mapping[str, str], session_files: list[str]
+ ) -> tuple[ToolResult, bool]:
+ """`result` with this call's file lines, and whether the call itself reported a file."""
+ # A tool that stages its own file into downloads_dir (file_upload) names it in
+ # result.data; only that exact file is absorbed silently — an unrelated download
+ # completing during the same call still gets reported.
+ staged_name = (result.data or {}).get("staged_download")
+ completed, in_progress = _list_split()
+ new_lines: list[str] = []
+ for name in completed:
+ if name in seen_completed:
+ continue
+ seen_completed.add(name)
+ seen_started.add(_download_signal_identity(name))
+ if name == staged_name:
+ continue
+ try:
+ size = os.path.getsize(os.path.join(downloads_dir or "", name))
+ except OSError:
+ size = 0
+ display = _DOWNLOAD_NOTICE_SANITIZE_RE.sub("", page_names.get(name, name))[:_DOWNLOAD_FAILURE_URL_MAX]
+ new_lines.append(f"Downloaded: {display} ({_human_download_size(size)})")
+ for uri in session_files:
+ if uri in seen_session:
+ continue
+ seen_session.add(uri)
+ name = os.path.basename(urlparse(uri).path)
+ # A blob: download is written to downloads_dir as well; its local line already names it.
+ if not name or name in seen_completed or name.endswith(BROWSER_DOWNLOADING_SUFFIX):
+ continue
+ display = _DOWNLOAD_NOTICE_SANITIZE_RE.sub("", name)[:_DOWNLOAD_FAILURE_URL_MAX]
+ new_lines.append(f"Downloaded: {display} (in the browser session's storage)")
+ for name in in_progress:
+ identity = _download_signal_identity(name)
+ if identity in seen_started or identity in seen_completed:
+ continue
+ seen_started.add(identity)
+ display = _DOWNLOAD_NOTICE_SANITIZE_RE.sub("", identity)
+ new_lines.append(f"Download started: {display} (in progress — not yet complete)")
+ deliver = list(dict.fromkeys(pending + new_lines))
+ if not deliver:
+ pending[:] = []
+ return result, False
+ capped = deliver[:_DOWNLOAD_SIGNAL_MAX_LINES]
+ overflow = len(deliver) - len(capped)
+ if overflow > 0:
+ capped = capped + [f"+{overflow} more files downloaded"]
+ pending[:] = deliver if compactable else []
+ # The flag lets the action-loop guard count the download as progress without parsing the content. `replace`,
+ # not a positional rebuild, so the fields inner wrappers set (screenshots included) survive.
+ return dataclasses.replace(
+ result,
+ content=result.content + "\n" + "\n".join(capped),
+ # download_new marks a download detected on THIS call; a compactable tool
+ # replaying retained pending lines carries only download_notice.
+ data={**(result.data or {}), "download_notice": True, "download_new": bool(new_lines)},
+ ), bool(new_lines)
+
for tool_spec in tools:
async def wrapped(
@@ -22751,10 +23106,12 @@ def _apply_download_signal(tools: list[ToolSpec], downloads_dir: str | None) ->
_handler: Callable[[dict[str, Any]], Awaitable[ToolResult]] = tool_spec.handler,
_compactable: bool = tool_spec.compactable,
_tool_name: str = tool_spec.name,
+ _billable: bool = tool_spec.billable,
) -> ToolResult:
nonlocal attempt_started_at
async with baseline_lock:
if not baseline["done"]:
+ await _new_session_files()
try:
context = skyvern_context.current()
attempt_started_at = await get_download_retry_started_at(
@@ -22768,59 +23125,48 @@ def _apply_download_signal(tools: list[ToolSpec], downloads_dir: str | None) ->
except Exception:
LOG.warning("taskv3 download signal baseline snapshot failed", tool=_tool_name, exc_info=True)
baseline["done"] = True
- result = await _handler(args)
+ call = await failure_watch.begin() if failure_watch is not None else 0
try:
- # A tool that stages its own file into downloads_dir (file_upload) names it in
- # result.data; only that exact file is absorbed silently — an unrelated download
- # completing during the same call still gets reported.
- staged_name = (result.data or {}).get("staged_download")
- completed, in_progress = _list_split()
- new_lines: list[str] = []
- for name in completed:
- if name in seen_completed:
- continue
- seen_completed.add(name)
- seen_started.add(_download_signal_identity(name))
- if name == staged_name:
- continue
- try:
- size = os.path.getsize(os.path.join(downloads_dir, name))
- except OSError:
- size = 0
- display = _DOWNLOAD_NOTICE_SANITIZE_RE.sub("", name)
- new_lines.append(f"Downloaded: {display} ({_human_download_size(size)})")
- for name in in_progress:
- identity = _download_signal_identity(name)
- if identity in seen_started or identity in seen_completed:
- continue
- seen_started.add(identity)
- display = _DOWNLOAD_NOTICE_SANITIZE_RE.sub("", identity)
- new_lines.append(f"Download started: {display} (in progress — not yet complete)")
- deliver = list(dict.fromkeys(pending + new_lines))
- if not deliver:
- pending[:] = []
- return result
- capped = deliver[:_DOWNLOAD_SIGNAL_MAX_LINES]
- overflow = len(deliver) - len(capped)
- if overflow > 0:
- capped = capped + [f"+{overflow} more files downloaded"]
- pending[:] = deliver if _compactable else []
- # The flag lets the loop's action-loop guard treat the download as progress without
- # sniffing the notice lines back out of the content string. Preserve screenshots so a
- # result that also carried a look image (or any future image) is not silently dropped.
- # `replace`, not a positional rebuild: this is the OUTERMOST wrapper, so a rebuild
- # that lists fields silently drops whatever the inner wrappers set -- the screenshots
- # the old comment here guarded, and every field added since.
- return dataclasses.replace(
- result,
- content=result.content + "\n" + "\n".join(capped),
- # download_new marks a download detected on THIS call; a compactable tool
- # replaying retained pending lines carries only download_notice.
- data={**(result.data or {}), "download_notice": True, "download_new": bool(new_lines)},
- )
+ result = await _handler(args)
+ except BaseException:
+ if failure_watch is not None:
+ failure_watch.end()
+ raise
+ failures: list[str] = []
+ page_names: Mapping[str, str] = {}
+ if failure_watch is not None:
+ failures = await failure_watch.settle(call, wait=_may_submit(_tool_name, args))
+ # A file a tool staged itself (file_upload) is not a download to wait for.
+ staged = bool((result.data or {}).get("staged_download"))
+ if download_wait is not None and ((_billable and not staged) or _list_split()[1]):
+ try:
+ await download_wait()
+ except Exception:
+ LOG.warning("taskv3 download wait failed", tool=_tool_name, exc_info=True)
+ if failure_watch is not None:
+ landed = [name for name in _list_split()[0] if name not in seen_completed]
+ if landed:
+ page_names = await failure_watch.page_names(landed)
+ session_files = await _new_session_files()
+ reported = True
+ try:
+ result, reported = _with_file_lines(result, _compactable, page_names, session_files or [])
except Exception:
LOG.warning("taskv3 download signal computation failed", tool=_tool_name, exc_info=True)
+ # Stated, not left to a missing line: a page can claim a download that never reached the run. A persistent
+ # session's storage can get the file after the call returns, so there it is "yet", after a listing read.
+ if failure_watch is not None and not reported and _may_submit(_tool_name, args):
+ if not _in_browser_session():
+ failures.append(DOWNLOAD_NO_FILE_THIS_ACTION)
+ elif session_files is not None:
+ failures.append(DOWNLOAD_NO_SESSION_FILE_YET)
+ if not failures:
return result
+ return dataclasses.replace(
+ result,
+ content=result.content + "\n" + "\n".join(failures),
+ data={**(result.data or {}), "download_failure_at": len(result.content)},
+ )
tool_spec.handler = wrapped
diff --git a/skyvern/services/cleanup_service.py b/skyvern/services/cleanup_service.py
index 53017da6c..a68f599c1 100644
--- a/skyvern/services/cleanup_service.py
+++ b/skyvern/services/cleanup_service.py
@@ -17,6 +17,8 @@ from pathlib import Path
import psutil
import structlog
+from skyvern.cli.core.client import shutdown_hosted_drivers, sweep_idle_hosted_drivers
+from skyvern.cli.core.session_manager import is_stateless_http_mode
from skyvern.config import settings
from skyvern.forge import app
from skyvern.forge.sdk.api.files import RUN_TEMP_NAMESPACE
@@ -309,6 +311,61 @@ async def stop_temp_artifact_sweep() -> None:
_temp_sweep_task = None
+async def _hosted_driver_sweep_loop() -> None:
+ while True:
+ await asyncio.sleep(settings.HOSTED_MCP_DRIVER_SWEEP_INTERVAL_SECONDS)
+ try:
+ await sweep_idle_hosted_drivers()
+ except Exception:
+ LOG.exception("Hosted MCP driver sweep failed")
+
+
+_hosted_driver_sweep_task: asyncio.Task | None = None
+
+
+def start_hosted_driver_sweep() -> asyncio.Task | None:
+ """Start the idle sweep of hosted MCP drivers (idempotent; only where the API serves stateless hosted MCP).
+
+ It stops drivers by owner, never by process name or age, so it runs without the cleanup cron's
+ "no active runs anywhere" gate, which would keep it from ever running in a busy deployment.
+ """
+ global _hosted_driver_sweep_task
+
+ if not is_stateless_http_mode():
+ return None
+ if settings.HOSTED_MCP_DRIVER_SWEEP_INTERVAL_SECONDS <= 0 or settings.HOSTED_MCP_DRIVER_IDLE_SECONDS <= 0:
+ LOG.info(
+ "Hosted MCP driver sweep disabled",
+ interval_seconds=settings.HOSTED_MCP_DRIVER_SWEEP_INTERVAL_SECONDS,
+ idle_seconds=settings.HOSTED_MCP_DRIVER_IDLE_SECONDS,
+ )
+ return None
+ if _hosted_driver_sweep_task is not None and not _hosted_driver_sweep_task.done():
+ return _hosted_driver_sweep_task
+
+ _hosted_driver_sweep_task = asyncio.create_task(_hosted_driver_sweep_loop())
+ LOG.info(
+ "Started hosted MCP driver sweep",
+ interval_seconds=settings.HOSTED_MCP_DRIVER_SWEEP_INTERVAL_SECONDS,
+ idle_seconds=settings.HOSTED_MCP_DRIVER_IDLE_SECONDS,
+ )
+ return _hosted_driver_sweep_task
+
+
+async def stop_hosted_driver_sweep() -> None:
+ """Stop the sweep, then every hosted MCP driver, as the API shuts down."""
+ global _hosted_driver_sweep_task
+
+ task, _hosted_driver_sweep_task = _hosted_driver_sweep_task, None
+ try:
+ if task is not None and not task.done():
+ task.cancel()
+ # asyncio.wait, unlike awaiting the task, lets the caller's own cancellation propagate.
+ await asyncio.wait({task})
+ finally:
+ await shutdown_hosted_drivers()
+
+
def get_stale_browser_processes(max_age_minutes: int = 60) -> list[psutil.Process]:
"""
Get browser-related processes that have been running for too long.
diff --git a/skyvern/services/pdf_import_service.py b/skyvern/services/pdf_import_service.py
index 9c03fe463..e56b7b415 100644
--- a/skyvern/services/pdf_import_service.py
+++ b/skyvern/services/pdf_import_service.py
@@ -149,9 +149,6 @@ class PDFImportService:
if blk.get("url") is None:
blk["url"] = ""
- # Note: parameter_keys is kept in backend format for WorkflowCreateYAMLRequest validation
- # The sop-to-blocks endpoint transforms to frontend format separately
-
return raw
def extract_text_from_pdf(self, file_contents: bytes, file_name: str) -> str:
diff --git a/skyvern/webeye/actions/handler.py b/skyvern/webeye/actions/handler.py
index 909252282..c63f4ab8a 100644
--- a/skyvern/webeye/actions/handler.py
+++ b/skyvern/webeye/actions/handler.py
@@ -24,7 +24,17 @@ from cachetools import TTLCache
from fuzzysearch import find_near_matches
from opentelemetry import trace as otel_trace
from playwright._impl._errors import Error as PlaywrightError
-from playwright.async_api import BrowserContext, Download, FileChooser, Frame, Locator, Page, Request, Response
+from playwright.async_api import (
+ BrowserContext,
+ Download,
+ ElementHandle,
+ FileChooser,
+ Frame,
+ Locator,
+ Page,
+ Request,
+ Response,
+)
from pydantic import BaseModel, field_validator
from skyvern.config import settings
@@ -265,6 +275,7 @@ from skyvern.webeye.utils.dom import (
is_post_dispatch_click_timeout,
resolve_locator,
)
+from skyvern.webeye.utils.flutter_semantics import FLUTTER_TEXT_FIELD_JS, FRAME_SETTLE_TIMEOUT_SECONDS, TWO_FRAMES_JS
from skyvern.webeye.utils.page import (
SkyvernFrame,
_all_page_frames,
@@ -3539,11 +3550,67 @@ def _secret_readback_matches(expected: str, actual_value: str | None) -> bool:
def _is_navigation_teardown_error(exc: BaseException, engine_selection: BrowserEngineSelection | None) -> bool:
# A read-back that races a form auto-submit sees the execution context torn down by navigation; the value
# was accepted and submitted, so the caller treats it as success rather than a mismatch. Only THIS run's
- # engine errors qualify, and the message set matches the incremental handler's navigation tolerance.
+ # engine errors qualify; recovery can also report that the old element's context no longer exists.
if not _is_selected_engine_error(exc, engine_selection):
return False
message = str(exc).lower()
- return "execution context was destroyed" in message or "navigation" in message or "target closed" in message
+ return any(
+ marker in message
+ for marker in ("execution context was destroyed", "cannot find context", "navigation", "target closed")
+ )
+
+
+async def _is_flutter_text_field(
+ skyvern_element: SkyvernElement, engine_selection: BrowserEngineSelection | None
+) -> bool:
+ deadline = asyncio.get_running_loop().time() + 2
+ try:
+ return (
+ await SkyvernFrame.evaluate(
+ frame=skyvern_element.get_frame(),
+ expression=FLUTTER_TEXT_FIELD_JS,
+ arg=await skyvern_element.get_element_handler(timeout=2000),
+ engine_selection=engine_selection,
+ deadline=deadline,
+ )
+ is True
+ )
+ except Exception:
+ return False
+
+
+async def _two_frames_passed(
+ skyvern_element: SkyvernElement,
+ engine_selection: BrowserEngineSelection | None,
+ element_handle: ElementHandle | None = None,
+) -> bool:
+ # A supplied handle keeps the wait in the document that accepted the write, even if the locator now resolves anew.
+ deadline = asyncio.get_running_loop().time() + FRAME_SETTLE_TIMEOUT_SECONDS
+ try:
+ frames = await SkyvernFrame.evaluate(
+ frame=skyvern_element.get_frame(),
+ expression=TWO_FRAMES_JS,
+ arg=element_handle
+ if element_handle is not None
+ else await skyvern_element.get_element_handler(timeout=FRAME_SETTLE_TIMEOUT_SECONDS * 1000),
+ engine_selection=engine_selection,
+ deadline=deadline,
+ )
+ except SkyvernPageAnalysisTimeout as error:
+ # Recovery may exhaust its deadline after the document disappeared. Preserve the selected engine's
+ # teardown error so the post-write caller can distinguish a submission from a same-document no-frame wait.
+ cause = error.__context__
+ while cause is not None:
+ if _is_navigation_teardown_error(cause, engine_selection):
+ raise cause
+ cause = cause.__context__
+ return False
+ except Exception as error:
+ # The field did not resolve within the bound.
+ if _is_selected_engine_timeout(error, engine_selection):
+ return False
+ raise
+ return frames is True
async def _fill_secret_with_readback(
@@ -3578,6 +3645,23 @@ async def _fill_secret_with_readback(
readback_expected = text
date_recovered = False
await skyvern_element.refresh_locator_if_stale()
+ deferred_editing = await _is_flutter_text_field(skyvern_element, engine_selection)
+ if deferred_editing:
+ # The field starts editing in the first frame after it is focused and writes its own copy of the value over
+ # the input then, so the write waits for that frame.
+ await skyvern_element.focus()
+ if not await _two_frames_passed(skyvern_element, engine_selection):
+ LOG.warning(
+ "Credential field drew no frame after it was focused; nothing was entered",
+ element_id=skyvern_element.get_id(),
+ )
+ return ActionFailure(SecretInputMismatch())
+ # Keep the original document's handle: a locator can resolve into a replacement, even at the same URL.
+ written_element = (
+ await skyvern_element.get_element_handler(timeout=FRAME_SETTLE_TIMEOUT_SECONDS * 1000)
+ if deferred_editing
+ else None
+ )
if sequential_first:
await skyvern_element.input_sequentially(text=text)
else:
@@ -3606,6 +3690,11 @@ async def _fill_secret_with_readback(
# Returns (value, navigated). A read-back that races a form auto-submit sees the context torn down;
# navigated=True means the value was submitted, so the caller stops and treats it as success.
try:
+ # The field's next frame can still overwrite the write, so a value read before it confirms nothing.
+ if written_element is not None and not await _two_frames_passed(
+ skyvern_element, engine_selection, written_element
+ ):
+ return None, False
value = await get_input_value(
tag_name=tag_name, locator=skyvern_element.get_locator(), engine_selection=engine_selection
)
diff --git a/skyvern/webeye/browser_artifacts.py b/skyvern/webeye/browser_artifacts.py
index e13eb32b1..64041aa26 100644
--- a/skyvern/webeye/browser_artifacts.py
+++ b/skyvern/webeye/browser_artifacts.py
@@ -120,6 +120,10 @@ class BrowserArtifacts(BaseModel):
# treats the seed as UNKNOWN and never full-overwrites (a None etag would otherwise read "unchanged").
_seed_capture_failed: bool = PrivateAttr(default=False)
_action_download_source: ActionDownloadSource | None = PrivateAttr(default=None)
+ # The GL flags (--use-gl / --use-angle) a local creator handed the driver, for launch telemetry; no other arg.
+ _requested_graphics_flags: tuple[str, ...] | None = PrivateAttr(default=None)
+ # Whether the creator started this browser's process on this host itself, rather than dialing one.
+ _spawned_local_browser: bool = PrivateAttr(default=False)
def local_paths(self) -> list[str]:
"""Files and folders on this host that the browser writes to: recordings, HAR, traces, profile, console log."""
@@ -131,6 +135,24 @@ class BrowserArtifacts(BaseModel):
]
return paths
+ def note_requested_launch_args(self, args: object) -> None:
+ # Args a creator could not see stay unrecorded, which telemetry reads as unknown.
+ if isinstance(args, list):
+ self._requested_graphics_flags = tuple(
+ arg for arg in args if isinstance(arg, str) and arg.split("=", 1)[0] in ("--use-gl", "--use-angle")
+ )
+
+ @property
+ def requested_graphics_flags(self) -> tuple[str, ...] | None:
+ return self._requested_graphics_flags
+
+ def note_spawned_local_browser(self) -> None:
+ self._spawned_local_browser = True
+
+ @property
+ def spawned_local_browser(self) -> bool:
+ return self._spawned_local_browser
+
def attach_action_download_source(self, source: ActionDownloadSource | None) -> None:
self._action_download_source = source
diff --git a/skyvern/webeye/browser_factory.py b/skyvern/webeye/browser_factory.py
index 278a854fd..1f6ad4765 100644
--- a/skyvern/webeye/browser_factory.py
+++ b/skyvern/webeye/browser_factory.py
@@ -1210,6 +1210,7 @@ async def _create_headless_chromium(
except BaseException:
discard_temp_working_dir(read_only_copy)
raise
+ browser_artifacts.note_requested_launch_args(browser_args.get("args"))
return browser_context, browser_artifacts, _read_only_copy_cleanup(read_only_copy)
@@ -1343,6 +1344,7 @@ async def _create_headful_chromium(
discard_temp_working_dir(read_only_copy)
await release_started_display_recording(browser_artifacts)
raise
+ browser_artifacts.note_requested_launch_args(browser_args.get("args"))
return browser_context, browser_artifacts, _read_only_copy_cleanup(read_only_copy)
@@ -1403,6 +1405,7 @@ async def _create_cdp_connection_browser(
note_resolved_acquire_mode(ACQUIRE_MODE_ATTACH)
browser_type = settings.BROWSER_TYPE
browser_path = settings.CHROME_EXECUTABLE_PATH
+ spawn_args: list[str] | None = None
if browser_type == "cdp-connect" and browser_path:
LOG.info("Local browser path is given. Connecting to local browser with CDP", browser_path=browser_path)
@@ -1432,15 +1435,16 @@ async def _create_cdp_connection_browser(
# This invocation launches a new Chrome process, so it is a genuine create — recorded
# before the launch so a launch failure inherits create rather than the default attach.
note_resolved_acquire_mode(ACQUIRE_MODE_CREATE)
+ spawn_args = [
+ browser_path,
+ "--remote-debugging-port=9222",
+ "--no-first-run",
+ "--no-default-browser-check",
+ "--user-data-dir=./tmp/user_data_dir",
+ "--remote-debugging-address=0.0.0.0",
+ ]
browser_process = subprocess.Popen(
- [
- browser_path,
- "--remote-debugging-port=9222",
- "--no-first-run",
- "--no-default-browser-check",
- "--user-data-dir=./tmp/user_data_dir",
- "--remote-debugging-address=0.0.0.0",
- ],
+ spawn_args,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
@@ -1451,13 +1455,29 @@ async def _create_cdp_connection_browser(
else:
LOG.info("Port 9222 is in use, using existing browser")
- return await _connect_to_cdp_browser(
+ result = await _connect_to_cdp_browser(
playwright,
settings.BROWSER_REMOTE_DEBUGGING_URL,
extra_http_headers=extra_http_headers,
cdp_connect_headers=cdp_connect_headers,
validate_browser_address=False,
)
+ # Only a Chrome started here and dialed at its own debugging endpoint is this invocation's browser.
+ if spawn_args is not None and _dials_spawned_chrome(settings.BROWSER_REMOTE_DEBUGGING_URL):
+ result[1].note_spawned_local_browser()
+ result[1].note_requested_launch_args(spawn_args)
+ return result
+
+
+def _dials_spawned_chrome(endpoint: str) -> bool:
+ # The port check and the spawn are IPv4 only, so ::1, a resolved name, or another or missing port may reach a
+ # different browser.
+ parsed = urlparse(endpoint)
+ try:
+ port = parsed.port
+ except ValueError:
+ return False
+ return parsed.hostname == "127.0.0.1" and port == 9222
async def _connect_to_cdp_browser(
diff --git a/skyvern/webeye/browser_state.py b/skyvern/webeye/browser_state.py
index 7a7ce4c5c..f18e016f2 100644
--- a/skyvern/webeye/browser_state.py
+++ b/skyvern/webeye/browser_state.py
@@ -151,6 +151,10 @@ class BrowserState(Protocol):
async def reload_page(self, degradation: bool = False, page: Page | None = None) -> None: ...
+ async def wait_for_main_frame_navigation(self, page: Page, deadline: float) -> None:
+ """Wait, until at most the monotonic ``deadline``, for ``page``'s in-flight main-frame navigation to settle."""
+ ...
+
async def close(self, close_browser_on_completion: bool = True, release_driver: bool | None = None) -> bool: ...
async def detach_remote_driver(self) -> None:
@@ -179,6 +183,7 @@ class BrowserState(Protocol):
wait_seconds: float = 0,
must_included_tags: list[str] | None = None,
allow_transient_ui_suppression: bool = False,
+ navigation_deadline: float | None = None,
) -> ScrapedPage: ...
diff --git a/skyvern/webeye/driver_connection.py b/skyvern/webeye/driver_connection.py
index 8eba7b45c..f834ebaac 100644
--- a/skyvern/webeye/driver_connection.py
+++ b/skyvern/webeye/driver_connection.py
@@ -30,6 +30,10 @@ def driver_transport_error_future(driver: Any) -> asyncio.Future[None] | None:
return future if isinstance(future, asyncio.Future) else None
+def driver_connection_closed(driver: Any) -> bool:
+ return getattr(_driver_connection(driver), "_closed_error", None) is not None
+
+
def kill_driver_process(driver: Any) -> None:
process = getattr(getattr(_driver_connection(driver), "_transport", None), "_proc", None)
if process is None or process.returncode is not None:
diff --git a/skyvern/webeye/real_browser_manager.py b/skyvern/webeye/real_browser_manager.py
index 7973fb520..7419854bb 100644
--- a/skyvern/webeye/real_browser_manager.py
+++ b/skyvern/webeye/real_browser_manager.py
@@ -1006,6 +1006,7 @@ class RealBrowserManager(BrowserManager):
# An application-level retry across engines: the eventual success is not a first-try one.
note_fallback_target(FALLBACK_TARGET_CLASSICAL_ENGINE)
self._repin_engine_selection(run_key, boot_fallback)
+ app.AGENT_FUNCTION.note_browser_relaunch(None, "engine_fallback")
return await _start(boot_fallback)
if boot_fallback is not None:
# Commit-strip: re-pin the same engine with its boot fallback removed so a later same-run
diff --git a/skyvern/webeye/real_browser_state.py b/skyvern/webeye/real_browser_state.py
index d02e1c117..8f8ec5434 100644
--- a/skyvern/webeye/real_browser_state.py
+++ b/skyvern/webeye/real_browser_state.py
@@ -7,11 +7,11 @@ import weakref
from collections.abc import Awaitable, Callable, Collection
from dataclasses import dataclass, replace
from datetime import UTC, datetime
-from typing import Any, Literal, TypedDict, TypeGuard
+from typing import Any, Literal, Protocol, TypedDict, TypeGuard, runtime_checkable
from urllib.parse import urlparse
import structlog
-from playwright.async_api import Browser, BrowserContext, Page, Playwright, async_playwright
+from playwright.async_api import Browser, BrowserContext, Page, Playwright, Request, Response, async_playwright
from skyvern.config import settings
from skyvern.constants import (
@@ -191,6 +191,160 @@ def _chain_browser_cleanups(first: BrowserCleanupFunc, second: BrowserCleanupFun
return _both
+# These terminal responses leave the current document in place; ordinary responses still need to commit.
+_NO_DOCUMENT_STATUSES = frozenset({204, 205, 304})
+
+
+@runtime_checkable
+class _FrameIdentified(Protocol):
+ """Raw-CDP requests and frames expose their CDP frame id; Playwright's do not."""
+
+ @property
+ def frame_id(self) -> str | None: ...
+
+
+class _MainFrameNavigation:
+ """A page's in-flight main-frame document navigation, observed only through browser events.
+
+ While such a navigation is pending, evaluate calls against the page are deferred until it commits,
+ so the page's own scripts cannot report it.
+ """
+
+ def __init__(self, page: Page) -> None:
+ # Weak, so the browser state's per-page registry does not keep a closed page alive.
+ self._page_ref = weakref.ref(page)
+ self._request: Request | None = None
+ self.started_at: float | None = None
+ self.closed = False
+ self._idle = asyncio.Event()
+ self._idle.set()
+ self._commit_emitter_ref: weakref.ReferenceType[Any] | None = None
+ self._handlers: dict[str, Any] = {
+ "request": self._on_request,
+ "response": self._on_response,
+ "requestfailed": self._on_request_failed,
+ "close": self._on_gone,
+ "crash": self._on_gone,
+ }
+ attached: list[str] = []
+ try:
+ if isinstance(page.main_frame, _FrameIdentified):
+ # The raw-CDP facade emits this only for Page.frameNavigated (document commits),
+ # unlike Playwright's public event, which also includes same-document URL changes.
+ self._handlers["framenavigated"] = self._on_cdp_frame_navigated
+ else:
+ # The same event used by expect_navigation(wait_until="commit") carries the
+ # committed request identity. Headers and same-document events cannot prove commit.
+ emitter = page.main_frame._impl_obj._event_emitter
+ self._commit_emitter_ref = weakref.ref(emitter)
+ emitter.on("navigated", self._on_document_navigated)
+ for event, handler in self._handlers.items():
+ page.on(event, handler) # type: ignore[call-overload]
+ attached.append(event)
+ except Exception:
+ self._handlers = {event: self._handlers[event] for event in attached}
+ self.detach()
+ raise
+
+ @property
+ def is_pending(self) -> bool:
+ return self._request is not None and not self.closed
+
+ async def wait(self, deadline: float) -> None:
+ """Return once nothing is pending or the monotonic ``deadline`` passes."""
+ while self.is_pending:
+ remaining = deadline - time.monotonic()
+ if remaining <= 0:
+ return
+ try:
+ async with asyncio.timeout(remaining):
+ await self._idle.wait()
+ except TimeoutError:
+ return
+
+ def detach(self) -> None:
+ handlers, self._handlers = self._handlers, {}
+ # A detached observer can no longer see the navigation; wake any waiter as closed.
+ self.closed = True
+ self._settle()
+ emitter_ref, self._commit_emitter_ref = self._commit_emitter_ref, None
+ if emitter_ref is not None and (emitter := emitter_ref()) is not None:
+ emitter.remove_listener("navigated", self._on_document_navigated)
+ page = self._page_ref()
+ if page is None:
+ return
+ for event, handler in handlers.items():
+ try:
+ page.remove_listener(event, handler) # type: ignore[call-overload]
+ except Exception:
+ LOG.debug("Failed to remove main-frame navigation listener", page_event=event, exc_info=True)
+
+ def _is_main_frame_document(self, request: Request) -> bool:
+ if not request.is_navigation_request():
+ return False
+ page = self._page_ref()
+ frame = request.frame
+ if page is None or frame is not page.main_frame:
+ return False
+ # The raw-CDP engine's request.frame falls back to the main frame for a frame id it does not know.
+ if isinstance(request, _FrameIdentified) and isinstance(frame, _FrameIdentified):
+ return frame.frame_id == request.frame_id
+ return True
+
+ def _on_request(self, request: Request) -> None:
+ try:
+ if not self._is_main_frame_document(request):
+ return
+ except Exception:
+ return
+ if self._request is not None and request.redirected_from is self._request:
+ self._request = request
+ return
+ self._request = request
+ self.started_at = time.monotonic()
+ # A fresh event rather than clear(): the browser-API census counts every .clear() call site as a page
+ # sink. Only an idle event is replaced, so a waiter never holds a superseded one.
+ if self._idle.is_set():
+ self._idle = asyncio.Event()
+
+ def _on_response(self, response: Response) -> None:
+ if self._request is not None and response.request is self._request and response.status in _NO_DOCUMENT_STATUSES:
+ self._settle()
+
+ def _on_document_navigated(self, event: dict[str, Any]) -> None:
+ document = event.get("newDocument")
+ if (
+ self._request is not None
+ and "error" not in event
+ and document is not None
+ and document.get("request") is self._request._impl_obj._channel
+ ):
+ self._settle()
+
+ def _on_cdp_frame_navigated(self, frame: Any) -> None:
+ page = self._page_ref()
+ if (
+ page is not None
+ and frame is page.main_frame
+ and self._request is not None
+ and frame.url.split("#", 1)[0] == self._request.url.split("#", 1)[0]
+ ):
+ self._settle()
+
+ def _on_request_failed(self, request: Request) -> None:
+ # Identity-keyed: a superseded navigation's late failure must not settle its replacement.
+ if self._request is not None and request is self._request:
+ self._settle()
+
+ def _on_gone(self, _page: Page) -> None:
+ self.detach()
+
+ def _settle(self) -> None:
+ self._request = None
+ self.started_at = None
+ self._idle.set()
+
+
class RealBrowserState(BrowserState):
def __init__(
self,
@@ -232,6 +386,9 @@ class RealBrowserState(BrowserState):
self._disconnect_listener_browser: Browser | None = None
self._disconnect_listener_browser_context: BrowserContext | None = None
self._crash_listener_pages: weakref.WeakSet[Page] = weakref.WeakSet()
+ self._main_frame_navigations: weakref.WeakKeyDictionary[Page, _MainFrameNavigation] = (
+ weakref.WeakKeyDictionary()
+ )
self._crashed_pages: weakref.WeakSet[Page] = weakref.WeakSet()
self._crashed_targets_closing: weakref.WeakSet[Page] = weakref.WeakSet()
# Cleared while a recovery is producing the working page (opening it, closing crashed targets,
@@ -323,6 +480,7 @@ class RealBrowserState(BrowserState):
def mark_run_released(self) -> None:
self._run_released = True
+ app.AGENT_FUNCTION.on_browser_run_released(self.browser_context or self.browser_artifacts)
@property
def _run_phase(self) -> RunPhase:
@@ -565,6 +723,7 @@ class RealBrowserState(BrowserState):
# A replacement can run elsewhere than the browser it replaces (a vendor creator degrading to a
# local launch), so restamp from what its creator records instead of keeping the old runtime.
sample_token = None if current_browser_acquisition_sample() else begin_browser_acquisition_sample()
+ app.AGENT_FUNCTION.note_browser_relaunch(self, "relaunch")
try:
(
browser_context,
@@ -1026,13 +1185,40 @@ class RealBrowserState(BrowserState):
LOG.debug("Failed to register browser disconnect listener", exc_info=True)
def _watch_page_for_crash(self, page: Page) -> None:
- if page in self._crash_listener_pages:
+ if page not in self._crash_listener_pages:
+ try:
+ page.on("crash", self._on_page_crashed)
+ self._crash_listener_pages.add(page)
+ except Exception:
+ LOG.debug("Failed to register page crash listener", exc_info=True)
+ self._observe_main_frame_navigation(page)
+
+ def _observe_main_frame_navigation(self, page: Page) -> None:
+ if page in self._main_frame_navigations:
return
try:
- page.on("crash", self._on_page_crashed)
- self._crash_listener_pages.add(page)
+ self._main_frame_navigations[page] = _MainFrameNavigation(page)
except Exception:
- LOG.debug("Failed to register page crash listener", exc_info=True)
+ LOG.debug("Failed to observe main-frame navigation", exc_info=True)
+
+ def _release_main_frame_navigations(self) -> None:
+ navigations = list(self._main_frame_navigations.values())
+ self._main_frame_navigations = weakref.WeakKeyDictionary()
+ for navigation in navigations:
+ navigation.detach()
+
+ async def wait_for_main_frame_navigation(self, page: Page, deadline: float) -> None:
+ navigation = self._main_frame_navigations.get(page)
+ if navigation is None or navigation.started_at is None or not navigation.is_pending:
+ return
+ # The navigation's own loading budget also caps the wait, so a later scrape cannot restart it.
+ waited_from = time.monotonic()
+ await navigation.wait(min(deadline, navigation.started_at + settings.BROWSER_LOADING_TIMEOUT_MS / 1000))
+ LOG.info(
+ "Waited for an in-flight page navigation before scraping",
+ settled=not navigation.is_pending and not navigation.closed,
+ waited_ms=int((time.monotonic() - waited_from) * 1000),
+ )
def _on_page_crashed(self, page: Page) -> None:
# A crashed tab stays in context.pages and keeps winning get_working_page, so later operations
@@ -1782,6 +1968,7 @@ class RealBrowserState(BrowserState):
wait_seconds: float = 0,
must_included_tags: list[str] | None = None,
allow_transient_ui_suppression: bool = False,
+ navigation_deadline: float | None = None,
) -> ScrapedPage:
page = await self.get_working_page()
if page is not None:
@@ -1802,10 +1989,14 @@ class RealBrowserState(BrowserState):
wait_seconds=wait_seconds,
must_included_tags=must_included_tags,
allow_transient_ui_suppression=allow_transient_ui_suppression,
+ navigation_deadline=navigation_deadline,
)
async def close(self, close_browser_on_completion: bool = True, release_driver: bool | None = None) -> bool:
if self.external_browser:
+ # A keep-alive close (both controls off) leaves the pages to a later run, which still needs them tracked.
+ if close_browser_on_completion or release_driver is not False:
+ self._release_main_frame_navigations()
if close_browser_on_completion:
await self._run_on_close_callbacks()
if release_driver is not False:
@@ -1824,6 +2015,8 @@ class RealBrowserState(BrowserState):
# ``release_driver_on_close`` marker.
if release_driver is None:
release_driver = close_browser_on_completion or self.release_driver_on_close
+ if close_browser_on_completion or release_driver:
+ self._release_main_frame_navigations()
LOG.info("Closing browser state", sampling=True)
# Each teardown phase runs in its OWN bounded region so a phase that hangs — a
diff --git a/skyvern/webeye/scraper/scraper.py b/skyvern/webeye/scraper/scraper.py
index 1ec86b1ac..c60fd9de5 100644
--- a/skyvern/webeye/scraper/scraper.py
+++ b/skyvern/webeye/scraper/scraper.py
@@ -329,6 +329,7 @@ async def scrape_website(
wait_seconds: float = 0,
must_included_tags: list[str] | None = None,
allow_transient_ui_suppression: bool = False,
+ navigation_deadline: float | None = None,
) -> ScrapedPage:
"""
************************************************************************************************
@@ -366,6 +367,7 @@ async def scrape_website(
wait_seconds=wait_seconds,
must_included_tags=must_included_tags,
allow_transient_ui_suppression=allow_transient_ui_suppression,
+ navigation_deadline=navigation_deadline,
)
try:
@@ -439,6 +441,7 @@ async def scrape_website(
scroll=scroll,
must_included_tags=must_included_tags,
allow_transient_ui_suppression=allow_transient_ui_suppression,
+ navigation_deadline=navigation_deadline,
)
@@ -496,6 +499,30 @@ def _should_use_page_ready_wait() -> bool:
return bool(context and context.enable_page_ready_wait)
+async def _prepare_scrape_frame(
+ browser_state: BrowserState, page: Page, navigation_deadline: float | None, support_empty_page: bool
+) -> tuple[SkyvernFrame, str]:
+ """Get the working page ready for scraping and return its frame with the URL of the document being scraped.
+
+ Settles any in-flight navigation, rejects a dead blank page, injects the helpers, then waits for readiness.
+ Injection evaluates in the page, and evaluate calls are deferred while a cross-document navigation is pending,
+ so the navigation wait must come first. Only callers that pass a deadline (the step's scrape ladder) wait for it.
+ """
+ if navigation_deadline is not None:
+ await browser_state.wait_for_main_frame_navigation(page, navigation_deadline)
+ url = page.url
+ if url in BLANK_PAGE_URLS and not support_empty_page:
+ # A blank working page (about:blank or the ":" download-popup shape) is only scrapeable when
+ # a meaningful child frame renders real content (e.g. an Edge PDF interstitial); otherwise it
+ # is a dead blank and must fail classification so the caller can recover or fail closed.
+ if not page_has_meaningful_child_frame(page):
+ raise ScrapingFailedBlankPage()
+ LOG.info("blank page has meaningful child frames, proceeding with scraping")
+ skyvern_frame = await SkyvernFrame.create_instance(page, engine_selection=browser_state.engine_selection)
+ await _wait_for_scrape_ready(skyvern_frame)
+ return skyvern_frame, url
+
+
async def _wait_for_scrape_ready(skyvern_frame: SkyvernFrame) -> None:
if _should_use_page_ready_wait():
await skyvern_frame.wait_for_page_ready(
@@ -584,6 +611,7 @@ async def scrape_web_unsafe(
wait_seconds: float = 0,
must_included_tags: list[str] | None = None,
allow_transient_ui_suppression: bool = False,
+ navigation_deadline: float | None = None,
) -> ScrapedPage:
"""
Asynchronous function that performs web scraping without any built-in error handling. This function is intended
@@ -604,17 +632,7 @@ async def scrape_web_unsafe(
# We check if the scroll_y_px_old is the same as scroll_y_px to determine if we have reached the end of the page.
# This also solves the issue where we can't scroll due to a popup.(e.g. geico first popup on the homepage after
# clicking start my quote)
- url = page.url
- if url in BLANK_PAGE_URLS and not support_empty_page:
- # A blank working page (about:blank or the ":" download-popup shape) is only scrapeable when
- # a meaningful child frame renders real content (e.g. an Edge PDF interstitial); otherwise it
- # is a dead blank and must fail classification so the caller can recover or fail closed.
- if not page_has_meaningful_child_frame(page):
- raise ScrapingFailedBlankPage()
- LOG.info("blank page has meaningful child frames, proceeding with scraping")
-
- skyvern_frame = await SkyvernFrame.create_instance(page, engine_selection=browser_state.engine_selection)
- await _wait_for_scrape_ready(skyvern_frame)
+ skyvern_frame, url = await _prepare_scrape_frame(browser_state, page, navigation_deadline, support_empty_page)
if wait_seconds > 0:
LOG.info(f"Waiting for {wait_seconds} seconds before scraping the website.", wait_seconds=wait_seconds)
diff --git a/skyvern/webeye/utils/challenge_solve_record.py b/skyvern/webeye/utils/challenge_solve_record.py
new file mode 100644
index 000000000..d775a196e
--- /dev/null
+++ b/skyvern/webeye/utils/challenge_solve_record.py
@@ -0,0 +1,27 @@
+from __future__ import annotations
+
+from contextvars import ContextVar
+from dataclasses import dataclass
+from typing import TYPE_CHECKING, Any
+
+if TYPE_CHECKING:
+ from skyvern.webeye.utils.captcha_solver import ChallengeOutcome
+
+
+@dataclass
+class ChallengeSolveRecord:
+ """What one challenge-solve call observed, filled in by the call site for a deployment's solve ledger.
+
+ Nested solve calls share the outermost call's record. The OSS build discards it."""
+
+ challenge: ChallengeOutcome | None = None
+ route: str | None = None
+ route_results: list[Any] | None = None
+ image_text_read: bool | None = None
+ image_text_delivered: bool | None = None
+ extension_solved: bool | None = None
+ unsolved: bool = False
+
+
+# Set by a caller that reaches another client's solve boundary, so the recorded row names the caller instead.
+calling_solve_client: ContextVar[str | None] = ContextVar("calling_solve_client", default=None)
diff --git a/skyvern/webeye/utils/flutter_semantics.py b/skyvern/webeye/utils/flutter_semantics.py
index ceca94dd5..b8352a1a4 100644
--- a/skyvern/webeye/utils/flutter_semantics.py
+++ b/skyvern/webeye/utils/flutter_semantics.py
@@ -56,6 +56,13 @@ FLUTTER_STATE_JS = f"""(() => {{
_STATE_FN_JS = f"() => {FLUTTER_STATE_JS}"
+# A text field of the app's accessibility tree. The engine starts editing it in the first frame after it is focused and
+# then writes the framework's own copy of the value over the input, so text put there earlier is lost.
+FLUTTER_TEXT_FIELD_JS = "(el) => !!el.closest('flt-semantics-host, [data-semantics-role=text-field]')"
+# Resolves in the second frame from now, so the frame that handles an earlier focus or write has already run.
+TWO_FRAMES_JS = "() => new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(() => done(true))))"
+FRAME_SETTLE_TIMEOUT_SECONDS = 5.0
+
# One click per placeholder element: the engine listens for it from the moment it creates the placeholder, and a
# framework that starts later still picks up the enabled state, so an ignored click is not one that came too early. A
# rebuilt placeholder or a reload brings a new element to try, and the mobile engine deletes its placeholder after
diff --git a/tests/unit/force_stub_app.py b/tests/unit/force_stub_app.py
index c08085042..e764a73d3 100644
--- a/tests/unit/force_stub_app.py
+++ b/tests/unit/force_stub_app.py
@@ -125,6 +125,7 @@ def create_forge_stub_app() -> ForgeApp:
# AsyncMock and hijack the TextPromptBlock llm_key. Match the OSS no-op.
fake_app_module.AGENT_FUNCTION.get_fallback_llm_key = MagicMock(return_value=None)
fake_app_module.AGENT_FUNCTION.supports_image_captcha_ocr = base_agent_function.supports_image_captcha_ocr
+ fake_app_module.AGENT_FUNCTION.challenge_solve_recording = base_agent_function.challenge_solve_recording
# Credential write-lock gating — _LazyNamespace would auto-mock these as truthy AsyncMocks,
# forcing the update/delete credential routes down the lock path and handing `async with` a
# coroutine instead of a context manager. Match the real OSS base no-ops (unlocked path).
diff --git a/tests/unit/forge/sdk/copilot/test_organization_usage_tool.py b/tests/unit/forge/sdk/copilot/test_organization_usage_tool.py
index e9947bd7b..f82a33001 100644
--- a/tests/unit/forge/sdk/copilot/test_organization_usage_tool.py
+++ b/tests/unit/forge/sdk/copilot/test_organization_usage_tool.py
@@ -77,6 +77,7 @@ CATALOG_WITHOUT_THIS_TOOL = [
"start_fresh_browser",
"extend_browser_session",
"upload_attached_file",
+ "read_attached_pdf",
"reply",
]
diff --git a/tests/unit/forge/sdk/db/test_workflow_runs_repository.py b/tests/unit/forge/sdk/db/test_workflow_runs_repository.py
index 9ce5af94c..a888a45f0 100644
--- a/tests/unit/forge/sdk/db/test_workflow_runs_repository.py
+++ b/tests/unit/forge/sdk/db/test_workflow_runs_repository.py
@@ -4746,3 +4746,143 @@ async def test_final_webhook_claim_takes_over_only_an_unrecorded_claim_past_the_
assert await claim("wr_claim_abandoned") is None
assert await claim("wr_claim_in_flight") is None
assert await claim("wr_claim_recorded") is None
+
+
+_WINDOW_START = datetime(2026, 7, 20, 12, 0, 0)
+_WINDOW_END = datetime(2026, 7, 30, 12, 0, 0)
+
+
+def _window_run_names(runs: list[Any], organization_id: str) -> list[str]:
+ return [run.workflow_run_id.removesuffix(f"_{organization_id}") for run in runs]
+
+
+async def _seed_created_at_window_runs(db: AgentDB, organization_id: str) -> None:
+ # The PostgreSQL leg shares one scratch schema across tests, so primary keys are scoped to the organization.
+ workflow_id = f"wf_window_{organization_id}"
+ workflow_permanent_id = f"wpid_window_{organization_id}"
+ created = {
+ "wr_window_before": _WINDOW_START - timedelta(seconds=1),
+ "wr_window_at_start": _WINDOW_START,
+ "wr_window_inside": datetime(2026, 7, 25, 8, 0, 0),
+ "wr_window_inside_other": datetime(2026, 7, 26, 8, 0, 0),
+ "wr_window_at_end": _WINDOW_END,
+ "wr_window_after": _WINDOW_END + timedelta(seconds=1),
+ }
+ async with db.Session() as session:
+ session.add(
+ WorkflowModel(
+ workflow_id=workflow_id,
+ organization_id=organization_id,
+ workflow_permanent_id=workflow_permanent_id,
+ title="created_at window fixture",
+ workflow_definition={},
+ version=1,
+ )
+ )
+ await session.flush()
+ for workflow_run_id, created_at in created.items():
+ session.add(
+ _workflow_run_model(
+ workflow_run_id=f"{workflow_run_id}_{organization_id}",
+ queued_at=created_at,
+ workflow_id=workflow_id,
+ workflow_permanent_id=workflow_permanent_id,
+ organization_id=organization_id,
+ status=(
+ WorkflowRunStatus.failed.value
+ if workflow_run_id == "wr_window_inside_other"
+ else WorkflowRunStatus.completed.value
+ ),
+ webhook_callback_url=(
+ None
+ if workflow_run_id == "wr_window_inside_other"
+ else "https://hooks.example.test/window-term"
+ ),
+ )
+ )
+ await session.commit()
+
+
+ ("created_at_start", "created_at_end", "expected_run_ids"),
+ [
+ # Inclusive start, exclusive end, on the naive UTC column.
+ (_WINDOW_START, _WINDOW_END, ["wr_window_inside_other", "wr_window_inside", "wr_window_at_start"]),
+ (
+ _WINDOW_START,
+ None,
+ [
+ "wr_window_after",
+ "wr_window_at_end",
+ "wr_window_inside_other",
+ "wr_window_inside",
+ "wr_window_at_start",
+ ],
+ ),
+ (None, _WINDOW_END, ["wr_window_inside_other", "wr_window_inside", "wr_window_at_start", "wr_window_before"]),
+ # Aware bounds name the same instants in other offsets and must be normalized to naive UTC.
+ (
+ datetime(2026, 7, 20, 14, 0, 0, tzinfo=timezone(timedelta(hours=2))),
+ datetime(2026, 7, 30, 7, 0, 0, tzinfo=timezone(timedelta(hours=-5))),
+ ["wr_window_inside_other", "wr_window_inside", "wr_window_at_start"],
+ ),
+ (
+ datetime(2026, 7, 20, 12, 0, 0, tzinfo=UTC),
+ datetime(2026, 7, 30, 12, 0, 0, tzinfo=UTC),
+ ["wr_window_inside_other", "wr_window_inside", "wr_window_at_start"],
+ ),
+ ],
+)
+async def test_get_workflow_runs_filters_by_explicit_created_at_bounds(
+ org_scoped_db: tuple[AgentDB, AsyncEngine, str],
+ created_at_start: datetime | None,
+ created_at_end: datetime | None,
+ expected_run_ids: list[str],
+) -> None:
+ db, _engine, organization_id = org_scoped_db
+ await _seed_created_at_window_runs(db, organization_id)
+
+ runs = await db.workflow_runs.get_workflow_runs(
+ organization_id=organization_id,
+ page_size=20,
+ created_at_start=created_at_start,
+ created_at_end=created_at_end,
+ )
+
+ assert _window_run_names(runs, organization_id) == expected_run_ids
+
+
+async def test_get_workflow_runs_never_defaults_a_window_and_combines_bounds_with_other_filters(
+ org_scoped_db: tuple[AgentDB, AsyncEngine, str],
+) -> None:
+ db, _engine, organization_id = org_scoped_db
+ await _seed_created_at_window_runs(db, organization_id)
+
+ # The repository applies only the bounds it is given; the default window is the route's policy.
+ unbounded = await db.workflow_runs.get_workflow_runs(
+ organization_id=organization_id, page_size=20, search_key="window-term"
+ )
+ windowed_page = await db.workflow_runs.get_workflow_runs(
+ organization_id=organization_id,
+ page=2,
+ page_size=1,
+ status=[WorkflowRunStatus.completed],
+ search_key="window-term",
+ created_at_start=_WINDOW_START,
+ created_at_end=_WINDOW_END,
+ )
+ other_org = await db.workflow_runs.get_workflow_runs(
+ organization_id="o_someone_else", page_size=20, created_at_start=_WINDOW_START
+ )
+
+ assert set(_window_run_names(unbounded, organization_id)) == {
+ "wr_window_before",
+ "wr_window_at_start",
+ "wr_window_inside",
+ "wr_window_at_end",
+ "wr_window_after",
+ }
+ assert _window_run_names(windowed_page, organization_id) == ["wr_window_at_start"]
+ assert other_org == []
diff --git a/tests/unit/submission/test_wiring.py b/tests/unit/submission/test_wiring.py
index fe38166ac..7131f4227 100644
--- a/tests/unit/submission/test_wiring.py
+++ b/tests/unit/submission/test_wiring.py
@@ -64,7 +64,9 @@ async def test_workflow_debug_artifacts_use_step_archive_when_hmac_signing_is_co
await service.persist_debug_artifacts(browser_state, last_task, workflow, workflow_run)
- persist_archive.assert_awaited_once_with(browser_state, last_step, workflow, workflow_run)
+ persist_archive.assert_awaited_once_with(
+ browser_state, last_step, workflow, workflow_run, browser_session_id=None, attempt_number=None
+ )
def test_submission_signal_shadow_setting_defaults_off() -> None:
diff --git a/tests/unit/test_agent_task_v3.py b/tests/unit/test_agent_task_v3.py
index b14544be7..383c8d0d6 100644
--- a/tests/unit/test_agent_task_v3.py
+++ b/tests/unit/test_agent_task_v3.py
@@ -78,11 +78,13 @@ from skyvern.forge.taskv3.handoff_redaction import pin_caller_authored_block_url
from skyvern.forge.taskv3.loop import (
ACTION_BLOCK_TARGET_ACTION_RESERVE,
ACTION_LOOP_GUARD,
+ DOWNLOAD_NO_FILE_FACT,
NAV_DEAD_END_GUARD,
LoopOutcome,
RoundAction,
ToolSpec,
_dead_end_reason,
+ make_finish_tool,
)
from skyvern.forge.taskv3.run_arms import (
DATE_SEGMENT_AIM_FLAG,
@@ -2361,13 +2363,6 @@ async def test_a_kill_switched_recovery_fails_instead_of_running_on_the_step_eng
assert v3_mock.task.status is TaskStatus.failed
-# ---------------------------------------------------------------------------
-# P2b: complete_on_download wiring -- the completion_probe/completion_blocker
-# handed to run_task_v3_agent_loop, backed by the same finalize-and-rename path
-# v1 uses (ForgeAgent._finalize_downloaded_files_for_task).
-# ---------------------------------------------------------------------------
-
-
async def _run_execute_task_v3_download(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
@@ -2385,17 +2380,10 @@ async def _run_execute_task_v3_download(
download_monitor: object | None = None,
download_timeout: float | None = None,
cancel_after_checks: int | None = None,
+ data_extraction_goal: str | None = None,
) -> dict[str, Any]:
- """Drive _execute_task_v3 for a complete_on_download block, capturing the loop kwargs.
-
- The fake loop stands in for run_task_v3_agent_loop: it optionally drops a new file into the
- run's download directory (mimicking a tool call that triggered a download), then awaits the
- completion_probe/completion_blocker it was handed, exactly like the real loop does.
-
- ``loop_fn``, when given, fully replaces the default drop-then-probe-once loop body -- used to
- drive a block through a custom probe/blocker sequence (e.g. a second block in the same run,
- checked against a baseline that already contains an earlier block's file).
- """
+ """Drive _execute_task_v3 for a complete_on_download block with a fake loop that optionally drops a file and
+ awaits the download settle once. ``loop_fn`` replaces that body for a custom settle sequence."""
agent = ForgeAgent()
now = datetime.now(UTC)
organization = make_organization(now)
@@ -2404,7 +2392,7 @@ async def _run_execute_task_v3_download(
organization,
task_id=task_id,
workflow_run_id="wr-download-test",
- data_extraction_goal=None,
+ data_extraction_goal=data_extraction_goal,
extracted_information_schema=None,
browser_session_id=browser_session_id,
)
@@ -2443,8 +2431,7 @@ async def _run_execute_task_v3_download(
async def _default_loop_body(**kwargs: Any) -> LoopOutcome:
if drop_file:
(tmp_path / dropped_filename).write_bytes(b"file-bytes")
- captured["probe_reason"] = await kwargs["completion_probe"](frozenset())
- captured["blocker_message"] = await kwargs["completion_blocker"](frozenset())
+ captured["probe_reason"] = await kwargs["download_settle"](frozenset())
if captured["probe_reason"]:
return LoopOutcome(status="completed", reason=captured["probe_reason"], billable_actions=["click"])
return LoopOutcome(status="budget_exhausted", reason="no download detected", billable_actions=[])
@@ -2489,6 +2476,8 @@ async def _run_execute_task_v3_download(
task.status = status
if "failure_reason" in _kwargs:
task.failure_reason = _kwargs["failure_reason"]
+ if "extracted_information" in _kwargs:
+ task.extracted_information = _kwargs["extracted_information"]
return task
agent.update_step = AsyncMock(side_effect=fake_update_step)
@@ -2523,7 +2512,7 @@ async def _run_execute_task_v3_download(
@pytest.mark.asyncio
@pytest.mark.parametrize("block_cls", [ActionBlock, FileDownloadBlock], ids=["action", "file_download"])
-async def test_execute_task_v3_download_completion_probe_finalizes_and_ends_the_loop(
+async def test_execute_task_v3_download_settle_finalizes_the_landed_file(
monkeypatch: pytest.MonkeyPatch, tmp_path: Path, block_cls: type[BaseTaskBlock]
) -> None:
captured = await _run_execute_task_v3_download(monkeypatch, tmp_path, drop_file=True, block_cls=block_cls)
@@ -2545,7 +2534,7 @@ async def test_execute_task_v3_finalized_download_completes_on_a_blank_page(
# The file is the goal, and the tab a download opens is routinely left blank.
async def _download_then_blank(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
(tmp_path / "report.pdf").write_bytes(b"file-bytes")
- captured["probe_reason"] = await kwargs["completion_probe"](frozenset())
+ captured["probe_reason"] = await kwargs["download_settle"](frozenset())
page = await kwargs["page_provider"]()
page.url = "about:blank"
page.main_frame.child_frames = []
@@ -2620,20 +2609,70 @@ async def test_execute_task_v3_session_only_download_completes_on_a_blank_page(
assert captured["task"].status == TaskStatus.completed
+async def _finish_through_the_real_tool(
+ kwargs: dict[str, Any], captured: dict[str, Any], extracted_output: Any
+) -> LoopOutcome:
+ finish = make_finish_tool(
+ should_cancel=kwargs["should_cancel"],
+ download_settle=kwargs["download_settle"],
+ staged_downloads=kwargs["staged_downloads"],
+ )
+ result = await finish.handler({"status": "completed", "reason": "finished", "extracted_output": extracted_output})
+ captured["finish_content"] = result.content
+ return LoopOutcome(
+ status=result.data["status"], reason=result.data["reason"], extracted_output=result.data["extracted_output"]
+ )
+
+
@pytest.mark.asyncio
[email protected]("extraction", [False, True], ids=["no_extraction", "extraction"])
@pytest.mark.parametrize("block_cls", [ActionBlock, FileDownloadBlock], ids=["action", "file_download"])
-async def test_execute_task_v3_download_completion_probe_no_file_blocks_finish(
- monkeypatch: pytest.MonkeyPatch, tmp_path: Path, block_cls: type[BaseTaskBlock]
+async def test_execute_task_v3_download_block_completes_with_zero_files_when_none_landed(
+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, block_cls: type[BaseTaskBlock], extraction: bool
) -> None:
- captured = await _run_execute_task_v3_download(monkeypatch, tmp_path, drop_file=False, block_cls=block_cls)
+ async def _finish_without_a_file(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
+ return await _finish_through_the_real_tool(kwargs, captured, {"records": 0} if extraction else None)
- assert captured["probe_reason"] is None
- assert captured["blocker_message"]
- assert isinstance(captured["blocker_message"], str)
+ captured = await _run_execute_task_v3_download(
+ monkeypatch,
+ tmp_path,
+ drop_file=False,
+ block_cls=block_cls,
+ loop_fn=_finish_without_a_file,
+ data_extraction_goal="Extract the record count" if extraction else None,
+ )
+
+ assert DOWNLOAD_NO_FILE_FACT in captured["finish_content"]
+ assert captured["task"].status == TaskStatus.completed
+ assert list(tmp_path.iterdir()) == []
@pytest.mark.asyncio
-async def test_execute_task_v3_download_completion_probe_returns_none_when_wait_reports_cancellation(
[email protected]("extraction", [False, True], ids=["no_extraction", "extraction"])
+async def test_execute_task_v3_download_block_records_the_file_that_landed(
+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, extraction: bool
+) -> None:
+ async def _download_then_finish(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
+ (tmp_path / "report.pdf").write_bytes(b"file-bytes")
+ return await _finish_through_the_real_tool(kwargs, captured, {"total": "12.00"} if extraction else None)
+
+ captured = await _run_execute_task_v3_download(
+ monkeypatch,
+ tmp_path,
+ drop_file=False,
+ loop_fn=_download_then_finish,
+ data_extraction_goal="Extract the invoice total" if extraction else None,
+ )
+
+ assert captured["task"].status == TaskStatus.completed
+ assert [path.name for path in tmp_path.iterdir()] == ["invoice.pdf"]
+ assert DOWNLOAD_NO_FILE_FACT not in captured["finish_content"]
+ if extraction:
+ assert captured["task"].extracted_information == {"total": "12.00"}
+
+
+async def test_execute_task_v3_download_settle_returns_none_when_wait_reports_cancellation(
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
# A run being canceled races with a download landing: the wait reports the cancellation, but
@@ -2650,12 +2689,11 @@ async def test_execute_task_v3_download_completion_probe_returns_none_when_wait_
@pytest.mark.asyncio
-async def test_execute_task_v3_download_completion_with_extraction_goal_is_blocker_only(
- monkeypatch: pytest.MonkeyPatch,
[email protected]("extraction", [False, True], ids=["no_extraction", "extraction"])
+async def test_execute_task_v3_download_block_waits_after_actions_and_settles_at_finish(
+ monkeypatch: pytest.MonkeyPatch, extraction: bool
) -> None:
- # A data-extraction goal needs the model to keep the turn and call finish(completed,
- # extracted_output=...) itself; the probe would otherwise end the loop the moment a billable
- # action lands the download, before extraction ever happens.
+ # Identical with or without an extraction goal: nothing but the model's finish ends the block.
outcome = LoopOutcome(status="completed", reason="done", billable_actions=[])
block = _make_block(ActionBlock, complete_on_download=True, download_suffix="invoice")
_step, _task, loop_mock, _post = await _run_execute_task_v3(
@@ -2663,19 +2701,19 @@ async def test_execute_task_v3_download_completion_with_extraction_goal_is_block
outcome,
task_block=block,
workflow_run_id="wr_extract",
- data_extraction_goal="Extract the invoice total",
+ data_extraction_goal="Extract the invoice total" if extraction else None,
extracted_information_schema=None,
)
- assert loop_mock.await_args.kwargs["completion_probe"] is None
- assert loop_mock.await_args.kwargs["completion_blocker"] is not None
+ assert loop_mock.await_args.kwargs["download_wait"] is not None
+ assert loop_mock.await_args.kwargs["download_settle"] is not None
@pytest.mark.asyncio
-async def test_execute_task_v3_download_timeout_only_gets_wait_only_probe_no_blocker(
+async def test_execute_task_v3_download_timeout_only_gets_a_download_wait_and_no_settle(
monkeypatch: pytest.MonkeyPatch,
) -> None:
# download_timeout alone carries no completion semantics; it must not go inert on v3 -- v1
- # bounds a post-action download-settle wait with it, so v3 gets an equivalent wait-only probe
+ # bounds a post-action download-settle wait with it, so v3 gets an equivalent download wait
# that awaits the same in-flight-download wait and never ends the run or blocks finish.
outcome = LoopOutcome(status="completed", reason="done", billable_actions=[])
block = _make_block(ActionBlock, download_timeout=5.0)
@@ -2690,12 +2728,11 @@ async def test_execute_task_v3_download_timeout_only_gets_wait_only_probe_no_blo
data_extraction_goal=None,
extracted_information_schema=None,
)
- probe = loop_mock.await_args.kwargs["completion_probe"]
- assert probe is not None
- assert loop_mock.await_args.kwargs["completion_blocker"] is None
+ wait = loop_mock.await_args.kwargs["download_wait"]
+ assert wait is not None
+ assert loop_mock.await_args.kwargs["download_settle"] is None
- result = await probe(frozenset())
- assert result is None
+ await wait()
wait_mock.assert_awaited_once()
assert wait_mock.await_args.kwargs["timeout_cap"] is not None
assert isinstance(wait_mock.await_args.kwargs["exhausted"], set)
@@ -2727,12 +2764,11 @@ async def test_execute_task_v3_download_baseline_is_scoped_per_block(
async def _block2_loop(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
# No new file yet: block 2's baseline already contains first.pdf, so the probe must not
- # mistake it for a fresh download, and the blocker must withhold completion.
- captured["probe_before_new_file"] = await kwargs["completion_probe"](frozenset())
- captured["blocker_before_new_file"] = await kwargs["completion_blocker"](frozenset())
+ # mistake it for a fresh download.
+ captured["probe_before_new_file"] = await kwargs["download_settle"](frozenset())
(tmp_path / "b.pdf").write_bytes(b"file-bytes-b")
- captured["probe_after_new_file"] = await kwargs["completion_probe"](frozenset())
+ captured["probe_after_new_file"] = await kwargs["download_settle"](frozenset())
if captured["probe_after_new_file"]:
return LoopOutcome(status="completed", reason=captured["probe_after_new_file"], billable_actions=["click"])
return LoopOutcome(status="budget_exhausted", reason="no download detected", billable_actions=[])
@@ -2749,8 +2785,6 @@ async def test_execute_task_v3_download_baseline_is_scoped_per_block(
)
assert captured_block2["probe_before_new_file"] is None
- assert isinstance(captured_block2["blocker_before_new_file"], str)
- assert captured_block2["blocker_before_new_file"]
assert captured_block2["probe_after_new_file"]
# Only b.pdf was new to block 2's run: it alone is finalized/renamed, and first.pdf (block 1's
@@ -2767,16 +2801,15 @@ async def test_execute_task_v3_download_completion_excludes_staged_download_pers
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
# file_upload's staged http(s) source file sits in the same download directory and never goes
- # away on its own; the probe/blocker must exclude it by name on every later call this run, not
+ # away on its own; the probe must exclude it by name on every later call this run, not
# just the one call that staged it, or it gets finalized/renamed as if it were a real download.
async def _loop(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
(tmp_path / "in.pdf").write_bytes(b"staged-input-bytes")
staged = frozenset({"in.pdf"})
- captured["probe_before_download"] = await kwargs["completion_probe"](staged)
- captured["blocker_before_download"] = await kwargs["completion_blocker"](staged)
+ captured["probe_before_download"] = await kwargs["download_settle"](staged)
(tmp_path / "out.pdf").write_bytes(b"real-download-bytes")
- captured["probe_after_download"] = await kwargs["completion_probe"](staged)
+ captured["probe_after_download"] = await kwargs["download_settle"](staged)
if captured["probe_after_download"]:
return LoopOutcome(status="completed", reason=captured["probe_after_download"], billable_actions=["click"])
return LoopOutcome(status="budget_exhausted", reason="no download detected", billable_actions=[])
@@ -2784,8 +2817,6 @@ async def test_execute_task_v3_download_completion_excludes_staged_download_pers
captured = await _run_execute_task_v3_download(monkeypatch, tmp_path, drop_file=False, loop_fn=_loop)
assert captured["probe_before_download"] is None
- assert isinstance(captured["blocker_before_download"], str)
- assert captured["blocker_before_download"]
assert captured["probe_after_download"]
# Only the real download was finalized/renamed per download_suffix; the staged input is
@@ -2821,7 +2852,7 @@ async def test_execute_task_v3_download_completion_staged_add_gated_by_existence
if not file_exists_at_add_time:
(tmp_path / "report.csv").write_bytes(b"real-download-bytes")
- captured["probe_reason"] = await kwargs["completion_probe"](frozenset(staged_downloads))
+ captured["probe_reason"] = await kwargs["download_settle"](frozenset(staged_downloads))
if captured["probe_reason"]:
return LoopOutcome(status="completed", reason=captured["probe_reason"], billable_actions=["click"])
return LoopOutcome(status="budget_exhausted", reason="no download detected", billable_actions=[])
@@ -2841,14 +2872,14 @@ async def test_execute_task_v3_download_completion_staged_add_gated_by_existence
@pytest.mark.asyncio
-async def test_execute_task_v3_download_completion_probe_does_not_refinalize_once_cached(
+async def test_execute_task_v3_download_settle_does_not_refinalize_once_cached(
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
- # A finish(completed) deferred by the settle gate re-probes after the first probe already
- # finalized the download. Without download_suffix, finalize renames to a fresh random name
+ # A second settle call after the first already finalized the download. Without download_suffix,
+ # finalize renames to a fresh random name
# every call, so re-finalizing on the re-probe would rename the file again and return a
# different (but still truthy) reason. The cached-reason short-circuit must make every later
- # probe/blocker call a no-op: same reason, same directory listing, one finalize call total.
+ # probe call a no-op: same reason, same directory listing, one finalize call total.
original_finalize = ForgeAgent._finalize_downloaded_files_for_task
finalize_calls = 0
@@ -2861,15 +2892,12 @@ async def test_execute_task_v3_download_completion_probe_does_not_refinalize_onc
async def _loop(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
(tmp_path / "a.pdf").write_bytes(b"file-bytes")
- captured["probe_reason_1"] = await kwargs["completion_probe"](frozenset())
+ captured["probe_reason_1"] = await kwargs["download_settle"](frozenset())
captured["listing_1"] = sorted(p.name for p in tmp_path.iterdir())
- captured["probe_reason_2"] = await kwargs["completion_probe"](frozenset())
+ captured["probe_reason_2"] = await kwargs["download_settle"](frozenset())
captured["listing_2"] = sorted(p.name for p in tmp_path.iterdir())
- captured["blocker_reason_3"] = await kwargs["completion_blocker"](frozenset())
- captured["listing_3"] = sorted(p.name for p in tmp_path.iterdir())
-
if captured["probe_reason_1"]:
return LoopOutcome(status="completed", reason=captured["probe_reason_1"], billable_actions=["click"])
return LoopOutcome(status="budget_exhausted", reason="no download detected", billable_actions=[])
@@ -2880,10 +2908,8 @@ async def test_execute_task_v3_download_completion_probe_does_not_refinalize_onc
assert captured["probe_reason_1"]
assert captured["probe_reason_2"] == captured["probe_reason_1"]
- assert captured["blocker_reason_3"] is None
assert captured["listing_2"] == captured["listing_1"]
- assert captured["listing_3"] == captured["listing_1"]
assert finalize_calls == 1
@@ -6705,7 +6731,7 @@ def _click_then_probe(
monitor.browser_download_event_count += 1
if local_file is not None:
(tmp_path / local_file).write_bytes(b"local-bytes")
- probe = kwargs["completion_probe"]
+ probe = kwargs["download_settle"]
captured["probe_started_at"] = time.monotonic()
captured["probe_reason"] = await probe(frozenset())
captured["probe_returned_at"] = time.monotonic()
@@ -7044,7 +7070,7 @@ async def test_v3_download_does_not_take_a_staged_upload_for_the_admitted_downlo
async def _loop(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
monitor.browser_download_event_count += 1
(tmp_path / "upload.pdf").write_bytes(b"staged-upload")
- captured["probe_reason"] = await kwargs["completion_probe"](frozenset({"upload.pdf"}))
+ captured["probe_reason"] = await kwargs["download_settle"](frozenset({"upload.pdf"}))
return LoopOutcome(status="completed", reason="done", billable_actions=["click"])
captured = await _run_execute_task_v3_download(
@@ -7071,6 +7097,12 @@ async def test_v3_wait_only_download_does_not_read_the_provider(
observation = _FakeActionDownloadObservation([("export.csv", b"real-export")])
source = _ActionDownloadSource(observation)
+ async def _click_then_wait(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
+ captured["begin_calls_at_loop_start"] = source.begin_calls
+ monitor.browser_download_event_count += 1
+ await kwargs["download_wait"]()
+ return LoopOutcome(status="budget_exhausted", reason="no download detected", billable_actions=[])
+
captured = await _run_execute_task_v3_download(
monkeypatch,
tmp_path,
@@ -7079,11 +7111,10 @@ async def test_v3_wait_only_download_does_not_read_the_provider(
download_timeout=10.0,
provider_source=source,
download_monitor=monitor,
- loop_fn=_click_then_probe(tmp_path, monitor, source),
+ loop_fn=_click_then_wait,
)
assert captured["begin_calls_at_loop_start"] == 0
- assert captured["probe_reason"] is None
assert observation.poll_deadlines == []
assert not [p for p in tmp_path.iterdir() if p.is_file()]
@@ -7130,10 +7161,10 @@ async def test_v3_download_without_a_provider_source_is_unchanged(
def _probe_twice(
monitor: _FakeBrowserDownloadMonitor, between: Callable[[], None]
) -> Callable[[dict[str, Any], dict[str, Any]], Awaitable[LoopOutcome]]:
- # One click, two probes: the second follows an unrelated billable tool, with no new download event.
+ # One click, two settles: the second finish follows no new download event.
async def _loop(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
monitor.browser_download_event_count += 1
- probe = kwargs["completion_probe"]
+ probe = kwargs["download_settle"]
captured["first_reason"] = await probe(frozenset())
between()
captured["probe_reason"] = await probe(frozenset())
@@ -7208,7 +7239,7 @@ async def test_v3_download_cancellation_returns_only_after_the_provider_poll_cle
async def _loop(kwargs: dict[str, Any], captured: dict[str, Any]) -> LoopOutcome:
monitor.browser_download_event_count += 1
asyncio.get_running_loop().call_later(2.0, gate.set)
- captured["probe_reason"] = await kwargs["completion_probe"](frozenset())
+ captured["probe_reason"] = await kwargs["download_settle"](frozenset())
captured["cleanup_finished_at_return"] = observation.cleanup_finished
return LoopOutcome(status="budget_exhausted", reason="no download detected", billable_actions=[])
diff --git a/tests/unit/test_bitwarden_login.py b/tests/unit/test_bitwarden_login.py
index 2e1d8c2cd..cfa330f3d 100644
--- a/tests/unit/test_bitwarden_login.py
+++ b/tests/unit/test_bitwarden_login.py
@@ -674,8 +674,58 @@ def test_retry_backoff_is_full_jitter_with_doubling_cap(monkeypatch: pytest.Monk
delays = [bitwarden_module._retry_backoff_seconds(attempt) for attempt in range(5)]
- assert seen == [(0, 5.0), (0, 10.0), (0, 20.0), (0, 40.0), (0, 60.0)]
- assert delays == [5.0, 10.0, 20.0, 40.0, 60.0]
+ assert seen == [(0, 20.0), (0, 40.0), (0, 60.0), (0, 60.0), (0, 60.0)]
+ assert delays == [20.0, 40.0, 60.0, 60.0, 60.0]
+
+
+async def test_cold_login_gets_its_own_budget_beyond_the_read_timeout(monkeypatch: pytest.MonkeyPatch) -> None:
+ """A cold `bw login` downloads the whole vault, so it outlives the budget sized for the reads
+ behind it. Under a batch it regularly needs more than that, and killing it there fails the run
+ before it starts (SKY-18666)."""
+ read_timeout = 0.2
+ login_seconds = 0.6
+ monkeypatch.setattr(bitwarden_module.settings, "BITWARDEN_LOGIN_TIMEOUT_SECONDS", 5.0)
+ monkeypatch.setattr(bitwarden_module.settings, "BITWARDEN_MAX_JITTER_SECONDS", 0.0)
+ await bitwarden_module._cli_sessions.clear()
+
+ budgets: dict[str, float] = {}
+
+ async def fake_run_command(
+ command: list[str], additional_env: dict | None = None, timeout: float = 60
+ ) -> RunCommandResult:
+ step = command[1]
+ budgets[step] = timeout
+ if step == "login":
+ await asyncio.sleep(login_seconds)
+ if timeout < login_seconds:
+ raise asyncio.TimeoutError
+ return RunCommandResult(stdout="You are logged in!", stderr="", returncode=0)
+ if step == "unlock":
+ return RunCommandResult(
+ stdout='Your vault is now unlocked!\nBW_SESSION="session-key"', stderr="", returncode=0
+ )
+ return RunCommandResult(stdout=json.dumps(_cli_item()), stderr="", returncode=0)
+
+ monkeypatch.setattr(BitwardenService, "run_command", fake_run_command)
+
+ try:
+ credential = await BitwardenService.get_secret_value_from_url(
+ client_id="client-id",
+ client_secret="client-secret",
+ master_password="master-password",
+ bw_organization_id="org-id",
+ bw_collection_ids=None,
+ item_id="11111111-1111-1111-1111-111111111111",
+ timeout=read_timeout,
+ )
+ finally:
+ await bitwarden_module._cli_sessions.clear()
+
+ assert credential["BW_PASSWORD"] == "example-password"
+ # The login outlives the read budget; the reads keep theirs so a hung read still fails fast.
+ assert budgets["login"] == 5.0
+ assert budgets["get"] == read_timeout
@pytest.mark.asyncio
diff --git a/tests/unit/test_browser_effect_sink_enumeration.py b/tests/unit/test_browser_effect_sink_enumeration.py
index fe8d050e1..7e104fae4 100644
--- a/tests/unit/test_browser_effect_sink_enumeration.py
+++ b/tests/unit/test_browser_effect_sink_enumeration.py
@@ -27,10 +27,11 @@ _DISCOVERED_BROWSER_API_CALLS = {
# 6 = 5 prior + the bounded v4 FileDownloadBlock synchronous popup close (SKY-15371).
"close": 6,
"dblclick": 2,
- # 16 = 15 prior + the held-autocomplete declared-list rows read after input_text (SKY-17867).
- "evaluate": 16,
+ # 18 = 16 prior + the read-only Flutter text-field probe and two-frame wait around a credential write.
+ "evaluate": 18,
"fill": 2,
- "focus": 4,
+ # 5 = 4 prior + the focus that lets a Flutter text field start editing before a credential write.
+ "focus": 5,
"go_back": 1,
"go_forward": 1,
"goto": 2,
@@ -128,6 +129,9 @@ _EVALUATE_CALLERS = {
"_inner": 1,
# read-only declared-list rows probe after input_text into a held autocomplete (SKY-17867)
"_held_value_lost_to_unmatched_text": 1,
+ # read-only Flutter text-field probe and two-frame wait around a credential write and its read-back
+ "_is_flutter_text_field": 1,
+ "_two_frames_passed": 1,
"_normal_select_readback_contradicts": 1,
"_probe_tel_browser_validity": 1,
"handle_click_action": 2,
@@ -264,21 +268,21 @@ def test_discovered_browser_api_lower_bound_is_stable() -> None:
}
assert observed == _DISCOVERED_BROWSER_API_CALLS
- assert sum(sum(methods.values()) for methods in observed.values()) == 208
+ assert sum(sum(methods.values()) for methods in observed.values()) == 211
handler_candidates = _candidate_signatures("skyvern/webeye/actions/handler.py", _CANDIDATE_METHODS)
classified_non_browser = Counter(
{signature: count for signature, count in handler_candidates.items() if signature in _NON_BROWSER_CANDIDATES}
)
assert classified_non_browser == _NON_BROWSER_CANDIDATES
assert sum(_NON_BROWSER_CANDIDATES.values()) == 7
- assert sum(sum(methods.values()) for methods in observed.values()) - sum(_NON_BROWSER_CANDIDATES.values()) == 201
+ assert sum(sum(methods.values()) for methods in observed.values()) - sum(_NON_BROWSER_CANDIDATES.values()) == 204
def test_every_raw_evaluate_call_is_classified() -> None:
observed = {path: callers for path in _owned_source_paths() if (callers := _callers_for_method(path, "evaluate"))}
assert observed == _EVALUATE_CALLERS
- assert sum(sum(callers.values()) for callers in observed.values()) == 39
+ assert sum(sum(callers.values()) for callers in observed.values()) == 41
def test_every_cdp_dispatch_is_classified_by_exact_command() -> None:
diff --git a/tests/unit/test_copilot_attached_file_upload.py b/tests/unit/test_copilot_attached_file_upload.py
index 252e8fa63..3c4691096 100644
--- a/tests/unit/test_copilot_attached_file_upload.py
+++ b/tests/unit/test_copilot_attached_file_upload.py
@@ -4,7 +4,7 @@ import hashlib
import json
import struct
import zlib
-from collections.abc import AsyncIterator
+from collections.abc import AsyncIterator, Awaitable, Callable
from contextlib import asynccontextmanager
from datetime import datetime, timedelta, timezone
from types import SimpleNamespace
@@ -12,11 +12,12 @@ from typing import Any
import pytest
from playwright.async_api import Page, Route, async_playwright
+from structlog.testing import capture_logs
from skyvern.forge import app
from skyvern.forge.sdk.copilot.context import CopilotContext
from skyvern.forge.sdk.copilot.runtime import AgentContext
-from skyvern.forge.sdk.copilot.tools import _shared, attached_file_upload
+from skyvern.forge.sdk.copilot.tools import _shared, attached_file_upload, read_attached_pdf_tool
from skyvern.forge.sdk.copilot.turn_context import AttachedFileContext, TranscriptContext, TurnContextPacket
from skyvern.forge.sdk.schemas.workflow_copilot import CopilotAttachedFile
from skyvern.services import uploaded_file_service
@@ -404,3 +405,192 @@ async def test_a_browser_that_cannot_be_reached_reports_no_endpoint_text(
assert result["ok"] is False
assert expected_detail in result["error"]
assert "10.1.2.3" not in json.dumps(result)
+
+
+def _pdf(pages: list[list[str]]) -> bytes:
+ def text(line: str) -> str:
+ return line.replace("\\", "\\\\").replace("(", "\\(").replace(")", "\\)")
+
+ objects = ["<< /Type /Catalog /Pages 2 0 R >>", "", "<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>"]
+ kids = []
+ for lines in pages:
+ stream = "BT /F1 9 Tf 11 TL 36 800 Td " + " ".join(f"({text(line)}) Tj T*" for line in lines) + " ET"
+ objects.append(f"<< /Length {len(stream.encode('latin-1'))} >>\nstream\n{stream}\nendstream")
+ objects.append(
+ "<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 842] "
+ f"/Resources << /Font << /F1 3 0 R >> >> /Contents {len(objects)} 0 R >>"
+ )
+ kids.append(len(objects))
+ objects[1] = f"<< /Type /Pages /Kids [{' '.join(f'{kid} 0 R' for kid in kids)}] /Count {len(kids)} >>"
+ out = b"%PDF-1.4\n"
+ offsets = []
+ for number, body in enumerate(objects, 1):
+ offsets.append(len(out))
+ out += f"{number} 0 obj\n{body}\nendobj\n".encode("latin-1")
+ xref = len(out)
+ out += f"xref\n0 {len(objects) + 1}\n0000000000 65535 f \n".encode()
+ out += b"".join(f"{offset:010d} 00000 n \n".encode() for offset in offsets)
+ out += f"trailer\n<< /Size {len(objects) + 1} /Root 1 0 R >>\nstartxref\n{xref}\n%%EOF\n".encode()
+ return out
+
+
+SEMANTIC_SECRET = "Zq8!vL3#pR2w"
+ScreenHandler = Callable[..., Awaitable[dict[str, Any]]] | None
+
+
+async def _citing_screen(prompt: str, prompt_name: str) -> dict[str, Any]:
+ cited = [SEMANTIC_SECRET] if SEMANTIC_SECRET in prompt else []
+ return {"version": "1", "state": "detected" if cited else "clean", "citations": cited}
+
+
+async def _read(ctx: CopilotContext, file_id: str, offset: int = 0) -> tuple[str, dict[str, Any]]:
+ output = await read_attached_pdf_tool.on_invoke_tool(
+ SimpleNamespace(context=ctx, tool_name=attached_file_upload.READ_PDF_TOOL_NAME),
+ json.dumps({"file_id": file_id, "offset": offset}),
+ )
+ return output, json.loads(output)
+
+
+async def test_reading_an_attached_pdf_returns_every_line_once_with_secrets_redacted(
+ monkeypatch: pytest.MonkeyPatch,
+ repo: FakeUploadedFilesRepository,
+ storage: FakeStorage,
+) -> None:
+ # Accents and quotes make the serialized text longer than the raw text, which is what the window is sized on.
+ lines = [f'Étape {n}: vérifiez "Détails", réservé à l\'élève, ligne {n} terminée.' for n in range(1, 1601)]
+ lines[2] = "Sign in with Password: Spring2026!"
+ lines[700] = "The vault answer is RegisteredValue77"
+ lines[1400] = f"Backup portal code {SEMANTIC_SECRET} when the first one fails"
+ attached = _attach(repo, storage, "procedure.pdf", _pdf([lines[i : i + 60] for i in range(0, len(lines), 60)]))
+ ctx = _chat(monkeypatch, None, [attached])
+ ctx.secret_scrub_values = ["RegisteredValue77"]
+
+ async def _handler(_workflow_permanent_id: str | None, _organization_id: str | None) -> ScreenHandler:
+ return _citing_screen
+
+ monkeypatch.setattr(attached_file_upload, "resolve_raw_secret_safety_handler", _handler)
+
+ windows: list[str] = []
+ offset: int | None = 0
+ while offset is not None:
+ output, result = await _read(ctx, attached.file_id, offset)
+ assert result["ok"] is True
+ assert result["offset"] == offset
+ assert len(output) <= 50_000
+ assert len(json.dumps(result["text"], ensure_ascii=False)) <= attached_file_upload._READ_WINDOW_SERIALIZED_CHARS
+ windows.append(result["text"])
+ offset = result["next_offset"]
+
+ text = "".join(windows)
+ assert len(windows) > 1
+ assert all(window.endswith("\n") for window in windows[:-1])
+ assert [n for n in range(1, 1601) if n not in (3, 701, 1401) and text.count(f" ligne {n} ") != 1] == []
+ assert "Spring2026!" not in text
+ assert "RegisteredValue77" not in text
+ assert SEMANTIC_SECRET not in text
+ assert text.count("[REDACTED_SECRET]") == 3
+
+
+PASSPHRASE = "orchard apple moon"
+PASSPHRASE_LABEL = "The account password is a phrase"
+
+
+async def _label_aware_screen(prompt: str, prompt_name: str) -> dict[str, Any]:
+ # Like the real screen, a bare phrase is only a secret when its label is in view.
+ cited = [PASSPHRASE] if PASSPHRASE_LABEL in prompt and PASSPHRASE in prompt else []
+ return {"version": "1", "state": "detected" if cited else "clean", "citations": cited}
+
+
+async def _label_aware_handler(_workflow_permanent_id: str | None, _organization_id: str | None) -> ScreenHandler:
+ return _label_aware_screen
+
+
+async def test_a_read_cannot_start_inside_a_line_and_cut_a_secret_away_from_its_label(
+ monkeypatch: pytest.MonkeyPatch,
+ repo: FakeUploadedFilesRepository,
+ storage: FakeStorage,
+) -> None:
+ attached = _attach(
+ repo, storage, "procedure.pdf", _pdf([["Open the portal.", f"{PASSPHRASE_LABEL}: {PASSPHRASE}.", "Submit."]])
+ )
+ ctx = _chat(monkeypatch, None, [attached])
+ monkeypatch.setattr(attached_file_upload, "resolve_raw_secret_safety_handler", _label_aware_handler)
+
+ result = await attached_file_upload.read_attached_pdf(ctx, attached.file_id, offset=40)
+
+ assert result["ok"] is True
+ assert result["offset"] == 0
+ assert PASSPHRASE not in result["text"]
+
+
+async def test_a_secret_shaped_attachment_name_stays_out_of_the_logs(
+ monkeypatch: pytest.MonkeyPatch,
+ repo: FakeUploadedFilesRepository,
+ storage: FakeStorage,
+) -> None:
+ token = "aB3dE9fG2hJ7kL1mN5pQ8rS4"
+ attached = _attach(repo, storage, f"vault_{token}.pdf", _pdf([["Open the claims form."]]))
+ ctx = _chat(monkeypatch, None, [attached])
+ monkeypatch.setattr(attached_file_upload, "resolve_raw_secret_safety_handler", _label_aware_handler)
+
+ with capture_logs() as logs:
+ result = await attached_file_upload.read_attached_pdf(ctx, attached.file_id)
+
+ assert result["ok"] is True
+ assert logs
+ assert token not in json.dumps(logs, default=str)
+ assert token not in json.dumps(result)
+
+
+async def test_each_window_is_screened_with_the_text_before_it(
+ monkeypatch: pytest.MonkeyPatch,
+ repo: FakeUploadedFilesRepository,
+ storage: FakeStorage,
+) -> None:
+ lines = [f"Step {n}: copy row {n} from the export into the matching form field." for n in range(1, 1201)]
+ attached = _attach(repo, storage, "procedure.pdf", _pdf([lines[i : i + 60] for i in range(0, len(lines), 60)]))
+ ctx = _chat(monkeypatch, None, [attached])
+ prompts: list[str] = []
+
+ async def _recording_screen(prompt: str, prompt_name: str) -> dict[str, Any]:
+ prompts.append(prompt)
+ return {"version": "1", "state": "clean", "citations": []}
+
+ async def _handler(_workflow_permanent_id: str | None, _organization_id: str | None) -> ScreenHandler:
+ return _recording_screen
+
+ monkeypatch.setattr(attached_file_upload, "resolve_raw_secret_safety_handler", _handler)
+
+ first = await attached_file_upload.read_attached_pdf(ctx, attached.file_id)
+ second = await attached_file_upload.read_attached_pdf(ctx, attached.file_id, first["next_offset"])
+
+ assert first["text"].rstrip().splitlines()[-1] in prompts[1]
+ assert first["text"].rstrip().splitlines()[-1] not in second["text"]
+
+
[email protected]("case", ["not_in_this_chat", "not_a_pdf", "no_text_layer", "screen_unavailable"])
+async def test_an_attached_pdf_that_cannot_be_read_safely_returns_no_text(
+ monkeypatch: pytest.MonkeyPatch,
+ repo: FakeUploadedFilesRepository,
+ storage: FakeStorage,
+ case: str,
+) -> None:
+ data = {"not_a_pdf": _png(), "no_text_layer": _pdf([[]])}.get(case, _pdf([["Open the claims form."]]))
+ attached = _attach(repo, storage, "procedure.pdf", data)
+ ctx = _chat(monkeypatch, None, [] if case == "not_in_this_chat" else [attached])
+
+ async def _handler(_workflow_permanent_id: str | None, _organization_id: str | None) -> ScreenHandler:
+ return None if case == "screen_unavailable" else _citing_screen
+
+ monkeypatch.setattr(attached_file_upload, "resolve_raw_secret_safety_handler", _handler)
+
+ result = await attached_file_upload.read_attached_pdf(ctx, attached.file_id)
+
+ assert result["ok"] is False
+ assert result["error"]
+ assert "text" not in result
diff --git a/tests/unit/test_copilot_budget_drain.py b/tests/unit/test_copilot_budget_drain.py
index 2bb8873e3..7ee3eef28 100644
--- a/tests/unit/test_copilot_budget_drain.py
+++ b/tests/unit/test_copilot_budget_drain.py
@@ -659,9 +659,11 @@ _DRAIN_KEPT_NATIVE_TOOLS = {
"inspect_page_for_composition",
"list_credentials",
"list_integrations",
+ "read_attached_pdf",
"read_google_sheet",
"reply",
"request_credential",
+ "request_google_connection",
"run_browser_code",
"search_web",
"set_work_plan",
diff --git a/tests/unit/test_copilot_code_artifact_metadata_violations.py b/tests/unit/test_copilot_code_artifact_metadata_violations.py
index 922280b5b..0b7623fc6 100644
--- a/tests/unit/test_copilot_code_artifact_metadata_violations.py
+++ b/tests/unit/test_copilot_code_artifact_metadata_violations.py
@@ -5,20 +5,29 @@ OSS-synced: only example.* / RFC-2606 placeholder targets and synthetic labels.
from __future__ import annotations
+import json
import re
import textwrap
+from collections.abc import Callable
+from typing import Any
+
+import pytest
from skyvern.forge.sdk.copilot.outcome_verification_trace import (
finalize_outcome_verification_trace,
record_code_artifact_violations,
)
from skyvern.forge.sdk.copilot.output_utils import _sanitize_failure_text
+from skyvern.forge.sdk.copilot.schema_incompatibility import SchemaIncompatibility
from skyvern.forge.sdk.copilot.tools import _normalize_code_artifact_metadata
from skyvern.forge.sdk.copilot.tools.workflow_update import (
_code_artifact_metadata_shape_errors,
_code_block_returns_flat_string,
_code_block_returns_uninvoked_structured_function,
_download_descriptor_leak_finding,
+ _extraction_return_shape_error,
+ _extraction_schema_conformance_error,
+ _extraction_schema_incompatibility,
_is_download_intent,
_normalize_code_artifact_metadata_detailed,
)
@@ -689,42 +698,63 @@ def _download_intent_metadata(label: str) -> dict:
return metadata
+_CLAIM_TERMINAL = 'saved_as = await click_and_claim_download(page, "a#statement-pdf")\n'
+_FRAME_EVENT_TERMINAL = (
+ "async with page.expect_download() as download_info:\n"
+ ' await page.frame_locator("iframe#viewer").locator("a#statement-pdf").click()\n'
+ "saved_as = (await download_info.value).suggested_filename\n"
+)
+_NO_TERMINAL = 'saved_as = await page.inner_text("#statement-name")\n'
+
+
+def _schema_extraction_metadata(label: str) -> dict[str, Any]:
+ metadata = _extraction_metadata(label, ["records[].number"])
+ metadata["claimed_outcomes"][0]["extraction_schema"] = json.dumps(
+ {"type": "object", "properties": {"invoice_total": {"type": "string"}}, "required": ["invoice_total"]}
+ )
+ return metadata
+
+
class TestDownloadIntentTerminals:
- """Which engine will run a block is unknown when it is authored, and `click_and_claim_download`
- is the only download terminal that registers on both, so it is the only one this gate credits.
- A block relying on the `page.expect_download` idiom therefore loses the download exemption and
- is held to the extraction-shape checks."""
+ """Which engine will run a block is unknown when it is authored. Both the claim helper and a
+ `page.expect_download()` capture register on both saved-block engines, so both are download terminals."""
- def test_expect_download_alone_is_not_download_intent(self) -> None:
- code = textwrap.dedent(
- """
- async with page.expect_download(timeout=30000) as download_event:
- await page.click("a#statement-pdf")
- """
- )
- assert _is_download_intent({}, code) is False
+ def test_expect_download_is_download_intent(self) -> None:
+ assert _is_download_intent({}, _FRAME_EVENT_TERMINAL) is True
def test_download_claim_is_download_intent(self) -> None:
- code = 'saved = await click_and_claim_download(page, "a#statement-pdf")\nreturn {"saved_as": saved}'
- assert _is_download_intent({}, code) is True
+ assert _is_download_intent({}, _CLAIM_TERMINAL) is True
def test_declared_registration_key_still_carries_download_intent(self) -> None:
- code = "async with page.expect_download() as download_event:\n await page.click('a#statement-pdf')"
+ code = "await page.click('a#statement-pdf')"
assert _is_download_intent(_download_intent_metadata("dl_block"), code) is True
- def test_expect_download_no_longer_exempts_a_block_from_the_extraction_validators(self) -> None:
- code = """
- async with page.expect_download() as dl_info:
- await page.click("a#statement-pdf")
- return page.inner_text("#results")
- """
- normalized, error = _normalize_code_artifact_metadata(
- [_extraction_metadata("my_block", ["records[].number"])],
- _extraction_code_block_yaml("my_block", code),
- )
- assert normalized == {}
- assert error is not None
- assert "flat text blob" in error
+ @pytest.mark.parametrize(
+ ("terminal", "exempt"),
+ [(_CLAIM_TERMINAL, True), (_FRAME_EVENT_TERMINAL, True), (_NO_TERMINAL, False)],
+ ids=["claim_helper", "expect_download", "no_download"],
+ )
+ @pytest.mark.parametrize(
+ ("check", "returned"),
+ [
+ (lambda code, artifact: _extraction_return_shape_error("b", artifact, code), 'f"saved {saved_as}"'),
+ (
+ lambda code, artifact: _extraction_schema_conformance_error("b", artifact, code),
+ '{"saved_as": saved_as}',
+ ),
+ (lambda code, artifact: _extraction_schema_incompatibility("b", artifact, code), '{"saved_as": saved_as}'),
+ ],
+ ids=["return_shape", "schema_conformance", "schema_incompatibility"],
+ )
+ def test_every_extraction_shape_check_exempts_both_download_terminals(
+ self,
+ check: Callable[[str, dict[str, Any]], str | SchemaIncompatibility | None],
+ returned: str,
+ terminal: str,
+ exempt: bool,
+ ) -> None:
+ finding = check(f"{terminal}return {returned}", _schema_extraction_metadata("b"))
+ assert (finding is None) is exempt
class TestDownloadDescriptorLeak:
@@ -746,9 +776,7 @@ class TestDownloadDescriptorLeak:
class TestDownloadShapesThatMustNotBeFlagged:
"""Negative space for the surviving descriptor-leak arm: a clean descriptor, an extraction
- block, and a non-download block must all normalize without a violation. The first arm passes
- because its artifact declares a registration key, not because the `expect_download` idiom is
- read as a download terminal."""
+ block, and a non-download block must all normalize without a violation."""
def test_expect_download_idiom_with_descriptor_passes(self) -> None:
code = """
diff --git a/tests/unit/test_copilot_context.py b/tests/unit/test_copilot_context.py
index 778cc09a3..f118a3eab 100644
--- a/tests/unit/test_copilot_context.py
+++ b/tests/unit/test_copilot_context.py
@@ -362,9 +362,9 @@ def _policy_ctx(
selected_connected_account_id: str | None = None,
) -> SimpleNamespace:
return SimpleNamespace(
- credential_pause_connected_credential_id=None,
request_policy=SimpleNamespace(
resolved_credentials=resolved,
+ credential_pause_connected_credential_ids=set(),
credential_input_kind=credential_input_kind,
live_page_admitted_urls={},
seeded_proposal_credential_ids=set(),
diff --git a/tests/unit/test_copilot_credential_pause.py b/tests/unit/test_copilot_credential_pause.py
index cb959cd0d..27887db38 100644
--- a/tests/unit/test_copilot_credential_pause.py
+++ b/tests/unit/test_copilot_credential_pause.py
@@ -46,7 +46,11 @@ from skyvern.forge.sdk.cache.base import NoopLock
from skyvern.forge.sdk.copilot import credential_pause as credential_pause_module
from skyvern.forge.sdk.copilot import credential_resolution
from skyvern.forge.sdk.copilot import tools as tools_module
-from skyvern.forge.sdk.copilot.agent import _finalize_result_with_blocker_override, _turn_credential_prompt_reason
+from skyvern.forge.sdk.copilot.agent import (
+ _finalize_result_with_blocker_override,
+ _make_agent_result,
+ _turn_credential_prompt_reason,
+)
from skyvern.forge.sdk.copilot.blocker_signal import (
CREDENTIAL_ORIGIN_RECOVERY_DECLINED_REASON_CODE,
CREDENTIAL_ORIGIN_RECOVERY_PENDING_REASON_CODE,
@@ -93,6 +97,7 @@ from skyvern.forge.sdk.copilot.enforcement import (
run_with_enforcement,
)
from skyvern.forge.sdk.copilot.hooks import CopilotRunHooks
+from skyvern.forge.sdk.copilot.human_input_wait import HumanInputWait, pause_human_input
from skyvern.forge.sdk.copilot.narration import NarratorState, build_tool_call_activity
from skyvern.forge.sdk.copilot.request_policy import (
RequestPolicy,
@@ -118,6 +123,7 @@ from skyvern.forge.sdk.routes.workflow_copilot import (
workflow_copilot_credential_generate,
workflow_copilot_credential_response,
)
+from skyvern.forge.sdk.schemas.copilot_turn_outcome import ResponseKind, TurnOutcome
from skyvern.forge.sdk.schemas.credentials import (
CreateCredentialRequest,
Credential,
@@ -137,6 +143,7 @@ from skyvern.forge.sdk.schemas.workflow_copilot import (
)
from tests.unit.conftest import make_copilot_context
from tests.unit.copilot_test_helpers import wire_credential_vault
+from tests.unit.test_copilot_make_agent_result_backfill import _payload as _backfill_payload
@pytest.fixture(autouse=True)
@@ -327,58 +334,6 @@ def test_reason_none_when_no_signals_present() -> None:
# ---------------------------------------------------------------------------
-async def test_a_run_that_hits_a_login_still_gets_a_card_after_an_unanswered_tool_ask(
- monkeypatch: pytest.MonkeyPatch,
-) -> None:
- """The one-card budget is spent when the tool asks on a guess. A run that then hits a real login
- has evidence the guess did not, so the guess must not cost the turn its real card."""
- ctx = make_copilot_context()
- ctx.organization_id = "org-1"
- ctx.turn_id = "turn-1"
- ctx.client_supports_credential_pause = True
- ctx.workflow_copilot_chat_id = "chat-1"
- ctx.last_run_skipped_unbound_credentials = True
- ctx.request_policy = RequestPolicy(
- credential_ask_login_page_urls=["https://old.example.com/login"],
- login_page_urls=["https://actual.example.com/login"],
- )
- # State left by a tool ask the user skipped.
- ctx.credential_pause_used = True
- ctx.credential_pause_reaskable_by_run = True
-
- cache = _FakeCache()
- cache.store[credential_response_cache_key("org-1", "chat-1", "turn-1")] = encode_credential_response(
- "connected", "cred_1", "tok-1"
- )
- monkeypatch.setattr(credential_pause_module.app._inst, "CACHE", cache, raising=False)
- monkeypatch.setattr(
- credential_pause_module.app,
- "DATABASE",
- SimpleNamespace(
- credentials=SimpleNamespace(get_credentials_by_ids=AsyncMock(return_value=[_make_credential()]))
- ),
- )
- monkeypatch.setattr(credential_pause_module, "CREDENTIAL_RESPONSE_POLL_SECONDS", 0.01)
-
- resume_msgs = await maybe_credential_pause(
- ctx,
- _fake_result(),
- _make_stream(),
- CopilotConfig(credential_pause_enabled=True, credential_pause_timeout_seconds=5),
- )
-
- assert resume_msgs is not None
- assert ctx.credential_pause_outcome == "connected"
- assert ctx.request_policy.live_page_admitted_urls == {"cred_1": "https://actual.example.com/login"}
- carried = record_approved_credentials_in_global_llm_context(ctx, None)
- assert StructuredContext.from_json_str(carried).approved_credentials == [
- ApprovedCredential(credential_id="cred_1", admitted_url="https://actual.example.com/login")
- ]
- # Handed back once only, so the turn cannot loop on repeated cards.
- assert ctx.credential_pause_reaskable_by_run is False
-
-
@pytest.mark.asyncio
async def test_connected_action_mutates_policy_and_resolves(monkeypatch: pytest.MonkeyPatch) -> None:
ctx = make_copilot_context()
@@ -548,7 +503,7 @@ async def test_skip_action_leaves_policy_untouched(monkeypatch: pytest.MonkeyPat
assert ctx.credential_pause_outcome == "skipped"
assert ctx.request_policy.resolved_credentials == []
assert ctx.request_policy == RequestPolicy()
- assert "chose not to connect a credential now" in resume_msgs[-1]["content"]
+ assert "chose not to connect a credential" in resume_msgs[-1]["content"]
@pytest.mark.asyncio
@@ -1986,19 +1941,261 @@ async def test_the_tool_call_raises_the_card_and_returns_the_connected_credentia
@pytest.mark.asyncio
-async def test_a_skipped_card_returns_skipped_and_spends_the_one_ask_per_turn_latch(
+ ("first_answer", "first_status"),
+ [(("signed_in", None), "signed_in"), (("connected", "cred_1"), "connected"), (("skip", None), "skipped")],
+ ids=["signed_in", "connected", "skipped"],
+)
+async def test_a_settled_card_leaves_the_models_next_ask_free_to_open_a_fresh_card(
+ monkeypatch: pytest.MonkeyPatch, first_answer: _CardAnswer, first_status: str
+) -> None:
+ """A Done can save a browser state whose next test is still signed out, so the model's next ask must
+ reach the user as a new card rather than an already_asked from the settled one."""
+ cache = _FakeCache()
+ ctx = _tool_ctx(monkeypatch, cache)
+ _stub_credential_lookup(monkeypatch, _make_credential())
+ ctx.stream.send = AsyncMock(side_effect=_answer_each_card(cache, [first_answer, ("connected", "cred_1")]))
+
+ first = await _call_ask_tool(ctx)
+ ctx.last_test_ok = False
+ second = await _call_ask_tool(ctx)
+
+ assert first["status"] == first_status
+ assert (second["status"], second.get("credential_id")) == ("connected", "cred_1")
+ assert [card.resume_token for card in _sent_cards(ctx)] == ["tok-1", "tok-2"]
+ assert [(resolved.resume_token, resolved.outcome) for resolved in _sent_resolutions(ctx)] == [
+ ("tok-1", first_status),
+ ("tok-2", "connected"),
+ ]
+ assert ctx.credential_pause_outcome == "connected"
+
+
+ ("first_card", "credited"), [("unanswered", False), ("start_sign_in", True)], ids=["nobody_there", "signing_in"]
+)
+async def test_an_unanswered_card_returns_past_the_deadline_and_counts_against_the_turn_unless_someone_signed_in(
+ monkeypatch: pytest.MonkeyPatch, first_card: Literal["unanswered", "start_sign_in"], credited: bool
+) -> None:
+ cache = _FakeCache()
+ ctx = _tool_ctx(monkeypatch, cache)
+ ctx.copilot_config = CopilotConfig(credential_pause_enabled=True, credential_pause_timeout_seconds=1)
+ ctx.browser_session_id = "pbs_debug"
+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_MANUAL_SIGN_IN_TIMEOUT_SECONDS", 1)
+ _stub_credential_lookup(monkeypatch, _make_credential())
+ ctx.stream.send = AsyncMock(side_effect=_answer_each_card(cache, [(first_card, None), ("connected", "cred_1")]))
+
+ # The turn's backstop is shorter than the card's wait.
+ async with asyncio.timeout(0.3) as deadline:
+ ctx.model_stream_deadline = deadline
+ first = await _call_ask_tool(ctx)
+ credited_after_first = ctx.copilot_credential_pause_seconds
+ backstop_after_first = deadline.when() or 0.0
+ backstop_still_ahead = backstop_after_first > asyncio.get_running_loop().time()
+ second = await _call_ask_tool(ctx)
+
+ assert (first["status"], first["outcome"]) == ("unanswered", "timeout")
+ assert backstop_still_ahead
+ # The backstop's grace is one-shot: a later card in a spent turn no longer pushes it out.
+ assert deadline.when() == backstop_after_first
+ assert (credited_after_first > 0.0) is credited
+ assert (second["status"], second.get("credential_id")) == ("connected", "cred_1")
+ assert [card.resume_token for card in _sent_cards(ctx)] == ["tok-1", "tok-2"]
+
+
+def test_overlapping_waits_credit_only_the_time_someone_was_answering() -> None:
+ def waiting_ctx() -> SimpleNamespace:
+ return SimpleNamespace(
+ human_input_wait=HumanInputWait(),
+ model_stream_deadline=None,
+ copilot_question_pause_seconds=0.0,
+ copilot_credential_pause_seconds=0.0,
+ )
+
+ question_outlasts_card = waiting_ctx()
+ with pause_human_input(question_outlasts_card, "question"): # type: ignore[arg-type]
+ with pause_human_input(question_outlasts_card, "credential") as card: # type: ignore[arg-type]
+ card.unattended = True
+ time.sleep(0.01)
+
+ card_outlasts_question = waiting_ctx()
+ with pause_human_input(card_outlasts_question, "credential") as card: # type: ignore[arg-type]
+ with pause_human_input(card_outlasts_question, "question"): # type: ignore[arg-type]
+ pass
+ time.sleep(0.2)
+ card.unattended = True
+
+ assert question_outlasts_card.copilot_question_pause_seconds > 0.0
+ assert card_outlasts_question.copilot_credential_pause_seconds < 0.1
+
+
+async def test_an_ask_issued_while_a_card_is_open_opens_no_second_card(monkeypatch: pytest.MonkeyPatch) -> None:
+ response_key = credential_response_cache_key("org-1", "chat-1", "turn-1")
+ ctx = _tool_ctx(monkeypatch, _SlowAnswerCache(response_key, 0.2, "connected"))
+ _stub_credential_lookup(monkeypatch, _make_credential())
+
+ results = await asyncio.gather(_call_ask_tool(ctx), _call_ask_tool(ctx))
+ refused = next(result for result in results if result["status"] == "already_asked")
+
+ assert sorted(result["status"] for result in results) == ["already_asked", "connected"]
+ assert "outcome" not in refused
+ assert [card.resume_token for card in _sent_cards(ctx)] == ["tok-1"]
+
+
+ ("answers", "settled_outcome"),
+ [
+ ([("signed_in", None)], "signed_in"),
+ ([("skip", None)], "skipped"),
+ ([("connected", "cred_1"), ("skip", None)], "skipped"),
+ ],
+ ids=["signed_in", "skipped", "connected_then_skipped"],
+)
+async def test_a_run_derived_ask_does_not_reopen_a_card_the_model_raised(
+ monkeypatch: pytest.MonkeyPatch, answers: list[_CardAnswer], settled_outcome: str
+) -> None:
+ cache = _FakeCache()
+ ctx = _tool_ctx(monkeypatch, cache)
+ _stub_credential_lookup(monkeypatch, _make_credential())
+ ctx.stream.send = AsyncMock(side_effect=_answer_each_card(cache, answers))
+ for _ in answers:
+ await _call_ask_tool(ctx)
+ ctx.last_run_skipped_unbound_credentials = True
+ ctx.request_policy.login_page_urls = ["https://portal.example.com/login"]
+ stream = _make_stream()
+
+ assert credential_pause_module.credential_pause_reason(ctx) == "workflow_credential_inputs_unbound"
+ assert await maybe_credential_pause(ctx, _fake_result(), stream, ctx.copilot_config) is None
+ stream.send.assert_not_awaited()
+ assert ctx.credential_pause_outcome == settled_outcome
+
+
+async def test_two_cards_answered_with_different_logins_both_become_durable_approvals(
monkeypatch: pytest.MonkeyPatch,
) -> None:
- ctx = _tool_ctx(monkeypatch, _answered_cache("skip"))
+ ctx, statuses = await _answer_two_cards_with_different_logins(monkeypatch)
+ carried = StructuredContext.from_json_str(record_approved_credentials_in_global_llm_context(ctx, None))
- first = await _ask(ctx)
- second = await _ask(ctx)
+ assert statuses == ["connected", "connected"]
+ assert {approval.credential_id: approval.admitted_url for approval in carried.approved_credentials} == {
+ "cred_a": "https://portal.example.com/login",
+ "cred_b": "https://portal.example.com/login",
+ }
- assert first["status"] == "skipped"
- assert ctx.credential_pause_outcome == "skipped"
- assert second["status"] == "already_asked"
- assert second["outcome"] == "skipped"
- assert len(_sent_cards(ctx)) == 1
+
[email protected]("server_bound_before_the_card", [False, True])
+async def test_an_earlier_card_pick_survives_a_later_card_while_fill_targets_the_later_one(
+ monkeypatch: pytest.MonkeyPatch, server_bound_before_the_card: bool
+) -> None:
+ ctx, _ = await _answer_two_cards_with_different_logins(monkeypatch, server_bound_a=server_bound_before_the_card)
+ ctx.request_policy.canonical_user_message = "use cred_missing"
+ ctx.block_authoring_policy = BlockAuthoringPolicy.CODE_ONLY_BROWSER
+
+ earlier_pick = await tools_module.credentials._resolve_exact_credential("cred_a", ctx)
+ missing = await tools_module.credentials._resolve_exact_credential("cred_missing", ctx)
+ grant, error = await tools_module.credential_fill._credential_fill_origin_grant(ctx, "cred_b")
+
+ assert earlier_pick["ok"] is True
+ assert missing["data"]["withdrawn_credential_ids"] == []
+ assert "cred_a" in {credential.credential_id for credential in ctx.request_policy.resolved_credentials}
+ assert ctx.request_policy.current_turn_named_credential_ids == {"cred_b"}
+ assert error is None and grant is not None
+
+
+async def _answer_two_cards_with_different_logins(
+ monkeypatch: pytest.MonkeyPatch, *, server_bound_a: bool = False
+) -> tuple[CopilotContext, list[str]]:
+ cache = _FakeCache()
+ ctx = _tool_ctx(monkeypatch, cache)
+ logins = [_make_credential("cred_a", "Login A"), _make_credential("cred_b", "Login B")]
+ if server_bound_a:
+ ctx.request_policy.resolved_credentials = [logins[0]]
+ ctx.request_policy.auto_bound_credentials = [logins[0]]
+ monkeypatch.setattr(tools_module.credentials, "load_credentials", AsyncMock(return_value=logins))
+ monkeypatch.setattr(
+ credential_pause_module.app,
+ "DATABASE",
+ SimpleNamespace(
+ credentials=SimpleNamespace(
+ get_credentials_by_ids=AsyncMock(
+ side_effect=lambda ids, **_: [login for login in logins if login.credential_id in ids]
+ ),
+ get_credential=AsyncMock(return_value=None),
+ )
+ ),
+ )
+ ctx.stream.send = AsyncMock(
+ side_effect=_answer_each_card(cache, [("connected", "cred_a"), ("connected", "cred_b")])
+ )
+
+ return ctx, [(await _call_ask_tool(ctx))["status"] for _ in logins]
+
+
+async def test_each_settled_card_keeps_its_own_turn_end_receipt(monkeypatch: pytest.MonkeyPatch) -> None:
+ cache = _FakeCache()
+ ctx = _tool_ctx(monkeypatch, cache)
+ _stub_credential_lookup(monkeypatch, _make_credential())
+ ctx.stream.send = AsyncMock(side_effect=_answer_each_card(cache, [("connected", "cred_1"), ("skip", None)]))
+ await _call_ask_tool(ctx)
+ await _call_ask_tool(ctx)
+
+ result = _make_agent_result(
+ ctx,
+ user_response="ok",
+ updated_workflow=None,
+ turn_outcome=TurnOutcome(response_kind=ResponseKind.BUILD),
+ narrative_payload=_backfill_payload(),
+ )
+
+ assert result.narrative_payload is not None
+ assert result.narrative_payload["credentialPause"] == {"outcome": "skipped"}
+ assert result.narrative_payload["credentialPauses"] == [
+ {"outcome": "connected", "credentialId": "cred_1"},
+ {"outcome": "skipped"},
+ ]
+
+
+async def test_a_second_card_cancelled_mid_wait_keeps_the_first_cards_turn_end_receipt(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ cache = _FakeCache()
+ ctx = _tool_ctx(monkeypatch, cache)
+ _stub_credential_lookup(monkeypatch, _make_credential())
+ answer_first = _answer_each_card(cache, [("connected", "cred_1")])
+ second_card_open = asyncio.Event()
+
+ async def send(
+ frame: WorkflowCopilotCredentialRequiredUpdate | WorkflowCopilotCredentialPauseResolvedUpdate,
+ ) -> bool:
+ if frame.type == WorkflowCopilotStreamMessageType.CREDENTIAL_REQUIRED and frame.resume_token == "tok-2":
+ second_card_open.set()
+ return True
+ return await answer_first(frame)
+
+ ctx.stream.send = AsyncMock(side_effect=send)
+ assert (await _call_ask_tool(ctx))["status"] == "connected"
+ second = asyncio.create_task(_call_ask_tool(ctx))
+ await asyncio.wait_for(second_card_open.wait(), 1)
+ second.cancel()
+ with pytest.raises(asyncio.CancelledError):
+ await second
+
+ result = _make_agent_result(
+ ctx,
+ user_response="ok",
+ updated_workflow=None,
+ turn_outcome=TurnOutcome(response_kind=ResponseKind.BUILD),
+ narrative_payload=_backfill_payload(),
+ )
+
+ assert result.narrative_payload is not None
+ assert result.narrative_payload["credentialPause"] == {"outcome": "connected", "credentialId": "cred_1"}
@pytest.mark.asyncio
@@ -2280,11 +2477,9 @@ def test_the_card_message_is_capped_and_stripped_before_the_user_sees_it() -> No
async def test_a_repeat_ask_in_a_later_response_releases_the_gate_it_armed(
monkeypatch: pytest.MonkeyPatch,
) -> None:
- """already_asked means a card was raised somewhere this turn, not that one is open now. A later
- response arms a fresh gate, so refusing to release on that exit parks every sibling on an Event
- no one owns until the turn times out."""
- ctx = _tool_ctx(monkeypatch)
- ctx.credential_pause_used = True
+ """A later response arms a fresh gate, so an ask that settles without releasing it parks every
+ sibling on an Event no one owns until the turn times out."""
+ ctx = _tool_ctx(monkeypatch, _answered_cache("skip"))
await _announce_ask(ctx)
await _invoke_ask_tool(ctx, "https://portal.example.com/login")
@@ -2337,7 +2532,13 @@ async def test_a_raw_secret_turn_opens_no_authenticator_card(monkeypatch: pytest
assert ctx.credential_totp_update_asked is False
-_CardAnswer = tuple[Literal["connected", "skip"], str | None]
+_CardAnswer = tuple[Literal["connected", "skip", "signed_in", "unanswered", "start_sign_in"], str | None]
+_SIGNED_IN_PORTAL = credential_pause_module.SignedInProfile(
+ browser_profile_id="bp_signed_in",
+ profile_name="Sign-in for portal.example.com",
+ site="portal.example.com",
+ cookie_count=2,
+)
def _answer_each_card(
@@ -2354,6 +2555,23 @@ def _answer_each_card(
if card.type != WorkflowCopilotStreamMessageType.CREDENTIAL_REQUIRED:
return True
action, credential_id = pending.pop(0)
+ if action == "unanswered":
+ return True
+ if action == "start_sign_in":
+ await credential_pause_module.start_manual_sign_in(
+ cache,
+ organization_id="org-1",
+ workflow_copilot_chat_id="chat-1",
+ turn_id=card.turn_id,
+ resume_token=card.resume_token,
+ )
+ return True
+ if action == "signed_in":
+ # The Done route saves the profile and writes this response; saving a profile is not under test here.
+ cache.store[credential_response_cache_key("org-1", "chat-1", card.turn_id)] = encode_credential_response(
+ action, None, card.resume_token, signed_in=_SIGNED_IN_PORTAL
+ )
+ return True
await resolve_credential_pause(
cache,
organization_id="org-1",
@@ -2480,7 +2698,6 @@ async def test_the_update_card_after_a_pick_waits_for_its_own_answer(monkeypatch
assert "outcome" not in repeat
assert [card.reason for card in _sent_cards(ctx)] == ["login_credentials_unresolved", "credential_missing_totp"]
assert (ctx.credential_pause_outcome, ctx.credential_pause_connected_credential_id) == ("connected", "cred_1")
- assert ctx.credential_pause_reaskable_by_run is False
assert ctx.last_test_ok is False
@@ -2737,27 +2954,178 @@ def _assert_declined(ctx: CopilotContext, result: dict[str, Any], status: str) -
@pytest.mark.asyncio
-async def test_origin_recovery_gets_one_card_after_an_earlier_card_and_clears_on_a_same_origin_connect(
[email protected]("connect_first", [True, False], ids=["after_a_connect", "while_pending"])
+ "later_ask_url",
+ ["https://idp.provider.com/login", "https://login.provider.com/login"],
+ ids=["same_origin", "same_site"],
+)
+async def test_a_pick_ask_on_a_recovery_site_keeps_its_admission_check_before_and_after_a_connect(
+ monkeypatch: pytest.MonkeyPatch, later_ask_url: str, connect_first: bool
+) -> None:
+ # A registrable domain, unlike .test, so a sibling host shares the recovery's site.
+ provider = "https://idp.provider.com"
+ cache = _FakeCache()
+ ctx = _recovery_ctx(monkeypatch, cache)
+ ctx.credential_origin_recovery = CredentialOriginRecovery(provider, "pending", refused_credential_id="cred_service")
+ refused = _make_credential("cred_service").model_copy(update={"tested_url": "https://portal.example.com/login"})
+ provider_login = _make_credential("cred_idp", "Provider Login").model_copy(
+ update={"tested_url": f"{provider}/login"}
+ )
+ logins = [provider_login, refused]
+ monkeypatch.setattr(
+ credential_pause_module.app,
+ "DATABASE",
+ SimpleNamespace(
+ credentials=SimpleNamespace(
+ get_credentials_by_ids=AsyncMock(
+ side_effect=lambda ids, **_: [login for login in logins if login.credential_id in ids]
+ ),
+ get_credential=AsyncMock(return_value=None),
+ )
+ ),
+ )
+ answers: list[_CardAnswer] = [("connected", "cred_idp")] if connect_first else []
+ ctx.stream.send = AsyncMock(side_effect=_answer_each_card(cache, [*answers, ("connected", "cred_service")]))
+
+ if connect_first:
+ result = await _ask(ctx, f"{provider}/login?state=opaque-state#fragment")
+
+ assert result["status"] == "connected"
+ assert result["credential_id"] == "cred_idp"
+ [card] = _sent_cards(ctx)
+ assert card.login_page_urls == [f"{provider}/login"]
+ assert ctx.request_policy.live_page_admitted_urls["cred_idp"] == f"{provider}/login"
+ assert ctx.credential_origin_recovery is None
+ assert ctx.blocker_signal is None
+
+ again = await _ask(ctx, later_ask_url)
+
+ assert again["status"] == "connected_other_site"
+ assert [resolved.outcome for resolved in _sent_resolutions(ctx)][-1] == "not_admitted"
+ assert "cred_service" not in ctx.request_policy.live_page_admitted_urls
+
+
+ ("steps", "later_origin", "picked"),
+ [
+ (
+ [
+ ("refuse", "https://a.provider.com", "cred_a"),
+ ("card", "https://a.provider.com", "cred_b"),
+ ("refuse", "https://b.provider.com", "cred_d"),
+ ("card", "https://b.provider.com", "cred_e"),
+ ],
+ "https://b.provider.com",
+ "cred_d",
+ ),
+ (
+ [
+ ("refuse", "https://a.provider.com", "cred_a"),
+ ("card", "https://a.provider.com", "cred_b"),
+ ("refuse", "https://a.provider.com", "cred_d"),
+ ("card", "https://a.provider.com", "cred_b"),
+ ],
+ "https://a.provider.com",
+ "cred_a",
+ ),
+ (
+ [
+ ("refuse", "https://a.provider.com", "cred_a"),
+ ("card", "https://a.provider.com", "cred_b"),
+ ("refuse", "https://b.provider.com", "cred_d"),
+ ],
+ "https://a.provider.com",
+ "cred_a",
+ ),
+ (
+ [
+ ("refuse", "https://idp.other.com", "cred_x"),
+ ("refuse", "https://b.provider.com", "cred_d"),
+ ("card", "https://idp.other.com", "cred_o"),
+ ],
+ "https://b.provider.com",
+ "cred_d",
+ ),
+ ],
+ ids=["sibling_origins", "same_origin_twice", "sibling_still_pending", "refused_while_another_site_pending"],
+)
+async def test_a_later_card_on_a_recovery_site_never_admits_a_login_refused_anywhere_on_it(
monkeypatch: pytest.MonkeyPatch,
+ steps: list[tuple[Literal["refuse", "card"], str, str]],
+ later_origin: str,
+ picked: str,
) -> None:
- ctx = _recovery_ctx(monkeypatch, _answered_cache("connected", "cred_idp"))
- _stub_credential_lookup(monkeypatch, _idp_credential())
+ cache = _FakeCache()
+ ctx = _tool_ctx(monkeypatch, cache)
+ # The refused logins are saved on the provider's own site, so only the refusal can keep them off it.
+ logins = {
+ "cred_a": _make_credential("cred_a").model_copy(update={"tested_url": "https://login.provider.com/a"}),
+ "cred_d": _make_credential("cred_d").model_copy(update={"tested_url": "https://login.provider.com/d"}),
+ "cred_b": _make_credential("cred_b").model_copy(update={"tested_url": "https://a.provider.com/login"}),
+ "cred_e": _make_credential("cred_e").model_copy(update={"tested_url": "https://b.provider.com/login"}),
+ "cred_o": _make_credential("cred_o").model_copy(update={"tested_url": "https://idp.other.com/login"}),
+ }
+ monkeypatch.setattr(
+ credential_pause_module.app,
+ "DATABASE",
+ SimpleNamespace(
+ credentials=SimpleNamespace(
+ get_credentials_by_ids=AsyncMock(side_effect=lambda ids, **_: [logins[i] for i in ids if i in logins]),
+ get_credential=AsyncMock(return_value=None),
+ )
+ ),
+ )
+ answers: list[_CardAnswer] = [("connected", login) for step, _, login in steps if step == "card"]
+ ctx.stream.send = AsyncMock(side_effect=_answer_each_card(cache, [*answers, ("connected", picked)]))
+ for step, origin, login in steps:
+ if step == "refuse":
+ credential_fill_module._start_credential_origin_recovery(ctx, origin, login)
+ else:
+ assert (await _ask(ctx, f"{origin}/login"))["credential_id"] == login
- result = await _ask(ctx, f"{_IDP_ORIGIN}/login?state=opaque-state#fragment")
+ later = await _ask(ctx, f"{later_origin}/login")
- assert result["status"] == "connected"
- assert result["credential_id"] == "cred_idp"
- [card] = _sent_cards(ctx)
- assert card.login_page_urls == [f"{_IDP_ORIGIN}/login"]
- assert ctx.request_policy.live_page_admitted_urls["cred_idp"] == f"{_IDP_ORIGIN}/login"
- assert ctx.credential_origin_recovery is None
- assert ctx.blocker_signal is None
+ assert later["status"] == "connected_other_site"
+ assert picked not in ctx.request_policy.live_page_admitted_urls
- ctx.credential_origin_recovery = _PENDING
+
+async def test_a_card_for_another_site_after_a_declined_recovery_still_offers_signing_in(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ cache = _FakeCache()
+ ctx = _recovery_ctx(monkeypatch, cache)
+ ctx.browser_session_id = "pbs_debug"
+ _stub_credential_lookup(monkeypatch, _make_credential())
+ ctx.stream.send = AsyncMock(side_effect=_answer_each_card(cache, [("skip", None), ("skip", None)]))
+
+ _assert_declined(ctx, await _ask(ctx, f"{_IDP_ORIGIN}/login"), "skipped")
+ await _ask(ctx, "https://portal.example.com/login")
+
+ recovery_card, other_site_card = _sent_cards(ctx)
+ assert recovery_card.sign_in_browser_session_id is None
+ assert other_site_card.sign_in_browser_session_id == "pbs_debug"
+
+
+async def test_a_retry_after_a_declined_origin_recovery_opens_a_card_that_keeps_its_admission_check(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ cache = _FakeCache()
+ ctx = _recovery_ctx(monkeypatch, cache)
+ _stub_credential_lookup(monkeypatch, _idp_credential())
+ ctx.stream.send = AsyncMock(side_effect=_answer_each_card(cache, [("skip", None), ("connected", "cred_idp")]))
+
+ _assert_declined(ctx, await _ask(ctx, f"{_IDP_ORIGIN}/login"), "skipped")
again = await _ask(ctx, f"{_IDP_ORIGIN}/login")
- assert len(_sent_cards(ctx)) == 1
- _assert_declined(ctx, again, "already_asked")
+ assert again["status"] == "connected"
+ assert [card.credential_refs for card in _sent_cards(ctx)] == [[], []]
+ assert ctx.request_policy.live_page_admitted_urls == {"cred_idp": f"{_IDP_ORIGIN}/login"}
+ assert ctx.credential_origin_recovery is None
+ assert ctx.blocker_signal is None
@pytest.mark.asyncio
@@ -2926,7 +3294,7 @@ async def test_origin_recovery_raises_no_second_card_while_one_is_in_flight(monk
assert result["status"] == "already_asked"
ctx.stream.send.assert_not_awaited()
assert ctx.credential_origin_recovery == _PENDING
- assert _IDP_ORIGIN not in ctx.credential_origin_recovery_carded
+ assert ctx.credential_origin_refusals == set()
@pytest.mark.asyncio
@@ -2945,7 +3313,7 @@ async def test_an_authenticator_update_ask_neither_spends_nor_resolves_origin_re
assert len(_sent_cards(ctx)) == 1
assert ctx.credential_origin_recovery == _PENDING
- assert _IDP_ORIGIN not in ctx.credential_origin_recovery_carded
+ assert ctx.credential_origin_refusals == set()
@pytest.mark.asyncio
@@ -2969,7 +3337,7 @@ async def test_a_run_derived_pause_does_not_reopen_the_card_during_origin_recove
) -> None:
ctx = _recovery_ctx(monkeypatch, _answered_cache("connected", "cred_1"))
ctx.credential_origin_recovery = replace(_PENDING, state=state)
- ctx.credential_pause_reaskable_by_run = True
+ ctx.credential_pause_used = False
ctx.last_run_skipped_unbound_credentials = True
ctx.request_policy.login_page_urls = [f"{_IDP_ORIGIN}/login"]
_stub_credential_lookup(monkeypatch, _make_credential())
@@ -3434,7 +3802,7 @@ async def test_registration_ask_on_an_origin_recovery_handback_after_a_generate_
@pytest.mark.asyncio
[email protected]("reask", ["origin_recovery_handback", "run_budget_reset"])
[email protected]("reask", ["origin_recovery", "plain_card"])
@pytest.mark.parametrize("outcome", ["unknown", "rejected"])
async def test_registration_reask_after_an_unconfirmed_generate_never_creates_a_second_credential(
monkeypatch: pytest.MonkeyPatch, outcome: str, reask: str
@@ -3468,13 +3836,10 @@ async def test_registration_reask_after_an_unconfirmed_generate_never_creates_a_
ctx.stream.send.side_effect = generate_then_skip
first = await _call_ask_tool(ctx, registration=_REGISTRATION)
assert (first["status"], generated) == ("skipped", [outcome])
- assert ctx.credential_pause_reaskable_by_run is True
login_page_url = "https://portal.example.com/login"
- if reask == "origin_recovery_handback":
+ if reask == "origin_recovery":
ctx.credential_origin_recovery = _PENDING
login_page_url = f"{_IDP_ORIGIN}/login"
- else:
- ctx.credential_pause_used = False
second = await _call_ask_tool(ctx, login_page_url=login_page_url, registration=_REGISTRATION)
diff --git a/tests/unit/test_copilot_credential_pause_reload.py b/tests/unit/test_copilot_credential_pause_reload.py
index b2e428790..8957a7b4f 100644
--- a/tests/unit/test_copilot_credential_pause_reload.py
+++ b/tests/unit/test_copilot_credential_pause_reload.py
@@ -327,7 +327,6 @@ async def test_signing_in_survives_a_reload_and_done_resumes_the_same_call_with_
assert result["credential_provided"] is False
assert "next" not in result
assert ctx.credential_pause_outcome == "signed_in"
- assert ctx.credential_pause_reaskable_by_run is False
assert ctx.request_policy.credential_pause_signed_in_profile_id == "bp_signed_in"
assert ctx.request_policy.credential_pause_signed_in_site == "portal.example.com"
assert ctx.request_policy.credential_draft_deferred_explicitly is False
@@ -371,6 +370,60 @@ async def test_done_without_card_recovery_still_resumes_and_a_skip_after_no_sign
assert ctx.request_policy.credential_pause_signed_in_profile_id is None
+async def test_a_card_after_a_settled_sign_in_restores_alone_and_only_its_own_token_answers_it(
+ sqlite_engine, monkeypatch
+):
+ _, client, ctx, _ = await setup_question_chat(sqlite_engine, monkeypatch)
+ monkeypatch.setattr(app, "CACHE", _FakeCache())
+ monkeypatch.setattr(pauses, "CREDENTIAL_RESPONSE_POLL_SECONDS", 0.01)
+ monkeypatch.setattr(
+ routes, "create_profile_from_running_session", AsyncMock(return_value=(_signed_in_profile(), 2))
+ )
+ emitted = _sign_in_card_context(ctx, recovery=True)
+ client._transport.app.add_api_route(
+ "/credential-response", routes.workflow_copilot_credential_response, methods=["POST"]
+ )
+ headers = {"X-Copilot-Credential-Recovery-Token": "a" * 64}
+ params = {"workflow_copilot_chat_id": ctx.workflow_copilot_chat_id}
+ cards = []
+ results = []
+ async with client:
+ for card_number in (1, 2):
+ emitted.clear()
+ invocation = asyncio.create_task(_request_credential("https://portal.example.com/login", "Login", ctx))
+ try:
+ await asyncio.wait_for(emitted.wait(), 1)
+ card = ctx.stream.send.await_args.args[0]
+ cards.append(card)
+ body = {
+ "workflow_copilot_chat_id": card.workflow_copilot_chat_id,
+ "turn_id": card.turn_id,
+ "resume_token": card.resume_token,
+ }
+ if card_number == 2:
+ reloaded = (await client.get("/history", params=params, headers=headers)).json()
+ pending = [request["resume_token"] for request in reloaded["pending_credential_requests"]]
+ assert pending == [card.resume_token]
+ stale = await client.post(
+ "/credential-response",
+ json={**body, "resume_token": cards[0].resume_token, "action": "skip"},
+ )
+ assert stale.status_code == 403
+ assert not invocation.done()
+ done = await client.post("/credential-response", json={**body, "action": "signed_in"})
+ assert done.json()["result"] == "signed_in"
+ results.append(await asyncio.wait_for(invocation, 1))
+ finally:
+ if not invocation.done():
+ invocation.cancel()
+ await asyncio.gather(invocation, return_exceptions=True)
+
+ assert cards[0].resume_token != cards[1].resume_token
+ assert [result["status"] for result in results] == ["signed_in", "signed_in"]
+ assert ctx.credential_pause_outcome == "signed_in"
+
+
@pytest.mark.asyncio
async def test_a_done_whose_pause_ended_while_saving_discards_the_profile(sqlite_engine, monkeypatch):
_, client, ctx, _ = await setup_question_chat(sqlite_engine, monkeypatch)
diff --git a/tests/unit/test_copilot_fill_credential_field.py b/tests/unit/test_copilot_fill_credential_field.py
index b85c539d7..8ef6f66ab 100644
--- a/tests/unit/test_copilot_fill_credential_field.py
+++ b/tests/unit/test_copilot_fill_credential_field.py
@@ -130,6 +130,7 @@ def _ctx(**overrides: Any) -> SimpleNamespace:
signed_out_page_observations=[],
signed_out_page_observation_attempts=[],
credential_origin_recovery=None,
+ credential_origin_refusals=set(),
blocker_signal=None,
codeblock_redaction_parameters={},
supports_vision=False,
diff --git a/tests/unit/test_copilot_google_connection_notice.py b/tests/unit/test_copilot_google_connection_notice.py
index d259635f7..7b1b184ae 100644
--- a/tests/unit/test_copilot_google_connection_notice.py
+++ b/tests/unit/test_copilot_google_connection_notice.py
@@ -97,12 +97,16 @@ def test_reports_missing_and_unusable_new_bindings_but_not_active_or_preexisting
"connectionId": "goac_missing",
"displayName": None,
"condition": "missing",
+ "scopeProfile": "google_sheets",
+ "origin": "workflow",
},
{
"provider": "google",
"connectionId": "goac_error",
"displayName": "Needs reconnect",
"condition": "unusable",
+ "scopeProfile": "google_sheets",
+ "origin": "workflow",
},
]
@@ -209,28 +213,32 @@ def test_repeated_update_can_clear_notice_and_lookup_failure_only_retains_still_
assert removed == []
-def test_active_connection_without_sheets_scope_is_unusable() -> None:
+ ("other_state", "other_scopes"),
+ [
+ ("active", ["https://www.googleapis.com/auth/gmail.readonly"]),
+ ("error", ["https://www.googleapis.com/auth/gmail.readonly"]),
+ ("error", ["https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/drive"]),
+ ],
+ ids=["active-gmail", "expired-gmail", "expired-sheets-and-drive"],
+)
+def test_sheets_block_bound_to_a_connection_holding_another_profile_offers_a_sheets_choice_instead_of_a_reconnect(
+ other_state: str, other_scopes: list[str]
+) -> None:
notices = collect_google_connection_notices(
turn_start_bindings=(),
- current_bindings=(("write", "goac_gmail"),),
+ current_bindings=(("write", "goac_gmail"), ("other", "goac_sheets_error")),
visible_credentials=[
- _credential(
- "goac_gmail",
- "active",
- "Mail only",
- scopes_granted=["https://www.googleapis.com/auth/gmail.readonly"],
- )
+ _credential("goac_gmail", other_state, "Other profile", scopes_granted=other_scopes),
+ _credential("goac_sheets_error", "error", "Sheets expired"),
+ _credential("goac_sheets", "active"),
],
)
- assert [notice.to_payload() for notice in notices] == [
- {
- "provider": "google",
- "connectionId": "goac_gmail",
- "displayName": "Mail only",
- "condition": "unusable",
- }
- ]
+ assert [
+ (notice.connectionId, notice.condition, [choice.connection_id for choice in notice.choices])
+ for notice in notices
+ ] == [(None, "unbound", ["goac_sheets"]), ("goac_sheets_error", "unusable", [])]
def _capture(tmp_path: Path, turn_id: str, *blocks: object, credentials: list[GoogleOAuthCredentialBase]) -> None:
diff --git a/tests/unit/test_copilot_locator_inspection.py b/tests/unit/test_copilot_locator_inspection.py
index 30df83d34..fd188c2e0 100644
--- a/tests/unit/test_copilot_locator_inspection.py
+++ b/tests/unit/test_copilot_locator_inspection.py
@@ -10,6 +10,7 @@ from __future__ import annotations
import asyncio
import html
import json
+from collections.abc import Awaitable, Callable
from datetime import UTC, datetime
from functools import partial
from types import SimpleNamespace
@@ -19,6 +20,7 @@ from urllib.parse import quote
import pytest
from playwright.async_api import Error as PlaywrightError
+from playwright.async_api import Locator, Page, async_playwright
from skyvern.forge.sdk.copilot.browser_target import resolve_browser_session_binding
from skyvern.forge.sdk.copilot.context import CopilotContext
@@ -45,7 +47,7 @@ from skyvern.forge.sdk.schemas.workflow_runs import WorkflowRunBlock
from skyvern.forge.sdk.workflow.models.block import CodeBlock
from skyvern.forge.sdk.workflow.models.parameter import OutputParameter
from skyvern.schemas.workflows import BlockType
-from tests.unit.copilot_test_helpers import make_copilot_ctx
+from tests.unit.copilot_test_helpers import make_copilot_ctx, skip_no_browser
STAR_BUTTON = 'button.pill:has-text("Star")'
STAR_VALUE = 'button.pill:has-text("Star") span.n'
@@ -70,9 +72,18 @@ class _FakeMatch:
def __init__(self, facts: dict[str, Any]) -> None:
self._facts = facts
+ async def element_handle(self) -> _FakeMatch:
+ return self
+
+ async def is_visible(self) -> bool:
+ return True
+
async def evaluate(self, _expression: str) -> dict[str, Any]:
return dict(self._facts)
+ async def dispose(self) -> None:
+ return None
+
class _FakePage:
"""Stands in for a Playwright page: the tool only ever counts and evaluates against it."""
@@ -204,6 +215,116 @@ async def test_the_same_call_twice_returns_byte_identical_output() -> None:
assert json.dumps(first, sort_keys=True) == json.dumps(second, sort_keys=True)
+@skip_no_browser
+async def test_each_match_reports_whether_playwright_considers_it_visible() -> None:
+ # A `.first` locator resolves to the hidden responsive copy here; its text and markup match the
+ # visible one, so only the visibility fact separates them.
+ stat = '<span class="stat"><strong>23.2k</strong> stars</span>'
+ body = f'<div style="display:none">{stat}</div><div style="visibility:hidden">{stat}</div>{stat}'
+
+ async with async_playwright() as playwright:
+ browser = await playwright.chromium.launch(headless=True)
+ try:
+ page = await browser.new_page()
+ await page.set_content(f"<html><body>{body}</body></html>")
+ result = await inspect_locator_matches(page, ["span.stat"])
+ finally:
+ await browser.close()
+
+ entry = result["selectors"][0]
+ assert entry["match_count"] == 3
+ assert [match["visible"] for match in entry["matches"]] == [False, False, True]
+ assert {match["text_content"] for match in entry["matches"]} == {"23.2k stars"}
+
+
+class _SwapDuringRead:
+ """A real page that navigates to `next_url` once: before a match is found, after it is found, or after the
+ first read made on the found element."""
+
+ def __init__(self, page: Page, next_url: str, swap_at: str) -> None:
+ self._page = page
+ self._next_url = next_url
+ self._swap_at = swap_at
+ self._swapped = False
+
+ async def _read(self, read: Callable[[], Awaitable[object]], before: bool, after: bool) -> object:
+ swap = not self._swapped and (before or after)
+ if swap:
+ self._swapped = True
+ if swap and before:
+ await self._page.goto(self._next_url)
+ result = await read()
+ if swap and after:
+ await self._page.goto(self._next_url)
+ return result
+
+ def locator(self, selector: str) -> SimpleNamespace:
+ real = self._page.locator(selector)
+ return SimpleNamespace(count=real.count, nth=lambda index: self._match(real.nth(index)))
+
+ def _match(self, real: Locator) -> SimpleNamespace:
+ on_resolve = {"before": self._swap_at == "before_resolve", "after": self._swap_at == "after_resolve"}
+
+ async def element_handle() -> SimpleNamespace:
+ return self._handle(await self._read(real.element_handle, **on_resolve))
+
+ return SimpleNamespace(
+ element_handle=element_handle,
+ is_visible=lambda: self._read(real.is_visible, **on_resolve),
+ evaluate=lambda expression: self._read(lambda: real.evaluate(expression), **on_resolve),
+ )
+
+ def _handle(self, real: Any) -> SimpleNamespace: # noqa: ANN401 - an ElementHandle or whatever resolve returned
+ after = self._swap_at == "between_handle_reads"
+ return SimpleNamespace(
+ is_visible=lambda: self._read(real.is_visible, before=False, after=after),
+ evaluate=lambda expression: self._read(lambda: real.evaluate(expression), before=False, after=after),
+ dispose=real.dispose,
+ )
+
+
+@skip_no_browser
+ ("swap_at", "first_page"),
+ [
+ ("after_resolve", '<div style="display:none"><span class="stat">A stars</span></div>'),
+ ("before_resolve", '<div style="display:none"><span class="stat">A stars</span></div>'),
+ ("between_handle_reads", '<span class="stat">A stars</span>'),
+ ],
+)
+async def test_a_page_swap_never_pairs_one_pages_visibility_with_anothers_facts(swap_at: str, first_page: str) -> None:
+ # Visibility and DOM facts must describe the same element on the same page, or the read must fail. The
+ # last case starts on a visible copy, so a DOM read made before the visibility read would sit beside a
+ # stale False.
+ bodies = {"https://example.test/a": first_page, "https://example.test/b": '<span class="stat">B stars</span>'}
+
+ async with async_playwright() as playwright:
+ browser = await playwright.chromium.launch(headless=True)
+ try:
+ page = await browser.new_page()
+ await page.route(
+ "**/*",
+ lambda route: route.fulfill(
+ status=200,
+ content_type="text/html",
+ body=f"<html><body>{bodies.get(route.request.url, '')}</body></html>",
+ ),
+ )
+ await page.goto("https://example.test/a")
+ swapping = _SwapDuringRead(page, "https://example.test/b", swap_at)
+ result = await inspect_locator_matches(swapping, ["span.stat"]) # type: ignore[arg-type]
+ finally:
+ await browser.close()
+
+ match = result["selectors"][0]["matches"][0]
+ if swap_at == "before_resolve":
+ assert (match["visible"], match["text_content"]) == (True, "B stars")
+ else:
+ assert "visible" not in match and "error" in match
+
+
def test_the_advertised_contract_is_the_tested_contract() -> None:
# Step 5 measured this description and this schema. Shipping a paraphrase, or a schema that
# drops the parameter descriptions, would ship a different tool than the one that was measured.
diff --git a/tests/unit/test_copilot_make_agent_result_backfill.py b/tests/unit/test_copilot_make_agent_result_backfill.py
index 1859b8c40..1b273e07c 100644
--- a/tests/unit/test_copilot_make_agent_result_backfill.py
+++ b/tests/unit/test_copilot_make_agent_result_backfill.py
@@ -85,8 +85,11 @@ def test_backfill_tolerates_turn_outcome_none() -> None:
assert "responseKind" not in result.narrative_payload
-def test_backfill_adds_google_connection_notices_to_terminal_payload() -> None:
+def test_backfill_adds_setup_and_binding_google_connection_notices_to_terminal_payload() -> None:
ctx = _ctx()
+ ctx.google_setup_notices = [
+ GoogleConnectionNotice(connectionId=None, condition="unbound", scopeProfile="gmail", origin="setup")
+ ]
ctx.google_connection_notices = [
GoogleConnectionNotice(
connectionId="goac_needs_reconnect",
@@ -99,12 +102,23 @@ def test_backfill_adds_google_connection_notices_to_terminal_payload() -> None:
assert result.narrative_payload is not None
assert result.narrative_payload["googleConnectionNotices"] == [
+ {
+ "provider": "google",
+ "connectionId": None,
+ "displayName": None,
+ "condition": "unbound",
+ "scopeProfile": "gmail",
+ "origin": "setup",
+ "choices": [],
+ },
{
"provider": "google",
"connectionId": "goac_needs_reconnect",
"displayName": "Sheets account",
"condition": "unusable",
- }
+ "scopeProfile": "google_sheets",
+ "origin": "workflow",
+ },
]
diff --git a/tests/unit/test_copilot_raw_secret_safety.py b/tests/unit/test_copilot_raw_secret_safety.py
index 79a30e9a9..8619062cf 100644
--- a/tests/unit/test_copilot_raw_secret_safety.py
+++ b/tests/unit/test_copilot_raw_secret_safety.py
@@ -341,6 +341,49 @@ async def test_multiple_semantic_secret_citations_are_each_redacted() -> None:
assert policy.raw_secret_safety_citation_count == 2
+async def test_every_copy_of_a_cited_secret_is_redacted_including_curly_quoted_and_colon_prefixed() -> None:
+ secret = "Zq8!vL3#pR2w"
+ policy, _ = await _build(
+ f"Use backup code {secret} first.\nIf asked again, type “{secret}” or enter PIN:{secret} and press Enter.",
+ {"version": "1", "state": "detected", "citations": [secret]},
+ )
+
+ assert secret not in policy.canonical_user_message
+ assert policy.canonical_user_message.count("[REDACTED_SECRET]") == 3
+
+
+ ("secret", "citation"),
+ [("Hunter2:Portal!", "Portal!"), ("Hunter2‘Portal!", "Portal!"), ("Hunter2’Portal!", "Hunter2")],
+ ids=["after-colon", "after-curly-quote", "before-curly-quote"],
+)
+async def test_citing_part_of_a_secret_split_by_a_colon_or_curly_quote_fails_closed(secret: str, citation: str) -> None:
+ policy, _ = await _build(
+ f"My portal login is {secret}",
+ {"version": "1", "state": "detected", "citations": [citation]},
+ )
+
+ assert policy.raw_secret_safety_status == "blocked"
+ assert policy.raw_secret_safety_failure_kind == "invalid_citation"
+ assert "Hunter2" not in policy.canonical_user_message
+ assert "Portal" not in policy.canonical_user_message
+
+
+async def test_a_cited_value_that_also_ends_a_longer_secret_leaves_no_part_of_it() -> None:
+ policy, _ = await _build(
+ "Use Portal! at the kiosk. The admin login is Hunter2:Portal! and the backup is “Portal!”.",
+ {"version": "1", "state": "detected", "citations": ["Portal!"]},
+ )
+
+ assert policy.raw_secret_safety_status == "detected"
+ assert "Portal!" not in policy.canonical_user_message
+ assert "Hunter2" not in policy.canonical_user_message
+ assert "Use [REDACTED_SECRET] at the kiosk." in policy.canonical_user_message
+
+
@pytest.mark.asyncio
async def test_citation_containing_another_citation_leaves_no_tail() -> None:
outer = "Hunter2Portal-8391"
diff --git a/tests/unit/test_copilot_request_policy_workflow_credentials.py b/tests/unit/test_copilot_request_policy_workflow_credentials.py
index 92f81fbb8..4f5db3737 100644
--- a/tests/unit/test_copilot_request_policy_workflow_credentials.py
+++ b/tests/unit/test_copilot_request_policy_workflow_credentials.py
@@ -1,3 +1,4 @@
+import json
from collections.abc import Callable
from datetime import datetime, timezone
from types import SimpleNamespace
@@ -9,6 +10,7 @@ from structlog.testing import capture_logs
from skyvern.forge import app
from skyvern.forge.sdk.copilot import agent as agent_module
from skyvern.forge.sdk.copilot import credential_pause as credential_pause_module
+from skyvern.forge.sdk.copilot import request_policy as request_policy_module
from skyvern.forge.sdk.copilot.context import (
_MAX_PROPOSAL_CARRIES,
ApprovedCredential,
@@ -40,7 +42,9 @@ from skyvern.forge.sdk.copilot.tools.credentials import (
_serialize_credential,
_typed_resume_arm,
)
+from skyvern.forge.sdk.copilot.turn_outcome import connected_account_choice_context
from skyvern.forge.sdk.schemas.credentials import Credential, CredentialType, CredentialVaultType, TotpType
+from skyvern.forge.sdk.schemas.google_oauth import GoogleOAuthCredentialBase
from tests.unit.copilot_test_helpers import make_copilot_ctx
@@ -1057,13 +1061,11 @@ async def test_the_hydrated_proposal_is_not_promoted_to_durable_approval(
policy = RequestPolicy()
await _seed_proposed_credential(policy, organization_id="org-1", global_llm_context=seeded or "")
- page_vouched = SimpleNamespace(request_policy=policy, credential_pause_connected_credential_id=None)
- card_picked = SimpleNamespace(
- request_policy=policy, credential_pause_connected_credential_id=credential.credential_id
- )
+ ctx = SimpleNamespace(request_policy=policy)
- after_page_vouch = record_approved_credentials_in_global_llm_context(page_vouched, seeded)
- after_card_pick = record_approved_credentials_in_global_llm_context(card_picked, seeded)
+ after_page_vouch = record_approved_credentials_in_global_llm_context(ctx, seeded)
+ policy.credential_pause_connected_credential_ids = {credential.credential_id}
+ after_card_pick = record_approved_credentials_in_global_llm_context(ctx, seeded)
assert StructuredContext.from_json_str(after_page_vouch).approved_credentials == []
assert [
@@ -1419,3 +1421,79 @@ async def test_the_settled_profile_pick_comes_from_the_saved_row_not_the_submitt
)
assert policy.persisted_workflow_browser_profile_id == "bp_saved"
+
+
+_SHEETS_SCOPE = "https://www.googleapis.com/auth/spreadsheets"
+_GMAIL_READ_SCOPE = "https://www.googleapis.com/auth/gmail.readonly"
+_GMAIL_SEND_SCOPE = "https://www.googleapis.com/auth/gmail.send"
+
+
+def _google_row(organization_id: str, state: str, scopes: list[str]) -> GoogleOAuthCredentialBase:
+ now = datetime.now(timezone.utc)
+ return GoogleOAuthCredentialBase(
+ id="goac_picked",
+ organization_id=organization_id,
+ credential_name="Picked",
+ state=state,
+ scopes_requested=scopes,
+ scopes_granted=scopes,
+ created_at=now,
+ modified_at=now,
+ )
+
+
+ ("rows", "selected_scopes"),
+ [
+ ([_google_row("org-1", "active", [_GMAIL_READ_SCOPE])], [_GMAIL_READ_SCOPE]),
+ (
+ [_google_row("org-1", "active", [_GMAIL_READ_SCOPE, _GMAIL_SEND_SCOPE])],
+ [_GMAIL_READ_SCOPE, _GMAIL_SEND_SCOPE],
+ ),
+ ([_google_row("org-1", "active", [_SHEETS_SCOPE])], [_SHEETS_SCOPE]),
+ ([_google_row("org-other", "active", [_GMAIL_READ_SCOPE])], None),
+ ([_google_row("org-1", "error", [_GMAIL_READ_SCOPE])], None),
+ ([_google_row("org-1", "active", [_GMAIL_SEND_SCOPE])], None),
+ ([], None),
+ ],
+ ids=["gmail-read", "gmail-read-send", "sheets", "other-org", "inactive", "send-only", "deleted"],
+)
+async def test_picked_google_account_is_reported_when_valid_and_only_a_sheets_pick_gains_run_authority(
+ monkeypatch: pytest.MonkeyPatch,
+ rows: list[GoogleOAuthCredentialBase],
+ selected_scopes: list[str] | None,
+) -> None:
+ monkeypatch.setattr(
+ request_policy_module.google_oauth_service, "get_credentials_for_org", AsyncMock(return_value=rows)
+ )
+
+ policy = await _build_request_policy_bootstrap(
+ user_message="goac_picked",
+ workflow_yaml="workflow_definition:\n blocks: []\n",
+ chat_history=[],
+ global_llm_context="",
+ organization_id="org-1",
+ selected_connected_account_id="goac_picked",
+ )
+ facts = connected_account_choice_context(
+ None,
+ explicit_selected_connection_id=policy.picked_connected_account_id,
+ explicit_selected_connection_scopes=policy.picked_connected_account_scopes,
+ )
+
+ if selected_scopes is None:
+ assert policy.picked_connected_account_id is None
+ assert policy.selected_connected_account_id is None
+ assert "goac_picked" not in policy.run_approved_google_connection_ids
+ assert facts == ""
+ else:
+ assert policy.picked_connected_account_id == "goac_picked"
+ assert json.loads(facts)["selected_connection"] == {
+ "connection_id": "goac_picked",
+ "state": "active",
+ "scopes_granted": selected_scopes,
+ }
+ sheets_pick = selected_scopes == [_SHEETS_SCOPE]
+ assert (policy.selected_connected_account_id == "goac_picked") is sheets_pick
+ assert ("goac_picked" in policy.run_approved_google_connection_ids) is sheets_pick
diff --git a/tests/unit/test_copilot_tools_list_integrations.py b/tests/unit/test_copilot_tools_list_integrations.py
index e72145cae..9abdddca4 100644
--- a/tests/unit/test_copilot_tools_list_integrations.py
+++ b/tests/unit/test_copilot_tools_list_integrations.py
@@ -9,6 +9,7 @@ import pytest
from skyvern.cli.mcp_tools import mcp as skyvern_mcp
from skyvern.forge import app
+from skyvern.forge.sdk.copilot.agent import _make_agent_result, _reshow_unselected_google_setup
from skyvern.forge.sdk.copilot.browser_ablation import (
REPAIR_PROBE_MODES,
CopilotBrowserCodeMode,
@@ -25,12 +26,22 @@ from skyvern.forge.sdk.copilot.tools import (
get_skyvern_mcp_alias_map,
list_integrations_tool,
)
-from skyvern.forge.sdk.copilot.tools.integrations import _list_integrations, _read_google_sheet, _serialize
+from skyvern.forge.sdk.copilot.tools.integrations import (
+ _list_integrations,
+ _read_google_sheet,
+ _request_google_connection,
+ _serialize,
+)
+from skyvern.forge.sdk.copilot.turn_outcome import connected_account_choice_context
+from skyvern.forge.sdk.schemas.copilot_turn_outcome import ResponseKind, TurnOutcome
from skyvern.forge.sdk.schemas.google_oauth import GoogleOAuthCredentialBase
from skyvern.forge.sdk.schemas.microsoft_oauth import MicrosoftOAuthCredentialBase
from tests.unit.copilot_test_helpers import make_copilot_ctx
ORGANIZATION_ID = "o_test_org"
+SHEETS_SCOPE = "https://www.googleapis.com/auth/spreadsheets"
+GMAIL_READ_SCOPE = "https://www.googleapis.com/auth/gmail.readonly"
+GMAIL_SEND_SCOPE = "https://www.googleapis.com/auth/gmail.send"
TOKEN_FIELD_NAMES = (
"access_token",
@@ -490,3 +501,211 @@ def test_read_google_sheet_description_states_facts_without_steering() -> None:
assert status in description
for steering in ("ask the user", "reconnect", "instead of", "prefer", "do not", "must call", "browser ui"):
assert steering not in description
+
+
+def _setup_rows() -> list[GoogleOAuthCredentialBase]:
+ return [
+ _google(id="goac_sheets_a", credential_name="Sheets A"),
+ _google(id="goac_sheets_b", credential_name="Sheets B"),
+ _google(id="goac_sheets_expired", credential_name="Sheets expired", state="error"),
+ _google(
+ id="goac_mail_expired",
+ credential_name="Mail expired",
+ state="error",
+ scopes_requested=[GMAIL_READ_SCOPE],
+ scopes_granted=[GMAIL_READ_SCOPE],
+ ),
+ _google(
+ id="goac_send_only",
+ credential_name="Send only",
+ scopes_requested=[GMAIL_SEND_SCOPE],
+ scopes_granted=[GMAIL_SEND_SCOPE],
+ ),
+ _google(
+ id="goac_mail_sheets_reauth_cancelled",
+ credential_name="Mail, Sheets reconnect cancelled",
+ scopes_requested=[SHEETS_SCOPE],
+ scopes_granted=[GMAIL_READ_SCOPE],
+ ),
+ _google(
+ id="goac_drive_sheets_reauth_cancelled",
+ credential_name="Drive, Sheets reconnect cancelled",
+ scopes_requested=[SHEETS_SCOPE],
+ scopes_granted=["https://www.googleapis.com/auth/drive"],
+ ),
+ ]
+
+
+async def test_request_google_connection_offers_one_unbound_card_per_profile_without_touching_the_workflow(
+ patched_services,
+) -> None:
+ patched_services([], [])
+ ctx = make_copilot_ctx(organization_id=ORGANIZATION_ID, workflow_yaml="title: untouched\n")
+
+ gmail = await _request_google_connection("gmail", None, ctx)
+ sheets = await _request_google_connection("google_sheets", None, ctx)
+ await _request_google_connection("gmail", None, ctx)
+
+ assert gmail == {
+ "ok": True,
+ "data": {"status": "offered", "scope_profile": "gmail", "card": "connect", "compatible_connections": []},
+ }
+ assert sheets["data"]["scope_profile"] == "google_sheets"
+ assert [(notice.scopeProfile, notice.origin, notice.condition) for notice in ctx.google_setup_notices] == [
+ ("google_sheets", "setup", "unbound"),
+ ("gmail", "setup", "unbound"),
+ ]
+ assert ctx.google_connection_notices == []
+ assert ctx.workflow_yaml == "title: untouched\n"
+ assert not ctx.update_workflow_called
+ payloads = ctx.google_connection_notice_payloads()
+ assert {(payload["scopeProfile"], payload["connectionId"]) for payload in payloads} == {
+ ("gmail", None),
+ ("google_sheets", None),
+ }
+
+
+ ("scope_profile", "connection_id", "card", "reconnect_id", "ignored_id", "choice_ids"),
+ [
+ ("google_sheets", None, "connect", None, None, ["goac_sheets_a", "goac_sheets_b"]),
+ ("google_sheets", "goac_sheets_expired", "reconnect", "goac_sheets_expired", None, None),
+ ("gmail", "goac_mail_expired", "reconnect", "goac_mail_expired", None, None),
+ ("gmail", "goac_sheets_expired", "connect", None, "goac_sheets_expired", ["goac_mail_sheets_reauth_cancelled"]),
+ ("google_sheets", "goac_mail_expired", "connect", None, "goac_mail_expired", None),
+ ("gmail", "goac_send_only", "connect", None, "goac_send_only", ["goac_mail_sheets_reauth_cancelled"]),
+ (
+ "google_sheets",
+ "goac_mail_sheets_reauth_cancelled",
+ "connect",
+ None,
+ "goac_mail_sheets_reauth_cancelled",
+ ["goac_sheets_a", "goac_sheets_b"],
+ ),
+ (
+ "google_sheets",
+ "goac_drive_sheets_reauth_cancelled",
+ "connect",
+ None,
+ "goac_drive_sheets_reauth_cancelled",
+ ["goac_sheets_a", "goac_sheets_b"],
+ ),
+ (
+ "gmail",
+ "goac_other_org_or_deleted",
+ "connect",
+ None,
+ "goac_other_org_or_deleted",
+ ["goac_mail_sheets_reauth_cancelled"],
+ ),
+ ("google_sheets", "goac_sheets_a", "connect", None, "goac_sheets_a", None),
+ ],
+)
+async def test_request_google_connection_reconnects_only_a_same_profile_row(
+ patched_services,
+ scope_profile: str,
+ connection_id: str | None,
+ card: str,
+ reconnect_id: str | None,
+ ignored_id: str | None,
+ choice_ids: list[str] | None,
+) -> None:
+ patched_services(_setup_rows(), [])
+ ctx = make_copilot_ctx(organization_id=ORGANIZATION_ID)
+
+ result = await _request_google_connection(scope_profile, connection_id, ctx)
+
+ data = result["data"]
+ (notice,) = ctx.google_setup_notices
+ assert data["card"] == card
+ assert data.get("reconnect_connection_id") == reconnect_id
+ assert data.get("ignored_connection_id") == ignored_id
+ assert notice.connectionId == reconnect_id
+ assert notice.scopeProfile == scope_profile
+ expected_ready = {
+ "gmail": ["goac_mail_sheets_reauth_cancelled"],
+ "google_sheets": ["goac_sheets_a", "goac_sheets_b"],
+ }[scope_profile]
+ assert [row["connection_id"] for row in data["compatible_connections"]] == expected_ready
+ if choice_ids is not None:
+ assert [choice.connection_id for choice in notice.choices] == choice_ids
+ serialized = json.dumps(result)
+ for name in TOKEN_FIELD_NAMES:
+ assert f'"{name}"' not in serialized
+
+
[email protected]("supports_google_setup_card", [False, True])
+def test_request_google_connection_is_offered_only_to_a_client_that_renders_the_card(
+ supports_google_setup_card: bool,
+) -> None:
+ names = {
+ tool.name
+ for tool in copilot_native_tools(
+ supports_question_tool=True,
+ browser_code_available=False,
+ run_tools_available=True,
+ supports_google_setup_card=supports_google_setup_card,
+ )
+ }
+
+ assert ("request_google_connection" in names) is supports_google_setup_card
+
+
+def _persisted_offer_turn(ctx: CopilotContext) -> TurnOutcome:
+ result = _make_agent_result(
+ ctx,
+ user_response="ok",
+ updated_workflow=None,
+ global_llm_context=None,
+ narrative_payload={"turnId": "turn-1", "terminal": "response"},
+ turn_outcome=TurnOutcome(response_kind=ResponseKind.ANSWER),
+ )
+ assert result.turn_outcome is not None
+ return TurnOutcome.model_validate_json(result.turn_outcome.model_dump_json())
+
+
+async def test_picking_one_setup_card_offers_its_unpicked_sibling_again_on_the_selection_turn(
+ patched_services,
+) -> None:
+ gmail_row = _google(
+ id="goac_mail", credential_name="Mail", scopes_requested=[GMAIL_READ_SCOPE], scopes_granted=[GMAIL_READ_SCOPE]
+ )
+ patched_services([gmail_row, _google(id="goac_sheets")], [])
+ offer_ctx = make_copilot_ctx(organization_id=ORGANIZATION_ID)
+ await _request_google_connection("gmail", None, offer_ctx)
+ await _request_google_connection("google_sheets", None, offer_ctx)
+ offer_turn = _persisted_offer_turn(offer_ctx)
+
+ selection_ctx = make_copilot_ctx(organization_id=ORGANIZATION_ID)
+ gmail_pick = RequestPolicy(
+ picked_connected_account_id="goac_mail", picked_connected_account_scopes=[GMAIL_READ_SCOPE]
+ )
+ reshown = await _reshow_unselected_google_setup(selection_ctx, offer_turn, gmail_pick)
+ facts = json.loads(
+ connected_account_choice_context(
+ offer_turn,
+ explicit_selected_connection_id="goac_mail",
+ explicit_selected_connection_scopes=[GMAIL_READ_SCOPE],
+ reshown_setup_profiles=reshown,
+ )
+ )
+
+ assert [
+ (notice.scopeProfile, notice.condition, [choice.connection_id for choice in notice.choices])
+ for notice in selection_ctx.google_setup_notices
+ ] == [("google_sheets", "unbound", ["goac_sheets"])]
+ assert facts["unselected_setup_cards_shown_again"] == ["google_sheets"]
+
+ free_text_ctx = make_copilot_ctx(organization_id=ORGANIZATION_ID)
+ assert await _reshow_unselected_google_setup(free_text_ctx, offer_turn, RequestPolicy()) == []
+ assert free_text_ctx.google_setup_notices == []
+
+ sheets_pick = RequestPolicy(
+ picked_connected_account_id="goac_sheets", picked_connected_account_scopes=[SHEETS_SCOPE]
+ )
+ done_ctx = make_copilot_ctx(organization_id=ORGANIZATION_ID)
+ assert await _reshow_unselected_google_setup(done_ctx, _persisted_offer_turn(selection_ctx), sheets_pick) == []
+ assert done_ctx.google_setup_notices == []
diff --git a/tests/unit/test_copilot_typed_value_policy.py b/tests/unit/test_copilot_typed_value_policy.py
index 043fdb468..e04a167d2 100644
--- a/tests/unit/test_copilot_typed_value_policy.py
+++ b/tests/unit/test_copilot_typed_value_policy.py
@@ -7,6 +7,7 @@ import pytest
from skyvern.forge import app
from skyvern.forge.agent_functions import AgentFunction, CodeBlockExecutionLimits
from skyvern.forge.sdk.copilot.config import BlockAuthoringPolicy
+from skyvern.forge.sdk.copilot.reached_download_target import DownloadClaimHelperContract
from skyvern.forge.sdk.copilot.tools.mcp_hooks import _get_block_schema_post_hook, _type_text_pre_hook
@@ -199,13 +200,18 @@ async def test_code_block_schema_exposes_download_claim_helper_before_scouting()
assert "code_block_runtime_helpers" not in result["data"]
helper = result["data"]["download_claim_helper_contract"]["click_and_claim_download"]
+ contract = DownloadClaimHelperContract()
assert helper == {
"call": "await click_and_claim_download(page, selector)",
"parameters": {
"page": {"accepted_type": "current_code_block_page"},
- "selector": {"accepted_types": ["selector_string"]},
+ "selector": {"accepted_types": ["selector_string"], "scope": contract.selector_scope},
},
"returns": {"type": "string", "value": "sanitized_suggested_filename"},
+ "expect_download": {
+ "call": contract.expect_download_call,
+ "registration": contract.expect_download_registration,
+ },
}
assert ctx.reached_download_target is None
assert ctx.scout_trajectory == []
diff --git a/tests/unit/test_input_secret_readback.py b/tests/unit/test_input_secret_readback.py
index 48231db41..bb80d51d1 100644
--- a/tests/unit/test_input_secret_readback.py
+++ b/tests/unit/test_input_secret_readback.py
@@ -462,13 +462,17 @@ _NAV_ERROR = PlaywrightError("Execution context was destroyed, most likely becau
@pytest.mark.asyncio
-async def test_fill_secret_treats_navigation_after_fill_as_submitted() -> None:
+ "error",
+ [_NAV_ERROR, PlaywrightError("Protocol error (DOM.describeNode): Cannot find context with specified id")],
+)
+async def test_fill_secret_treats_navigation_after_fill_as_submitted(error: Exception) -> None:
# A TOTP/credential field that auto-submits once the value completes tears down the execution context, so
# the read-back raises a navigation error. The value was accepted and submitted, so treat it as success --
# never re-raise out of the action or turn a correctly-entered code into SecretInputMismatch (SKY-13821).
element = _make_secret_element([SECRET])
- with patch("skyvern.webeye.actions.handler.get_input_value", new=AsyncMock(side_effect=_NAV_ERROR)):
+ with patch("skyvern.webeye.actions.handler.get_input_value", new=AsyncMock(side_effect=error)):
result = await _fill(element)
assert result is None
@@ -477,16 +481,20 @@ async def test_fill_secret_treats_navigation_after_fill_as_submitted() -> None:
@pytest.mark.asyncio
-async def test_fill_secret_propagates_non_navigation_readback_error() -> None:
+ "error",
+ [PlaywrightError("some other driver failure"), RuntimeError("Cannot find context with specified id")],
+)
+async def test_fill_secret_propagates_non_navigation_readback_error(error: Exception) -> None:
# Guard: only navigation teardown is tolerated. Any other read-back driver error still propagates rather
# than being swallowed into a false success.
element = _make_secret_element([SECRET])
with patch(
"skyvern.webeye.actions.handler.get_input_value",
- new=AsyncMock(side_effect=PlaywrightError("some other driver failure")),
+ new=AsyncMock(side_effect=error),
):
- with pytest.raises(PlaywrightError):
+ with pytest.raises(type(error)):
await _fill(element)
diff --git a/tests/unit/test_mcp_session_lifecycle.py b/tests/unit/test_mcp_session_lifecycle.py
index 5d457aee5..9b2f6137f 100644
--- a/tests/unit/test_mcp_session_lifecycle.py
+++ b/tests/unit/test_mcp_session_lifecycle.py
@@ -2,7 +2,9 @@ from __future__ import annotations
import asyncio
import json
-from collections.abc import Iterator
+import time
+from collections.abc import Awaitable, Callable, Iterator
+from datetime import UTC, datetime
from types import SimpleNamespace
from typing import cast
from unittest.mock import AsyncMock, MagicMock
@@ -12,8 +14,10 @@ import pytest
from fastmcp import Client
from fastmcp.server.middleware import MiddlewareContext
from playwright.async_api import Page
+from structlog.testing import capture_logs
from skyvern.cli.core import client as client_mod
+from skyvern.cli.core import hosted_driver
from skyvern.cli.core import result as result_mod
from skyvern.cli.core import session_manager, session_ops
from skyvern.cli.core.result import BrowserContext
@@ -22,11 +26,15 @@ from skyvern.cli.mcp_tools import mcp
from skyvern.cli.mcp_tools import session as mcp_session
from skyvern.cli.mcp_tools import tabs as mcp_tabs
from skyvern.cli.mcp_tools.telemetry import MCPTelemetryMiddleware
+from skyvern.client.types.browser_session_response import BrowserSessionResponse
from skyvern.client.types.extensions import Extensions
+from skyvern.config import settings
from skyvern.constants import SKYVERN_MCP_USER_AGENT
+from skyvern.library.skyvern import Skyvern
from skyvern.library.skyvern_browser import SkyvernBrowser
from skyvern.library.skyvern_browser_page_ai import SdkSkyvernPageAi
from skyvern.schemas.runs import GeoTarget, ProxyLocation
+from skyvern.services import cleanup_service
CAPTCHA_SOLVER_EXTENSION: Extensions = "captcha-solver"
@@ -40,6 +48,8 @@ def _clear_singletons() -> None:
client_mod._api_key_override.set(None)
client_mod._global_skyvern_instance = None
client_mod._api_key_clients.clear()
+ client_mod._closing_clients.clear()
+ hosted_driver._OWNERS.clear()
session_manager._current_session.set(None)
session_manager._current_organization_id.set(None)
@@ -702,6 +712,727 @@ async def test_tool_calls_disconnect_only_the_stateless_cdp_connections_they_ope
assert not any(browser.session_closed for browser in [*opened, copilot_browser])
+class _FakeDriverProcess:
+ def __init__(self) -> None:
+ self.pid = 4242
+ self.returncode: int | None = None
+ self.kills = 0
+ self.killed = asyncio.Event()
+
+ def kill(self) -> None:
+ self.kills += 1
+ self.returncode = -9
+ self.killed.set()
+
+
+class _FakeDriverConnection:
+ """One CDP connection a fake driver opened; close() drops only this connection."""
+
+ def __init__(self, driver: _FakeDriver) -> None:
+ self.driver = driver
+ self.connected = True
+ self.contexts = [
+ SimpleNamespace(_loop=asyncio.get_running_loop(), pages=[], on=lambda *_args: None, browser=self)
+ ]
+
+ async def new_browser_cdp_session(self) -> SimpleNamespace:
+ return SimpleNamespace(send=AsyncMock())
+
+ async def close(self) -> None:
+ if self.driver.close_hangs:
+ await asyncio.Event().wait()
+ self.connected = False
+
+ def is_connected(self) -> bool:
+ return self.connected
+
+
+class _FakeDriver:
+ """A started Playwright driver whose process runs until stop() returns or it is killed."""
+
+ def __init__(self, *, close_hangs: bool = False, stop_hangs: bool = False, stop_raises: bool = False) -> None:
+ self.close_hangs = close_hangs
+ self.stop_hangs = stop_hangs
+ self.stop_raises = stop_raises
+ self.process = _FakeDriverProcess()
+ self.transport_lost: asyncio.Future[None] = asyncio.get_running_loop().create_future()
+ self.closed_reasons: list[str] = []
+ connection = SimpleNamespace(
+ _transport=SimpleNamespace(on_error_future=self.transport_lost, _proc=self.process), _closed_error=None
+ )
+
+ def cleanup(reason: str) -> None:
+ # Playwright's Connection.cleanup latches the error that fails every later call on this driver.
+ self.closed_reasons.append(reason)
+ connection._closed_error = reason
+
+ connection.cleanup = cleanup
+ self._impl_obj = SimpleNamespace(_connection=connection)
+ self.chromium = SimpleNamespace(connect_over_cdp=self._connect_over_cdp)
+ self.connections: list[_FakeDriverConnection] = []
+
+ async def _connect_over_cdp(self, _endpoint: str, **_kwargs: object) -> _FakeDriverConnection:
+ self.connections.append(_FakeDriverConnection(self))
+ return self.connections[-1]
+
+ async def stop(self) -> None:
+ if self.stop_hangs:
+ await asyncio.Event().wait()
+ if self.stop_raises:
+ raise RuntimeError("driver pipe already closed") # the process itself keeps running
+ self.process.returncode = 0
+
+ @property
+ def alive(self) -> bool:
+ return self.process.returncode is None
+
+
+class _FakePlaywright:
+ """Stands in for ``async_playwright``: each start() spawns one _FakeDriver."""
+
+ def __init__(self) -> None:
+ self.drivers: list[_FakeDriver] = []
+ self.start_gate: asyncio.Event | None = None
+ # While closed, the spawned driver exists but its manager has not published the process handle yet.
+ self.publish_gate: asyncio.Event | None = None
+ self.next_driver: dict[str, bool] = {}
+ self.failing_starts = 0
+
+ def __call__(self) -> SimpleNamespace:
+ manager = SimpleNamespace(_connection=None)
+ manager.start = lambda: self._start(manager)
+ return manager
+
+ async def _start(self, manager: SimpleNamespace) -> _FakeDriver:
+ if self.failing_starts:
+ self.failing_starts -= 1
+ raise RuntimeError("Playwright driver failed to start")
+ # Like a real spawn, the process exists from the moment start() begins.
+ driver = _FakeDriver(**self.next_driver)
+ self.drivers.append(driver)
+ if self.publish_gate is not None:
+ await self.publish_gate.wait()
+ manager._connection = driver._impl_obj._connection
+ if self.start_gate is not None:
+ gate = asyncio.ensure_future(self.start_gate.wait())
+ killed = asyncio.ensure_future(driver.process.killed.wait())
+ await asyncio.wait({gate, killed}, return_when=asyncio.FIRST_COMPLETED)
+ gate.cancel()
+ killed.cancel()
+ if driver.process.killed.is_set():
+ # Like Playwright, a driver killed before initialize answers fails the pending start.
+ raise ConnectionError("Connection closed while reading from the driver")
+ return driver
+
+ def live(self) -> list[_FakeDriver]:
+ return [driver for driver in self.drivers if driver.alive]
+
+
+def fake_playwright(monkeypatch: pytest.MonkeyPatch) -> _FakePlaywright:
+ factory = _FakePlaywright()
+ monkeypatch.setattr("playwright.async_api.async_playwright", factory)
+ return factory
+
+
+def hosted_mcp(monkeypatch: pytest.MonkeyPatch) -> None:
+ """Hosted stateless MCP with the real client factory; only the browser-session lookup is stubbed."""
+
+ async def get_browser_session(_self: Skyvern, browser_session_id: str, **_kwargs: object) -> BrowserSessionResponse:
+ now = datetime.now(UTC)
+ return BrowserSessionResponse(
+ browser_session_id=browser_session_id,
+ organization_id="org_1",
+ status="running",
+ browser_address=f"ws://127.0.0.1:9222/{browser_session_id}",
+ created_at=now,
+ modified_at=now,
+ )
+
+ monkeypatch.setattr(Skyvern, "get_browser_session", get_browser_session)
+ session_manager.set_stateless_http_mode(True)
+
+
+def _connection_of(browser: SkyvernBrowser) -> _FakeDriverConnection:
+ return cast(_FakeDriverConnection, browser.browser)
+
+
+def _cached_client(api_key: str) -> Skyvern:
+ return client_mod._api_key_clients[client_mod._cache_key(api_key)]
+
+
+async def _until(condition: Callable[[], bool]) -> None:
+ for _ in range(1000):
+ if condition():
+ return
+ await asyncio.sleep(0)
+ raise AssertionError("condition never held")
+
+
+async def _settle_call_cleanups() -> None:
+ pending = set(session_manager._CALL_CONNECTION_DISCONNECTS)
+ if pending:
+ await asyncio.wait(pending, timeout=2)
+
+
+async def _sweep_after_idle() -> int:
+ """One sweep run as if every released driver had been idle past the threshold."""
+ return await client_mod.sweep_idle_hosted_drivers(
+ now=time.monotonic() + settings.HOSTED_MCP_DRIVER_IDLE_SECONDS + 1
+ )
+
+
+async def _hosted_call(
+ api_key: str,
+ session_id: str,
+ body: Callable[[SkyvernBrowser], Awaitable[None]] | None = None,
+) -> SkyvernBrowser:
+ """One hosted tool call: the auth middleware's key and organization scope around the MCP call scope."""
+ token = client_mod.set_api_key_override(api_key)
+ try:
+ with session_manager.request_session_scope("org_1"):
+ async with session_manager.stateless_call_connection_scope():
+ browser, _ = await session_manager.resolve_browser(session_id=session_id)
+ if body is not None:
+ await body(browser)
+ return browser
+ finally:
+ client_mod.reset_api_key_override(token)
+
+
+def _held(
+ browsers: dict[str, SkyvernBrowser], releases: dict[str, asyncio.Event], name: str
+) -> Callable[[SkyvernBrowser], Awaitable[None]]:
+ releases[name] = asyncio.Event()
+
+ async def body(browser: SkyvernBrowser) -> None:
+ browsers[name] = browser
+ await releases[name].wait()
+
+ return body
+
+
+async def test_hosted_tool_calls_share_one_driver_per_key_until_the_idle_sweep(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ for api_key, session_ids in (("sk_key_a", ("pbs_1", "pbs_1")), ("sk_key_b", ("pbs_2",))):
+ token = client_mod.set_api_key_override(api_key)
+ try:
+ with session_manager.request_session_scope("org_1"):
+ async with Client(mcp) as client:
+ for session_id in session_ids:
+ result = await client.call_tool("skyvern_tab_list", {"session_id": session_id})
+ assert result.structured_content is not None
+ assert result.structured_content["ok"] is True
+ finally:
+ client_mod.reset_api_key_override(token)
+
+ # One driver per key, reused by its sequential calls; each call still dropped its own CDP connection.
+ assert len(fake_playwright.drivers) == 2
+ assert fake_playwright.live() == fake_playwright.drivers
+ assert not any(connection.connected for driver in fake_playwright.drivers for connection in driver.connections)
+
+ assert await client_mod.sweep_idle_hosted_drivers() == 0
+ assert fake_playwright.live() == fake_playwright.drivers
+
+ assert await _sweep_after_idle() == 2
+ assert fake_playwright.live() == []
+ assert hosted_driver.owners() == []
+ # The per-key HTTP clients stay cached for the next call.
+ assert list(client_mod._api_key_clients) == [client_mod._cache_key("sk_key_a"), client_mod._cache_key("sk_key_b")]
+
+
+async def test_overlapping_same_key_calls_share_a_driver_the_sweep_spares_while_any_call_runs(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ browsers: dict[str, SkyvernBrowser] = {}
+ releases: dict[str, asyncio.Event] = {}
+ first = asyncio.create_task(_hosted_call("sk_key_a", "pbs_1", _held(browsers, releases, "first")))
+ second = asyncio.create_task(_hosted_call("sk_key_a", "pbs_1", _held(browsers, releases, "second")))
+ await _until(lambda: len(browsers) == 2)
+ [driver] = fake_playwright.drivers
+ assert _connection_of(browsers["first"]).driver is driver
+ assert _connection_of(browsers["second"]).driver is driver
+
+ releases["first"].set()
+ await first
+ assert not _connection_of(browsers["first"]).connected
+ assert await _sweep_after_idle() == 0
+ assert driver.alive
+ assert _connection_of(browsers["second"]).connected
+
+ releases["second"].set()
+ await second
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+
+
+async def test_simultaneous_first_use_of_a_key_starts_exactly_one_driver(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ fake_playwright.start_gate = asyncio.Event()
+ calls = [asyncio.create_task(_hosted_call("sk_key_a", f"pbs_{index}")) for index in range(3)]
+ await _until(lambda: len(fake_playwright.drivers) >= 1)
+ for _ in range(20):
+ await asyncio.sleep(0) # every call is now waiting on the key's driver
+ fake_playwright.start_gate.set()
+ browsers = await asyncio.gather(*calls)
+
+ assert len(fake_playwright.drivers) == 1
+ assert {_connection_of(browser).driver for browser in browsers} == set(fake_playwright.drivers)
+
+
+async def test_sibling_attaches_in_one_call_share_one_driver_start(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ fake_playwright.start_gate = asyncio.Event()
+ token = client_mod.set_api_key_override("sk_key_a")
+ try:
+ with session_manager.request_session_scope("org_1"):
+ async with session_manager.stateless_call_connection_scope():
+ siblings = asyncio.gather(
+ session_manager.resolve_browser(session_id="pbs_1"),
+ session_manager.resolve_browser(session_id="pbs_2"),
+ )
+ await _until(lambda: len(fake_playwright.drivers) >= 1)
+ for _ in range(10):
+ await asyncio.sleep(0) # both siblings are now waiting for the driver
+ fake_playwright.start_gate.set()
+ (first, _), (second, _) = await siblings
+ assert _connection_of(first).driver is _connection_of(second).driver
+ finally:
+ client_mod.reset_api_key_override(token)
+
+ assert len(fake_playwright.drivers) == 1
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+
+
+async def test_cancelling_one_waiter_does_not_cancel_the_shared_start(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ fake_playwright.start_gate = asyncio.Event()
+ cancelled = asyncio.create_task(_hosted_call("sk_key_a", "pbs_1"))
+ browsers: dict[str, SkyvernBrowser] = {}
+ releases: dict[str, asyncio.Event] = {}
+ survivor = asyncio.create_task(_hosted_call("sk_key_a", "pbs_2", _held(browsers, releases, "survivor")))
+ await _until(lambda: len(fake_playwright.drivers) == 1)
+ for _ in range(10):
+ await asyncio.sleep(0)
+ cancelled.cancel()
+ with pytest.raises(asyncio.CancelledError):
+ await cancelled
+ await _settle_call_cleanups()
+
+ fake_playwright.start_gate.set()
+ await _until(lambda: "survivor" in browsers)
+ [driver] = fake_playwright.drivers
+ assert _connection_of(browsers["survivor"]).driver is driver
+ assert _connection_of(browsers["survivor"]).connected
+
+ releases["survivor"].set()
+ await survivor
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+
+
+async def test_a_start_whose_caller_was_cancelled_stays_owned_until_its_handle_can_be_reclaimed(
+ fake_playwright: _FakePlaywright, hosted_mcp: None, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr(session_manager, "_CALL_CONNECTION_DISCONNECT_TIMEOUT_SECONDS", 0.2)
+ fake_playwright.publish_gate = asyncio.Event()
+ call = asyncio.create_task(_hosted_call("sk_key_a", "pbs_1"))
+ await _until(lambda: len(fake_playwright.drivers) == 1)
+ call.cancel()
+ with pytest.raises(asyncio.CancelledError):
+ await call
+ await _settle_call_cleanups()
+ [driver] = fake_playwright.drivers
+
+ # The handle is not published yet, so nothing can reach the child; the owner must keep it rather than forget it.
+ assert await _sweep_after_idle() == 0
+ assert driver.alive
+ assert _cached_client("sk_key_a")._hosted_driver.owns_driver
+
+ fake_playwright.publish_gate.set()
+ await _until(lambda: _cached_client("sk_key_a")._hosted_driver.started)
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+ assert not _cached_client("sk_key_a")._hosted_driver.owns_driver
+
+
+async def test_a_failed_start_is_retried_by_the_next_attach_in_the_same_call(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ fake_playwright.failing_starts = 1
+ token = client_mod.set_api_key_override("sk_key_a")
+ try:
+ with session_manager.request_session_scope("org_1"):
+ async with session_manager.stateless_call_connection_scope():
+ with pytest.raises(Exception, match="failed to start"):
+ await session_manager.resolve_browser(session_id="pbs_1")
+ browser, _ = await session_manager.resolve_browser(session_id="pbs_1")
+ assert _connection_of(browser).connected
+ finally:
+ client_mod.reset_api_key_override(token)
+
+ assert len(fake_playwright.drivers) == 1
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+
+
+async def test_a_task_that_outlives_its_call_cannot_use_a_driver(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ call_over = asyncio.Event()
+ late: list[asyncio.Task[object]] = []
+
+ async def late_attach() -> object:
+ await call_over.wait()
+ return await session_manager.resolve_browser(session_id="pbs_2")
+
+ async def body(_browser: SkyvernBrowser) -> None:
+ late.append(asyncio.create_task(late_attach())) # inherits this call's context
+
+ await _hosted_call("sk_key_a", "pbs_1", body)
+ call_over.set()
+ with pytest.raises(session_manager.StatelessCallEndedError):
+ await late[0]
+
+ [driver] = fake_playwright.drivers
+ assert len(driver.connections) == 1
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+
+
+async def test_a_failing_call_still_disconnects_and_releases_its_driver(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ async def body(_browser: SkyvernBrowser) -> None:
+ raise RuntimeError("tool failed")
+
+ with pytest.raises(RuntimeError, match="tool failed"):
+ await _hosted_call("sk_key_a", "pbs_1", body)
+
+ [driver] = fake_playwright.drivers
+ assert not driver.connections[0].connected
+ assert await _sweep_after_idle() == 1
+ assert not driver.alive
+
+
+ ("failure", "reported"),
+ [
+ pytest.param({"close_hangs": True, "stop_hangs": True}, {"pending": 1}, id="close-and-stop-hang"),
+ pytest.param({"stop_raises": True}, {"error_type": "RuntimeError"}, id="stop-raises"),
+ ],
+)
+async def test_the_sweep_kills_a_driver_that_will_not_stop_without_touching_a_busy_peer(
+ fake_playwright: _FakePlaywright,
+ hosted_mcp: None,
+ monkeypatch: pytest.MonkeyPatch,
+ failure: dict[str, bool],
+ reported: dict[str, object],
+) -> None:
+ monkeypatch.setattr(session_manager, "_CALL_CONNECTION_DISCONNECT_TIMEOUT_SECONDS", 0.2)
+ monkeypatch.setattr("skyvern.cli.core.hosted_driver.DRIVER_STOP_TIMEOUT_SECONDS", 0.2)
+ browsers: dict[str, SkyvernBrowser] = {}
+ releases: dict[str, asyncio.Event] = {}
+ peer = asyncio.create_task(_hosted_call("sk_key_b", "pbs_2", _held(browsers, releases, "peer")))
+ await _until(lambda: "peer" in browsers)
+ fake_playwright.next_driver = failure
+
+ with capture_logs() as logs:
+ await _hosted_call("sk_key_a", "pbs_1")
+ await _settle_call_cleanups()
+ assert await _sweep_after_idle() == 1
+
+ peer_driver, failed_driver = fake_playwright.drivers
+ assert failed_driver.process.kills == 1
+ assert not failed_driver.alive
+ # The kill must not hide why the driver failed to stop.
+ assert any(reported.items() <= log.items() for log in logs if log["log_level"] == "warning")
+ assert peer_driver.process.kills == 0
+ assert peer_driver.alive
+ assert _connection_of(browsers["peer"]).connected
+
+ releases["peer"].set()
+ await peer
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+
+
+async def test_a_driver_started_after_its_client_was_evicted_is_still_swept(
+ fake_playwright: _FakePlaywright, hosted_mcp: None, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr(client_mod, "_API_KEY_CLIENT_CACHE_MAX", 1)
+ lookup_gate = asyncio.Event()
+ lookup = Skyvern.get_browser_session
+
+ async def gated_lookup(self: Skyvern, browser_session_id: str, **kwargs: object) -> BrowserSessionResponse:
+ if browser_session_id == "pbs_gated":
+ await lookup_gate.wait()
+ return await lookup(self, browser_session_id, **kwargs)
+
+ monkeypatch.setattr(Skyvern, "get_browser_session", gated_lookup)
+ late = asyncio.create_task(_hosted_call("sk_key_a", "pbs_gated"))
+ await _until(lambda: client_mod._cache_key("sk_key_a") in client_mod._api_key_clients)
+ for _ in range(10):
+ await asyncio.sleep(0)
+ await _hosted_call("sk_key_b", "pbs_2") # evicts sk_key_a's client before its call has attached
+ await asyncio.sleep(0)
+
+ lookup_gate.set()
+ await late
+ assert len(fake_playwright.live()) == 2
+ assert await _sweep_after_idle() == 2
+ assert fake_playwright.live() == []
+
+
+async def test_an_evicted_client_whose_start_is_still_pending_keeps_its_driver_reachable(
+ fake_playwright: _FakePlaywright, hosted_mcp: None, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr(client_mod, "_API_KEY_CLIENT_CACHE_MAX", 1)
+ monkeypatch.setattr(session_manager, "_CALL_CONNECTION_DISCONNECT_TIMEOUT_SECONDS", 0.2)
+ monkeypatch.setattr("skyvern.cli.core.hosted_driver.DRIVER_STOP_TIMEOUT_SECONDS", 0.1)
+ publish = fake_playwright.publish_gate = asyncio.Event()
+ call = asyncio.create_task(_hosted_call("sk_key_a", "pbs_1"))
+ await _until(lambda: len(fake_playwright.drivers) == 1)
+ call.cancel()
+ with pytest.raises(asyncio.CancelledError):
+ await call
+ await _settle_call_cleanups()
+ [pending] = fake_playwright.drivers
+
+ fake_playwright.publish_gate = None
+ await _hosted_call("sk_key_b", "pbs_2") # evicts sk_key_a's client while its start is still pending
+ await asyncio.sleep(0.3) # the evicted client's close gives up waiting on the unpublished start
+ assert pending.alive
+
+ assert await _sweep_after_idle() == 1 # sk_key_b's driver; the pending one has no handle to kill yet
+ assert pending.alive and pending.process.kills == 0
+
+ publish.set() # the handle is published and the start completes after the client was closed
+ for _ in range(20):
+ await asyncio.sleep(0)
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+
+
+async def test_a_hung_start_is_killed_even_while_calls_wait_on_it_and_the_next_attach_recovers(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ fake_playwright.start_gate = asyncio.Event()
+ waiters = [asyncio.create_task(_hosted_call("sk_key_a", f"pbs_{index}")) for index in range(2)]
+ await _until(lambda: len(fake_playwright.drivers) == 1)
+ for _ in range(10):
+ await asyncio.sleep(0)
+ [hung] = fake_playwright.drivers
+
+ # The waiters keep refreshing use, but a start older than the threshold has no usable driver to protect.
+ assert await _sweep_after_idle() == 0
+ assert hung.process.kills == 1
+ for waiter in waiters:
+ with pytest.raises(session_manager.BrowserSessionConnectionError):
+ await waiter
+
+ fake_playwright.start_gate = None
+ recovered = await _hosted_call("sk_key_a", "pbs_1")
+ assert _connection_of(recovered).driver is not hung
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+
+
+async def test_cancelling_the_sweep_during_a_hung_stop_still_kills_that_driver(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ fake_playwright.next_driver = {"stop_hangs": True}
+ await _hosted_call("sk_key_a", "pbs_1")
+ [driver] = fake_playwright.drivers
+
+ sweep = asyncio.create_task(_sweep_after_idle())
+ for _ in range(20):
+ await asyncio.sleep(0)
+ sweep.cancel()
+ with pytest.raises(asyncio.CancelledError):
+ await sweep
+
+ assert driver.process.kills == 1
+ assert not driver.alive
+ await client_mod.shutdown_hosted_drivers()
+ assert fake_playwright.live() == []
+
+
+async def test_stopping_the_sweep_propagates_the_callers_cancellation_after_stopping_drivers(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ await _hosted_call("sk_key_a", "pbs_1")
+ assert cleanup_service.start_hosted_driver_sweep() is not None
+ stopper = asyncio.create_task(cleanup_service.stop_hosted_driver_sweep())
+ await asyncio.sleep(0)
+ stopper.cancel()
+ with pytest.raises(asyncio.CancelledError):
+ await stopper
+ assert fake_playwright.live() == []
+
+
+async def test_lru_eviction_never_stops_a_driver_a_call_still_uses(
+ fake_playwright: _FakePlaywright, hosted_mcp: None, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr(client_mod, "_API_KEY_CLIENT_CACHE_MAX", 1)
+ browsers: dict[str, SkyvernBrowser] = {}
+ releases: dict[str, asyncio.Event] = {}
+ busy = asyncio.create_task(_hosted_call("sk_key_a", "pbs_1", _held(browsers, releases, "busy")))
+ await _until(lambda: "busy" in browsers)
+
+ await _hosted_call("sk_key_b", "pbs_2") # evicts sk_key_a's client while its call is still running
+ await asyncio.sleep(0)
+ busy_driver, other_driver = fake_playwright.drivers
+ assert client_mod._cache_key("sk_key_a") not in client_mod._api_key_clients
+ assert busy_driver.alive
+ assert _connection_of(browsers["busy"]).connected
+ assert await _sweep_after_idle() == 1 # only the idle driver of the cached client
+ assert busy_driver.alive and not other_driver.alive
+
+ releases["busy"].set()
+ await busy
+ assert await _sweep_after_idle() == 1 # the evicted client's driver once its last call ended
+ assert fake_playwright.live() == []
+
+
+async def test_a_dead_driver_is_replaced_on_the_next_attach(fake_playwright: _FakePlaywright, hosted_mcp: None) -> None:
+ first = await _hosted_call("sk_key_a", "pbs_1")
+ dead = _connection_of(first).driver
+ dead.process.returncode = 1
+ dead.transport_lost.set_exception(ConnectionResetError("driver exited"))
+ await asyncio.sleep(0)
+
+ second = await _hosted_call("sk_key_a", "pbs_1")
+ replacement = _connection_of(second).driver
+ assert replacement is not dead
+ assert await _sweep_after_idle() == 1
+ assert fake_playwright.live() == []
+
+
+async def test_stopping_the_hosted_driver_sweep_stops_every_driver_at_shutdown(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ browsers: dict[str, SkyvernBrowser] = {}
+ releases: dict[str, asyncio.Event] = {}
+ busy = asyncio.create_task(_hosted_call("sk_key_a", "pbs_1", _held(browsers, releases, "busy")))
+ await _until(lambda: "busy" in browsers)
+ await _hosted_call("sk_key_b", "pbs_2")
+ assert len(fake_playwright.live()) == 2
+
+ assert cleanup_service.start_hosted_driver_sweep() is not None
+ await cleanup_service.stop_hosted_driver_sweep()
+ assert fake_playwright.live() == []
+
+ releases["busy"].set()
+ await busy
+
+
+async def test_hosted_driver_sweep_runs_only_for_the_hosted_stateless_server(
+ hosted_mcp: None, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ session_manager.set_stateless_http_mode(False)
+ assert cleanup_service.start_hosted_driver_sweep() is None
+
+ session_manager.set_stateless_http_mode(True)
+ monkeypatch.setattr(settings, "HOSTED_MCP_DRIVER_SWEEP_INTERVAL_SECONDS", 0.0)
+ assert cleanup_service.start_hosted_driver_sweep() is None
+ monkeypatch.setattr(settings, "HOSTED_MCP_DRIVER_SWEEP_INTERVAL_SECONDS", 300.0)
+ monkeypatch.setattr(settings, "HOSTED_MCP_DRIVER_IDLE_SECONDS", 0.0)
+ assert cleanup_service.start_hosted_driver_sweep() is None
+
+ monkeypatch.setattr(settings, "HOSTED_MCP_DRIVER_IDLE_SECONDS", 600.0)
+ task = cleanup_service.start_hosted_driver_sweep()
+ assert task is not None and cleanup_service.start_hosted_driver_sweep() is task
+ await cleanup_service.stop_hosted_driver_sweep()
+ assert task.done()
+
+
+async def test_outside_a_call_scope_the_loopback_client_reuses_its_driver_until_closed(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ token = client_mod.set_api_key_override("sk_key_a")
+ try:
+ loopback = client_mod.get_skyvern()
+ finally:
+ client_mod.reset_api_key_override(token)
+
+ first = await loopback._get_playwright()
+ second = await loopback._get_playwright()
+ assert first is second
+ assert fake_playwright.live() == [first]
+
+ await loopback.aclose()
+ assert fake_playwright.live() == []
+
+
+async def test_stateful_transport_keeps_one_driver_for_its_session(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ session_manager.set_stateless_http_mode(False)
+
+ first = await _hosted_call("sk_key_a", "pbs_1")
+ second = await _hosted_call("sk_key_a", "pbs_1")
+
+ assert first is second
+ assert fake_playwright.live() == fake_playwright.drivers
+ assert len(fake_playwright.drivers) == 1
+ assert _connection_of(first).connected
+
+ await client_mod.close_skyvern()
+ assert fake_playwright.live() == []
+
+
+async def test_a_registered_copilot_browser_is_borrowed_not_owned(
+ fake_playwright: _FakePlaywright, hosted_mcp: None
+) -> None:
+ copilot_browser = _FakeCloudBrowser()
+ session_manager.register_copilot_session(
+ "pbs_copilot",
+ session_manager.SessionState(
+ browser=cast(SkyvernBrowser, copilot_browser),
+ context=BrowserContext(mode="cloud_session", session_id="pbs_copilot"),
+ api_key_hash=session_manager._api_key_hash("sk_key_a"),
+ ),
+ organization_id="org_1",
+ )
+
+ browser = await _hosted_call("sk_key_a", "pbs_copilot")
+
+ assert browser is cast(SkyvernBrowser, copilot_browser)
+ assert fake_playwright.drivers == []
+ assert copilot_browser.browser.connected
+ assert not copilot_browser.session_closed
+ assert await _sweep_after_idle() == 0
+
+
@pytest.mark.asyncio
async def test_resolve_browser_raises_for_invalid_matching_state(monkeypatch: pytest.MonkeyPatch) -> None:
session_manager.set_current_session(
diff --git a/tests/unit/test_microsoft_oauth_service.py b/tests/unit/test_microsoft_oauth_service.py
index 8f08b1e15..184ecf792 100644
--- a/tests/unit/test_microsoft_oauth_service.py
+++ b/tests/unit/test_microsoft_oauth_service.py
@@ -301,6 +301,7 @@ async def test_promote_pending_credential_stores_refresh_token_as_gcm(monkeypatc
persisted = promote_pending_to_active.await_args.kwargs
assert persisted["encrypted_refresh_token"].startswith("skyvern_enc:aesgcm-v1:")
+ assert persisted["encrypted_method"] == microsoft_oauth_service.EncryptMethod.AES
assert (
await microsoft_oauth_service.secret_encryption.decrypt_secret_field_value(
persisted["encrypted_refresh_token"],
@@ -311,6 +312,26 @@ async def test_promote_pending_credential_stores_refresh_token_as_gcm(monkeypatc
)
+async def test_promote_pending_credential_fails_closed_without_gcm_key(monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.setattr(microsoft_oauth_service.settings, "ENABLE_ENCRYPTION", True, raising=False)
+ monkeypatch.setattr(microsoft_oauth_service.settings, "ENCRYPTOR_AES_SECRET_KEY", "", raising=False)
+ promote_pending_to_active = AsyncMock()
+ repository = SimpleNamespace(promote_pending_to_active=promote_pending_to_active)
+ monkeypatch.setattr(microsoft_oauth_service.app, "DATABASE", SimpleNamespace(microsoft_oauth=repository))
+
+ with pytest.raises(microsoft_oauth_service.EncryptionNotConfiguredError):
+ await microsoft_oauth_service.promote_pending_credential(
+ organization_id="org-1",
+ state="state",
+ initiator_id="user-1",
+ refresh_token="rt-new",
+ scopes_granted=["Mail.Read"],
+ )
+
+ promote_pending_to_active.assert_not_awaited()
+
+
@pytest.mark.asyncio
async def test_refresh_and_rotate_persists_rotated_refresh_token(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(microsoft_oauth_service.settings, "MICROSOFT_OAUTH_CLIENT_ID", "cid", raising=False)
diff --git a/tests/unit/test_org_auth_credential_clear_routes.py b/tests/unit/test_org_auth_credential_clear_routes.py
index f50ce71fa..50b57edc0 100644
--- a/tests/unit/test_org_auth_credential_clear_routes.py
+++ b/tests/unit/test_org_auth_credential_clear_routes.py
@@ -139,7 +139,7 @@ async def test_clear_onepassword_without_existing_token_does_not_capture_success
monkeypatch.setattr(
routes.app,
"AGENT_FUNCTION",
- SimpleNamespace(capture_onepassword_telemetry=capture),
+ SimpleNamespace(capture_onepassword_telemetry=capture, enforce_request_authorization=AsyncMock()),
)
response = await routes.clear_org_auth_credential("onepassword", _org())
@@ -148,6 +148,26 @@ async def test_clear_onepassword_without_existing_token_does_not_capture_success
capture.assert_not_awaited()
+async def test_clear_onepassword_denial_stops_before_invalidation(
+ monkeypatch: pytest.MonkeyPatch,
+ fake_organizations: FakeOrganizationsRepository,
+) -> None:
+ enforce_request_authorization = AsyncMock(side_effect=HTTPException(status_code=403, detail="denied"))
+ monkeypatch.setattr(
+ routes.app,
+ "AGENT_FUNCTION",
+ SimpleNamespace(enforce_request_authorization=enforce_request_authorization),
+ )
+
+ with pytest.raises(HTTPException) as exc_info:
+ await routes.clear_org_auth_credential("onepassword", _org())
+
+ assert exc_info.value.status_code == 403
+ enforce_request_authorization.assert_awaited_once()
+ assert fake_organizations.invalidate_calls == []
+
+
@pytest.mark.asyncio
async def test_onepassword_token_mutations_capture_safe_success_events(
monkeypatch: pytest.MonkeyPatch,
@@ -158,7 +178,7 @@ async def test_onepassword_token_mutations_capture_safe_success_events(
monkeypatch.setattr(
routes.app,
"AGENT_FUNCTION",
- SimpleNamespace(capture_onepassword_telemetry=capture),
+ SimpleNamespace(capture_onepassword_telemetry=capture, enforce_request_authorization=AsyncMock()),
)
monkeypatch.setattr(routes, "record_request_audit_event", AsyncMock())
monkeypatch.setattr(routes, "_validate_onepassword_service_account_token", AsyncMock())
@@ -191,7 +211,7 @@ async def test_onepassword_token_mutation_failures_capture_only_error_class(
monkeypatch.setattr(
routes.app,
"AGENT_FUNCTION",
- SimpleNamespace(capture_onepassword_telemetry=capture),
+ SimpleNamespace(capture_onepassword_telemetry=capture, enforce_request_authorization=AsyncMock()),
)
monkeypatch.setattr(routes, "record_request_audit_event", AsyncMock())
monkeypatch.setattr(routes, "_validate_onepassword_service_account_token", AsyncMock())
diff --git a/tests/unit/test_pending_navigation.py b/tests/unit/test_pending_navigation.py
new file mode 100644
index 000000000..539caada6
--- /dev/null
+++ b/tests/unit/test_pending_navigation.py
@@ -0,0 +1,1155 @@
+"""The scrape retry ladder must not reload over a main-frame navigation that is still in flight.
+
+Reloading the committed page cancels the pending navigation; when the committed page is an
+auto-submitting form, the reload re-submits that form.
+"""
+
+from __future__ import annotations
+
+import asyncio
+import gc
+import threading
+import time
+import weakref
+from collections.abc import AsyncIterator
+from dataclasses import dataclass, field
+from datetime import UTC, datetime
+from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
+from pathlib import Path
+from types import SimpleNamespace
+from typing import Any
+from unittest.mock import AsyncMock, MagicMock
+
+import pytest
+import pytest_asyncio
+from pyee import EventEmitter
+
+from skyvern.config import settings
+from skyvern.constants import ScrapeType
+from skyvern.forge import agent as agent_mod
+from skyvern.forge.agent import ForgeAgent
+from skyvern.forge.sdk.core import skyvern_context
+from skyvern.forge.sdk.core.skyvern_context import SkyvernContext
+from skyvern.forge.sdk.models import StepStatus
+from skyvern.schemas.runs import RunEngine
+from skyvern.webeye import real_browser_state as real_browser_state_mod
+from skyvern.webeye.real_browser_state import RealBrowserState
+from skyvern.webeye.scraper import scraper as scraper_mod
+from skyvern.webeye.utils import document as document_mod
+from skyvern.webeye.utils.page import SkyvernFrame
+from tests.unit.helpers import make_organization, make_step, make_task
+
+
+def _chromium_available() -> bool:
+ try:
+ from playwright.sync_api import sync_playwright
+
+ with sync_playwright() as p:
+ return Path(p.chromium.executable_path).exists()
+ except Exception:
+ return False
+
+
+requires_chromium = pytest.mark.skipif(
+ not _chromium_available(), reason="Requires Playwright chromium (playwright install chromium)"
+)
+
+LANDING_MARKER = "Bravo dashboard ready"
+SPINNER_CSS = (
+ "<style>@keyframes r{to{transform:rotate(360deg)}}"
+ ".spinner{width:40px;height:40px;border:4px solid #888;animation:r 1s linear infinite}</style>"
+)
+
+
+@dataclass
+class _Site:
+ signin_unload_delay_ms: int = 0
+ landing_header_delay: float = 0.0
+ landing_body_delay: float = 0.0
+ landing_never_answers: bool = False
+ hits: list[tuple[str, str]] = field(default_factory=list)
+
+ def count(self, method: str, path: str) -> int:
+ return sum(1 for m, p in self.hits if m == method and p.startswith(path))
+
+
+def _html(body: str) -> bytes:
+ return f"<html><head>{SPINNER_CSS}</head><body>{body}</body></html>".encode()
+
+
+def _handler(site: _Site) -> type[BaseHTTPRequestHandler]:
+ pages = {
+ "/start": _html("<p>start</p>"),
+ "/spinner-gone": _html(
+ "<div id='s' class='spinner'></div><p>start</p>"
+ "<script>setTimeout(() => document.getElementById('s').remove(), 1000)</script>"
+ ),
+ "/spinner-stuck": _html("<div class='spinner'></div><p>start</p>"),
+ "/iframe-loading": _html("<p>start</p><iframe src='/hang'></iframe>"),
+ "/wedge": _html("<p>start</p><script>setTimeout(() => { while (true) {} }, 300)</script>"),
+ }
+
+ class Handler(BaseHTTPRequestHandler):
+ protocol_version = "HTTP/1.1"
+
+ def log_message(self, *args: Any) -> None:
+ pass
+
+ def _send(self, status: int, body: bytes = b"", headers: dict[str, str] | None = None) -> None:
+ self.send_response(status)
+ for name, value in (headers or {}).items():
+ self.send_header(name, value)
+ self.send_header("Content-Length", str(len(body)))
+ self.end_headers()
+ if body:
+ self.wfile.write(body)
+
+ def do_GET(self) -> None:
+ site.hits.append(("GET", self.path))
+ try:
+ if self.path.startswith("/signin"):
+ # Hold the renderer in the old document after response headers arrive, so the
+ # response-to-commit race is exercised through Chromium's real navigation path.
+ unload = (
+ "addEventListener('unload', () => {"
+ f"const until = Date.now() + {site.signin_unload_delay_ms};"
+ "while (Date.now() < until) {} });"
+ )
+ self._send(
+ 200,
+ (
+ "<html><body>Signing in<form id='f' method='POST' action='/assert'>"
+ "<input name='token' value='t'></form>"
+ f"<script>{unload if site.signin_unload_delay_ms else ''}"
+ "document.getElementById('f').submit()</script></body></html>"
+ ).encode(),
+ {"Content-Type": "text/html", "Permissions-Policy": "unload=(self)"},
+ )
+ elif self.path.startswith("/hop"):
+ self._send(302, headers={"Location": "/landing"})
+ elif self.path.startswith("/landing"):
+ if site.landing_never_answers:
+ time.sleep(120)
+ return
+ # Only the hand-off's landing is slow; a later reload of the landing answers at once.
+ if site.count("GET", "/landing") == 1:
+ time.sleep(site.landing_header_delay)
+ head = b"<html><head><title>Bravo</title></head><body><h1>Bravo</h1>"
+ tail = f"<p id='done'>{LANDING_MARKER}</p></body></html>".encode()
+ self.send_response(200)
+ self.send_header("Content-Type", "text/html")
+ self.send_header("Content-Length", str(len(head) + len(tail)))
+ self.end_headers()
+ self.wfile.write(head)
+ self.wfile.flush()
+ site.hits.append(("SENT", "/landing"))
+ time.sleep(site.landing_body_delay)
+ self.wfile.write(tail)
+ elif self.path.startswith("/moved"):
+ self._send(307, headers={"Location": "/slow"})
+ elif self.path.startswith("/slow"):
+ time.sleep(2)
+ self._send(200, b"<html><body><p>slow</p></body></html>", {"Content-Type": "text/html"})
+ elif self.path.startswith("/hang"):
+ time.sleep(60)
+ elif self.path.startswith("/file"):
+ self._send(
+ 200,
+ b"abc",
+ {
+ "Content-Type": "application/octet-stream",
+ "Content-Disposition": "attachment; filename=a.bin",
+ },
+ )
+ elif self.path.startswith("/empty"):
+ self._send(204)
+ elif self.path.startswith("/pushstate"):
+ self._send(
+ 200,
+ b"<html><body><script>location.href = '/hang';"
+ b"setTimeout(() => history.pushState({}, '', '/pushstate#moved'), 300)</script></body></html>",
+ {"Content-Type": "text/html"},
+ )
+ else:
+ self._send(200, pages.get(self.path, pages["/start"]), {"Content-Type": "text/html"})
+ except (BrokenPipeError, ConnectionResetError):
+ pass
+
+ def do_POST(self) -> None:
+ self.rfile.read(int(self.headers.get("Content-Length") or 0))
+ site.hits.append(("POST", self.path))
+ self._send(302, headers={"Location": "/hop"})
+
+ return Handler
+
+
+@pytest_asyncio.fixture
+async def site_browser() -> AsyncIterator[tuple[_Site, str, Any]]:
+ from playwright.async_api import async_playwright
+
+ site = _Site()
+
+ class _QuietServer(ThreadingHTTPServer):
+ daemon_threads = True
+
+ def handle_error(self, request: Any, client_address: Any) -> None:
+ pass
+
+ server = _QuietServer(("127.0.0.1", 0), _handler(site))
+ threading.Thread(target=server.serve_forever, daemon=True).start()
+ base = f"http://127.0.0.1:{server.server_address[1]}"
+ async with async_playwright() as p:
+ browser = await p.chromium.launch(
+ headless=True,
+ args=["--no-proxy-server", "--proxy-bypass-list=*", "--use-mock-keychain", "--password-store=basic"],
+ proxy={"server": "direct://"},
+ )
+ context = await browser.new_context()
+ try:
+ yield site, base, context
+ finally:
+ if browser.is_connected():
+ await browser.close()
+ server.shutdown()
+
+
+def _fast_scrape_failures(monkeypatch: pytest.MonkeyPatch) -> None:
+ # Production's scrape timeouts are tens of seconds; shrink them so the NORMAL rungs time out
+ # against the pending navigation within the test's budget. The timeouts are the only change.
+ monkeypatch.setattr(settings, "BROWSER_SCRAPING_BUILDING_ELEMENT_TREE_TIMEOUT_MS", 5000)
+ monkeypatch.setattr(settings, "PAGE_READY_NETWORK_IDLE_TIMEOUT_MS", 300)
+ monkeypatch.setattr(settings, "PAGE_READY_LOADING_INDICATOR_TIMEOUT_MS", 300)
+ monkeypatch.setattr(settings, "PAGE_READY_DOM_STABILITY_TIMEOUT_MS", 300)
+ monkeypatch.setattr(document_mod, "LOADER_ID_ATTACH_TIMEOUT_SECONDS", 0.5)
+ monkeypatch.setattr(document_mod, "LOADER_ID_FRAME_TREE_TIMEOUT_SECONDS", 0.5)
+ monkeypatch.setattr(document_mod, "LOADER_ID_DETACH_TIMEOUT_SECONDS", 0.5)
+
+
+def _agent_and_kwargs(
+ monkeypatch: pytest.MonkeyPatch, browser_state: RealBrowserState, page_ready_wait: bool = False
+) -> tuple[ForgeAgent, dict[str, Any]]:
+ now = datetime.now(UTC)
+ task = make_task(now, make_organization(now), navigation_goal="Open the dashboard", workflow_run_id="wr_nav")
+ step = make_step(now, task, step_id="step-nav", status=StepStatus.running, order=1, output=None)
+ agent = ForgeAgent()
+ agent.async_operation_pool = MagicMock()
+ monkeypatch.setattr(agent_mod, "resolve_transient_ui_capture_arm", AsyncMock())
+ monkeypatch.setattr(
+ agent_mod.app.EXPERIMENTATION_PROVIDER, "is_feature_enabled_cached", AsyncMock(return_value=False)
+ )
+
+ async def keep_elements(_frame: Any, _url: str, element_tree: list[dict]) -> list[dict]:
+ return element_tree
+
+ monkeypatch.setattr(object.__getattribute__(agent_mod.app, "_inst"), "scrape_exclude", None, raising=False)
+ monkeypatch.setattr(
+ agent_mod.app.AGENT_FUNCTION, "cleanup_element_tree_factory", MagicMock(return_value=keep_elements)
+ )
+ skyvern_context.set(
+ SkyvernContext(
+ task_id=task.task_id, workflow_run_id=task.workflow_run_id, enable_page_ready_wait=page_ready_wait
+ )
+ )
+ return agent, {"task": task, "step": step, "browser_state": browser_state, "engine": RunEngine.skyvern_v1}
+
+
+async def _browser_state(context: Any, base: str, path: str = "/start") -> tuple[Any, RealBrowserState]:
+ page = await context.new_page()
+ browser_state = RealBrowserState(pw=MagicMock(), browser_context=context, page=page)
+ # A still-loading iframe holds back the load event, so do not wait for it.
+ await page.goto(f"{base}{path}", wait_until="domcontentloaded")
+ return page, browser_state
+
+
+async def _start_sign_in(page: Any, base: str, site: _Site, browser_state: RealBrowserState | None = None) -> None:
+ """Start the auto-POST hand-off and return once the server has seen the landing request.
+
+ With ``browser_state``, also wait until its passive observer has been handed that navigation. The server can
+ see the request before the browser delivers the page's request event, and only the event is product input.
+ """
+ try:
+ await asyncio.wait_for(page.evaluate(f"location.href = '{base}/signin'"), 3)
+ except Exception:
+ pass
+ deadline = time.monotonic() + 5
+ while site.count("GET", "/landing") == 0:
+ assert time.monotonic() < deadline, "the landing request never started"
+ await asyncio.sleep(0.05)
+ if browser_state is not None:
+ navigation = browser_state._main_frame_navigations[page]
+ while not navigation.is_pending:
+ assert time.monotonic() < deadline + 10, "the observer never received the pending navigation"
+ await asyncio.sleep(0.02)
+
+
+def _spy_reload(monkeypatch: pytest.MonkeyPatch, browser_state: RealBrowserState) -> AsyncMock:
+ reload_spy = AsyncMock(wraps=browser_state.reload_page)
+ monkeypatch.setattr(browser_state, "reload_page", reload_spy)
+ return reload_spy
+
+
+@requires_chromium
[email protected]("page_ready_wait", [False, True], ids=["animation_wait", "page_ready_wait"])
+async def test_reload_waits_for_document_commit_after_response_headers(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch, page_ready_wait: bool
+) -> None:
+ site, base, context = site_browser
+ site.signin_unload_delay_ms = 2000
+ site.landing_header_delay = 0.5
+ page, browser_state = await _browser_state(context, base)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state, page_ready_wait)
+ headers = asyncio.Event()
+
+ def on_response(response: Any) -> None:
+ if response.url == f"{base}/landing":
+ headers.set()
+
+ page.on("response", on_response)
+ await _start_sign_in(page, base, site)
+ await asyncio.wait_for(headers.wait(), 5)
+ assert page.url == f"{base}/signin", "the test must reach headers before the new document commits"
+ scraped = await asyncio.wait_for(
+ agent._scrape_with_type(**kwargs, scrape_type=ScrapeType.RELOAD, navigation_deadline=time.monotonic() + 15),
+ 25,
+ )
+ assert LANDING_MARKER in scraped.html
+ assert site.count("POST", "/assert") == 1, site.hits
+ assert site.count("GET", "/signin") == 1, site.hits
+ assert page.url == f"{base}/landing"
+
+
+def _record_scrape_order(monkeypatch: pytest.MonkeyPatch, browser_state: RealBrowserState) -> list[str]:
+ """Record, in order, the navigation wait, frame injection, readiness checks and challenge-solver wait."""
+ events: list[str] = []
+ real_create_instance = SkyvernFrame.create_instance.__func__ # type: ignore[attr-defined]
+
+ async def create_instance(cls: Any, frame: Any, *args: Any, **kwargs: Any) -> Any:
+ # A Page has a main_frame; an iframe's Frame does not.
+ events.append("inject_main" if hasattr(frame, "main_frame") else "inject_frame")
+ return await real_create_instance(cls, frame, *args, **kwargs)
+
+ monkeypatch.setattr(SkyvernFrame, "create_instance", classmethod(create_instance))
+ for name in ("wait_for_page_ready", "safe_wait_for_animation_end"):
+ original = getattr(SkyvernFrame, name)
+
+ def readiness(self: Any, *args: Any, _name: str = name, _original: Any = original, **kwargs: Any) -> Any:
+ events.append(_name)
+ return _original(self, *args, **kwargs)
+
+ monkeypatch.setattr(SkyvernFrame, name, readiness)
+ for name, label in (
+ ("wait_for_main_frame_navigation", "navigation_wait"),
+ ("_wait_for_challenge_solver", "solver"),
+ ):
+ original_method = getattr(browser_state, name, None)
+ if original_method is None:
+ continue
+
+ async def recorded(*args: Any, _label: str = label, _original: Any = original_method, **kwargs: Any) -> Any:
+ events.append(_label)
+ return await _original(*args, **kwargs)
+
+ monkeypatch.setattr(browser_state, name, recorded)
+ return events
+
+
+def _first_scrape(order: list[str]) -> list[str]:
+ """The events of the first scrape: from its challenge-solver wait up to the next scrape's."""
+ start = order.index("solver")
+ rest = order[start + 1 :]
+ return order[start : start + 1 + (rest.index("solver") if "solver" in rest else len(rest))]
+
+
+def _record_rungs(monkeypatch: pytest.MonkeyPatch, agent: ForgeAgent) -> list[tuple[str, float]]:
+ rungs: list[tuple[str, float]] = []
+ real_scrape_with_type = agent._scrape_with_type
+
+ async def recorded(*args: Any, **kwargs: Any) -> Any:
+ rungs.append((str(kwargs["scrape_type"].value), time.monotonic()))
+ return await real_scrape_with_type(*args, **kwargs)
+
+ monkeypatch.setattr(agent, "_scrape_with_type", recorded)
+ return rungs
+
+
+@requires_chromium
[email protected]("page_ready_wait", [False, True], ids=["animation_wait", "page_ready_wait"])
+async def test_the_first_scrape_waits_for_a_slow_landing_instead_of_resubmitting_the_sign_in_form(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch, page_ready_wait: bool
+) -> None:
+ site, base, context = site_browser
+ # Long enough that a scrape that does not wait times out while the landing is still pending.
+ site.landing_header_delay = 20.0
+ site.landing_body_delay = 2.0
+ page, browser_state = await _browser_state(context, base)
+ _fast_scrape_failures(monkeypatch)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state, page_ready_wait)
+ reload_spy = _spy_reload(monkeypatch, browser_state)
+ order = _record_scrape_order(monkeypatch, browser_state)
+ rungs = _record_rungs(monkeypatch, agent)
+
+ await _start_sign_in(page, base, site, browser_state)
+ try:
+ result = await agent.build_and_record_step_prompt(**kwargs, persist_artifacts=False)
+ except Exception as e:
+ result, ladder_error = None, e
+ else:
+ ladder_error = None
+
+ assert site.count("POST", "/assert") == 1, f"sign-in form re-submitted: {site.hits}"
+ assert site.count("GET", "/signin") == 1, f"sign-in page reloaded: {site.hits}"
+ assert ladder_error is None, f"retry ladder failed: {ladder_error!r}"
+ assert result is not None and page.url.endswith("/landing")
+ # The landing body arrives after its headers; the scrape must see the late content, not just the commit.
+ assert LANDING_MARKER in result.scraped_page.html
+ # The scrape must report the document it read, not the hand-off page that was committed when it started.
+ assert result.scraped_page.url.endswith("/landing"), result.scraped_page.url
+ assert [rung for rung, _ in rungs] == ["normal"], f"the first scrape must succeed: {rungs}"
+ reload_spy.assert_not_awaited()
+ readiness = "wait_for_page_ready" if page_ready_wait else "safe_wait_for_animation_end"
+ other = "safe_wait_for_animation_end" if page_ready_wait else "wait_for_page_ready"
+ scrape = _first_scrape(order)
+ # The wait comes before the frame injection, then the existing flag-selected readiness runs exactly once.
+ assert scrape[:4] == ["solver", "navigation_wait", "inject_main", readiness], order
+ assert scrape.count(readiness) == 1 and other not in order, order
+
+
+@requires_chromium
+async def test_a_blank_tab_whose_first_navigation_is_pending_is_scraped_once_it_lands(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """A new tab still reads about:blank while its first navigation is in flight; that is not a dead blank page."""
+ site, base, context = site_browser
+ site.landing_header_delay = 10.0
+ page = await context.new_page()
+ browser_state = RealBrowserState(pw=MagicMock(), browser_context=context, page=page)
+ _fast_scrape_failures(monkeypatch)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state)
+ reload_spy = _spy_reload(monkeypatch, browser_state)
+ rungs = _record_rungs(monkeypatch, agent)
+ navigation = browser_state._main_frame_navigations[page]
+
+ await _navigate(page, f"{base}/landing")
+ await _until(lambda: site.count("GET", "/landing") == 1 and navigation.is_pending, 10)
+ assert page.url == "about:blank"
+ result = await agent.build_and_record_step_prompt(**kwargs, persist_artifacts=False)
+
+ assert [rung for rung, _ in rungs] == ["normal"], rungs
+ reload_spy.assert_not_awaited()
+ assert result.scraped_page.url.endswith("/landing"), result.scraped_page.url
+ assert LANDING_MARKER in result.scraped_page.html
+
+
+@requires_chromium
[email protected]("page_ready_wait", [False, True], ids=["animation_wait", "page_ready_wait"])
+ "reported_after_check", [1, 2], ids=["reported_after_first_rung_check", "reported_after_second_rung_check"]
+)
+async def test_a_late_reported_navigation_is_still_never_resubmitted(
+ site_browser: tuple[_Site, str, Any],
+ monkeypatch: pytest.MonkeyPatch,
+ page_ready_wait: bool,
+ reported_after_check: int,
+) -> None:
+ """The wait can only act on a navigation the browser has already reported to the observer.
+
+ The hand-off's request events are held back until the ladder's Nth navigation check has passed, as when the
+ browser reports them late. A rung that started earlier times out against the navigation; a later wait, at the
+ latest the RELOAD rung's, still lets it settle before anything is reloaded.
+ """
+ real_on_request = real_browser_state_mod._MainFrameNavigation._on_request
+ held: list[tuple[Any, Any]] | None = None
+
+ def held_on_request(self: Any, request: Any) -> None:
+ if held is None:
+ real_on_request(self, request)
+ else:
+ held.append((self, request))
+
+ monkeypatch.setattr(real_browser_state_mod._MainFrameNavigation, "_on_request", held_on_request)
+ site, base, context = site_browser
+ site.landing_header_delay = 20.0
+ page, browser_state = await _browser_state(context, base)
+ _fast_scrape_failures(monkeypatch)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state, page_ready_wait)
+ reload_spy = _spy_reload(monkeypatch, browser_state)
+ rungs = _record_rungs(monkeypatch, agent)
+ checks = 0
+ real_check = browser_state.wait_for_main_frame_navigation
+
+ async def check_then_report(*args: Any, **kwargs: Any) -> None:
+ nonlocal checks, held
+ await real_check(*args, **kwargs)
+ checks += 1
+ if checks == reported_after_check and held is not None:
+ for observer, request in held:
+ real_on_request(observer, request)
+ held = None
+
+ monkeypatch.setattr(browser_state, "wait_for_main_frame_navigation", check_then_report)
+
+ held = []
+ await _start_sign_in(page, base, site)
+ assert not browser_state._main_frame_navigations[page].is_pending, "the observer must not have the events yet"
+ result = await agent.build_and_record_step_prompt(**kwargs, persist_artifacts=False)
+
+ print(f"LATE_REPORT after_check={reported_after_check} rungs={[rung for rung, _ in rungs]} hits={site.hits}")
+ assert site.count("POST", "/assert") == 1, f"sign-in form re-submitted: {site.hits}"
+ assert site.count("GET", "/signin") == 1, f"sign-in page reloaded: {site.hits}"
+ assert LANDING_MARKER in result.scraped_page.html
+ if reported_after_check == 1:
+ assert [rung for rung, _ in rungs] == ["normal", "normal"], rungs
+ reload_spy.assert_not_awaited()
+ else:
+ # The RELOAD rung waits for the late-reported navigation, then reloads the settled landing.
+ assert [rung for rung, _ in rungs] == ["normal", "normal", "reload"], rungs
+ reload_spy.assert_awaited_once_with(degradation=True)
+ assert site.count("GET", "/landing") == 2
+
+
+@requires_chromium
+async def test_a_failing_landing_scrape_still_reaches_the_original_reload(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch
+) -> None:
+ site, base, context = site_browser
+ site.landing_header_delay = 20.0
+ page, browser_state = await _browser_state(context, base)
+ _fast_scrape_failures(monkeypatch)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state)
+ real_prepare = scraper_mod._prepare_scrape_frame
+ failures_after_landing = 0
+
+ async def landing_unusable_twice(*args: Any, **kwargs: Any) -> Any:
+ nonlocal failures_after_landing
+ prepared = await real_prepare(*args, **kwargs)
+ # Both NORMAL rungs fail after the wait has settled on the landing; the RELOAD rung's scrape is real.
+ if site.count("SENT", "/landing") and failures_after_landing < 2:
+ failures_after_landing += 1
+ raise RuntimeError("landing not usable yet")
+ return prepared
+
+ monkeypatch.setattr(scraper_mod, "_prepare_scrape_frame", landing_unusable_twice)
+ reload_spy = _spy_reload(monkeypatch, browser_state)
+
+ await _start_sign_in(page, base, site, browser_state)
+ result = await agent.build_and_record_step_prompt(**kwargs, persist_artifacts=False)
+
+ assert failures_after_landing == 2, "both NORMAL rungs should have scraped the settled landing"
+ reload_spy.assert_awaited_once_with(degradation=True)
+ assert site.count("POST", "/assert") == 1, f"sign-in form re-submitted: {site.hits}"
+ assert site.count("GET", "/landing") == 2, "the original reload must reload the settled landing"
+ assert LANDING_MARKER in result.scraped_page.html
+
+
+@requires_chromium
+async def test_a_landing_that_never_answers_gets_the_original_reload_within_one_ladder_budget(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch
+) -> None:
+ site, base, context = site_browser
+ site.landing_never_answers = True
+ page, browser_state = await _browser_state(context, base)
+ _fast_scrape_failures(monkeypatch)
+ # Short enough to keep the test fast; the budget counts from the navigation's start.
+ monkeypatch.setattr(settings, "BROWSER_LOADING_TIMEOUT_MS", 15_000)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state)
+ rungs = _record_rungs(monkeypatch, agent)
+ reload_spy = _spy_reload(monkeypatch, browser_state)
+
+ await _start_sign_in(page, base, site, browser_state)
+ navigation_started = time.monotonic()
+ with pytest.raises(Exception):
+ await agent.build_and_record_step_prompt(**kwargs, persist_artifacts=False)
+
+ assert [rung for rung, _ in rungs] == ["normal", "normal", "reload"], rungs
+ # Only the attempt is asserted: Chromium may abort a reload issued over a navigation that never answers before
+ # its request leaves the browser, so whether the server saw a second sign-in GET is reported, not required.
+ reload_spy.assert_awaited_once_with(degradation=True)
+ print(f"NEVER_ANSWERS signin_gets={site.count('GET', '/signin')} hits={site.hits}")
+ assert rungs[1][1] - navigation_started >= 15 - 1, "the first scrape must wait out the loading budget"
+ assert rungs[2][1] - rungs[1][1] < 15, "a later rung must not wait out another budget"
+
+
+@requires_chromium
+async def test_cancelling_the_ladder_during_the_wait_cancels_without_reloading(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch
+) -> None:
+ site, base, context = site_browser
+ site.landing_never_answers = True
+ page, browser_state = await _browser_state(context, base)
+ _fast_scrape_failures(monkeypatch)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state)
+ reload_spy = _spy_reload(monkeypatch, browser_state)
+ waiting = asyncio.Event()
+ real_wait = real_browser_state_mod._MainFrameNavigation.wait
+
+ async def observed_wait(self: Any, deadline: float) -> None:
+ waiting.set()
+ await real_wait(self, deadline)
+
+ monkeypatch.setattr(real_browser_state_mod._MainFrameNavigation, "wait", observed_wait)
+
+ await _start_sign_in(page, base, site, browser_state)
+ ladder = asyncio.create_task(agent.build_and_record_step_prompt(**kwargs, persist_artifacts=False))
+ await asyncio.wait_for(waiting.wait(), 30)
+ ladder.cancel()
+
+ with pytest.raises(asyncio.CancelledError):
+ await asyncio.wait_for(ladder, 5)
+ reload_spy.assert_not_awaited()
+ assert site.count("GET", "/signin") == 1
+
+
+@requires_chromium
+async def test_a_scrape_outside_the_ladder_does_not_wait_for_the_navigation(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Refreshes and other non-ladder scrapes pass no deadline, so they keep today's behavior."""
+ site, base, context = site_browser
+ site.landing_never_answers = True
+ page, browser_state = await _browser_state(context, base)
+ _fast_scrape_failures(monkeypatch)
+ _agent_and_kwargs(monkeypatch, browser_state)
+ order = _record_scrape_order(monkeypatch, browser_state)
+
+ await _start_sign_in(page, base, site, browser_state)
+ started = time.monotonic()
+ with pytest.raises(Exception):
+ await browser_state.scrape_website(
+ url=f"{base}/signin", cleanup_element_tree=AsyncMock(side_effect=lambda *a: a[2])
+ )
+
+ assert "navigation_wait" not in order, order
+ assert time.monotonic() - started < 15, "a non-ladder scrape must not wait for the navigation"
+ assert site.count("POST", "/assert") == 1
+
+
+@requires_chromium
+async def test_ladder_reloads_immediately_when_nothing_is_pending(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Injected NORMAL failures on an idle page: the RELOAD rung keeps today's behavior and adds no wait."""
+ site, base, context = site_browser
+ page, browser_state = await _browser_state(context, base)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state)
+ real_scrape = scraper_mod.scrape_web_unsafe
+ calls = 0
+
+ async def fail_twice(*args: Any, **kwargs: Any) -> Any:
+ nonlocal calls
+ calls += 1
+ if calls <= 2:
+ raise RuntimeError("renderer wedged")
+ return await real_scrape(*args, **kwargs)
+
+ monkeypatch.setattr(scraper_mod, "scrape_web_unsafe", fail_twice)
+ reload_called_at: list[float] = []
+ real_reload = browser_state.reload_page
+
+ async def timed_reload(**kwargs: Any) -> None:
+ reload_called_at.append(time.monotonic())
+ await real_reload(**kwargs)
+
+ monkeypatch.setattr(browser_state, "reload_page", timed_reload)
+ rungs = _record_rungs(monkeypatch, agent)
+
+ result = await agent.build_and_record_step_prompt(**kwargs, persist_artifacts=False)
+
+ assert [rung for rung, _ in rungs] == ["normal", "normal", "reload"], rungs
+ assert len(reload_called_at) == 1
+ assert reload_called_at[0] - rungs[-1][1] < 1.0, "no wait may precede the reload when nothing is pending"
+ assert "start" in result.scraped_page.html
+
+
+@requires_chromium
+async def test_a_wedged_renderer_gets_the_original_reload_without_waiting(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """A busy-looping page has no pending navigation, so the RELOAD rung reloads at once, as before.
+
+ The reload does not recover this wedge in Chromium; only its invocation and timing are asserted.
+ """
+ site, base, context = site_browser
+ page, browser_state = await _browser_state(context, base, "/wedge")
+ await asyncio.sleep(0.6)
+ _fast_scrape_failures(monkeypatch)
+ monkeypatch.setattr(settings, "BROWSER_LOADING_TIMEOUT_MS", 3_000)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state)
+ reload_called_at: list[float] = []
+ real_reload = browser_state.reload_page
+
+ async def timed_reload(**kwargs: Any) -> None:
+ reload_called_at.append(time.monotonic())
+ await real_reload(**kwargs)
+
+ monkeypatch.setattr(browser_state, "reload_page", timed_reload)
+ rungs = _record_rungs(monkeypatch, agent)
+
+ started = time.monotonic()
+ try:
+ await agent.build_and_record_step_prompt(**kwargs, persist_artifacts=False)
+ outcome = "recovered"
+ except Exception as e:
+ outcome = type(e).__name__
+
+ assert len(reload_called_at) == 1, "the RELOAD rung must invoke the original reload exactly once"
+ reload_delay = reload_called_at[0] - rungs[-1][1]
+ print(
+ f"WEDGE_RESCUE outcome={outcome} rungs={len(rungs)} "
+ f"reload_after_rung_entry_s={reload_delay:.3f} total_s={time.monotonic() - started:.3f}"
+ )
+ assert reload_delay < 1.0, "no wait may precede the reload when nothing is pending"
+
+
+@requires_chromium
[email protected]("page_ready_wait", [False, True], ids=["animation_wait", "page_ready_wait"])
[email protected]("path", ["/start", "/spinner-gone", "/spinner-stuck", "/iframe-loading"])
+async def test_pages_with_nothing_pending_scrape_on_the_first_rung(
+ site_browser: tuple[_Site, str, Any], monkeypatch: pytest.MonkeyPatch, path: str, page_ready_wait: bool
+) -> None:
+ site, base, context = site_browser
+ page, browser_state = await _browser_state(context, base, path)
+ agent, kwargs = _agent_and_kwargs(monkeypatch, browser_state, page_ready_wait)
+ reload_spy = _spy_reload(monkeypatch, browser_state)
+ order = _record_scrape_order(monkeypatch, browser_state)
+
+ started = time.monotonic()
+ result = await agent.build_and_record_step_prompt(**kwargs, persist_artifacts=False)
+ print(f"FIRST_RUNG path={path} page_ready_wait={page_ready_wait} elapsed_s={time.monotonic() - started:.3f}")
+
+ reload_spy.assert_not_awaited()
+ assert "start" in result.scraped_page.html
+ readiness = "wait_for_page_ready" if page_ready_wait else "safe_wait_for_animation_end"
+ scrape = _first_scrape(order)
+ # The challenge-solver wait keeps its place ahead of the scraper; only the main page waits on navigation.
+ assert scrape[:4] == ["solver", "navigation_wait", "inject_main", readiness], order
+ assert scrape.count("navigation_wait") == 1, order
+
+
+def _navigation(browser_state: RealBrowserState, page: Any) -> Any:
+ navigation = browser_state._main_frame_navigations.get(page)
+ assert navigation is not None, "the page should be observed from creation"
+ return navigation
+
+
+async def _navigate(page: Any, url: str) -> None:
+ try:
+ await asyncio.wait_for(page.evaluate(f"location.href = '{url}'"), 2)
+ except Exception:
+ pass
+
+
+async def _until(condition: Any, seconds: float = 5) -> None:
+ deadline = time.monotonic() + seconds
+ while not condition():
+ assert time.monotonic() < deadline, "condition not reached"
+ await asyncio.sleep(0.02)
+
+
+def _settled(navigation: Any) -> bool:
+ return not navigation.is_pending and not navigation.closed
+
+
+@requires_chromium
+async def test_a_307_redirect_keeps_the_navigation_pending_until_the_final_response(
+ site_browser: tuple[_Site, str, Any],
+) -> None:
+ site, base, context = site_browser
+ page, browser_state = await _browser_state(context, base)
+ navigation = _navigation(browser_state, page)
+
+ await _navigate(page, f"{base}/moved")
+ await _until(lambda: site.count("GET", "/slow") == 1)
+ assert navigation.is_pending, "a redirect hop must keep the navigation pending"
+
+ await navigation.wait(time.monotonic() + 10)
+ assert _settled(navigation)
+ # Settling means the response arrived; the commit follows it.
+ await page.wait_for_url("**/slow", timeout=5_000)
+
+
+@requires_chromium
+async def test_a_replaced_navigations_late_failure_does_not_settle_its_replacement(
+ site_browser: tuple[_Site, str, Any],
+) -> None:
+ site, base, context = site_browser
+ page, browser_state = await _browser_state(context, base)
+ navigation = _navigation(browser_state, page)
+
+ await _navigate(page, f"{base}/hang")
+ await _until(lambda: site.count("GET", "/hang") == 1)
+ replaced = asyncio.Event()
+ page.on("requestfailed", lambda request: replaced.set() if "/hang" in request.url else None)
+ goto = asyncio.create_task(page.goto(f"{base}/slow", timeout=10_000))
+ await asyncio.wait_for(replaced.wait(), 5)
+ await _until(lambda: site.count("GET", "/slow") == 1)
+ # The browser's request event can trail the server seeing the request.
+ await _until(lambda: navigation.is_pending, 3)
+
+ await navigation.wait(time.monotonic() + 10)
+ assert _settled(navigation)
+ await goto
+ assert page.url.endswith("/slow")
+
+
+@requires_chromium
+async def test_a_same_document_url_change_does_not_settle_the_navigation(
+ site_browser: tuple[_Site, str, Any],
+) -> None:
+ site, base, context = site_browser
+ page, browser_state = await _browser_state(context, base)
+ navigation = _navigation(browser_state, page)
+ same_document_change = asyncio.Event()
+ page.on("framenavigated", lambda frame: same_document_change.set() if "#moved" in frame.url else None)
+
+ await _navigate(page, f"{base}/pushstate")
+ await asyncio.wait_for(same_document_change.wait(), 5)
+
+ assert site.count("GET", "/hang") == 1
+ assert navigation.is_pending
+
+
+@requires_chromium
+async def test_iframe_navigations_are_ignored_and_downloads_and_empty_responses_settle(
+ site_browser: tuple[_Site, str, Any],
+) -> None:
+ site, base, context = site_browser
+ page, browser_state = await _browser_state(context, base)
+ navigation = _navigation(browser_state, page)
+
+ await page.goto(f"{base}/iframe-loading", wait_until="commit")
+ await _until(lambda: site.count("GET", "/hang") == 1)
+ assert not navigation.is_pending, "a pending iframe navigation is not the page's navigation"
+
+ for path in ("/file", "/empty"):
+ await page.goto(f"{base}/start")
+ await _navigate(page, f"{base}{path}")
+ await navigation.wait(time.monotonic() + 5)
+ assert _settled(navigation), path
+
+
+@requires_chromium
[email protected]("ends", ["page_close", "browser_close"])
+async def test_closing_the_page_or_browser_wakes_a_waiter(site_browser: tuple[_Site, str, Any], ends: str) -> None:
+ site, base, context = site_browser
+ page, browser_state = await _browser_state(context, base)
+ navigation = _navigation(browser_state, page)
+ await _navigate(page, f"{base}/hang")
+ await _until(lambda: site.count("GET", "/hang") == 1)
+
+ waiter = asyncio.create_task(navigation.wait(time.monotonic() + 30))
+ await asyncio.sleep(0.2)
+ if ends == "page_close":
+ await page.close()
+ else:
+ await context.browser.close()
+
+ await asyncio.wait_for(waiter, 5)
+ assert not navigation.is_pending
+
+
+class _FakeFrame:
+ def __init__(self) -> None:
+ self._impl_obj = SimpleNamespace(_event_emitter=EventEmitter())
+
+ def commit(self, request: Any) -> None:
+ self._impl_obj._event_emitter.emit("navigated", {"newDocument": {"request": request._impl_obj._channel}})
+
+
+@dataclass
+class _FakeRequest:
+ frame: Any
+ redirected_from: Any = None
+ navigation: bool = True
+ _impl_obj: Any = field(default_factory=lambda: SimpleNamespace(_channel=object()), repr=False)
+
+ def is_navigation_request(self) -> bool:
+ return self.navigation
+
+
+@dataclass
+class _FakeResponse:
+ request: Any
+ status: int
+
+
+class _FakePage:
+ def __init__(self) -> None:
+ self.main_frame = _FakeFrame()
+ self.listeners: dict[str, list[Any]] = {}
+ self.closed = False
+
+ def on(self, event: str, handler: Any) -> None:
+ self.listeners.setdefault(event, []).append(handler)
+
+ def remove_listener(self, event: str, handler: Any) -> None:
+ self.listeners[event].remove(handler)
+
+ def emit(self, event: str, payload: Any) -> None:
+ for handler in list(self.listeners.get(event, [])):
+ handler(payload)
+
+ def is_closed(self) -> bool:
+ return self.closed
+
+ def listener_count(self) -> int:
+ return sum(len(handlers) for handlers in self.listeners.values()) + len(
+ self.main_frame._impl_obj._event_emitter.listeners("navigated")
+ )
+
+
+def _observed_page(state: RealBrowserState | None = None) -> tuple[_FakePage, RealBrowserState, Any]:
+ state = state or RealBrowserState(pw=AsyncMock(), browser_context=None)
+ page = _FakePage()
+ state._observe_main_frame_navigation(page) # type: ignore[arg-type]
+ return page, state, state._main_frame_navigations[page] # type: ignore[index]
+
+
+async def test_the_navigation_wait_ends_at_the_earlier_of_the_chain_budget_and_the_ladder_deadline(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ page, state, _ = _observed_page()
+ monkeypatch.setattr(settings, "BROWSER_LOADING_TIMEOUT_MS", 1_000)
+ page.emit("request", _FakeRequest(frame=page.main_frame))
+
+ started = time.monotonic()
+ await state.wait_for_main_frame_navigation(page, started + 0.3) # type: ignore[arg-type]
+ assert 0.25 <= time.monotonic() - started < 0.8, "the ladder deadline must cut the wait short"
+
+ await state.wait_for_main_frame_navigation(page, started + 30) # type: ignore[arg-type]
+ assert 0.9 <= time.monotonic() - started < 1.5, "the chain budget must cap a later ladder deadline"
+
+
+async def test_a_replacement_navigation_cannot_extend_the_ladder_deadline(monkeypatch: pytest.MonkeyPatch) -> None:
+ page, state, _ = _observed_page()
+ first = _FakeRequest(frame=page.main_frame)
+ page.emit("request", first)
+ started = time.monotonic()
+ deadline = started + 0.6
+ loop = asyncio.get_running_loop()
+ loop.call_later(0.2, page.emit, "response", _FakeResponse(request=first, status=200))
+ loop.call_later(0.2, page.main_frame.commit, first)
+ loop.call_later(0.25, page.emit, "request", _FakeRequest(frame=page.main_frame))
+
+ await state.wait_for_main_frame_navigation(page, deadline) # type: ignore[arg-type]
+ assert time.monotonic() - started < 0.55, "the wait ends when the navigation it waited for settles"
+ await asyncio.sleep(0.1)
+ await state.wait_for_main_frame_navigation(page, deadline) # type: ignore[arg-type]
+ assert 0.55 <= time.monotonic() - started < 1.1, "the replacement is waited for only until the ladder deadline"
+
+
+async def test_nothing_pending_or_an_unobserved_page_returns_at_once() -> None:
+ page, state, _ = _observed_page()
+ started = time.monotonic()
+ await state.wait_for_main_frame_navigation(page, started + 30) # type: ignore[arg-type]
+ await state.wait_for_main_frame_navigation(_FakePage(), started + 30) # type: ignore[arg-type]
+ assert time.monotonic() - started < 0.05
+
+
+async def test_crash_wakes_waiters_and_detaches() -> None:
+ page, _, navigation = _observed_page()
+ page.emit("request", _FakeRequest(frame=page.main_frame))
+ waiter = asyncio.create_task(navigation.wait(time.monotonic() + 30))
+ await asyncio.sleep(0)
+
+ page.emit("crash", page)
+
+ await asyncio.wait_for(waiter, 1)
+ assert navigation.closed
+ assert page.listener_count() == 0
+
+
+async def test_a_superseded_requests_late_failure_does_not_settle_its_replacement() -> None:
+ page, _, navigation = _observed_page()
+ superseded = _FakeRequest(frame=page.main_frame)
+ replacement = _FakeRequest(frame=page.main_frame)
+ page.emit("request", superseded)
+ page.emit("request", replacement)
+
+ page.emit("requestfailed", superseded)
+ assert navigation.is_pending
+ page.emit("requestfailed", replacement)
+ assert not navigation.is_pending
+
+
+async def test_concurrent_waiters_share_the_navigation_and_cancelling_one_leaves_the_other() -> None:
+ page, _, navigation = _observed_page()
+ request = _FakeRequest(frame=page.main_frame)
+ page.emit("request", request)
+ first = asyncio.create_task(navigation.wait(time.monotonic() + 30))
+ second = asyncio.create_task(navigation.wait(time.monotonic() + 30))
+ await asyncio.sleep(0)
+
+ first.cancel()
+ with pytest.raises(asyncio.CancelledError):
+ await first
+ assert navigation.is_pending and not second.done()
+
+ page.emit("response", _FakeResponse(request=request, status=200))
+ assert not second.done(), "headers alone must not release the other waiter"
+ page.main_frame.commit(request)
+ await asyncio.wait_for(second, 1)
+ assert _settled(navigation)
+
+
[email protected]("status", [204, 205, 304])
+def test_redirects_keep_the_chain_start_and_no_document_responses_settle(status: int) -> None:
+ page, _, navigation = _observed_page()
+ first = _FakeRequest(frame=page.main_frame)
+ page.emit("request", first)
+ started_at = navigation.started_at
+ for redirect_status in (301, 302, 303, 307, 308):
+ hop = _FakeRequest(frame=page.main_frame, redirected_from=first)
+ page.emit("response", _FakeResponse(request=first, status=redirect_status))
+ page.emit("request", hop)
+ assert navigation.is_pending, f"{redirect_status} is a redirect and must keep the navigation pending"
+ assert navigation.started_at == started_at, "a redirect hop must not restart the budget"
+ first = hop
+
+ page.emit("response", _FakeResponse(request=first, status=status))
+ assert not navigation.is_pending, f"{status} leaves the old document in place, so it must settle"
+
+
+def test_response_headers_and_same_document_events_do_not_settle_a_pending_document() -> None:
+ page, _, navigation = _observed_page()
+ request = _FakeRequest(frame=page.main_frame)
+ page.emit("request", request)
+ page.emit("response", _FakeResponse(request=request, status=200))
+ assert navigation.is_pending, "response headers do not mean the document committed"
+
+ page.main_frame._impl_obj._event_emitter.emit("navigated", {"url": "https://example.com/#moved"})
+ assert navigation.is_pending, "a same-document URL change cannot commit the pending document"
+ replacement = _FakeRequest(frame=page.main_frame)
+ page.emit("request", replacement)
+ page.main_frame.commit(request)
+ assert navigation.is_pending, "a superseded request's commit must not settle its replacement"
+ page.main_frame.commit(replacement)
+ assert _settled(navigation)
+
+
+def test_iframe_and_unknown_frame_ids_are_not_the_main_frame_navigation() -> None:
+ page, _, navigation = _observed_page()
+
+ page.emit("request", _FakeRequest(frame=_FakeFrame()))
+ assert not navigation.is_pending
+
+ @dataclass
+ class _CdpFrame:
+ frame_id: str | None
+
+ @dataclass
+ class _CdpRequest(_FakeRequest):
+ frame_id: str | None = None
+
+ page.main_frame = _CdpFrame(frame_id="main") # type: ignore[assignment]
+ page.emit("request", _CdpRequest(frame=page.main_frame, frame_id="child"))
+ assert not navigation.is_pending, "a frame id fallback to the main frame must not count"
+ page.emit("request", _CdpRequest(frame=page.main_frame, frame_id="main"))
+ assert navigation.is_pending
+
+
+def test_raw_cdp_document_commit_ignores_iframes_and_a_superseded_url() -> None:
+ page = _FakePage()
+ page.main_frame = SimpleNamespace(frame_id="main", url="https://example.com/old")
+ navigation = real_browser_state_mod._MainFrameNavigation(page) # type: ignore[arg-type]
+ request = SimpleNamespace(
+ frame=page.main_frame,
+ frame_id="main",
+ url="https://example.com/landing",
+ redirected_from=None,
+ is_navigation_request=lambda: True,
+ )
+ page.emit("request", request)
+ page.emit("response", _FakeResponse(request=request, status=200))
+ page.emit("framenavigated", SimpleNamespace(frame_id="child", url=request.url))
+ assert navigation.is_pending
+ page.emit("framenavigated", page.main_frame)
+ assert navigation.is_pending
+ page.main_frame.url = f"{request.url}#ready"
+ page.emit("framenavigated", page.main_frame)
+ assert _settled(navigation)
+ navigation.detach()
+ assert not any(page.listeners.values())
+
+
[email protected]("gone_event", ["close", "crash"])
+def test_a_closed_or_crashed_page_is_released_by_the_browser_state(gone_event: str) -> None:
+ page, state, _ = _observed_page()
+ page.emit("request", _FakeRequest(frame=page.main_frame))
+ page.emit(gone_event, page)
+ released = weakref.ref(page)
+
+ del page
+ gc.collect()
+
+ assert released() is None, "the browser state must not keep a closed page alive"
+ assert len(state._main_frame_navigations) == 0
+
+
+async def test_a_keep_alive_close_keeps_observing_the_reused_page() -> None:
+ """A state kept for reuse (persistent session, shared browser) must keep guarding its pages."""
+ page, state, navigation = _observed_page()
+
+ await state.close(close_browser_on_completion=False, release_driver=False)
+
+ assert state._main_frame_navigations.get(page) is navigation # type: ignore[call-overload]
+ page.emit("request", _FakeRequest(frame=page.main_frame))
+ assert navigation.is_pending, "a reused page's navigation must still be observed"
+
+
+ "close_kwargs",
+ [
+ {"close_browser_on_completion": True, "release_driver": False},
+ {"close_browser_on_completion": False, "release_driver": True},
+ ],
+)
+async def test_a_terminal_close_or_driver_release_detaches_and_wakes_waiters(close_kwargs: dict[str, bool]) -> None:
+ page, state, navigation = _observed_page()
+ page.emit("request", _FakeRequest(frame=page.main_frame))
+ waiter = asyncio.create_task(navigation.wait(time.monotonic() + 30))
+ await asyncio.sleep(0)
+
+ await state.close(**close_kwargs)
+
+ await asyncio.wait_for(waiter, 1)
+ assert navigation.closed
+ assert state._main_frame_navigations.get(page) is None # type: ignore[call-overload]
+ assert page.listener_count() == 0
+
+
[email protected](("release_driver", "kept"), [(False, True), (None, False)])
+async def test_an_attached_external_browser_releases_observation_only_with_its_driver(
+ release_driver: bool | None, kept: bool
+) -> None:
+ state = RealBrowserState(pw=AsyncMock(), browser_context=None)
+ state.external_browser = True
+ page, _, _ = _observed_page(state)
+
+ await state.close(close_browser_on_completion=False, release_driver=release_driver)
+
+ assert (state._main_frame_navigations.get(page) is not None) is kept # type: ignore[call-overload]
diff --git a/tests/unit/test_real_browser_state_discards_orphaned_tab_video.py b/tests/unit/test_real_browser_state_discards_orphaned_tab_video.py
index fbbc6c0d9..873d5809d 100644
--- a/tests/unit/test_real_browser_state_discards_orphaned_tab_video.py
+++ b/tests/unit/test_real_browser_state_discards_orphaned_tab_video.py
@@ -229,4 +229,4 @@ async def test_a_crashed_page_that_refuses_to_close_stays_watchable() -> None:
assert crashed in state._crash_listener_pages
state._register_disconnect_listeners(state.browser_context)
- assert crashed.on.call_count == 1
+ assert [call.args for call in crashed.on.call_args_list].count(("crash", state._on_page_crashed)) == 1
diff --git a/tests/unit/test_runs_v2_route.py b/tests/unit/test_runs_v2_route.py
index 1c0989889..65e55d536 100644
--- a/tests/unit/test_runs_v2_route.py
+++ b/tests/unit/test_runs_v2_route.py
@@ -12,9 +12,11 @@ import pytest_asyncio
from fastapi import BackgroundTasks, FastAPI, HTTPException, Request, Response
from sqlalchemy.exc import OperationalError
from sqlalchemy.ext.asyncio import AsyncEngine
+from structlog.testing import capture_logs
from skyvern.constants import SKYVERN_MCP_USER_AGENT, SKYVERN_UI_USER_AGENT
from skyvern.exceptions import WorkflowNotFound
+from skyvern.forge.api_app import register_agent_route_aliases
from skyvern.forge.sdk.core import skyvern_context
from skyvern.forge.sdk.core.skyvern_context import SkyvernContext
from skyvern.forge.sdk.db.agent_db import AgentDB
@@ -543,6 +545,180 @@ async def test_get_workflow_runs_by_id_does_not_blame_the_search_for_another_que
)
+_ORG_RUNS_NOW = datetime(2026, 10, 19, 12, 0, 0)
+_ORG_RUNS_DEFAULT_START = datetime(2026, 9, 19, 12, 0, 0)
+_EXPLICIT_START = datetime(2026, 1, 1, tzinfo=UTC)
+_EXPLICIT_END = datetime(2026, 2, 1, tzinfo=UTC)
+_EXPLICIT_END_PLUS_TWO = datetime(2026, 2, 1, 2, 0, tzinfo=timezone(timedelta(hours=2)))
+_END_ONLY_DEFAULT_START = datetime(2026, 1, 2, 0, 0, 0)
+
+
+def _org_runs_service(monkeypatch: pytest.MonkeyPatch, **service_kwargs: Any) -> SimpleNamespace:
+ mock_service = SimpleNamespace(get_workflow_runs=AsyncMock(**service_kwargs))
+ monkeypatch.setattr(agent_protocol.app, "WORKFLOW_SERVICE", mock_service)
+ monkeypatch.setattr(agent_protocol.analytics, "capture", lambda *args, **kwargs: None)
+ monkeypatch.setattr(agent_protocol, "naive_utc_now", lambda: _ORG_RUNS_NOW, raising=False)
+ return mock_service
+
+
+ ("search_key", "created_at_start", "created_at_end", "expected_start", "expected_end"),
+ [
+ # Unindexed free text without a date range is bounded to the last 30 days.
+ ("login", None, None, _ORG_RUNS_DEFAULT_START, None),
+ ("wr_123456789012345678", None, None, _ORG_RUNS_DEFAULT_START, None),
+ ("cred_123456789", None, None, _ORG_RUNS_DEFAULT_START, None),
+ # Complete browser identifiers resolve through an indexed lookup and keep the full history.
+ ("bp_123456789", None, None, None, None),
+ ("pbs_123456789", None, None, None, None),
+ # A listing without a search term is unchanged.
+ (None, None, None, None, None),
+ ("", None, None, None, None),
+ # A caller-supplied start replaces the default, unclamped.
+ ("login", _EXPLICIT_START, None, _EXPLICIT_START, None),
+ ("login", _EXPLICIT_START, _EXPLICIT_END, _EXPLICIT_START, _EXPLICIT_END),
+ # Without a start, the default window ends at the caller's end, normalized to naive UTC.
+ ("login", None, _EXPLICIT_END, _END_ONLY_DEFAULT_START, _EXPLICIT_END),
+ ("login", None, _EXPLICIT_END_PLUS_TWO, _END_ONLY_DEFAULT_START, _EXPLICIT_END_PLUS_TWO),
+ # An end too early to subtract the window from floors the start instead of overflowing.
+ ("login", None, datetime(1, 1, 1), datetime.min, datetime(1, 1, 1)),
+ # Explicit bounds also narrow listings and indexed searches.
+ (None, _EXPLICIT_START, _EXPLICIT_END, _EXPLICIT_START, _EXPLICIT_END),
+ ("bp_123456789", None, _EXPLICIT_END, None, _EXPLICIT_END),
+ ],
+)
+async def test_get_workflow_runs_bounds_free_text_search_without_a_start_to_a_default_window(
+ monkeypatch: pytest.MonkeyPatch,
+ search_key: str | None,
+ created_at_start: datetime | None,
+ created_at_end: datetime | None,
+ expected_start: datetime | None,
+ expected_end: datetime | None,
+) -> None:
+ mock_service = _org_runs_service(monkeypatch, return_value=[])
+
+ response = await agent_protocol.get_workflow_runs(
+ page=2,
+ page_size=5,
+ status=[WorkflowRunStatus.failed],
+ search_key=search_key,
+ error_code="LOGIN_FAILED",
+ created_at_start=created_at_start,
+ created_at_end=created_at_end,
+ current_org=SimpleNamespace(organization_id="org_123"),
+ )
+
+ assert response == []
+ mock_service.get_workflow_runs.assert_awaited_once_with(
+ organization_id="org_123",
+ page=2,
+ page_size=5,
+ status=[WorkflowRunStatus.failed],
+ search_key=search_key,
+ error_code="LOGIN_FAILED",
+ created_at_start=expected_start,
+ created_at_end=expected_end,
+ )
+
+
+ ("created_at_start", "created_at_end", "expected_filters", "expected_default_window_applied"),
+ [
+ (None, None, ["search_key"], True),
+ (None, _EXPLICIT_END, ["created_at_end", "search_key"], True),
+ (_EXPLICIT_START, None, ["created_at_start", "search_key"], False),
+ ],
+)
+async def test_get_workflow_runs_timeout_advises_a_narrower_date_range(
+ monkeypatch: pytest.MonkeyPatch,
+ created_at_start: datetime | None,
+ created_at_end: datetime | None,
+ expected_filters: list[str],
+ expected_default_window_applied: bool,
+) -> None:
+ cancelled = RunsListSearchCanceled(indexed_search=False, statement_timeout_seconds=30)
+ _org_runs_service(monkeypatch, side_effect=cancelled)
+
+ with capture_logs() as logs, pytest.raises(HTTPException) as exc_info:
+ await agent_protocol.get_workflow_runs(
+ page=1,
+ page_size=5,
+ status=None,
+ search_key="a-search-term",
+ error_code=None,
+ created_at_start=created_at_start,
+ created_at_end=created_at_end,
+ current_org=SimpleNamespace(organization_id="org_123"),
+ )
+
+ assert exc_info.value.status_code == 400
+ assert "created_at_start" in exc_info.value.detail
+ assert "30 days" in exc_info.value.detail
+ timeout_logs = [log for log in logs if log["event"] == "runs_list_statement_timeout"]
+ assert len(timeout_logs) == 1
+ # Filter names only: the default window is reported separately so it is not mistaken for a caller filter.
+ assert timeout_logs[0]["filters"] == expected_filters
+ assert timeout_logs[0]["default_window_applied"] is expected_default_window_applied
+ assert "a-search-term" not in str(timeout_logs[0])
+
+
[email protected]("path", ["/v1/workflows/runs", "/v1/agents/runs", "/api/v1/workflows/runs"])
+async def test_org_runs_routes_parse_created_at_bounds(monkeypatch: pytest.MonkeyPatch, path: str) -> None:
+ mock_service = _org_runs_service(monkeypatch, return_value=[])
+ fastapi_app = FastAPI()
+ fastapi_app.include_router(base_router, prefix="/v1")
+ fastapi_app.include_router(legacy_base_router, prefix="/api/v1")
+ register_agent_route_aliases(fastapi_app)
+ fastapi_app.dependency_overrides[org_auth_service.get_current_org] = lambda: SimpleNamespace(
+ organization_id="org_123"
+ )
+
+ async with httpx.AsyncClient(transport=httpx.ASGITransport(app=fastapi_app), base_url="http://test") as client:
+ response = await client.get(
+ path,
+ params={
+ "search_key": "login",
+ "created_at_start": "2026-01-01T02:00:00+02:00",
+ "created_at_end": "2026-02-01T00:00:00Z",
+ },
+ )
+
+ assert response.status_code == 200, response.text
+ kwargs = mock_service.get_workflow_runs.await_args.kwargs
+ assert kwargs["created_at_start"] == datetime(2026, 1, 1, tzinfo=UTC)
+ assert kwargs["created_at_end"] == datetime(2026, 2, 1, tzinfo=UTC)
+
+
+def test_org_runs_openapi_documents_the_default_search_window() -> None:
+ fastapi_app = FastAPI()
+ fastapi_app.include_router(base_router, prefix="/v1")
+ register_agent_route_aliases(fastapi_app)
+ operation = fastapi_app.openapi()["paths"]["/v1/agents/runs"]["get"]
+
+ assert {"created_at_start", "created_at_end"} <= {parameter["name"] for parameter in operation["parameters"]}
+ assert "30 days" in operation["description"]
+ assert "created_at_end" in operation["description"]
+
+
+async def test_workflow_service_forwards_created_at_bounds_to_the_repository(monkeypatch: pytest.MonkeyPatch) -> None:
+ repository = SimpleNamespace(get_workflow_runs=AsyncMock(return_value=[]))
+ monkeypatch.setattr(agent_protocol.app, "DATABASE", SimpleNamespace(workflow_runs=repository), raising=False)
+
+ await WorkflowService().get_workflow_runs(
+ organization_id="org_123",
+ search_key="login",
+ created_at_start=_EXPLICIT_START,
+ created_at_end=_EXPLICIT_END,
+ )
+
+ assert repository.get_workflow_runs.await_args.kwargs["created_at_start"] == _EXPLICIT_START
+ assert repository.get_workflow_runs.await_args.kwargs["created_at_end"] == _EXPLICIT_END
+
+
@pytest.mark.parametrize(
("original_trigger_type", "x_user_agent", "expected_trigger"),
[
diff --git a/tests/unit/test_scraper_engine_timeout_classification.py b/tests/unit/test_scraper_engine_timeout_classification.py
index ff0f92067..4fc7f61b8 100644
--- a/tests/unit/test_scraper_engine_timeout_classification.py
+++ b/tests/unit/test_scraper_engine_timeout_classification.py
@@ -118,6 +118,7 @@ class TestScrapeWebsiteEmptyTreeRecovery:
"wait_seconds": 1.25,
"must_included_tags": ["button"],
"allow_transient_ui_suppression": True,
+ "navigation_deadline": 123.5,
}
return SimpleNamespace(
browser_state=browser_state,
diff --git a/tests/unit/test_sdk_run_metadata.py b/tests/unit/test_sdk_run_metadata.py
index a5684c6dc..1ff88c973 100644
--- a/tests/unit/test_sdk_run_metadata.py
+++ b/tests/unit/test_sdk_run_metadata.py
@@ -885,3 +885,56 @@ async def test_connect_to_cloud_browser_session_hands_downloads_back_to_the_brow
assert sent == [("Browser.setDownloadBehavior", {"behavior": "default", "eventsEnabled": True})]
assert detached == []
+
+
+_CREATED_AT_QUERY = {"created_at_start": "2020-01-01T00:00:00Z", "created_at_end": "2020-02-01T00:00:00Z"}
+
+
+def _assert_org_runs_request_carries_created_at(request: httpx.Request) -> None:
+ assert request.method == "GET"
+ assert request.url.path == "/v1/agents/runs"
+ assert request.url.params["search_key"] == "acme"
+ assert request.url.params["created_at_start"] == _CREATED_AT_QUERY["created_at_start"]
+ assert request.url.params["created_at_end"] == _CREATED_AT_QUERY["created_at_end"]
+
+
+def test_get_workflow_runs_accepts_created_at_bounds_as_additional_query_parameters() -> None:
+ # The generated SDK has no typed created_at arguments for the org-wide list; request_options is the
+ # documented way to search past the default window until the SDK is regenerated.
+ captured_requests: list[httpx.Request] = []
+
+ def handler(request: httpx.Request) -> httpx.Response:
+ captured_requests.append(request)
+ return httpx.Response(status_code=200, json=[_workflow_run_payload()])
+
+ client = Skyvern(
+ base_url="https://api.example.test",
+ api_key="test-key",
+ httpx_client=httpx.Client(transport=httpx.MockTransport(handler)),
+ )
+
+ runs = client.get_workflow_runs(
+ search_key="acme", request_options={"additional_query_parameters": dict(_CREATED_AT_QUERY)}
+ )
+
+ assert runs[0].workflow_run_id == "wr_123"
+ _assert_org_runs_request_carries_created_at(captured_requests[0])
+
+
+def test_async_get_workflow_runs_accepts_created_at_bounds_as_additional_query_parameters() -> None:
+ captured_requests: list[httpx.Request] = []
+
+ async def handler(request: httpx.Request) -> httpx.Response:
+ captured_requests.append(request)
+ return httpx.Response(status_code=200, json=[_workflow_run_payload()])
+
+ async def call() -> None:
+ async with httpx.AsyncClient(transport=httpx.MockTransport(handler)) as httpx_client:
+ client = AsyncSkyvern(base_url="https://api.example.test", api_key="test-key", httpx_client=httpx_client)
+ runs = await client.get_workflow_runs(
+ search_key="acme", request_options={"additional_query_parameters": dict(_CREATED_AT_QUERY)}
+ )
+ assert runs[0].workflow_run_id == "wr_123"
+
+ asyncio.run(call())
+ _assert_org_runs_request_carries_created_at(captured_requests[0])
diff --git a/tests/unit/test_taskv3_engine.py b/tests/unit/test_taskv3_engine.py
index 4f1e4a38d..54efe0449 100644
--- a/tests/unit/test_taskv3_engine.py
+++ b/tests/unit/test_taskv3_engine.py
@@ -66,7 +66,7 @@ from skyvern.forge.taskv3.loop import (
_ProgressEvidence,
)
from skyvern.forge.taskv3.opaque_refs import OpaqueUrlRefs, mask_opaque_urls
-from skyvern.forge.taskv3.tools import PAGE_UNAVAILABLE_ERROR
+from skyvern.forge.taskv3.tools import PAGE_UNAVAILABLE_ERROR, DownloadFailureWatch
from skyvern.schemas.llm import LLMConfig, LLMRouterConfig, LLMRouterModelConfig
from skyvern.utils.prompt_engine import PROMPT_HARD_CEILING_TOKENS
from skyvern.utils.token_counter import count_tokens
@@ -1250,15 +1250,20 @@ async def test_page_free_mode_does_not_mask_signed_urls() -> None:
@pytest.mark.asyncio
-async def test_engine_forwards_completion_hooks_and_gates_guidance_on_probe(monkeypatch: pytest.MonkeyPatch) -> None:
- # completion_probe must reach the loop and completion_blocker must reach the finish tool, and
- # the download-completion guidance is appended to the system prompt only when a probe is given.
- from skyvern.forge.taskv3 import engine as engine_mod
- from skyvern.forge.taskv3.engine import DOWNLOAD_COMPLETION_GUIDANCE
- from skyvern.forge.taskv3.loop import LoopOutcome
-
+async def test_engine_forwards_download_hooks_without_a_download_order(monkeypatch: pytest.MonkeyPatch) -> None:
loop_kwargs: dict[str, Any] = {}
finish_kwargs: dict[str, Any] = {}
+ watches: list[DownloadFailureWatch] = []
+ closed: list[DownloadFailureWatch] = []
+
+ class RecordingWatch(DownloadFailureWatch):
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
+ super().__init__(*args, **kwargs)
+ watches.append(self)
+
+ def close(self) -> None:
+ closed.append(self)
+ super().close()
async def fake_loop(**kwargs: Any) -> LoopOutcome:
loop_kwargs.update(kwargs)
@@ -1270,93 +1275,51 @@ async def test_engine_forwards_completion_hooks_and_gates_guidance_on_probe(monk
finish_kwargs.update(kwargs)
return real_make_finish_tool(*args, **kwargs)
+ tools_kwargs: dict[str, Any] = {}
+ real_build = engine_mod.build_browser_tools
+
+ def capturing_build(*args: Any, **kwargs: Any) -> Any:
+ tools_kwargs.update(kwargs)
+ return real_build(*args, **kwargs)
+
monkeypatch.setattr(engine_mod, "run_agent_tool_loop", fake_loop)
monkeypatch.setattr(engine_mod, "make_finish_tool", capturing_make_finish_tool)
+ monkeypatch.setattr(engine_mod, "DownloadFailureWatch", RecordingWatch)
+ monkeypatch.setattr(engine_mod, "build_browser_tools", capturing_build)
- async def probe(_staged: frozenset[str]) -> str | None:
- return "a file finished downloading"
-
- async def blocker(_staged: frozenset[str]) -> str | None:
+ async def probe() -> None:
return None
await run_task_v3_agent_loop(
page_provider=_fixed_page_provider(_FakePage()),
llm_caller=_ScriptedCaller([]),
goal="download the file",
- completion_probe=probe,
- completion_blocker=blocker,
+ download_wait=probe,
+ download_settle=_no_download_pending,
)
- assert loop_kwargs["completion_probe"] is probe
- assert finish_kwargs["completion_blocker"] is blocker
- assert DOWNLOAD_COMPLETION_GUIDANCE in loop_kwargs["system_prompt"]
+ assert tools_kwargs["download_wait"] is probe
+ assert finish_kwargs["download_settle"] is _no_download_pending
+ download_prompt = loop_kwargs["system_prompt"]
# One staged_downloads set is shared between the loop and the finish tool -- a name staged via
- # a billable tool call must be visible to the SAME finish-tool blocker, not a divergent copy.
+ # a billable tool call must be visible to the SAME finish-tool settle hook, not a divergent copy.
assert loop_kwargs["staged_downloads"] is finish_kwargs["staged_downloads"]
assert isinstance(loop_kwargs["staged_downloads"], set)
+ [watch] = watches
+ assert watch in closed
+ assert finish_kwargs["download_facts"] is watch.facts
- loop_kwargs.clear()
- finish_kwargs.clear()
await run_task_v3_agent_loop(
page_provider=_fixed_page_provider(_FakePage()), llm_caller=_ScriptedCaller([]), goal="download the file"
)
- assert loop_kwargs["completion_probe"] is None
- assert finish_kwargs["completion_blocker"] is None
- assert DOWNLOAD_COMPLETION_GUIDANCE not in loop_kwargs["system_prompt"]
-
-
-async def test_engine_guidance_keyed_on_which_hooks_are_present(monkeypatch: pytest.MonkeyPatch) -> None:
- # blocker-only (extraction tasks: the probe would end the loop before the model returns
- # extracted_output) gets the DOWNLOAD_REQUIRED variant naming finish(completed) as the model's
- # own job; probe-only (download_timeout alone, wait-only) has no completion semantics at all,
- # so it gets neither guidance string.
- from skyvern.forge.taskv3 import engine as engine_mod
- from skyvern.forge.taskv3.engine import DOWNLOAD_COMPLETION_GUIDANCE, DOWNLOAD_REQUIRED_GUIDANCE
- from skyvern.forge.taskv3.loop import LoopOutcome
-
- loop_kwargs: dict[str, Any] = {}
-
- async def fake_loop(**kwargs: Any) -> LoopOutcome:
- loop_kwargs.update(kwargs)
- return LoopOutcome(status="completed", reason="ok")
-
- monkeypatch.setattr(engine_mod, "run_agent_tool_loop", fake_loop)
-
- async def blocker(_staged: frozenset[str]) -> str | None:
- return None
-
- await run_task_v3_agent_loop(
- page_provider=_fixed_page_provider(_FakePage()),
- llm_caller=_ScriptedCaller([]),
- goal="download the file",
- completion_blocker=blocker,
- )
- assert DOWNLOAD_REQUIRED_GUIDANCE in loop_kwargs["system_prompt"]
- assert DOWNLOAD_COMPLETION_GUIDANCE not in loop_kwargs["system_prompt"]
-
- loop_kwargs.clear()
-
- async def probe(_staged: frozenset[str]) -> str | None:
- return None
-
- await run_task_v3_agent_loop(
- page_provider=_fixed_page_provider(_FakePage()),
- llm_caller=_ScriptedCaller([]),
- goal="download the file",
- completion_probe=probe,
+ assert len(watches) == 1
+ assert finish_kwargs["download_facts"] is None
+ assert (
+ download_prompt.split("\n\nToday's date is")[0] == loop_kwargs["system_prompt"].split("\n\nToday's date is")[0]
)
- assert DOWNLOAD_REQUIRED_GUIDANCE not in loop_kwargs["system_prompt"]
- assert DOWNLOAD_COMPLETION_GUIDANCE not in loop_kwargs["system_prompt"]
@pytest.mark.asyncio
async def test_engine_drops_download_hooks_in_page_free_mode(monkeypatch: pytest.MonkeyPatch) -> None:
- # No browser tools exist to trigger a download, so a blocker would refuse finish(completed)
- # forever; page-free runs get neither hook nor the download guidance.
- from skyvern.forge.taskv3 import engine as engine_mod
- from skyvern.forge.taskv3.engine import DOWNLOAD_COMPLETION_GUIDANCE, DOWNLOAD_REQUIRED_GUIDANCE
- from skyvern.forge.taskv3.loop import LoopOutcome
-
loop_kwargs: dict[str, Any] = {}
finish_kwargs: dict[str, Any] = {}
@@ -1373,11 +1336,8 @@ async def test_engine_drops_download_hooks_in_page_free_mode(monkeypatch: pytest
monkeypatch.setattr(engine_mod, "run_agent_tool_loop", fake_loop)
monkeypatch.setattr(engine_mod, "make_finish_tool", capturing_make_finish_tool)
- async def probe(_staged: frozenset[str]) -> str | None:
- return "a file finished downloading"
-
- async def blocker(_staged: frozenset[str]) -> str | None:
- return "no download yet"
+ async def probe() -> None:
+ return None
async def verification_blocker(_status: str) -> str | None:
return "no code arrived"
@@ -1387,15 +1347,12 @@ async def test_engine_drops_download_hooks_in_page_free_mode(monkeypatch: pytest
llm_caller=_ScriptedCaller([]),
goal="validate the record",
page_free=True,
- completion_probe=probe,
- completion_blocker=blocker,
+ download_wait=probe,
+ download_settle=_no_download_pending,
verification_blocker=verification_blocker,
)
- assert loop_kwargs["completion_probe"] is None
- assert finish_kwargs["completion_blocker"] is None
+ assert finish_kwargs["download_settle"] is None
assert finish_kwargs["verification_blocker"] is None
- assert DOWNLOAD_COMPLETION_GUIDANCE not in loop_kwargs["system_prompt"]
- assert DOWNLOAD_REQUIRED_GUIDANCE not in loop_kwargs["system_prompt"]
@pytest.mark.asyncio
@@ -2356,7 +2313,7 @@ async def _no_download_pending(_staged: frozenset[str]) -> str | None:
("scope", "judged"),
[
({}, 1),
- ({"completion_blocker": _no_download_pending}, 0),
+ ({"download_settle": _no_download_pending}, 0),
({"extraction_requested": True}, 0),
({"page_free": True}, 0),
],
@@ -2530,7 +2487,7 @@ class _ReaskAnsweringCaller(_ScriptedCaller):
@pytest.mark.asyncio
@pytest.mark.parametrize(
("scope", "asked"),
- [({}, True), ({"extraction_requested": True}, False), ({"completion_blocker": _no_download_pending}, False)],
+ [({}, True), ({"extraction_requested": True}, False), ({"download_settle": _no_download_pending}, False)],
ids=["navigation", "extraction", "download_gated"],
)
async def test_a_terminated_finish_is_reasked_on_the_runs_own_model_without_a_goal_judge(
diff --git a/tests/unit/test_taskv3_loop.py b/tests/unit/test_taskv3_loop.py
index ecef80199..a75a45a23 100644
--- a/tests/unit/test_taskv3_loop.py
+++ b/tests/unit/test_taskv3_loop.py
@@ -19,7 +19,6 @@ import re
import subprocess
import sys
import time
-from datetime import UTC, datetime
from types import SimpleNamespace
from typing import Any, Awaitable, Callable, Collection
@@ -32,7 +31,7 @@ from skyvern.forge.sdk.core import skyvern_context
from skyvern.forge.sdk.core.skyvern_context import SkyvernContext
from skyvern.forge.taskv3 import loop as loop_module
from skyvern.forge.taskv3 import tools as taskv3_tools_module
-from skyvern.forge.taskv3.auth_tools import _COMPLETION_BLOCKED, VerificationFailure, VerificationState
+from skyvern.forge.taskv3.auth_tools import VerificationFailure, VerificationState
from skyvern.forge.taskv3.engine import MAX_TOKENS_CEILING, MAX_TOKENS_PER_ACTION_STEP, taskv3_runaway_backstops
from skyvern.forge.taskv3.goal_check import GoalVerdict, ToolTrail, run_goal_check
from skyvern.forge.taskv3.handoff_redaction import ELIDED_URL_PATH, caller_known_published_urls
@@ -48,6 +47,8 @@ from skyvern.forge.taskv3.loop import (
CLICK_DISPATCHED_DATA_KEY,
CODE_TOOL_NAME,
COMPLETION_GATE_REFUSAL,
+ DOWNLOAD_FAILURE_MAX_LINES,
+ DOWNLOAD_NO_FILE_FACT,
FAILURE_EVIDENCE_MIN_TOOL_CALLS,
FAILURE_EVIDENCE_MIN_TURNS,
FINAL_TURN_GRANTED_EVENT,
@@ -76,6 +77,7 @@ from skyvern.forge.taskv3.loop import (
UNCHARGED_REFUSAL_GRACE,
VERDICT_URL_MAX_CHARS,
ActivityRecency,
+ DownloadFailureFacts,
LoopOutcome,
RoundAction,
SemanticCommitStats,
@@ -106,7 +108,6 @@ from skyvern.forge.taskv3.loop import (
from skyvern.forge.taskv3.opaque_refs import mask_opaque_urls
from skyvern.forge.taskv3.tools import build_browser_tools
from skyvern.utils.url_validators import validate_fetch_url
-from tests.unit.helpers import make_organization, make_task
class _ScriptedCaller:
@@ -8541,202 +8542,103 @@ def test_canonicalization_covers_a_marker_fragment_left_open_at_the_tail() -> No
@pytest.mark.asyncio
-async def test_completion_probe_ends_loop_mid_batch_without_finish() -> None:
- # A billable action's own result can carry the download-completion signal; the probe ends the
- # run right there, no finish tool call needed, and the rest of the batch never dispatches.
- clicks: list[tuple[str, dict[str, Any]]] = []
-
- async def probe(_staged: frozenset[str]) -> str | None:
- return "a file finished downloading"
-
- tools = [_billable_tool("click", clicks), make_finish_tool()]
- script = [[("click", {"selector": "#a"}), ("click", {"selector": "#b"})]]
- recorded_rounds: list[list[RoundAction]] = []
-
- async def on_action_round(round_actions: list[RoundAction], _turn_text: str | None, *, round_done: bool) -> None:
- recorded_rounds.append(round_actions)
-
- outcome, _ = await _run(script, tools, completion_probe=probe, on_action_round=on_action_round)
-
- assert outcome.status == "completed"
- assert outcome.reason == "a file finished downloading"
- assert len(clicks) == 1 # the second batched click never ran
- assert outcome.tool_calls == 1
- # The click that produced the download must be billed and persisted, not lost because the
- # probe fired before the recording step that appends it.
- assert outcome.billable_actions == ["click"]
- assert recorded_rounds == [[RoundAction("click", {"selector": "#a"}, True, billable=True)]]
[email protected]("settle_outcome", ["no_file", "landed", "raises_once", "canceled"])
+async def test_download_settle_accepts_a_completed_finish_it_could_record(settle_outcome: str) -> None:
+ canceled = False
+ raised = False
+ async def settle(_staged: frozenset[str]) -> str | None:
+ nonlocal canceled, raised
+ if settle_outcome == "raises_once" and not raised:
+ raised = True
+ raise RuntimeError("storage unavailable")
+ canceled = settle_outcome == "canceled"
+ return "Downloaded report.csv" if settle_outcome == "landed" else None
-async def test_completion_probe_is_refused_while_verification_never_delivered() -> None:
- # The probe is a second path to `completed` that never reaches the finish tool, so it needs the
- # same verification gate: a file landing after the code source gave up must not read as success.
- now = datetime.now(UTC)
- task = make_task(now, make_organization(now), totp_verification_url="https://example.com/otp")
-
- async def probe(_staged: frozenset[str]) -> str | None:
- return "a file finished downloading"
+ async def should_cancel() -> bool:
+ return canceled
- gave_up = VerificationState(task=task)
- gave_up.arm(VerificationFailure.BUDGET_EXHAUSTED, "get_verification_code")
- outcome, caller = await _run(
- [
- [("click", {"selector": "#a"})],
- [("finish", {"status": "failed", "reason": "the verification step never completed"})],
- ],
- [_billable_tool("click", []), make_finish_tool()],
- completion_probe=probe,
- verification_blocker=gave_up.block_finish,
+ facts = DownloadFailureFacts()
+ facts.add("Request failed: POST /api/collect returned HTTP 404", repeat=True)
+ finish = ("finish", {"status": "completed", "reason": "the account shows 0 records"})
+ outcome, _ = await _run(
+ [[finish], [finish]],
+ [make_finish_tool(download_settle=settle, should_cancel=should_cancel, download_facts=facts)],
+ should_cancel=should_cancel,
)
- assert outcome.status == "failed", outcome.reason
- # The refusal has to REACH the model. DOWNLOAD_COMPLETION_GUIDANCE tells it the run ends on its
- # own and not to call finish(completed), so a silent refusal would leave it acting until a stall
- # guard terminated the run instead of finishing failed with the verification reason.
- assert _COMPLETION_BLOCKED in json.dumps(caller.message_history, default=str)
- # Control: the identical landed download still completes when the source never failed, so the
- # refusal above is the gate firing and not the probe being disabled.
- healthy = VerificationState(task=task)
- ok_outcome, _ = await _run(
- [[("click", {"selector": "#a"})]],
- [_billable_tool("click", []), make_finish_tool()],
- completion_probe=probe,
- verification_blocker=healthy.block_finish,
- )
- assert ok_outcome.status == "completed"
- assert ok_outcome.reason == "a file finished downloading"
+ if settle_outcome == "canceled":
+ assert outcome.status == "canceled"
+ return
+ assert (outcome.status, outcome.reason) == ("completed", "the account shows 0 records")
+ finishes = [m["content"] for m in outcome.messages if m.get("role") == "tool" and m.get("name") == "finish"]
+ # A settle that raised could not record the block's files, so that finish is refused and the retry ends it.
+ assert len(finishes) == (2 if settle_outcome == "raises_once" else 1), finishes
+ assert "POST /api/collect returned HTTP 404" in finishes[-1]
+ assert (DOWNLOAD_NO_FILE_FACT in finishes[-1]) is (settle_outcome != "landed"), finishes
@pytest.mark.asyncio
-async def test_completion_probe_ignores_staged_download_unless_download_notice_too() -> None:
- # file_upload stages an http(s) source file into the same downloads dir and marks it via
- # staged_download; that must not read as the run's own landed download.
- probe_calls = 0
+async def test_a_held_finish_leaves_download_failures_and_files_for_the_accepted_finish() -> None:
+ facts = DownloadFailureFacts()
+ facts.add("Request failed: POST /api/export returned HTTP 503", repeat=True)
+ holds = iter(["the verification code never arrived"])
+ landed = ["guide.txt"]
+ recorded: list[list[str]] = []
- async def probe(_staged: frozenset[str]) -> str | None:
- nonlocal probe_calls
- probe_calls += 1
- return "a file finished downloading"
+ async def verification_blocker(_status: str) -> str | None:
+ return next(holds, None)
- async def staged_only_handler(_args: dict[str, Any]) -> ToolResult:
- return ToolResult.ok("uploaded", data={"staged_download": "x.pdf"})
+ async def settle(_staged: frozenset[str]) -> str | None:
+ recorded.append(list(landed))
+ return f"download completed ({len(landed)} new file(s))"
- staged_only_tool = ToolSpec(
- name="file_upload",
- description="file_upload",
- parameters={"type": "object", "properties": {}},
- handler=staged_only_handler,
- billable=True,
+ async def click(_args: dict[str, Any]) -> ToolResult:
+ landed.append("invoice.txt")
+ return ToolResult.ok("clicked")
+
+ click_tool = ToolSpec(
+ name="click", description="click", parameters={"type": "object", "properties": {}}, handler=click
)
+ finish = ("finish", {"status": "completed", "reason": "done"})
outcome, _ = await _run(
- [[("file_upload", {})], [("finish", {"status": "completed", "reason": "done"})]],
- [staged_only_tool, make_finish_tool()],
- completion_probe=probe,
+ [[finish], [("click", {})], [finish]],
+ [
+ click_tool,
+ make_finish_tool(verification_blocker=verification_blocker, download_facts=facts, download_settle=settle),
+ ],
)
- assert outcome.status == "completed"
- assert outcome.reason == "done" # not the probe's reason -- it was never consulted
- assert probe_calls == 0
- async def staged_and_landed_handler(_args: dict[str, Any]) -> ToolResult:
- return ToolResult.ok("uploaded", data={"staged_download": "x.pdf", "download_notice": True})
-
- staged_and_landed_tool = ToolSpec(
- name="file_upload",
- description="file_upload",
- parameters={"type": "object", "properties": {}},
- handler=staged_and_landed_handler,
- billable=True,
- )
- outcome2, _ = await _run(
- [[("file_upload", {})]],
- [staged_and_landed_tool, make_finish_tool()],
- completion_probe=probe,
- )
- assert outcome2.status == "completed"
- assert outcome2.reason == "a file finished downloading"
- assert probe_calls == 1
+ finishes = [m["content"] for m in outcome.messages if m.get("role") == "tool" and m.get("name") == "finish"]
+ assert len(finishes) == 2
+ assert "HTTP 503" not in finishes[0] and "HTTP 503" in finishes[1]
+ # The settle finalizes the block's files, so it runs once, for the finish that ends the block.
+ assert recorded == [["guide.txt", "invoice.txt"]]
@pytest.mark.asyncio
-async def test_completion_probe_gated_on_billable_or_download_notice() -> None:
- probe_calls = 0
-
- async def probe(_staged: frozenset[str]) -> str | None:
- nonlocal probe_calls
- probe_calls += 1
- return None
+async def test_finish_shows_at_most_the_capped_download_failures() -> None:
+ facts = DownloadFailureFacts()
- async def observe_handler(_args: dict[str, Any]) -> ToolResult:
- return ToolResult.ok("observed")
-
- observe_tool = ToolSpec(
- name="observe", description="observe", parameters={"type": "object", "properties": {}}, handler=observe_handler
- )
-
- async def check_download_handler(_args: dict[str, Any]) -> ToolResult:
- return ToolResult.ok("download seen", data={"download_notice": True})
+ async def click(args: dict[str, Any]) -> ToolResult:
+ # The last failure past the cap repeats; it is still one failure.
+ for i in [*range(DOWNLOAD_FAILURE_MAX_LINES + 2), DOWNLOAD_FAILURE_MAX_LINES + 1]:
+ facts.add(f"Request failed: GET /api/{args['batch']}{i} returned HTTP 503", repeat=True)
+ return ToolResult.ok("clicked")
- download_tool = ToolSpec(
- name="check_download",
- description="check_download",
- parameters={"type": "object", "properties": {}},
- handler=check_download_handler,
+ click_tool = ToolSpec(
+ name="click", description="click", parameters={"type": "object", "properties": {}}, handler=click
)
-
script = [
- [("observe", {})], # non-billable, no download_notice -> probe not consulted
- [("check_download", {})], # non-billable but download_notice -> probe consulted
+ [("click", {"batch": "a"})],
[("finish", {"status": "completed", "reason": "done"})],
]
- outcome, _ = await _run(script, [observe_tool, download_tool, make_finish_tool()], completion_probe=probe)
-
- assert outcome.status == "completed"
- assert probe_calls == 1
-
-
-async def test_completion_probe_exception_is_logged_and_treated_as_none() -> None:
- async def probe(_staged: frozenset[str]) -> str | None:
- raise RuntimeError("boom")
-
- clicks: list[tuple[str, dict[str, Any]]] = []
- tools = [_billable_tool("click", clicks), make_finish_tool()]
- script = [[("click", {"selector": "#a"})], [("finish", {"status": "completed", "reason": "done normally"})]]
- with capture_logs() as logs:
- outcome, _ = await _run(script, tools, completion_probe=probe)
-
- assert outcome.status == "completed"
- assert outcome.reason == "done normally"
- assert any(log["log_level"] == "warning" for log in logs)
-
-
-async def test_completion_blocker_gates_completed_status_only() -> None:
- # completed: blocked once, then allowed once the blocker clears.
- responses = iter(["wait: the download has not started yet", None])
-
- async def blocker(_staged: frozenset[str]) -> str | None:
- return next(responses)
-
- tools = [make_finish_tool(completion_blocker=blocker)]
- script = [
- [("finish", {"status": "completed", "reason": "first attempt"})],
- [("finish", {"status": "completed", "reason": "second attempt"})],
- ]
- outcome, caller = await _run(script, tools)
- assert outcome.status == "completed"
- assert outcome.reason == "second attempt"
- assert caller.calls == 2 # the first finish was rejected, forcing a second turn
-
- # failed: the blocker is never consulted, even though it would block if asked.
- async def always_blocks(_staged: frozenset[str]) -> str | None:
- return "should never be read"
+ outcome, _ = await _run(script, [click_tool, make_finish_tool(download_facts=facts)])
- tools2 = [make_finish_tool(completion_blocker=always_blocks)]
- outcome2, _ = await _run([[("finish", {"status": "failed", "reason": "blocked reason"})]], tools2)
- assert outcome2.status == "failed"
- assert outcome2.reason == "blocked reason"
+ assert (outcome.status, outcome.reason) == ("completed", "done")
+ [finished] = [m["content"] for m in outcome.messages if m.get("role") == "tool" and m.get("name") == "finish"]
+ assert finished.count("Request failed:") == DOWNLOAD_FAILURE_MAX_LINES and "+2 more failures" in finished
+ assert not facts.undelivered
def _gate_refusals(outcome: LoopOutcome) -> int:
@@ -8881,78 +8783,27 @@ async def test_completion_gate_never_holds_a_non_completed_finish(status: str) -
@pytest.mark.asyncio
- "finish_kwargs, held_with",
- [
- (
- {"completion_blocker": lambda _downloads: _async_value("the download has not landed")},
- "the download has not landed",
- ),
- (
- {"page_fingerprint": lambda: _async_value(str(time.monotonic_ns())), "settle_wait_seconds": 0},
- "still rendering",
- ),
- ],
- ids=["completion_blocker", "unsettled_page"],
-)
-async def test_an_earlier_completed_side_hold_answers_before_the_completion_gate_is_spent(
- finish_kwargs: dict[str, Any], held_with: str
-) -> None:
+async def test_an_earlier_completed_side_hold_answers_before_the_completion_gate_is_spent() -> None:
gate = _CountingGate()
- outcome, _ = await _run(
- [[("finish", {"status": "completed", "reason": "done"})]],
- [make_finish_tool(completion_gate=gate, **finish_kwargs)],
+ finish = make_finish_tool(
+ completion_gate=gate, page_fingerprint=lambda: _async_value(str(time.monotonic_ns())), settle_wait_seconds=0
)
+ outcome, _ = await _run([[("finish", {"status": "completed", "reason": "done"})]], [finish])
first_finish_result = next(m["content"] for m in outcome.messages if m.get("role") == "tool")
- assert held_with in first_finish_result
+ assert "still rendering" in first_finish_result
assert gate.calls == 0
-async def test_completion_blocker_exception_fails_closed() -> None:
- # A transient storage error checking for a landed download is evidence of nothing -- it must
- # not let a download-gated task complete with no file. finish(failed) is unaffected.
- calls = 0
-
- async def blocker(_staged: frozenset[str]) -> str | None:
- nonlocal calls
- calls += 1
- raise RuntimeError("boom")
-
- tools = [make_finish_tool(completion_blocker=blocker)]
- script = [
- [("finish", {"status": "completed", "reason": "first attempt"})],
- [("finish", {"status": "failed", "reason": "give up"})],
- ]
- with capture_logs() as logs:
- outcome, caller = await _run(script, tools)
-
- assert outcome.status == "failed"
- assert outcome.reason == "give up"
- assert caller.calls == 2 # the completed attempt was rejected, forcing a second turn
- assert calls == 1 # a failed verdict never consults the blocker
- assert any(log["log_level"] == "warning" for log in logs)
- rejected_tool_messages = [
- m for m in outcome.messages if m.get("role") == "tool" and "Could not verify" in m.get("content", "")
- ]
- assert len(rejected_tool_messages) == 1
-
-
@pytest.mark.asyncio
async def test_staged_download_stays_excluded_for_the_rest_of_the_run() -> None:
- # file_upload's staged http(s) source fetch must not be treated as a landed download by any
- # LATER probe/blocker call this run -- not just skipped for the tool call that staged it.
+ # file_upload's staged http(s) source fetch must not be treated as a landed download by a
+ # LATER settle this run -- not just skipped for the tool call that staged it.
staged_downloads: set[str] = set()
- probe_seen: list[frozenset[str]] = []
- blocker_seen: list[frozenset[str]] = []
-
- async def probe(staged: frozenset[str]) -> str | None:
- probe_seen.append(staged)
- return None
+ settle_seen: list[frozenset[str]] = []
- async def blocker(staged: frozenset[str]) -> str | None:
- blocker_seen.append(staged)
+ async def settle(staged: frozenset[str]) -> str | None:
+ settle_seen.append(staged)
return None
async def stage_handler(_args: dict[str, Any]) -> ToolResult:
@@ -8969,20 +8820,17 @@ async def test_staged_download_stays_excluded_for_the_rest_of_the_run() -> None:
tools = [
stage_tool,
_billable_tool("click", click_calls),
- make_finish_tool(completion_blocker=blocker, staged_downloads=staged_downloads),
+ make_finish_tool(download_settle=settle, staged_downloads=staged_downloads),
]
script = [
[("file_upload", {})],
[("click", {"selector": "#a"})],
[("finish", {"status": "completed", "reason": "done"})],
]
- outcome, _ = await _run(script, tools, completion_probe=probe, staged_downloads=staged_downloads)
+ outcome, _ = await _run(script, tools, staged_downloads=staged_downloads)
assert outcome.status == "completed"
- # The staging call itself never consults the probe (no download_notice); the next billable
- # call's probe already carries the name it staged.
- assert probe_seen == [frozenset({"in.pdf"})]
- assert blocker_seen == [frozenset({"in.pdf"})]
+ assert settle_seen == [frozenset({"in.pdf"})]
# --- SKY-15020 Lever C: net-progress _ProgressLedger (additive shadow) ---
@@ -10832,45 +10680,6 @@ async def test_canonical_loop_not_masked_by_replayed_download_notice() -> None:
assert [e["repeat_count"] for e in fires] == [3, 4]
-async def test_canonical_loop_suppressed_when_completion_probe_fires_on_the_rung_touch() -> None:
- # complete_on_download: the file can land while the probe waits, AFTER the tool result returned
- # without download_new. The probe's outcome skips the end-of-batch detector, but the pending
- # rung minted by that same touch must not be emitted — the run completed on real progress.
- from skyvern.forge.taskv3.loop import CANONICAL_LOOP_EVENT
-
- calls = {"n": 0}
-
- async def handler(args: dict[str, Any]) -> ToolResult:
- calls["n"] += 1
- return ToolResult.error("click refused") if calls["n"] < 3 else ToolResult.ok("clicked")
-
- click = ToolSpec(
- name="click",
- description="click",
- parameters={"type": "object", "properties": {}},
- handler=handler,
- billable=True,
- )
-
- async def probe(_staged: frozenset[str]) -> str | None:
- return "a file finished downloading" if calls["n"] >= 3 else None
-
- script = [
- [("click", {"selector": "#dl", "note": "a"})],
- [("click", {"selector": "#dl", "note": "b"})],
- [("click", {"selector": "#dl", "note": "c"})],
- [("finish", {"status": "failed", "reason": "unreached"})],
- ]
- with capture_logs() as logs:
- outcome, _ = await _run(
- script, [click, make_finish_tool()], completion_probe=probe, max_turns=50, max_tool_calls=100
- )
- assert outcome.status == "completed"
- assert outcome.reason == "a file finished downloading"
- assert [e for e in logs if e.get("event") == CANONICAL_LOOP_EVENT] == []
-
-
@pytest.mark.asyncio
async def test_canonical_loop_not_masked_by_missing_probe_samples() -> None:
# A missing probe sample around a failed dispatch is not evidence of a page change: intermittent
@@ -11074,41 +10883,6 @@ async def test_canonical_loop_clears_on_new_low_even_under_a_replayed_notice() -
assert [e for e in logs if e.get("event") == CANONICAL_LOOP_EVENT] == []
-async def test_completion_probe_spares_a_sibling_targets_rung() -> None:
- # Blocker 2 (AronPerez round 10): the probe firing is progress for the COMPLETING touch only.
- # A five-error streak on one selector minted a genuine rung 6 the same batch a download on a
- # DIFFERENT selector completed the run — that sibling rung is real data and must survive.
- from skyvern.forge.taskv3.loop import CANONICAL_LOOP_EVENT
-
- touches: list[tuple[str, dict[str, Any]]] = []
- fetched = {"done": False}
-
- async def fetch_handler(_args: dict[str, Any]) -> ToolResult:
- fetched["done"] = True
- return ToolResult.ok("fetch dispatched")
-
- fetch = ToolSpec(
- name="fetch",
- description="fetch",
- parameters={"type": "object", "properties": {}},
- handler=fetch_handler,
- billable=True,
- )
-
- async def probe(_staged: frozenset[str]) -> str | None:
- return "a file finished downloading" if fetched["done"] else None
-
- script = [[("click", {"selector": "#stuck", "note": str(i)})] for i in range(5)]
- script.append([("click", {"selector": "#stuck", "note": "sixth"}), ("fetch", {"selector": "#other"})])
- tools = [_error_billable_tool("click", touches), fetch, make_finish_tool()]
- with capture_logs() as logs:
- outcome, _ = await _run(script, tools, completion_probe=probe, max_turns=50, max_tool_calls=100)
- assert outcome.status == "completed"
- fires = [e for e in logs if e.get("event") == CANONICAL_LOOP_EVENT]
- assert [e["repeat_count"] for e in fires] == [3, 4, 6]
-
-
@pytest.mark.asyncio
async def test_canonical_rung_rearms_after_full_eviction() -> None:
# A rung re-arms once the target's in-window count dips below it: a fresh streak after full
@@ -11336,7 +11110,6 @@ async def test_a_renumbered_mark_does_not_alias_with_its_pre_renumber_history()
def _awaiting_verification_state(*, spent: float = 120.0, budget: float = 900.0) -> Any:
"""A VerificationState in the exact shape the bug produces: a healthy source that answered "not
yet" one 120s slice ago, with most of the 900s budget still unspent."""
- from skyvern.forge.taskv3.auth_tools import VerificationState
state = VerificationState(
task=SimpleNamespace(task_id="tsk_1", organization_id="o_1", workflow_run_id=None) # type: ignore[arg-type]
@@ -11484,7 +11257,6 @@ async def test_a_completion_blocked_run_still_escapes_via_failed_at_production_w
# terminally-failed source returns None from `block_giveup` by construction: giving up IS the
# correct answer once the source has been judged. Asserted against the real VerificationState,
# not a mock that cannot disagree with the gate it is standing in for.
- from skyvern.forge.taskv3.auth_tools import VerificationFailure, VerificationState
state = VerificationState(
task=SimpleNamespace(task_id="tsk_1", organization_id="o_1", workflow_run_id=None) # type: ignore[arg-type]
@@ -12790,6 +12562,26 @@ async def test_loop_reads_that_differ_only_in_their_delta_get_the_marker_and_kee
assert reads[0].startswith("[superseded get_html(selector=#a)")
+async def test_a_re_read_that_differs_only_by_a_download_failure_gets_the_marker_and_keeps_the_failure() -> None:
+ body = "<form #a>" + "y" * 2_000
+ failure = "Request failed: POST /api/export returned HTTP 503"
+ results = [ToolResult.ok(body), ToolResult.ok(f"{body}\n{failure}", data={"download_failure_at": len(body)})]
+
+ async def get_html(_args: dict[str, Any]) -> ToolResult:
+ return results.pop(0)
+
+ reader = _get_html_tool()
+ reader.handler = get_html
+ script = [[("get_html", {"selector": "#a"})], [("get_html", {"selector": "#a"})]]
+ script.append([("finish", {"status": "completed", "reason": "ok"})])
+ outcome, _ = await _run(script, [reader, make_finish_tool()])
+
+ reread = _tool_contents(outcome, "get_html")[1]
+ assert reread.startswith("[get_html(selector=#a) returned the same "), reread[:120]
+ assert reread.endswith(f"\n{failure}")
+
+
def test_perception_store_does_not_charge_the_unread_round() -> None:
# SKY-16330. The prompt asks the model to batch, so one turn routinely lands several large reads.
# Charging that unread round against the budget would let one batch evict every earlier read — and
@@ -13963,17 +13755,17 @@ async def test_a_mutation_batched_behind_an_accepted_verdict_never_dispatches()
@pytest.mark.asyncio
async def test_hold_gate_snapshot_records_the_verdict_after_a_refused_completion() -> None:
- # A zero-action finish(completed) refused by a gate above -- here the completion blocker -- is
+ # A zero-action finish(completed) refused by a gate above -- here the verification blocker -- is
# followed by finish(failed); the snapshot records that failed verdict, not the refused completion.
activity = ActivityRecency()
fingerprint, _ = _fingerprint_seq(["fp"])
- async def blocker(_staged: frozenset[str]) -> str | None:
- return "wait: the download has not started yet"
+ async def verification_blocker(status: str) -> str | None:
+ return "the verification code was never entered" if status == "completed" else None
tools = [
_perception_tool("observe", _REJECTION_OBSERVE),
- make_finish_tool(page_fingerprint=fingerprint, activity=activity, completion_blocker=blocker),
+ make_finish_tool(page_fingerprint=fingerprint, activity=activity, verification_blocker=verification_blocker),
]
script = [
[("observe", {})],
diff --git a/tests/unit/test_taskv3_tools.py b/tests/unit/test_taskv3_tools.py
index be8bc773e..4c7e7de64 100644
--- a/tests/unit/test_taskv3_tools.py
+++ b/tests/unit/test_taskv3_tools.py
@@ -27,7 +27,7 @@ from html import escape as html_escape
from pathlib import Path
from types import SimpleNamespace
from typing import Any, Awaitable, Callable, NoReturn
-from unittest.mock import AsyncMock
+from unittest.mock import AsyncMock, MagicMock
from urllib.parse import urlparse
import pyotp
@@ -42,6 +42,7 @@ from structlog.testing import capture_logs
import skyvern.forge.taskv3.loop as taskv3_loop
import skyvern.forge.taskv3.tools as taskv3_tools
+import skyvern.webeye.cdp_download_interceptor as cdp_download_interceptor
import skyvern.webeye.navigation as navigation_module
from skyvern.config import settings
from skyvern.exceptions import NO_ADDRESS_RECORD_NAV_ERROR_CODE
@@ -76,6 +77,7 @@ from skyvern.forge.taskv3.loop import (
UnseenPageText,
_navigate_record_fields,
)
+from skyvern.forge.taskv3.opaque_refs import mask_opaque_urls
from skyvern.forge.taskv3.run_arms import LOGIN_PACE_FLAG
# Captured at import (before the _fast_upload_settle autouse fixture rebinds the module attr) so the
@@ -87,6 +89,8 @@ from skyvern.forge.taskv3.tools import (
_SEMANTIC_COMMIT_STATE_JS,
_TYPE_TARGET_PROBE_JS,
_TYPING_REACH_PROBE_JS,
+ DOWNLOAD_NO_FILE_THIS_ACTION,
+ DOWNLOAD_NO_SESSION_FILE_YET,
NAVIGATION_DEAD_END_STATUSES,
OBSERVE_DISPLAY_WIDTHS,
OBSERVE_POINTER_ROOT_CAP,
@@ -94,6 +98,7 @@ from skyvern.forge.taskv3.tools import (
OBSERVE_SELECTED_OPTIONS_TOTAL_CAP,
PAGE_UNAVAILABLE_ERROR,
BlankWorkingPageGuard,
+ DownloadFailureWatch,
_annotate_screenshot,
_exact_tier_key,
_invalid_selector_result,
@@ -108,6 +113,7 @@ from skyvern.forge.taskv3.tools import (
pending_marker,
)
from skyvern.webeye.actions.handler import get_actual_value_of_parameter_if_secret_with_task
+from skyvern.webeye.cdp_download_interceptor import CDPDownloadInterceptor
from tests.unit.scoped_asyncio import ScopedAsyncio
from tests.unit.test_taskv3_loop import _ScriptedCaller
@@ -297,6 +303,7 @@ class _FakeRequest:
self.resource_type = resource_type
self.url = url
self.post_data: str | None = None
+ self.failure: str | None = None
class _FakeObserveElementProperty:
@@ -8956,6 +8963,113 @@ async def _prime(tools: list[Any]) -> None:
await _tool(tools, "wait").handler({"time_ms": 1})
+class _GeneratedNameDownloadPage(_DownloadFakePage):
+ """A browser that owns its downloads: the file lands under a generated id while the page named it."""
+
+ def __init__(self, downloads_dir: Path) -> None:
+ super().__init__(downloads_dir)
+ self._download_listeners: list[Any] = []
+ self.context = MagicMock(spec=BrowserContext)
+
+ def on(self, event: str, callback: Any) -> None:
+ if event == "download":
+ self._download_listeners.append(callback)
+ super().on(event, callback)
+
+ def remove_listener(self, event: str, callback: Any) -> None:
+ if event == "download":
+ self._download_listeners.remove(callback)
+
+ async def click(self, selector: str, timeout: int | None = None) -> None:
+ download = SimpleNamespace(
+ suggested_filename="dl1_receipt.txt", path=AsyncMock(return_value=str(self._downloads_dir / "c5cf4832"))
+ )
+ for listener in self._download_listeners:
+ listener(download)
+ (self._downloads_dir / "c5cf4832.txt").write_bytes(b"x" * 46)
+ await super().click(selector, timeout=timeout)
+
+
+async def test_a_download_saved_under_a_generated_id_is_reported_by_the_pages_name(tmp_path: Path) -> None:
+ page = _GeneratedNameDownloadPage(tmp_path)
+ watch = DownloadFailureWatch(_fixed_page_provider(page))
+ tools = build_browser_tools(_fixed_page_provider(page), downloads_dir=str(tmp_path), download_failures=watch)
+ result = await _tool(tools, "click").handler({"selector": "#dl"})
+ watch.close()
+
+ assert "Downloaded: dl1_receipt.txt (46 B)" in result.content, result.content
+
+
[email protected]("block", ["complete_on_download", "download_timeout_only"])
+async def test_a_download_stored_only_in_the_browser_session_is_reported(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch, block: str
+) -> None:
+ earlier = "s3://bucket/o_1/pbs_1/earlier.pdf"
+ listings = [[earlier], [earlier, "s3://bucket/o_1/pbs_1/statement.pdf"]]
+ listing = AsyncMock(side_effect=lambda **_kwargs: listings.pop(0) if len(listings) > 1 else listings[0])
+ monkeypatch.setattr("skyvern.forge.taskv3.tools.app.STORAGE.list_downloaded_files_in_browser_session", listing)
+ page = _DownloadFakePage(tmp_path)
+
+ async def download_wait() -> None:
+ return None
+
+ # A download_timeout-only block waits on downloads but has no failure watch.
+ watch = DownloadFailureWatch(_fixed_page_provider(page)) if block == "complete_on_download" else None
+ tools = build_browser_tools(
+ _fixed_page_provider(page), downloads_dir=str(tmp_path), download_failures=watch, download_wait=download_wait
+ )
+ with skyvern_context.scoped(SkyvernContext(organization_id="o_1", browser_session_id="pbs_1")):
+ result = await _tool(tools, "click").handler({"selector": "#dl"})
+ if watch is not None:
+ watch.close()
+
+ assert "Downloaded: statement.pdf (in the browser session's storage)" in result.content, result.content
+ assert "earlier.pdf" not in result.content
+
+
+async def test_a_session_baseline_hides_old_files_and_absence_is_claimed_only_after_a_read_baseline(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ earlier = "s3://bucket/o_1/pbs_1/earlier.pdf"
+ listings: list[list[str] | Exception] = [
+ TimeoutError(),
+ [earlier],
+ [earlier, "s3://bucket/o_1/pbs_1/statement.pdf"],
+ [earlier, "s3://bucket/o_1/pbs_1/statement.pdf"],
+ ]
+
+ async def listing(**_kwargs: str) -> list[str]:
+ item = listings.pop(0)
+ if isinstance(item, Exception):
+ raise item
+ return item
+
+ async def download_wait() -> None:
+ return None
+
+ monkeypatch.setattr("skyvern.forge.taskv3.tools.app.STORAGE.list_downloaded_files_in_browser_session", listing)
+ page = _DownloadFakePage(tmp_path)
+ watch = DownloadFailureWatch(_fixed_page_provider(page))
+ tools = build_browser_tools(
+ _fixed_page_provider(page), downloads_dir=str(tmp_path), download_failures=watch, download_wait=download_wait
+ )
+ with skyvern_context.scoped(SkyvernContext(organization_id="o_1", browser_session_id="pbs_1")):
+ first = await _tool(tools, "click").handler({"selector": "#go"})
+ second = await _tool(tools, "click").handler({"selector": "#dl"})
+ third = await _tool(tools, "click").handler({"selector": "#again"})
+ watch.close()
+
+ assert "earlier.pdf" not in first.content + second.content
+ # The first click's listing only set the baseline, so what is missing is unknown and nothing is said.
+ assert DOWNLOAD_NO_FILE_THIS_ACTION not in first.content and DOWNLOAD_NO_SESSION_FILE_YET not in first.content
+ assert "Downloaded: statement.pdf (in the browser session's storage)" in second.content, second.content
+ # A session's storage can get a file after the call returns, so its absence is stated as "yet".
+ assert DOWNLOAD_NO_SESSION_FILE_YET in third.content and DOWNLOAD_NO_FILE_THIS_ACTION not in third.content
+
+
@pytest.mark.asyncio
async def test_download_signal_reports_completed_download_then_is_absent(tmp_path: Path) -> None:
page = _DownloadFakePage(tmp_path)
@@ -9047,6 +9161,29 @@ async def test_download_signal_lifecycle_started_then_completed_or_never(tmp_pat
assert "Download started: export (in progress — not yet complete)" in r6.content
[email protected]("wait_fails", [False, True])
+async def test_a_click_result_reports_the_download_its_wait_saw_finish(tmp_path: Path, wait_fails: bool) -> None:
+ temp_name = "report.pdf." + "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6" + ".crdownload"
+ page = _DownloadFakePage(tmp_path)
+ page._click_writes = temp_name
+
+ async def download_wait() -> None:
+ if wait_fails:
+ raise RuntimeError("download wait broke")
+ if (tmp_path / temp_name).exists():
+ (tmp_path / temp_name).rename(tmp_path / "report.pdf")
+
+ tools = build_browser_tools(_fixed_page_provider(page), downloads_dir=str(tmp_path), download_wait=download_wait)
+ await _prime(tools)
+ result = await _tool(tools, "click").handler({"selector": "#dl"})
+
+ if wait_fails:
+ assert "Download started: report.pdf (in progress — not yet complete)" in result.content
+ else:
+ assert "Downloaded: report.pdf" in result.content and "Download started" not in result.content
+
+
@pytest.mark.asyncio
async def test_download_signal_sanitizes_display_name(tmp_path: Path) -> None:
tools = build_browser_tools(_fixed_page_provider(_FakePage()), downloads_dir=str(tmp_path))
@@ -9187,6 +9324,241 @@ async def test_download_signal_survives_compaction_end_to_end_through_loop(tmp_p
assert any("Downloaded: report.pdf" in m["content"] for m in observe_msgs) # notice survives on a live message
+_SIGNED_EXPORT_URL = (
+ "https://files.example.test/exports/tok-9f8e7d6c5b4a3f2e/report.csv"
+ "?X-Amz-Signature=3f9a1c7e5b2d8f4a6c0e9b1d3f5a7c9e&X-Amz-Expires=300"
+)
+_EXPORT_PAGE = f"""<!doctype html><html><body>
+<button id="export" type="button" onclick="fetch('/api/export', {{method: 'POST'}}).catch(() => {{}})">Export</button>
+<button id="burst" type="button" onclick="['a', 'b', 'c', 'd'].forEach((p) => fetch('/api/' + p).catch(() => {{}}))">Burst</button>
+<a id="report" href="/report">Report</a>
+<a id="download" href="/download">Download</a>
+<a id="signed" href="{_SIGNED_EXPORT_URL}">Signed report</a>
+<a id="wrapped" href="/report?src={_SIGNED_EXPORT_URL}">Wrapped report</a>
+<button id="hang" type="button" onclick="fetch('/api/hang').catch(() => {{}})">Hang</button>
+<button id="noop" type="button">Noop</button>
+<ul id="rows"></ul>
+</body></html>"""
+
+
+async def _serve_export(route: Route) -> None:
+ path = urlparse(route.request.url).path
+ if path == "/":
+ await route.fulfill(status=200, content_type="text/html", body=_EXPORT_PAGE)
+ return
+ if path == "/download":
+ await route.fulfill(
+ status=200, headers={"content-disposition": "attachment; filename=report.csv"}, body="a,b\n"
+ )
+ return
+ if path == "/api/export":
+ # Answers well after the click's own handler returns.
+ await asyncio.sleep(1.2)
+ await route.fulfill(status=503, body="unavailable")
+
+
+async def _export_page() -> AsyncIterator[Page]:
+ async with _page_context(viewport={"width": 1024, "height": 900}) as context:
+ await context.route("**/*", _serve_export)
+ page = await context.new_page()
+ await page.goto("http://app.example.test/")
+ yield page
+
+
+def _failure_tail(result: ToolResult) -> str:
+ return result.content[(result.data or {})["download_failure_at"] :]
+
+
+@_skip_no_browser
[email protected]("action", ["click", "press_key"])
+async def test_a_download_action_whose_request_fails_late_reports_the_status(tmp_path: Path, action: str) -> None:
+ async with _export_page() as page:
+ watch = DownloadFailureWatch(_fixed_page_provider(page))
+ tools = build_browser_tools(_fixed_page_provider(page), downloads_dir=str(tmp_path), download_failures=watch)
+ if action == "press_key":
+ await page.focus("#export")
+ result = await _tool(tools, "press_key").handler({"key": "Enter"})
+ else:
+ result = await _tool(tools, "click").handler({"selector": "#export"})
+ watch.close()
+
+ tail = _failure_tail(result)
+ assert "Request failed: POST /api/export returned HTTP 503" in tail, result.content
+ assert tail.endswith(DOWNLOAD_NO_FILE_THIS_ACTION), tail
+ assert not (result.data or {}).get("download_notice") and not (result.data or {}).get("download_new")
+
+
+@_skip_no_browser
[email protected]("link", ["report", "signed", "wrapped"])
+async def test_a_link_click_to_a_failing_document_reports_only_its_path(tmp_path: Path, link: str) -> None:
+ refs = mask_opaque_urls({"export": _SIGNED_EXPORT_URL})
+ async with _export_page() as page:
+ watch = DownloadFailureWatch(_fixed_page_provider(page), refs)
+ tools = build_browser_tools(
+ _fixed_page_provider(page), downloads_dir=str(tmp_path), opaque_refs=refs, download_failures=watch
+ )
+ result = await _tool(tools, "click").handler({"selector": f"#{link}"})
+ watch.close()
+
+ tail = _failure_tail(result)
+ if link == "signed":
+ assert f"Request failed: GET {refs.mask(_SIGNED_EXPORT_URL)} returned HTTP 503" in tail, result.content
+ else:
+ assert "Request failed: GET /report returned HTTP 503" in tail, result.content
+ assert "tok-9f8e7d6c5b4a3f2e" not in tail and "example.test" not in tail and "src=" not in tail
+
+
+@_skip_no_browser
+async def test_a_healthy_download_link_reports_no_failure(tmp_path: Path) -> None:
+ # The browser aborts a navigation it turns into a download after the response arrived.
+ async with _export_page() as page:
+ watch = DownloadFailureWatch(_fixed_page_provider(page))
+ tools = build_browser_tools(_fixed_page_provider(page), downloads_dir=str(tmp_path), download_failures=watch)
+ result = await _tool(tools, "click").handler({"selector": "#download"})
+ await _tool(tools, "wait").handler({"time_ms": 500})
+ watch.close()
+
+ assert "Request failed" not in result.content, result.content
+ assert watch.facts.delivered == set()
+
+
+@_skip_no_browser
+async def test_failures_are_reported_past_a_full_file_notice_and_capped(tmp_path: Path) -> None:
+ async with _export_page() as page:
+ watch = DownloadFailureWatch(_fixed_page_provider(page))
+ tools = build_browser_tools(_fixed_page_provider(page), downloads_dir=str(tmp_path), download_failures=watch)
+ await _prime(tools)
+ for i in range(6):
+ (tmp_path / f"part{i}.csv").write_text("a,b\n")
+ result = await _tool(tools, "click").handler({"selector": "#burst"})
+ watch.close()
+
+ assert "+1 more files downloaded" in result.content
+ tail = _failure_tail(result)
+ assert tail.count("Request failed: GET /api/") == 3 and "+1 more failures" in tail, tail
+ assert (result.data or {}).get("download_new") is True
+
+
+@_skip_no_browser
+async def test_a_failure_between_calls_reaches_the_next_read_without_changing_its_digest(tmp_path: Path) -> None:
+ async with _export_page() as page:
+ watch = DownloadFailureWatch(_fixed_page_provider(page))
+ tools = build_browser_tools(_fixed_page_provider(page), downloads_dir=str(tmp_path), download_failures=watch)
+ observe = _tool(tools, "observe")
+ await observe.handler({})
+ await page.evaluate(
+ "async () => { const li = document.createElement('li'); li.textContent = 'Export queued';"
+ " document.getElementById('rows').appendChild(li); await fetch('/api/poll'); }"
+ )
+ with_failure = await observe.handler({})
+ without_failure = await observe.handler({})
+ watch.close()
+
+ assert _delta_lines(with_failure) == ["Export queued"], with_failure.content
+ assert "Request failed: GET /api/poll returned HTTP 503" in _failure_tail(with_failure)
+ assert "download_failure_at" not in (without_failure.data or {})
+
+ def digest(r: ToolResult) -> str:
+ data = r.data or {}
+ return taskv3_loop._canonical_perception_content(
+ taskv3_loop.perception_digest_source(r.content, data.get("download_failure_at")),
+ is_observe=True,
+ clip_spans=data.get("clip_spans"),
+ delta_at=data.get("delta_at"),
+ delta_end=data.get("delta_end"),
+ )
+
+ assert digest(with_failure) == digest(without_failure)
+
+
+@_skip_no_browser
+async def test_a_click_does_not_wait_on_a_request_an_earlier_click_started(tmp_path: Path) -> None:
+ release = asyncio.Event()
+
+ async def hang(route: Route) -> None:
+ await release.wait()
+ await route.fulfill(status=503, body="unavailable")
+
+ async with _export_page() as page:
+ await page.context.route("**/api/hang", hang)
+ watch = DownloadFailureWatch(_fixed_page_provider(page))
+ tools = build_browser_tools(_fixed_page_provider(page), downloads_dir=str(tmp_path), download_failures=watch)
+ click = _tool(tools, "click")
+ await click.handler({"selector": "#hang"})
+ started = time.monotonic()
+ await click.handler({"selector": "#noop"})
+ elapsed = time.monotonic() - started
+ release.set()
+ late = await _tool(tools, "wait").handler({"time_ms": 300})
+ watch.close()
+
+ assert elapsed < 2.0, elapsed
+ assert "Request failed: GET /api/hang returned HTTP 503" in _failure_tail(late), late.content
+
+
+@_skip_no_browser
+async def test_a_browser_download_the_interceptor_could_not_save_is_reported(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ egress = MagicMock()
+ egress.authorize_request.return_value = True
+ interceptor = CDPDownloadInterceptor(network_egress_monitor=egress, redirect_hop_authorizer=AsyncMock())
+ async with _export_page() as page:
+ page.context._skyvern_cdp_download_interceptor = interceptor
+ watch = DownloadFailureWatch(_fixed_page_provider(page))
+ tools = build_browser_tools(_fixed_page_provider(page), downloads_dir=str(tmp_path), download_failures=watch)
+ await _prime(tools)
+ monkeypatch.setattr(cdp_download_interceptor, "MAX_DOWNLOAD_FILES_PER_RUN", 0)
+ assert interceptor._new_download_attempt() is None
+ result = await _tool(tools, "wait").handler({"time_ms": 1})
+ watch.close()
+
+ assert "Browser download not saved (file_count_limit): 1" in _failure_tail(result), result.content
+
+
+async def test_the_failure_watch_waits_only_on_its_own_call_and_reports_only_the_path() -> None:
+ refs = mask_opaque_urls({"export": _SIGNED_EXPORT_URL})
+ watch = DownloadFailureWatch(_fixed_page_provider(_FakePage()), refs)
+ on = watch._hooks
+ first = await watch.begin()
+ on["request"](_FakeRequest(method="GET", resource_type="fetch", url="https://app.example.test/api/hang"))
+ assert await watch.settle(first, wait=False) == []
+
+ second = await watch.begin()
+ export = _FakeRequest(resource_type="fetch", url="https://app.example.test/api/export?mode=fail")
+ signed = _FakeRequest(method="GET", resource_type="document", url=_SIGNED_EXPORT_URL)
+ saved = _FakeRequest(method="GET", resource_type="document", url="https://app.example.test/download")
+ for request, status in ((export, 503), (signed, 503), (saved, 200)):
+ on["request"](request)
+ on["response"](SimpleNamespace(request=request, status=status))
+ saved.failure = "net::ERR_ABORTED"
+ on["requestfailed"](saved)
+ facts = await asyncio.wait_for(watch.settle(second, wait=True), timeout=1.0)
+
+ assert facts == [
+ "Request failed: POST /api/export returned HTTP 503",
+ f"Request failed: GET {refs.mask(_SIGNED_EXPORT_URL)} returned HTTP 503",
+ ]
+
+ poll = _FakeRequest(method="GET", resource_type="fetch", url="https://app.example.test/api/poll")
+ reports: list[list[str]] = []
+ for _ in range(2):
+ on["request"](poll)
+ on["response"](SimpleNamespace(request=poll, status=503))
+ on["requestfinished"](poll)
+ reports.append(await watch.settle(await watch.begin(), wait=True))
+ assert reports == [["Request failed: GET /api/poll returned HTTP 503"], []]
+
+
@pytest.mark.asyncio
async def test_navigate_dead_end_terminates_run_through_real_handler(monkeypatch: pytest.MonkeyPatch) -> None:
# End-to-end through the REAL navigate handler and the REAL loop (not a fake tool): a model-issued
@@ -43419,6 +43791,126 @@ async def test_type_reads_every_field_back_and_names_what_it_holds(
assert f"'{held}'" in r.content, r.content
+# A text field in a canvas-drawn app's accessibility tree: the app owns the value, starts editing the field on the
+# first animation frame after it gains focus, and then writes its own copy over the input. Text that lands in the
+# input before that frame never reaches the app. Frames are paced slow, as on an app painting in software, so a
+# single fill always lands before that frame. With window.__refuse set, the app also drops every edit it receives.
+_DEFERRED_EDITING_FIELD_HTML = """
+<flt-semantics-host>
+ <flt-semantics data-semantics-role="text-field"><input id="field" type="password" aria-label="Password"></flt-semantics>
+</flt-semantics-host>
+<input id="plain" type="password" aria-label="Other password">
+<script>
+ let frame = [];
+ window.requestAnimationFrame = (callback) => {
+ if (!frame.length) {
+ setTimeout(() => { const run = frame; frame = []; run.forEach((cb) => cb(performance.now())); }, 500);
+ }
+ frame.push(callback);
+ return frame.length;
+ };
+ const field = document.getElementById("field");
+ let held = "";
+ let editing = false;
+ field.addEventListener("focus", () => requestAnimationFrame(() => {
+ editing = true;
+ field.value = held;
+ }));
+ field.addEventListener("blur", () => { editing = false; });
+ field.addEventListener("input", () => {
+ if (!editing) return;
+ held = window.__refuse ? "" : field.value;
+ if (window.__refuse) requestAnimationFrame(() => { field.value = held; });
+ });
+</script>
+"""
+_SYNTHETIC_SECRET = "Zx9-synthetic-pass"
+_NEXT_TWO_FRAMES_JS = "() => new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(done)))"
+_NO_FRAME_JS = "() => new Promise(() => {})"
+
+
+def _deferred_editing_tools(page: Any) -> Any:
+ return build_browser_tools(
+ _fixed_page_provider(page),
+ resolve_typed_text=lambda text: _SYNTHETIC_SECRET if text == "placeholder_pw" else text,
+ )
+
+
+@_skip_no_browser
+async def test_type_keeps_a_secret_in_a_field_that_starts_editing_a_frame_after_focus() -> None:
+ async with _content_page(_DEFERRED_EDITING_FIELD_HTML) as page:
+ r = await _tool(_deferred_editing_tools(page), "type").handler({"selector": "#field", "text": "placeholder_pw"})
+ await page.evaluate(_NEXT_TWO_FRAMES_JS)
+ held = await page.eval_on_selector("#field", "el => el.value")
+ assert (r.status, held) == ("ok", _SYNTHETIC_SECRET), r.content
+ assert _SYNTHETIC_SECRET not in r.content
+
+
+@_skip_no_browser
+async def test_type_reports_a_secret_a_deferred_editing_field_drops_as_not_held() -> None:
+ async with _content_page(_DEFERRED_EDITING_FIELD_HTML) as page:
+ await page.evaluate("() => { window.__refuse = true; }")
+ r = await _tool(_deferred_editing_tools(page), "type").handler({"selector": "#field", "text": "placeholder_pw"})
+ assert (r.status, r.error_class) == ("error", "text_not_held"), r.content
+ assert _SYNTHETIC_SECRET not in r.content
+
+
+@_skip_no_browser
+async def test_type_into_a_deferred_editing_field_fails_closed_when_no_frame_comes(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(taskv3_tools, "TWO_FRAMES_JS", _NO_FRAME_JS)
+ monkeypatch.setattr(taskv3_tools, "FRAME_SETTLE_TIMEOUT_SECONDS", 0.2)
+ async with _content_page(_DEFERRED_EDITING_FIELD_HTML) as page:
+ started = time.monotonic()
+ r = await _tool(_deferred_editing_tools(page), "type").handler({"selector": "#field", "text": "placeholder_pw"})
+ elapsed = time.monotonic() - started
+ held = await page.eval_on_selector("#field", "el => el.value")
+ assert (r.status, r.error_class) == ("error", "text_not_held"), r.content
+ assert held == "" and _SYNTHETIC_SECRET not in r.content
+ assert elapsed < 10, elapsed
+
+
+@_skip_no_browser
+async def test_type_into_a_deferred_editing_field_stops_when_cancelled_while_waiting_for_a_frame(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(taskv3_tools, "TWO_FRAMES_JS", _NO_FRAME_JS)
+ monkeypatch.setattr(taskv3_tools, "FRAME_SETTLE_TIMEOUT_SECONDS", 60.0)
+ async with _content_page(_DEFERRED_EDITING_FIELD_HTML) as page:
+ typing = asyncio.ensure_future(
+ _tool(_deferred_editing_tools(page), "type").handler({"selector": "#field", "text": "placeholder_pw"})
+ )
+ for _ in range(200):
+ if await page.evaluate("() => document.activeElement?.id === 'field'"):
+ break
+ await asyncio.sleep(0.05)
+ typing.cancel()
+ with pytest.raises(asyncio.CancelledError):
+ await asyncio.wait_for(typing, timeout=5)
+ held = await page.eval_on_selector("#field", "el => el.value")
+ assert held == ""
+
+
+@_skip_no_browser
+async def test_type_into_an_ordinary_password_field_does_not_wait_for_frames(monkeypatch: pytest.MonkeyPatch) -> None:
+ # No frame ever comes, so a frame wait here would fail the type: an ordinary input must not take that path.
+ monkeypatch.setattr(taskv3_tools, "TWO_FRAMES_JS", _NO_FRAME_JS)
+ monkeypatch.setattr(taskv3_tools, "FRAME_SETTLE_TIMEOUT_SECONDS", 60.0)
+ async with _content_page(_DEFERRED_EDITING_FIELD_HTML) as page:
+ r = await asyncio.wait_for(
+ _tool(_deferred_editing_tools(page), "type").handler({"selector": "#plain", "text": "placeholder_pw"}),
+ timeout=30,
+ )
+ held = await page.eval_on_selector("#plain", "el => el.value")
+ assert (r.status, held) == ("ok", _SYNTHETIC_SECRET), r.content
+
+
@_skip_no_browser
@pytest.mark.asyncio
async def test_type_does_not_press_enter_on_a_value_the_field_did_not_keep() -> None:
diff --git a/tests/unit/test_twilio_integration_routes.py b/tests/unit/test_twilio_integration_routes.py
index bab7e02b5..61b993856 100644
--- a/tests/unit/test_twilio_integration_routes.py
+++ b/tests/unit/test_twilio_integration_routes.py
@@ -1314,7 +1314,16 @@ async def _register(
organizations = SimpleNamespace(
get_valid_org_auth_token=AsyncMock(return_value=SimpleNamespace(token="service-account-token"))
)
- monkeypatch.setattr(cm, "app", SimpleNamespace(DATABASE=SimpleNamespace(organizations=organizations)))
+ credentials = SimpleNamespace(get_onepassword_credentials=AsyncMock(return_value=[]))
+ agent_function = SimpleNamespace(enforce_credential_use=AsyncMock())
+ monkeypatch.setattr(
+ cm,
+ "app",
+ SimpleNamespace(
+ DATABASE=SimpleNamespace(organizations=organizations, credentials=credentials),
+ AGENT_FUNCTION=agent_function,
+ ),
+ )
item = SimpleNamespace(fields=[], notes=None)
client = SimpleNamespace(items=SimpleNamespace(get=AsyncMock(return_value=item)))
monkeypatch.setattr(
diff --git a/tests/unit/test_workflow_onepassword_errors.py b/tests/unit/test_workflow_onepassword_errors.py
index 2031c048d..0fb06447a 100644
--- a/tests/unit/test_workflow_onepassword_errors.py
+++ b/tests/unit/test_workflow_onepassword_errors.py
@@ -77,6 +77,7 @@ def mocked_app_database():
original = getattr(forge_app, "DATABASE", None)
forge_app.DATABASE = MagicMock()
forge_app.DATABASE.organizations.get_valid_org_auth_token = AsyncMock(return_value=None)
+ forge_app.DATABASE.credentials.get_onepassword_credentials = AsyncMock(return_value=[])
yield forge_app.DATABASE
if original is None:
del forge_app.DATABASE
@@ -463,6 +464,8 @@ async def test_list_onepassword_items_captures_count_without_item_metadata(
SimpleNamespace(
capture_onepassword_telemetry=capture,
onepassword_instance_default_policy_mode=lambda: "unrestricted",
+ credential_folders_restricted=AsyncMock(return_value=False),
+ accessible_credential_ids=AsyncMock(return_value=set()),
),
)
item = SimpleNamespace(
@@ -471,9 +474,18 @@ async def test_list_onepassword_items_captures_count_without_item_metadata(
category=SimpleNamespace(value="LOGIN"),
websites=[SimpleNamespace(url="https://example.invalid")],
)
+ other_categories = [
+ SimpleNamespace(
+ id=category.lower(),
+ title=category,
+ category=SimpleNamespace(value=category),
+ websites=[],
+ )
+ for category in ("CREDIT_CARD", "PASSWORD", "DOCUMENT")
+ ]
client = MagicMock()
client.vaults.list = AsyncMock(return_value=[SimpleNamespace(id="vault-id", title="Sensitive Vault Name")])
- client.items.list = AsyncMock(return_value=[item])
+ client.items.list = AsyncMock(return_value=[item, *other_categories])
with patch(
"skyvern.forge.sdk.routes.credentials.OnePasswordClient.authenticate",
@@ -482,12 +494,12 @@ async def test_list_onepassword_items_captures_count_without_item_metadata(
):
response = await list_onepassword_items(_make_organization())
- assert len(response.items) == 1
+ assert [item.importable for item in response.items] == [True, True, False, False]
capture.assert_called_once_with(
organization_id="o_test",
event="onepassword.items_loaded",
success=True,
- item_count=1,
+ item_count=4,
)
assert "Sensitive Item Title" not in repr(capture.call_args)
assert "Sensitive Vault Name" not in repr(capture.call_args)
diff --git a/tests/unit/test_workflow_webhook_delivery.py b/tests/unit/test_workflow_webhook_delivery.py
index 883ac3b15..1062690d9 100644
--- a/tests/unit/test_workflow_webhook_delivery.py
+++ b/tests/unit/test_workflow_webhook_delivery.py
@@ -53,6 +53,7 @@ from skyvern.schemas.workflows import WorkflowRetryPolicy
from skyvern.services import run_service
from skyvern.services import webhook_delivery as webhook_delivery_module
from skyvern.services import webhook_service as replay_service
+from tests.unit.forge_log_capture import capture_runtime_logs
from tests.unit.scoped_asyncio import ScopedAsyncio
pytestmark = pytest.mark.usefixtures("public_dns")
@@ -168,16 +169,16 @@ def webhook_service(monkeypatch: pytest.MonkeyPatch) -> tuple[WorkflowService, A
final_exhausted_projection: WebhookDeliveryStatus | None = None,
expected_status: str | None = None,
expected_finished_at: datetime | None = None,
- ) -> int | None:
+ ) -> tuple[int | None, bool]:
rows = await service_module.app.DATABASE.workflow_run_attempts.get_attempts(workflow_run_id)
row = next((row for row in rows if row.attempt_number == attempt_number), None)
if row is None or getattr(row, "side_effects_released_at", None) != expected_claim_at:
- return None
+ return None, False
checkpoint = getattr(row, f"{kind}_side_effects_progress", None) or {}
attempts = checkpoint.get("webhook_delivery_attempts", 0) + 1
assert attempts <= max_attempts
setattr(row, f"{kind}_side_effects_progress", {**checkpoint, "webhook_delivery_attempts": attempts})
- return attempts
+ return attempts, False
monkeypatch.setattr(
service_module.app.DATABASE.workflow_run_attempts,
@@ -2277,7 +2278,7 @@ async def test_interim_delivery_does_not_project_final_status(
monkeypatch.setattr(
service_module.app.DATABASE.workflow_run_attempts,
"reserve_attempt_webhook_delivery",
- AsyncMock(return_value=1),
+ AsyncMock(return_value=(1, False)),
)
monkeypatch.setattr(
service_module.app.DATABASE.workflow_run_attempts, "claim_attempt_webhook", AsyncMock(return_value=True)
@@ -2460,7 +2461,7 @@ async def test_transient_final_failure_before_exhaustion_projects_no_status(
monkeypatch.setattr(
service_module.app.DATABASE.workflow_run_attempts,
"reserve_attempt_webhook_delivery",
- AsyncMock(return_value=1),
+ AsyncMock(return_value=(1, False)),
)
monkeypatch.setattr(service_module, "deliver_webhook_with_retries", AsyncMock(return_value=_response(503)))
@@ -2487,7 +2488,7 @@ async def test_final_outer_exhaustion_projects_exhausted_status(
monkeypatch.setattr(
service_module.app.DATABASE.workflow_run_attempts,
"reserve_attempt_webhook_delivery",
- AsyncMock(return_value=WORKFLOW_WEBHOOK_DELIVERY_MAX_ATTEMPTS),
+ AsyncMock(return_value=(WORKFLOW_WEBHOOK_DELIVERY_MAX_ATTEMPTS, False)),
)
monkeypatch.setattr(
service_module.app.DATABASE.workflow_run_attempts, "claim_attempt_webhook", AsyncMock(return_value=True)
@@ -2599,6 +2600,15 @@ async def test_webhook_reservation_recovery_projects_only_final_exhaustion(
svc, _build_response, _update_run = webhook_service
run = _workflow_run()
run.webhook_callback_url = callback_url
+ monkeypatch.setattr(
+ service_module.app.DATABASE.organizations,
+ "get_organization",
+ AsyncMock(
+ return_value=SimpleNamespace(
+ organization_name="Recovery org", created_at=datetime.now(UTC) - timedelta(days=5)
+ )
+ ),
+ )
sessions = async_sessionmaker(sqlite_engine, expire_on_commit=False)
runs = WorkflowRunsRepository(sessions)
attempts = WorkflowRunAttemptsRepository(sessions)
@@ -2637,13 +2647,13 @@ async def test_webhook_reservation_recovery_projects_only_final_exhaustion(
)
await session.commit()
- reservations: list[int | None] = []
+ reservations: list[tuple[int | None, bool]] = []
reserve = attempts.reserve_attempt_webhook_delivery
expected = current if execution_change == "matching" else None
if kind == "final" and current is None and not stale_claim and execution_change == "matching":
expected = EXHAUSTED if callback_url == DEFAULT_URL else WebhookDeliveryStatus.exhausted_customer_config
- async def record_reservation(*args: Any, **kwargs: Any) -> int | None:
+ async def record_reservation(*args: Any, **kwargs: Any) -> tuple[int | None, bool]:
result = await reserve(*args, **kwargs)
# A worker can stop here, before the service executes another statement.
async with sessions() as session:
@@ -2654,15 +2664,32 @@ async def test_webhook_reservation_recovery_projects_only_final_exhaustion(
return result
monkeypatch.setattr(attempts, "reserve_attempt_webhook_delivery", record_reservation)
- await svc.execute_workflow_webhook(
- run,
- claim_kind=kind,
- attempt_number=1,
- side_effects_claim_at=FINALIZED_AT if stale_claim else None,
- skip_side_effects_lease_check=stale_claim,
- )
+ with capture_runtime_logs() as logs:
+ await svc.execute_workflow_webhook(
+ run,
+ claim_kind=kind,
+ attempt_number=1,
+ side_effects_claim_at=FINALIZED_AT if stale_claim else None,
+ skip_side_effects_lease_check=stale_claim,
+ )
- assert reservations == [None if stale_claim else 0]
+ finalized_events = [event for event in logs if event["msg"].startswith("Workflow webhook delivery finalized")]
+ projection_written = kind == "final" and current is None and not stale_claim and execution_change == "matching"
+ assert reservations == [(None if stale_claim else 0, projection_written)]
+ assert len(finalized_events) == int(projection_written)
+ if projection_written:
+ event = finalized_events[0]
+ assert event["delivery_outcome"] == (
+ EXHAUSTED.value if callback_url == DEFAULT_URL else WebhookDeliveryStatus.exhausted_customer_config.value
+ )
+ assert event["http_status_class"] == "no_response"
+ assert event["attempts"] == 0
+ assert event["replay"] is False
+ assert event["workflow_run_id"] == run.workflow_run_id
+ assert event["delivery_seconds"] is not None
+ assert event["organization_id"] == run.organization_id
+ assert event["organization_name"] == "Recovery org"
+ assert event["org_age"] == 5
deliver.assert_not_awaited()
attempt = (await attempts.get_attempts(run.workflow_run_id))[0]
recorded_progress = (
@@ -2887,7 +2914,7 @@ async def test_reservation_recovery_exhaustion_projection_is_atomic_with_marker(
assert attempt.webhook_sent_at is None
assert attempt.final_side_effects_progress == progress
- result = await WorkflowRunAttemptsRepository(seed).reserve_attempt_webhook_delivery(
+ result, projection_written = await WorkflowRunAttemptsRepository(seed).reserve_attempt_webhook_delivery(
"wr_atomic",
1,
kind="final",
@@ -2898,6 +2925,7 @@ async def test_reservation_recovery_exhaustion_projection_is_atomic_with_marker(
expected_finished_at=FINALIZED_AT,
)
assert result == 0
+ assert projection_written is True
async with seed() as session:
run = await session.get(WorkflowRunModel, "wr_atomic")
attempt = await session.get(WorkflowRunAttemptModel, ("wr_atomic", 1))
@@ -2959,7 +2987,7 @@ async def test_reservation_recovery_refreshes_a_stale_bound_session(
)
assert stale.webhook_delivery_status == current
monkeypatch.setattr(attempts, "Session", lambda: nullcontext(stale_session))
- result = await attempts.reserve_attempt_webhook_delivery(
+ result, projection_written = await attempts.reserve_attempt_webhook_delivery(
"wr_stale_recovery",
1,
kind="final",
@@ -2971,6 +2999,7 @@ async def test_reservation_recovery_refreshes_a_stale_bound_session(
)
assert result == 0
+ assert projection_written is False
locked_tables = [statement.split("FROM ", 1)[1].split()[0] for statement in statements if "FOR UPDATE" in statement]
assert locked_tables == ["workflow_runs", "workflow_run_attempts"]
run_queries = [statement for statement in statements if "FROM workflow_runs" in statement]
diff --git a/tests/unit/workflow/test_block_browser_state_recovery.py b/tests/unit/workflow/test_block_browser_state_recovery.py
index 29df1065d..98aae1f77 100644
--- a/tests/unit/workflow/test_block_browser_state_recovery.py
+++ b/tests/unit/workflow/test_block_browser_state_recovery.py
@@ -2271,16 +2271,21 @@ def test_crash_listener_registers_once_for_pre_existing_and_later_pages() -> Non
context = MagicMock(pages=[existing])
state = RealBrowserState(pw=MagicMock(), browser_context=context)
- assert existing.on.call_args_list == [call("crash", state._on_page_crashed)]
+ # Other page listeners (the main-frame navigation observer) register after the crash listener.
+ assert existing.on.call_args_list[0] == call("crash", state._on_page_crashed)
+ assert existing.on.call_args_list.count(call("crash", state._on_page_crashed)) == 1
assert call("page", state._watch_page_for_crash) in context.on.call_args_list
+ registered_on_existing = existing.on.call_count
later = _crashable_page()
state._watch_page_for_crash(later)
+ registered_on_later = later.on.call_count
state._watch_page_for_crash(later)
state._register_disconnect_listeners(context)
- assert existing.on.call_count == 1
- assert later.on.call_count == 1
+ assert existing.on.call_count == registered_on_existing
+ assert later.on.call_count == registered_on_later
+ assert later.on.call_args_list.count(call("crash", state._on_page_crashed)) == 1
def test_a_context_attached_from_outside_the_class_is_armed_for_crash_reaping() -> None:
@@ -2290,7 +2295,8 @@ def test_a_context_attached_from_outside_the_class_is_armed_for_crash_reaping()
state.browser_context = replacement
- assert existing.on.call_args_list == [call("crash", state._on_page_crashed)]
+ assert existing.on.call_args_list[0] == call("crash", state._on_page_crashed)
+ assert existing.on.call_args_list.count(call("crash", state._on_page_crashed)) == 1
@pytest.mark.asyncio
diff --git a/tests/unit/workflow/test_file_parser_block.py b/tests/unit/workflow/test_file_parser_block.py
index b4dfb5767..2656c6b98 100644
--- a/tests/unit/workflow/test_file_parser_block.py
+++ b/tests/unit/workflow/test_file_parser_block.py
@@ -8,14 +8,17 @@ token truncation, and error handling for DOCX files.
from __future__ import annotations
import asyncio
+import gzip
import json
import os
import re
+import struct
import tempfile
import time
import zipfile
-from collections.abc import Awaitable
-from contextlib import suppress
+import zlib
+from collections.abc import Awaitable, Iterator
+from contextlib import contextmanager, suppress
from datetime import UTC, datetime
from pathlib import Path
from typing import Any, get_args
@@ -26,13 +29,16 @@ import libcst as cst
import pandas as pd
import pytest
import structlog
+from pypdf import PdfReader, apply_configuration
+from pypdf.errors import LimitReachedError, PdfReadError
import skyvern.forge.sdk.workflow.models.block as block_module
from skyvern.core.script_generations.generate_script import _build_file_url_parser_statement
+from skyvern.exceptions import PDFParsingError
from skyvern.forge import app
from skyvern.forge.forge_app_initializer import start_forge_app
from skyvern.forge.sdk.api.llm.exceptions import InvalidLLMResponseFormat
-from skyvern.forge.sdk.utils.pdf_parser import extract_pdf_file, scrambled_text_layer_reason
+from skyvern.forge.sdk.utils.pdf_parser import extract_pdf_file, scrambled_text_layer_reason, validate_pdf_file
from skyvern.forge.sdk.workflow.context_manager import WorkflowRunContext
from skyvern.forge.sdk.workflow.exceptions import FileParseTimeout, InvalidFileType, WorksheetNotFound
from skyvern.forge.sdk.workflow.models.block import BlockType, FileParserBlock, PDFParserBlock
@@ -1071,29 +1077,116 @@ _ITEMISED_INVOICE_LINES = _INVOICE_LINES + tuple(
)
-def _build_pdf(lines: tuple[str, ...], remap: dict[int, int] | None = None) -> bytes:
- """Build a one-page PDF, optionally giving its font a ToUnicode map that lies.
-
- The page always draws ordinary ASCII character codes, so with ``remap`` set only the
- ToUnicode map is wrong — which is what makes a subset font's text layer extract as
- plausible-looking garbage instead of failing outright.
+def _lzw_literals(data: bytes) -> bytes:
+ """LZW-encode ``data`` as bare 9-bit literals, clearing the table often enough that the code width never grows."""
+ codes = [code for index, byte in enumerate(data) for code in ((256, byte) if index % 100 == 0 else (byte,))]
+ bits = "".join(f"{code:09b}" for code in (*codes, 257))
+ bits += "0" * (-len(bits) % 8)
+ return int(bits, 2).to_bytes(len(bits) // 8, "big")
+
+
+def _run_length_literals(data: bytes) -> bytes:
+ """Run-length-encode ``data`` as literal runs only."""
+ runs = (data[start : start + 128] for start in range(0, len(data), 128))
+ return b"".join(bytes([len(run) - 1]) + run for run in runs) + b"\x80"
+
+
+def _build_pdf(
+ lines: tuple[str, ...],
+ remap: dict[int, int] | None = None,
+ font_entries: bytes = b"",
+ flate_content: bool = False,
+ lzw_content: bool = False,
+ run_length_content: bool = False,
+ gzip_content: bool = False,
+ jbig2_content: bool = False,
+ png_predictor: tuple[int, int] | None = None,
+ flate_xref_stream: bool = False,
+ content_copies: int = 1,
+ cid_widths: bytes | None = None,
+ cid_to_unicode_range: str | None = None,
+ cid_to_unicode_char: str | None = None,
+ content_length: int | None = None,
+) -> bytes:
+ """Build a one-page PDF that always draws plain ASCII codes, so ``remap`` alone makes the ToUnicode map lie.
+
+ The other options each shape one structure a limit test needs: Flate, LZW, run-length, gzip-wrapped Flate or JBIG2
+ content (at most one; gzip reaches pypdf's recovery loop, JBIG2 stays undecoded), a PNG predictor as
+ (Colors, Columns) on Flate content, a Flate xref stream, repeated /Contents, a CID font with its /W array and
+ ToUnicode bfrange or bfchar, and a replaced content /Length. Options that would silently override or ignore each
+ other raise ValueError.
"""
- content = ("BT /F1 12 Tf 72 720 Td 16 TL\n" + "".join(f"({line}) Tj T*\n" for line in lines) + "ET").encode()
- font = b"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica"
+ if sum([flate_content, lzw_content, run_length_content, gzip_content, jbig2_content]) > 1:
+ raise ValueError("the content encodings are mutually exclusive")
+ if png_predictor is not None and not flate_content:
+ raise ValueError("png_predictor needs flate_content")
+ if cid_widths is not None and (remap or font_entries):
+ raise ValueError("remap and font_entries are ignored by a CID font, which defines its own ToUnicode")
+ if cid_widths is None and (cid_to_unicode_range is not None or cid_to_unicode_char is not None):
+ raise ValueError("cid_to_unicode_range and cid_to_unicode_char need cid_widths")
+ if cid_widths is None:
+ shown = "".join(f"({line}) Tj T*\n" for line in lines)
+ else:
+ shown = "".join("<" + "".join(f"{ord(char):04X}" for char in line) + "> Tj T*\n" for line in lines)
+ content = ("BT /F1 12 Tf 72 720 Td 16 TL\n" + shown + "ET").encode()
+ content_filter = b""
+ if flate_content:
+ if png_predictor is not None:
+ colors, columns = png_predictor
+ row_length = colors * columns
+ content += b" " * (-len(content) % row_length)
+ content = b"".join(
+ b"\x00" + content[start : start + row_length] for start in range(0, len(content), row_length)
+ )
+ content_filter = b" /DecodeParms << /Predictor 12 /Colors %d /Columns %d >>" % (colors, columns)
+ content = zlib.compress(content)
+ content_filter += b" /Filter /FlateDecode"
+ elif gzip_content:
+ content = gzip.compress(content)
+ content_filter = b" /Filter /FlateDecode"
+ elif lzw_content:
+ content = _lzw_literals(content)
+ content_filter = b" /Filter /LZWDecode"
+ elif run_length_content:
+ content = _run_length_literals(content)
+ content_filter = b" /Filter /RunLengthDecode"
+ elif jbig2_content:
+ content_filter = b" /Filter /JBIG2Decode"
+ to_unicode: str | None = None
+ if remap:
+ entries = "\n".join(f"<{code:02X}> <{unicode_point:04X}>" for code, unicode_point in sorted(remap.items()))
+ to_unicode = (
+ f"1 begincodespacerange\n<00> <FF>\nendcodespacerange\n{len(remap)} beginbfchar\n{entries}\nendbfchar\n"
+ )
+ if cid_widths is None:
+ font = b"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica" + font_entries
+ else:
+ to_unicode = (
+ "1 begincodespacerange\n<0000> <FFFF>\nendcodespacerange\n"
+ f"1 beginbfrange\n{cid_to_unicode_range or '<0000> <00FF> <0000>'}\nendbfrange\n"
+ )
+ if cid_to_unicode_char:
+ to_unicode += f"1 beginbfchar\n{cid_to_unicode_char}\nendbfchar\n"
+ font = (
+ b"<< /Type /Font /Subtype /Type0 /BaseFont /Helvetica /Encoding /Identity-H /DescendantFonts "
+ b"[<< /Type /Font /Subtype /CIDFontType2 /BaseFont /Helvetica "
+ b"/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >> /W %s >>]" % cid_widths
+ )
+ contents = b"5 0 R" if content_copies == 1 else b"[%s]" % b" ".join([b"5 0 R"] * content_copies)
objects = [
b"<< /Type /Catalog /Pages 2 0 R >>",
b"<< /Type /Pages /Kids [3 0 R] /Count 1 >>",
b"<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] "
- b"/Resources << /Font << /F1 4 0 R >> >> /Contents 5 0 R >>",
- font + (b" /ToUnicode 6 0 R >>" if remap else b" >>"),
- b"<< /Length %d >>\nstream\n" % len(content) + content + b"\nendstream",
+ b"/Resources << /Font << /F1 4 0 R >> >> /Contents %s >>" % contents,
+ font + (b" /ToUnicode 6 0 R >>" if to_unicode else b" >>"),
+ b"<< /Length %d%s >>\nstream\n" % (len(content) if content_length is None else content_length, content_filter)
+ + content
+ + b"\nendstream",
]
- if remap:
- entries = "\n".join(f"<{code:02X}> <{unicode_point:04X}>" for code, unicode_point in sorted(remap.items()))
+ if to_unicode:
cmap = (
"/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CMapName /Broken def\n"
- "/CMapType 2 def\n1 begincodespacerange\n<00> <FF>\nendcodespacerange\n"
- f"{len(remap)} beginbfchar\n{entries}\nendbfchar\nendcmap\n"
+ f"/CMapType 2 def\n{to_unicode}endcmap\n"
"CMapName currentdict /CMap defineresource pop\nend\nend"
).encode()
objects.append(b"<< /Length %d >>\nstream\n" % len(cmap) + cmap + b"\nendstream")
@@ -1104,9 +1197,21 @@ def _build_pdf(lines: tuple[str, ...], remap: dict[int, int] | None = None) -> b
offsets.append(len(out))
out += b"%d 0 obj\n" % number + payload + b"\nendobj\n"
xref_at = len(out)
- out += b"xref\n0 %d\n" % (len(objects) + 1) + b"0000000000 65535 f \n"
- out += b"".join(b"%010d 00000 n \n" % offset for offset in offsets)
- out += b"trailer\n<< /Size %d /Root 1 0 R >>\nstartxref\n%d\n%%%%EOF\n" % (len(objects) + 1, xref_at)
+ if flate_xref_stream:
+ rows = struct.pack(">BIH", 0, 0, 65535)
+ rows += b"".join(struct.pack(">BIH", 1, offset, 0) for offset in (*offsets, xref_at))
+ xref_data = zlib.compress(rows)
+ out += b"%d 0 obj\n<< /Type /XRef /Size %d /W [1 4 2] /Root 1 0 R /Filter /FlateDecode /Length %d >>\n" % (
+ len(objects) + 1,
+ len(objects) + 2,
+ len(xref_data),
+ )
+ out += b"stream\n" + xref_data + b"\nendstream\nendobj\n"
+ else:
+ out += b"xref\n0 %d\n" % (len(objects) + 1) + b"0000000000 65535 f \n"
+ out += b"".join(b"%010d 00000 n \n" % offset for offset in offsets)
+ out += b"trailer\n<< /Size %d /Root 1 0 R >>\n" % (len(objects) + 1)
+ out += b"startxref\n%d\n%%%%EOF\n" % xref_at
return bytes(out)
@@ -1248,6 +1353,167 @@ class TestScrambledTextLayerDetection:
assert scrambled_text_layer_reason(scrambled) is not None
+@contextmanager
+def _fails_at_a_pypdf_limit() -> Iterator[None]:
+ """Expect the no-fallback error, raised from the pypdf error; a failed pdfplumber fallback raises with no cause."""
+ with pytest.raises(PDFParsingError) as excinfo:
+ yield
+ assert excinfo.value.__cause__ is not None
+
+
+class TestPypdfLimitFallback:
+ """Only pypdf's structural limits may fall back to pdfplumber, whose pdfminer has no decompressed-size limit."""
+
+ def test_decompression_limit_fails_without_falling_back(self, tmp_path: Path) -> None:
+ pdf_path = tmp_path / "invoice.pdf"
+ pdf_path.write_bytes(_build_pdf(_INVOICE_LINES, flate_content=True))
+
+ with apply_configuration(zlib_maximum_output_length=64), _fails_at_a_pypdf_limit():
+ extract_pdf_file(str(pdf_path))
+
+ def test_lzw_limit_fails_without_falling_back(self, tmp_path: Path) -> None:
+ pdf_path = tmp_path / "invoice.pdf"
+ pdf_path.write_bytes(_build_pdf(_INVOICE_LINES, lzw_content=True))
+ assert "17 Aug 26" in PdfReader(str(pdf_path)).pages[0].extract_text()
+
+ with apply_configuration(lzw_maximum_output_length=64), _fails_at_a_pypdf_limit():
+ extract_pdf_file(str(pdf_path))
+
+ def test_validation_fails_without_falling_back_when_the_xref_stream_hits_the_limit(self, tmp_path: Path) -> None:
+ pdf_path = tmp_path / "invoice.pdf"
+ pdf_path.write_bytes(_build_pdf(_INVOICE_LINES, flate_xref_stream=True))
+
+ with apply_configuration(zlib_maximum_output_length=16), _fails_at_a_pypdf_limit():
+ validate_pdf_file(str(pdf_path))
+
+ def test_content_array_over_the_cap_fails_without_falling_back(self, tmp_path: Path) -> None:
+ pdf_path = tmp_path / "invoice.pdf"
+ pdf_path.write_bytes(_build_pdf(_INVOICE_LINES, content_copies=2))
+
+ # Each copy is under the cap; only the array's total is over it.
+ with apply_configuration(array_based_stream_maximum_output_length=400), _fails_at_a_pypdf_limit():
+ extract_pdf_file(str(pdf_path))
+
+ @pytest.mark.parametrize(
+ "pdf_options",
+ [
+ pytest.param({"cid_widths": b"[0 65536 500]"}, id="cid_width_range"),
+ pytest.param(
+ {"cid_widths": b"[0 [500]]", "cid_to_unicode_range": "<000000> <0186A0> <000000>"},
+ id="to_unicode_range",
+ ),
+ ],
+ )
+ def test_range_pdfminer_would_expand_fails_without_falling_back(
+ self, tmp_path: Path, pdf_options: dict[str, Any]
+ ) -> None:
+ pdf_path = tmp_path / "invoice.pdf"
+ pdf_path.write_bytes(_build_pdf(_INVOICE_LINES, **pdf_options))
+
+ with _fails_at_a_pypdf_limit():
+ extract_pdf_file(str(pdf_path))
+
+ @pytest.mark.parametrize(
+ ("pdf_options", "limits"),
+ [
+ pytest.param({}, {"maximum_declared_stream_length": 100}, id="declared_stream_length"),
+ pytest.param(
+ {"content_length": -1}, {"maximum_declared_stream_length": 100}, id="stream_read_to_endstream"
+ ),
+ pytest.param(
+ {"content_length": 5}, {"maximum_declared_stream_length": 100}, id="stream_length_understated"
+ ),
+ pytest.param({}, {"page_tree_maximum_entries": 0}, id="page_tree_entries"),
+ pytest.param({"cid_widths": b"[0 65535 500 65536 131071 500]"}, {}, id="cid_width_entries"),
+ pytest.param({"gzip_content": True}, {"zlib_maximum_output_length": 64}, id="flate_recovery_output"),
+ pytest.param(
+ {"run_length_content": True}, {"run_length_maximum_output_length": 64}, id="run_length_output"
+ ),
+ # pdfminer sizes a buffer by Columns without any limit.
+ pytest.param(
+ {"flate_content": True, "png_predictor": (1, 17)}, {"flate_maximum_columns": 16}, id="predictor_columns"
+ ),
+ pytest.param(
+ {"flate_content": True, "png_predictor": (17, 1)},
+ {"flate_maximum_row_length": 16},
+ id="predictor_colors_over_row_limit",
+ ),
+ pytest.param(
+ {
+ "cid_widths": b"[0 [500]]",
+ "cid_to_unicode_range": "<000000000000000041> <000000000000000042> <0041>",
+ },
+ {},
+ id="to_unicode_code_length",
+ ),
+ ],
+ )
+ def test_other_size_cap_pdfminer_lacks_fails_without_falling_back(
+ self, tmp_path: Path, pdf_options: dict[str, Any], limits: dict[str, Any]
+ ) -> None:
+ pdf_path = tmp_path / "invoice.pdf"
+ pdf_path.write_bytes(_build_pdf(_INVOICE_LINES, **pdf_options))
+
+ with apply_configuration(**limits), _fails_at_a_pypdf_limit():
+ extract_pdf_file(str(pdf_path))
+
+ @pytest.mark.parametrize(
+ ("pdf_options", "limits"),
+ [
+ pytest.param(
+ {"font_entries": b" /FirstChar 0 /LastChar 299 /Widths [%s]" % b" ".join([b"500"] * 300)},
+ {},
+ id="simple_font_with_300_widths",
+ ),
+ pytest.param({"cid_widths": b"[40 30 500]"}, {}, id="inverted_cid_width_range"),
+ pytest.param({"font_entries": b" /Extra " + b"0" * 100}, {}, id="oversized_number_token"),
+ pytest.param(
+ {"cid_widths": b"[0 [500]]", "cid_to_unicode_char": "<000000000000000041> <0041>"},
+ {},
+ id="oversized_bfchar_code",
+ ),
+ pytest.param(
+ {"cid_widths": b"[0 [500]]", "cid_to_unicode_char": "<0100> <" + "0041" * 300 + ">"},
+ {},
+ id="oversized_bfchar_string",
+ ),
+ pytest.param({}, {"page_tree_maximum_depth": 0}, id="page_tree_depth"),
+ pytest.param({"flate_content": True, "png_predictor": (17, 1)}, {}, id="predictor_colors"),
+ pytest.param(
+ {"flate_content": True, "png_predictor": (1, 17)},
+ {"flate_maximum_row_length": 16},
+ id="predictor_row_length",
+ ),
+ ],
+ )
+ def test_structural_limit_still_falls_back_to_pdfplumber(
+ self, tmp_path: Path, pdf_options: dict[str, Any], limits: dict[str, Any]
+ ) -> None:
+ pdf_path = tmp_path / "invoice.pdf"
+ pdf_path.write_bytes(_build_pdf(_INVOICE_LINES, **pdf_options))
+
+ with apply_configuration(**limits):
+ # pypdf re-raises a limit hit while reading a dictionary value as PdfReadError.
+ with pytest.raises((LimitReachedError, PdfReadError)):
+ PdfReader(str(pdf_path)).pages[0].extract_text()
+
+ assert "17 Aug 26" in extract_pdf_file(str(pdf_path))
+
+ def test_jbig2_buffer_limit_still_falls_back_to_pdfplumber(self, tmp_path: Path) -> None:
+ # pdfminer passes a JBIG2 stream through undecoded, so only pypdf's jbig2dec call can hit the limit.
+ jbig2dec = tmp_path / "jbig2dec"
+ jbig2dec.write_text("#!/bin/sh\necho 'FATAL ERROR failed to allocate image data buffer' >&2\nexit 1\n")
+ jbig2dec.chmod(0o755)
+ pdf_path = tmp_path / "invoice.pdf"
+ pdf_path.write_bytes(_build_pdf(_INVOICE_LINES, jbig2_content=True))
+
+ with apply_configuration(jbig2dec_binary=str(jbig2dec)):
+ with pytest.raises((LimitReachedError, PdfReadError)):
+ PdfReader(str(pdf_path)).pages[0].extract_text()
+
+ assert "17 Aug 26" in extract_pdf_file(str(pdf_path))
+
+
class TestForceOcrOnTheCachedScriptPath:
"""A cached run must honor force OCR, or the fix only holds while the block runs via the agent."""
diff --git a/uv.lock b/uv.lock
index 8fd435a57..2a334653c 100644
--- a/uv.lock
+++ b/uv.lock
@@ -112,7 +112,7 @@ wheels = [
[[package]]
name = "aiohttp"
-version = "3.14.3"
+version = "3.14.5"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "aiohappyeyeballs" },
@@ -124,108 +124,109 @@ dependencies = [
{ name = "typing-extensions", marker = "python_full_version < '3.13'" },
{ name = "yarl" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/58/d9/22ce5786ac0c1653ae8b6c23bded02c1686d11f0dbb45b31ce128e0df985/aiohttp-3.14.3.tar.gz", hash = "sha256:9491196535a88924a60afd5b5f434b5b203b6cc616250878dbdb223a8f7844bc", size = 7971213, upload-time = "2026-07-23T01:57:27.037Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/f8/5c/b3e4ff8ad43a8afef9602c5e90285936da1beaea8b029016b793891f03c3/aiohttp-3.14.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:e568e14940c09955aa51f4e645b6daa18a581c5dcfcd73744dcc86a856e3ced3", size = 764250, upload-time = "2026-07-23T01:52:48.525Z" },
- { url = "https://files.pythonhosted.org/packages/0e/da/f1b384465e51449d844056b75070461da03a9a23e6c1747003695bf4172a/aiohttp-3.14.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:54cfcdee2770dac994417cbb0ee1f3eb0e7cb6b30c79bf44f2c02ff79ec5124a", size = 516281, upload-time = "2026-07-23T01:52:51.047Z" },
- { url = "https://files.pythonhosted.org/packages/b9/3f/01264f820ee2e3712a827892b1cd6ff80f3300c1fcbffbb45714a915d47a/aiohttp-3.14.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:21c016079415ed3fd676963e9793700a566d85dbbd6bfc564b9b2d209147dcc8", size = 514742, upload-time = "2026-07-23T01:52:53.779Z" },
- { url = "https://files.pythonhosted.org/packages/9e/8d/a71c6f2db52ac1ed142b133f7feddaa6b70539c3f4de24d7e226c95b794c/aiohttp-3.14.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d6088ec9894113802bddb3c09e974929aed2c7b3a8c456219b8aab4481f1a239", size = 1780613, upload-time = "2026-07-23T01:52:56.948Z" },
- { url = "https://files.pythonhosted.org/packages/a5/11/3dd9b3fb3a170f6ec9011b5291d876a6fab4086714c9e158600edf01b4fd/aiohttp-3.14.3-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:16ea7e24c309fb7c0bbd505d149abe4fe4dccfb8db911db7dbec0921bc889a6f", size = 1737688, upload-time = "2026-07-23T01:52:59.294Z" },
- { url = "https://files.pythonhosted.org/packages/6d/3e/834c26918be7d88068822b40e0db30fca50b5f4fe79104aa16a93f1d74e6/aiohttp-3.14.3-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:56f355e79f71aef2a85c80305cc915f894b170dba76de5fe84f6351939b83c06", size = 1845742, upload-time = "2026-07-23T01:53:01.641Z" },
- { url = "https://files.pythonhosted.org/packages/cc/c9/49ab8572df7d66bc13d11e31f781292badb04180dd87ba98733066c6aed7/aiohttp-3.14.3-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:18c441d0a8fca6de8d1f546849b9f0ab20d435993e2c5b59562b2fae6be2f929", size = 1928412, upload-time = "2026-07-23T01:53:04.018Z" },
- { url = "https://files.pythonhosted.org/packages/a5/b9/2b8f0c0ce09c87a1daf80fd483431b56b1435d3f62789bc86f572e1245de/aiohttp-3.14.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:53e7b4ce82b54a8bcc71b3b67a5cbd177ca1d7f592cbc92cd38b7349f73482db", size = 1786220, upload-time = "2026-07-23T01:53:06.481Z" },
- { url = "https://files.pythonhosted.org/packages/85/00/9c45f81de11710460edfa1dc81317b6e882703b160926c879a9d20da9fcc/aiohttp-3.14.3-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f55119f7bf25f49ed210f6096090715da24f2943c62102448915fde3c62877ce", size = 1637231, upload-time = "2026-07-23T01:53:10.258Z" },
- { url = "https://files.pythonhosted.org/packages/19/ce/967d628e910756f3539c6107cb7844a1b69440dcb3029a5ee7871b09ab63/aiohttp-3.14.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:9aa6e61fdf20105c4144e755bd586008ff450791d67b1c8146fdc15959c4d51c", size = 1753161, upload-time = "2026-07-23T01:53:13.817Z" },
- { url = "https://files.pythonhosted.org/packages/11/b2/0c3d4114f0aee4f580f5b3b4eb71b24d7a23b834ea506a4dfebe76513f35/aiohttp-3.14.3-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:ccd4893707b3e2a13e39c90d43cf80edf2e4d0457935bcc103bf2346214c3f15", size = 1756356, upload-time = "2026-07-23T01:53:16.211Z" },
- { url = "https://files.pythonhosted.org/packages/63/5d/99e7d91c82f1399d1ae2a854e080bd1493fbc31e5e959dbc4ec33dac3bec/aiohttp-3.14.3-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:b2466434105a4e03113c36ec775cc2ebe6676b62eae326fa670bb607ef788c1c", size = 1819846, upload-time = "2026-07-23T01:53:18.289Z" },
- { url = "https://files.pythonhosted.org/packages/ad/05/d5e1cb6480eeffd3f901d40a2c5e2d1e7effdc797837da3b490272699f13/aiohttp-3.14.3-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:ba59d59aba08ac02fc03b0c8983ccd5ee39a199d0552ce9e6d2b4845b34d59ae", size = 1628531, upload-time = "2026-07-23T01:53:23.86Z" },
- { url = "https://files.pythonhosted.org/packages/c9/90/b934682bcaefae18a9e04f3dff5b68522ba810906358ae5029b68110ea3b/aiohttp-3.14.3-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:ed099d105449c4f9e84f24af203cd131349d4761d8813fa7e02c32e7128cd910", size = 1832712, upload-time = "2026-07-23T01:53:27.551Z" },
- { url = "https://files.pythonhosted.org/packages/21/df/6061679faaf81fac746e7307c7adb71e858071a5d34c27583afefc64f543/aiohttp-3.14.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:152516815ef926786a0b6ae2b8f1fd2e0c71582dee0b435636865316fd4891b7", size = 1775014, upload-time = "2026-07-23T01:53:30.223Z" },
- { url = "https://files.pythonhosted.org/packages/8a/1d/f854878bbc69b88faefe924b619a34a6f59ec05fd387c77690667eaa75eb/aiohttp-3.14.3-cp311-cp311-win32.whl", hash = "sha256:a4af35c443e0b1a1bd6a8af3f3485d7fda15c142751a00f3ff8090f0b93346fa", size = 456006, upload-time = "2026-07-23T01:53:34.97Z" },
- { url = "https://files.pythonhosted.org/packages/73/0c/2af9d1674baccd1dbd47282a93d660a22e57ef6167c856deb24b4214fbab/aiohttp-3.14.3-cp311-cp311-win_amd64.whl", hash = "sha256:e1e74298bab6ee0d6e749ed4fd1901c7e604bdda32c03d787a2cc71c46d0433d", size = 481069, upload-time = "2026-07-23T01:53:39.673Z" },
- { url = "https://files.pythonhosted.org/packages/8e/76/88401ff3fc95e85c5fc38d588f36f55e61ecb64343b2bc8d69326f453cc0/aiohttp-3.14.3-cp311-cp311-win_arm64.whl", hash = "sha256:03cd2bde3d7f085b64e549c985f4bb928cad7e8ecf5323bfca320db548d81b39", size = 453021, upload-time = "2026-07-23T01:53:43.749Z" },
- { url = "https://files.pythonhosted.org/packages/18/d4/eb96299230e20acf2efae207cb8d69051f1f68e357e5ea5e479bf6fb097a/aiohttp-3.14.3-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:39aded8c7f3b935b54aab1d8d73c70ec0ee2d3ec3b943e0e86611bc150ba47f5", size = 754690, upload-time = "2026-07-23T01:53:47.332Z" },
- { url = "https://files.pythonhosted.org/packages/88/11/e7a70a209eb9a067c0d3212b518a0134e3484f5178c7533878b6b514d469/aiohttp-3.14.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5bcb6ff3fdab1258a192679ff1a05d44f59626430aa05cd1a9d2447423599228", size = 509484, upload-time = "2026-07-23T01:53:51.159Z" },
- { url = "https://files.pythonhosted.org/packages/30/07/4bbc222cc8dbe31d4c3e8a5baad2286e4d42026ac0c570027b89afce6344/aiohttp-3.14.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:617105e2c3018ee38d0c8ce5ee3c84f621a6d8b9f723202aacaff28449ca91ee", size = 511949, upload-time = "2026-07-23T01:53:55.083Z" },
- { url = "https://files.pythonhosted.org/packages/54/b9/42e74c46b7b7c794b995bbc1f573fb48950c38b19d8600c62a6804ee2d67/aiohttp-3.14.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f631fe87a6f30df5fbe6d79640b25e4cffb38c31c7fb6f10871517b84b0f8c1a", size = 1765282, upload-time = "2026-07-23T01:53:59.662Z" },
- { url = "https://files.pythonhosted.org/packages/6b/ed/62bc4d74363ad346d518e0720363a949f63e2e23439a79eb5813d4d29bb3/aiohttp-3.14.3-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a94dbaae5ae27bd849c93570669bff91e0510f33a80805738e3de72a7be0447b", size = 1741511, upload-time = "2026-07-23T01:54:04.063Z" },
- { url = "https://files.pythonhosted.org/packages/d0/9f/181e8a8bc79e47d13c7fc4540bd7a3b729d9505609c61f392a8dd2fbfe55/aiohttp-3.14.3-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8f2f1c4c032c7cedd7d8da6f54c97b70266c6570c3108d3fdffee7188bb70529", size = 1810680, upload-time = "2026-07-23T01:54:09.882Z" },
- { url = "https://files.pythonhosted.org/packages/5c/9a/dec94d6ad694552fe3424e3f1928d7a606a5d9d9433a04e7ecdd9d38ae7f/aiohttp-3.14.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:ea05e1f97ceea523942d9b2a7d7c0359d781d683d6b043f5943a602b14da4787", size = 1905646, upload-time = "2026-07-23T01:54:13.475Z" },
- { url = "https://files.pythonhosted.org/packages/52/b7/7cd31f29d6055bd711ae6e669367fba6f5ae9de463910a793e30556a8db7/aiohttp-3.14.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:543906c127fb1d929b95076db19b83fa2d46751006ff1e23b093aa5ac4d8db42", size = 1792122, upload-time = "2026-07-23T01:54:15.752Z" },
- { url = "https://files.pythonhosted.org/packages/66/73/10b1ef93afa61f4963c746257b70ced619cf31a4798671de5fdb2608501d/aiohttp-3.14.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0a5ff2dfbb9ce645fa5b8ef3e02c6c0b9cc3f6030ff863d0c51fffc50cb5541b", size = 1591127, upload-time = "2026-07-23T01:54:19.489Z" },
- { url = "https://files.pythonhosted.org/packages/49/ed/3b203fa6de1b338c14acdc06bf6ca9b043b7944f005966958c2ced932cde/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:041badb8f84396357c4d3ad26de6afd7a32b112f43d3c63045c0c8278cfd2043", size = 1725210, upload-time = "2026-07-23T01:54:24.129Z" },
- { url = "https://files.pythonhosted.org/packages/28/b7/1c2aab8c706436dcc28598452488ac9cd7c409da815237c28c27d58993e6/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:530125ee1163c4219af35dc3aa1206e541e7b31b6efc1a3f93b70a136f65d427", size = 1764848, upload-time = "2026-07-23T01:54:27.973Z" },
- { url = "https://files.pythonhosted.org/packages/54/50/94c28f08b131c4bf10984ea2c7a536c9920608bb2d6e7f95642c30cc87b7/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:c8653fd547c93a61aadc612007790f5555cdd18946fa48cf45e26d8ea4ea473d", size = 1777102, upload-time = "2026-07-23T01:54:31.775Z" },
- { url = "https://files.pythonhosted.org/packages/13/d4/e7d09ba7d345fb2d74440fd2fa033c5e079fac05552927705986f41a364f/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:89176250f686cb9853c0fb7ead90e639e915b84a6f43eedc2a4e7ec21f1037f0", size = 1580205, upload-time = "2026-07-23T01:54:34.518Z" },
- { url = "https://files.pythonhosted.org/packages/a3/84/072a91d68e1e1eb587985b54baab94221277f877e8ef274fc213a0ceae28/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:3a26434dafe408229ff3403458ca58de24fb51936504decac49ce6755f77e59d", size = 1797219, upload-time = "2026-07-23T01:54:36.995Z" },
- { url = "https://files.pythonhosted.org/packages/e0/eb/aad34e897e668424d6e995da5dff8a4a09af93363d3392488772957a63aa/aiohttp-3.14.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:d1558173930a5a8d3069cee5c92fc91c87c4dbcb099debbb3622053717145a19", size = 1768629, upload-time = "2026-07-23T01:54:40.103Z" },
- { url = "https://files.pythonhosted.org/packages/b6/2b/6bb88ddba0fecd9122aa3ebcad25996cf6c083a4a7040dbb3a4f97972af6/aiohttp-3.14.3-cp312-cp312-win32.whl", hash = "sha256:16100ad3ab8d649fdfbee87602d9d2dcdca9df0b9eda8a1b5fdc0d41f96da559", size = 451481, upload-time = "2026-07-23T01:54:42.547Z" },
- { url = "https://files.pythonhosted.org/packages/76/9b/f2f8f108da17ecef2cc3efc424e8b7ad3782b1a8360f7b8eae8ced84f6ea/aiohttp-3.14.3-cp312-cp312-win_amd64.whl", hash = "sha256:33a2d7c28d33797a2e99923dffa63f83d908a19b6bf26cfe80fa790aa5e1a75a", size = 476845, upload-time = "2026-07-23T01:54:44.853Z" },
- { url = "https://files.pythonhosted.org/packages/3e/44/28dac80a8941b604f4da10ce21097614ca1bf905ce93dca28d8d7de9c1e7/aiohttp-3.14.3-cp312-cp312-win_arm64.whl", hash = "sha256:362a3fd481769cac1a824514bcd86fda51c65e8fe6e051099e008fddde6db17c", size = 448050, upload-time = "2026-07-23T01:54:47.087Z" },
- { url = "https://files.pythonhosted.org/packages/57/be/5afd201cc0ab139029aadb75392efe85a293403d9dd3a3226161c21ce00c/aiohttp-3.14.3-cp313-cp313-android_21_arm64_v8a.whl", hash = "sha256:2e9878ae68e4a5f1c0abe4dd497dbc3d51946f5837b56759e2a02e78fa90ef86", size = 506269, upload-time = "2026-07-23T01:54:49.075Z" },
- { url = "https://files.pythonhosted.org/packages/22/09/dec8189d62b45ade009f6792a2264b942a90cb88aeaf181239933cd72c3c/aiohttp-3.14.3-cp313-cp313-android_21_x86_64.whl", hash = "sha256:f3d2669fe7dec7fc359ecdb5984b29b50d85d5d00f8c1cb61de4f4a24ee42627", size = 515166, upload-time = "2026-07-23T01:54:51.894Z" },
- { url = "https://files.pythonhosted.org/packages/28/24/2854869d29ed8a8b19d74f9ec6629515f7e04d02dd329d9d179201e58e47/aiohttp-3.14.3-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:cc7cb243a68167172f48c1fd43cee91ec4b1d40cefd190edd43369d1a6bc9c82", size = 486263, upload-time = "2026-07-23T01:54:54.223Z" },
- { url = "https://files.pythonhosted.org/packages/d4/dd/57187c8be2a35aea65eaee3bd2c3dcbbcf0204f5106c89637e3610380cd1/aiohttp-3.14.3-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:78253b573e6ffab5028924fc98bc281aae05445969982a10864bc360dea2016c", size = 492299, upload-time = "2026-07-23T01:54:56.236Z" },
- { url = "https://files.pythonhosted.org/packages/b9/11/06ae6ed8f0d414edf4068861e233d8fe23ee699bfd4b3ceb8663db948a62/aiohttp-3.14.3-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:7041d52c3a7fa20c9e8c182b534704abb19502c8bdcbde7ab23bfda6f642394f", size = 502235, upload-time = "2026-07-23T01:54:58.377Z" },
- { url = "https://files.pythonhosted.org/packages/7e/a3/559639c34a345d2cf7c52dff6838119f2eaf29eb508227b5b83f573af813/aiohttp-3.14.3-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ac74facc01463f138b0da5580329cfcc82818dea5656e83ddcd11268fc12ff80", size = 750883, upload-time = "2026-07-23T01:55:00.65Z" },
- { url = "https://files.pythonhosted.org/packages/91/cd/41e131f13afd1e7b0172a9d9eda085ef90eb8439f41f0d279db81ed3ae60/aiohttp-3.14.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:d6218d92e450824e9b4881f44e8c09f1853b490f9a64130801024a4793b1b3b0", size = 508473, upload-time = "2026-07-23T01:55:02.945Z" },
- { url = "https://files.pythonhosted.org/packages/bc/6b/e7f13410d391c6e55b4c007a8de024355389d7d459e3d64c42b2d33617e5/aiohttp-3.14.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:11fb37ef075669eee52ab1928fbf6e1741fada40409fa309ebde9607a962aebf", size = 509190, upload-time = "2026-07-23T01:55:05.173Z" },
- { url = "https://files.pythonhosted.org/packages/97/21/6464573e53d69672cc1eada3e5c5cb2d2efa82701e8305a0f2047a576967/aiohttp-3.14.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:55bdcc472aafe2de4a253045cc128007a64f1e0264fb675791e132ea5edaa3bd", size = 1761478, upload-time = "2026-07-23T01:55:07.383Z" },
- { url = "https://files.pythonhosted.org/packages/1a/81/d217043a4c17fbce360905e3b2bdd20139ebc9a2de836d035d179c4da006/aiohttp-3.14.3-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c39846c3aad97a8530c89d7a3869a8f8e9e3762c6ac0504481e5c80948f7e807", size = 1735092, upload-time = "2026-07-23T01:55:09.803Z" },
- { url = "https://files.pythonhosted.org/packages/a1/66/e13a02d0eeb1a9a502402a977abb4e4abff9fe4051c26f80558c57a7c975/aiohttp-3.14.3-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5895ef58c4620afe02fa16044f023dc4dafec08158f9d08874a46a7dbc0341b8", size = 1800546, upload-time = "2026-07-23T01:55:12.012Z" },
- { url = "https://files.pythonhosted.org/packages/26/5e/57d42fca1d18cb5acc1cad945d017fabc5d6ae71d8a08ad66be8dc3ee544/aiohttp-3.14.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:fa9467a8113aa69d3d7c55a70ef0b7c636010a40993f3df9d9d0d73b3eb7ef24", size = 1895250, upload-time = "2026-07-23T01:55:14.357Z" },
- { url = "https://files.pythonhosted.org/packages/ca/1c/7da8d08e74d56f00070822f9638ff3f1c563f8ad87d1efa996c87bfc8644/aiohttp-3.14.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d7d2deec16eeedf55f2c7cf75b521ea3856a5177e123844f8fd0f114ce252cb5", size = 1789289, upload-time = "2026-07-23T01:55:16.668Z" },
- { url = "https://files.pythonhosted.org/packages/cd/0f/cf16bcf56896981c1a0319f5d5db9337994b5165730c48a8fa07e9b34be6/aiohttp-3.14.3-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:dd54d0e8717de95939766febac482ac0474d8ac3b048115f9f2b1d23a16e7db4", size = 1586706, upload-time = "2026-07-23T01:55:18.913Z" },
- { url = "https://files.pythonhosted.org/packages/fe/6f/76eac12a7f2480e1e304f842efdb07db33256b0d9165b866b6ef0806c202/aiohttp-3.14.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:df82f3787c940c94986b34222d59c9e38843fba85139f36e85255a82ad5355a9", size = 1724652, upload-time = "2026-07-23T01:55:21.296Z" },
- { url = "https://files.pythonhosted.org/packages/39/b6/19c8c592baeeb94b75f966547d40c02ac7590902306ec5863d5c027cf506/aiohttp-3.14.3-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:42a67efc36300d052fb4508a53e8b6901b9284b599ae63945c377569c5fcc1e1", size = 1756239, upload-time = "2026-07-23T01:55:23.705Z" },
- { url = "https://files.pythonhosted.org/packages/dc/c9/4e9383150296f97f873b680c4de8fb2cd88608fb9f48c79edcb111611abc/aiohttp-3.14.3-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:7a75aa63cbf9b21cfaf60dc2657e19df2c2867d91707d653fee171ffeedd1371", size = 1769161, upload-time = "2026-07-23T01:55:26.082Z" },
- { url = "https://files.pythonhosted.org/packages/aa/1e/147bdc6cc5de5f3ab011be8bf5d6e786633249f22c20bae06f85e45f5387/aiohttp-3.14.3-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:e92eb8acc45eb6a9f4935071a77edf5b85cc6f8dfad5cd99e97653c26593cdde", size = 1578759, upload-time = "2026-07-23T01:55:28.846Z" },
- { url = "https://files.pythonhosted.org/packages/fd/31/78388a9d6040ece2e11df62ea229a822cf5e52d238374b220ae9975b2623/aiohttp-3.14.3-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:b014a6ed7cf912e787149fdc529166d3ceabac23f26efeea3158c9aba2354e7e", size = 1792025, upload-time = "2026-07-23T01:55:31.457Z" },
- { url = "https://files.pythonhosted.org/packages/03/51/a3d29fdf2c25d796746af8ad6fe56a45d6256c38b0a8a2ed752e1160b3a2/aiohttp-3.14.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:3d4f72af88ac2474bb5bca640030320e3d38a0163a1d7533500e87be458eef71", size = 1768477, upload-time = "2026-07-23T01:55:33.87Z" },
- { url = "https://files.pythonhosted.org/packages/29/a6/442e18b5afeade534d877a2dc3c3e392aff8d49787890b0cf84790410267/aiohttp-3.14.3-cp313-cp313-win32.whl", hash = "sha256:5f08ec777f35ee70720233b8b9811d3bb5d728137f30ac91b7457709c3261ac0", size = 451069, upload-time = "2026-07-23T01:55:36.121Z" },
- { url = "https://files.pythonhosted.org/packages/9d/69/3d876ac02659f271cf7f6769f14a8e3de5b6e888ed8b5a7e998086a4cec8/aiohttp-3.14.3-cp313-cp313-win_amd64.whl", hash = "sha256:dff9461ec275f22135650d5ba4b4931a11f3958df7dfbb8db630000d4dee0883", size = 476518, upload-time = "2026-07-23T01:55:38.303Z" },
- { url = "https://files.pythonhosted.org/packages/b2/0e/50d6e6471cd31edce8b282bdec59375a3a69124d8a989a0b1313355cae52/aiohttp-3.14.3-cp313-cp313-win_arm64.whl", hash = "sha256:ddcac3c6b382e81f1dd0499199d4136b877beb4cb5ef770bbbfba56c4b8f55d2", size = 447676, upload-time = "2026-07-23T01:55:40.451Z" },
- { url = "https://files.pythonhosted.org/packages/c8/20/887fdcf832326571b370ffc347b3e70abe101096f3720126aac161b1d872/aiohttp-3.14.3-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:49f7325beb0f85ef4aef5f48f490269575f83e6e2acad00a1d80b807eb027062", size = 509067, upload-time = "2026-07-23T01:55:42.618Z" },
- { url = "https://files.pythonhosted.org/packages/ad/a3/92cec936f78cc4bf0fa5554ebe593b73459d94e3c62303e1902a4cccb6f7/aiohttp-3.14.3-cp314-cp314-android_24_x86_64.whl", hash = "sha256:e3be98a7c30b8c25d573dafba7171d66dfb05ee6a9070fc46535464ff97700a6", size = 514774, upload-time = "2026-07-23T01:55:44.937Z" },
- { url = "https://files.pythonhosted.org/packages/29/ba/2a0c38df3fc557620b6a5acd98364af050053b6285b4dc7ee74100c63c18/aiohttp-3.14.3-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:614c61d478b83953e261d02bb2df750f17227cd33ef8002945bf5aebbde21919", size = 488134, upload-time = "2026-07-23T01:55:47.135Z" },
- { url = "https://files.pythonhosted.org/packages/48/d6/d51b7d4bf309af3693940d8ffd2b9ed0b682434ef85959b7c9c137f60cf8/aiohttp-3.14.3-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:1caa7b0d05f3e3a36f87788c59e970a7ee1cefcfcbb924a9f138c4a6551c9cb7", size = 494201, upload-time = "2026-07-23T01:55:49.451Z" },
- { url = "https://files.pythonhosted.org/packages/3f/5a/8f624384e5f1efabb5229b94157eb966b021e97bdb188c62860c2ae243c2/aiohttp-3.14.3-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:dfa68deb2a443bdaa3ea5297b0699c1464f08aef3812b486d1348eee61b07dc0", size = 502766, upload-time = "2026-07-23T01:55:51.656Z" },
- { url = "https://files.pythonhosted.org/packages/a6/26/4ff0164370deec18fb19254ee4ab10b7a73304ac0c860b13f5f84663759b/aiohttp-3.14.3-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:e72ee89e28d907a18f46959b4eb0bb06701cc7f8cf4366e00029e2ccfaaf5924", size = 756557, upload-time = "2026-07-23T01:55:53.964Z" },
- { url = "https://files.pythonhosted.org/packages/97/a3/7056b86dc0d9ec709ea9777eae3b0161428f943372f8b98c01c11593b682/aiohttp-3.14.3-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:ad4c8b7488d745d2ca4838ebd8ae5ba9b56341d30b1da43640e4ce87f9f49646", size = 510168, upload-time = "2026-07-23T01:55:56.22Z" },
- { url = "https://files.pythonhosted.org/packages/85/ed/0357a015892fd68058bf2d39d3fd1958e459b997a7db30aaa6aaa434ae96/aiohttp-3.14.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:db332af25642007330fca8be5c4d194caf2bea7a7fc84415aff3497af5dfee6b", size = 512957, upload-time = "2026-07-23T01:55:58.437Z" },
- { url = "https://files.pythonhosted.org/packages/47/d1/8aba53f15ccb2238405f5e9d30e2a8ca44f93878c26e7165ade00d374b1c/aiohttp-3.14.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:25bd2708db6bdf6a6630dd37bdcdfcb47c4434d22ac69c64665b802910140b30", size = 1750149, upload-time = "2026-07-23T01:56:00.856Z" },
- { url = "https://files.pythonhosted.org/packages/49/bd/40c3fee327529284375c6701cbb0fa4600cc2e8432af1378f897e2ef7d3a/aiohttp-3.14.3-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:cef89a58e628c4efcac3275c2d68083f82426dcdc89c1492a6f654f9f7ea6ab9", size = 1707685, upload-time = "2026-07-23T01:56:03.371Z" },
- { url = "https://files.pythonhosted.org/packages/2a/a3/ca0cc6724cca8114b05694abd916060758c79894c3aa5b012cdadc1bc28e/aiohttp-3.14.3-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c23ec8ee9d5ab2f5421f9c7fffce208435607af27fd46d4a44e031954352838f", size = 1803911, upload-time = "2026-07-23T01:56:05.817Z" },
- { url = "https://files.pythonhosted.org/packages/95/b5/85b099c299c3ffd38ad9b3e43694c8a346934e4a30c88c4fd5a841234f77/aiohttp-3.14.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e2667f0bbe7eb6c74eae5e9691441ad186e5845ca3cff63230fc09c4e7514f5d", size = 1876929, upload-time = "2026-07-23T01:56:08.413Z" },
- { url = "https://files.pythonhosted.org/packages/d5/b7/1da684a04175473fa4cddbf9a2f572e79514c3fd27a74597f43057d4f3da/aiohttp-3.14.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:18cb43369747b2ae007bd2655fb8e63a099c2ff1d207962943636dac989b3147", size = 1761112, upload-time = "2026-07-23T01:56:10.918Z" },
- { url = "https://files.pythonhosted.org/packages/d1/16/bc4b55e3e5cb175fd69c53c90d60d2f47797cb343da5106e23863dc4dba4/aiohttp-3.14.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d77640cc618c1d99fc4f8589c0f24a730adfa54eb1e57ef7bf0c8dfb78da898c", size = 1583500, upload-time = "2026-07-23T01:56:13.613Z" },
- { url = "https://files.pythonhosted.org/packages/2a/e8/13a9d957a1ee40837f46aa30f0f4c657e673ad86a2e6362a9f9be20d26d9/aiohttp-3.14.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:53e5179d8abb5710f8e83ba207c41c8d1261fcffd4616500e15ca2b7a33be10a", size = 1713940, upload-time = "2026-07-23T01:56:15.969Z" },
- { url = "https://files.pythonhosted.org/packages/38/05/d33c680c1bcf1c7e130f9cbfc1fc02fe8bb0c4af2a94a53dd5fb56131e5c/aiohttp-3.14.3-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:cd817772b2fcf2b8c0905795318485f9ec16eae60b29feb7f4c77085311637f0", size = 1724413, upload-time = "2026-07-23T01:56:18.591Z" },
- { url = "https://files.pythonhosted.org/packages/85/1d/af798d306f7a74b6a632dbcabcf62a4c91391b7582d2a8c6d7712e2cc54e/aiohttp-3.14.3-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:4e3ac92d90e92773b2362d506068e9a948192bd553e743c5b2429e28527c8661", size = 1770748, upload-time = "2026-07-23T01:56:21.074Z" },
- { url = "https://files.pythonhosted.org/packages/a8/92/ad720d472556a995049206867765e9410969684f86ee09423ff9969044c1/aiohttp-3.14.3-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:3f42e9b78301f11c8f861746175d8b9c1ccef713fcad9eab396e2f6db8ed4a22", size = 1577564, upload-time = "2026-07-23T01:56:23.475Z" },
- { url = "https://files.pythonhosted.org/packages/60/ad/0ed7586cbef7a884e23a752fa2bb987a122e6a5dd50dab109258d0a95193/aiohttp-3.14.3-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:9d9edccfe496b476db5f398d97b865e9a6752bcf8aec4eef8390ce20fb64bb41", size = 1782080, upload-time = "2026-07-23T01:56:25.994Z" },
- { url = "https://files.pythonhosted.org/packages/97/ea/dbaed0d73e8a69aad653b045dab451c67c2454bb731a37b45a86593e9422/aiohttp-3.14.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:1c5ec8fb1bcc31a8466f74aaf26c345d5c386fa4bd08a3f0eb9c7a4a3fe8b5bf", size = 1745813, upload-time = "2026-07-23T01:56:28.604Z" },
- { url = "https://files.pythonhosted.org/packages/81/1b/6893d4bc57e434fc93a6c9217c637d967a0b651d989f6e3265179375754a/aiohttp-3.14.3-cp314-cp314-win32.whl", hash = "sha256:38901a84da3ce22249f6e860bf8f90d141bcab7da090cc398f8bb58c0e44b7da", size = 455872, upload-time = "2026-07-23T01:56:31.031Z" },
- { url = "https://files.pythonhosted.org/packages/f5/8b/c7baa1ba1eda4db6989baefe5de6d99834921b84ebd7918624febcb9f290/aiohttp-3.14.3-cp314-cp314-win_amd64.whl", hash = "sha256:8b3b60de05f3dcb6f6a00f818bb2ec781cee4de0645f59ccaf99b1d1823b6100", size = 481030, upload-time = "2026-07-23T01:56:33.365Z" },
- { url = "https://files.pythonhosted.org/packages/22/8c/c29d067df825a2df88ca432db848aa2fe8199598359cc06c12b09320cac9/aiohttp-3.14.3-cp314-cp314-win_arm64.whl", hash = "sha256:1576145bdceeb92382d899751e12743a3a5b8e460a841e3e50543859e54864dc", size = 453669, upload-time = "2026-07-23T01:56:35.731Z" },
- { url = "https://files.pythonhosted.org/packages/6a/a4/9c033beb355d39b6147980597ec9645e4729243f686ee4dc73945de72030/aiohttp-3.14.3-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:8800c996b01c2772a783e3e46f3e1abd5823029adca0df54231960de9bfefa5b", size = 791403, upload-time = "2026-07-23T01:56:37.972Z" },
- { url = "https://files.pythonhosted.org/packages/80/ca/87c32a0a7704583cfc49660bd817889bae5b830bf53b5dcb4e92145ac2da/aiohttp-3.14.3-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:ebe8e504f058fe91223351cecd2d9d6946c9d241bb0250d898ffbdf584cc72b0", size = 526413, upload-time = "2026-07-23T01:56:40.523Z" },
- { url = "https://files.pythonhosted.org/packages/9e/d8/8ec0e471248c500acdce2be3f46db8fb62b5eb60efef072529cc85ee1d26/aiohttp-3.14.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:30402d03a7c0ff52bce290b57e564e9079fd9d0cb545c8aba73f86a103162d2e", size = 532135, upload-time = "2026-07-23T01:56:42.876Z" },
- { url = "https://files.pythonhosted.org/packages/fe/45/f8919fd936e8b79fcd9bda7b6d8e62613462a713f4f17987fd7c34399142/aiohttp-3.14.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9fc7b5bfec6573f3ae844f457fdde5adeb713f8b8e4a81ad64fc207b49383716", size = 1922742, upload-time = "2026-07-23T01:56:45.528Z" },
- { url = "https://files.pythonhosted.org/packages/f6/ec/9ca76b28a27525b0cc53e20842e0228b022f301ce1f436b7d814b4aaf2df/aiohttp-3.14.3-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:8a5fd34f7f7410d1730d5c2ba873cacb2eed3fede366feb268a70ba22581ed8f", size = 1787371, upload-time = "2026-07-23T01:56:48.045Z" },
- { url = "https://files.pythonhosted.org/packages/b1/04/6acdbf17315f7b55f1937e3387acb89a3cddeb4995689553d064af8e92ab/aiohttp-3.14.3-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:270d3dace9ca2f10f0da5d8ebe519b7a310fc6112ed916e32df5866df0888553", size = 1912623, upload-time = "2026-07-23T01:56:50.605Z" },
- { url = "https://files.pythonhosted.org/packages/86/e6/438b0c79ca6f45eb9fd9817dd4c01a91919a38c0de5ee9e05e2b4dc0ece7/aiohttp-3.14.3-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:3ae5b3a59436d089b5395d910121a390feed4d00578eb95a0fd1a329fe963100", size = 2005515, upload-time = "2026-07-23T01:56:53.153Z" },
- { url = "https://files.pythonhosted.org/packages/bb/6b/62cbd6577758699525f5c712d1ddef57d9875fbab0ae8d5f5a202fd598f8/aiohttp-3.14.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2498f0fe69ead802f9675beca44a7c21c62fdaa4ec5145ea1c3ad6edbee29f85", size = 1879906, upload-time = "2026-07-23T01:56:55.818Z" },
- { url = "https://files.pythonhosted.org/packages/00/95/18bcbf830a21dc3aae24d8f6b6feaf3db1d2090242d00a7868db2ffb0b67/aiohttp-3.14.3-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a0dc483c00da8b673abbb367eb6f8d8f4bcec30eb58529ea13cb42e7fd2dfa33", size = 1675849, upload-time = "2026-07-23T01:56:58.861Z" },
- { url = "https://files.pythonhosted.org/packages/a9/19/47f4968659c5e23606c3790c80fc624e691c153d036148449ee84d31b287/aiohttp-3.14.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c7d3a97c678d34fc5b59da671ee9cd630096ddc643e7b5a30d54a2a6f3574d3f", size = 1843496, upload-time = "2026-07-23T01:57:01.591Z" },
- { url = "https://files.pythonhosted.org/packages/64/af/38c33c4dd82fddcb4e56c4653b6f1072a8edbc6b7fa15809f14932c41e2d/aiohttp-3.14.3-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:f8fb78a83c9e5f741ca3a68cfb455c1f5bb83b4e7249a3848b3cd78d0a8563b0", size = 1827746, upload-time = "2026-07-23T01:57:05.131Z" },
- { url = "https://files.pythonhosted.org/packages/a1/9d/0537cda4885ac8f5b7053d164dd06312f4c483a4edcb8ee5b8aaf2a989bf/aiohttp-3.14.3-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:74ab5b6a9fb13e873e5a90946588baecaf488745e1db1a4a5c433f971f035098", size = 1853810, upload-time = "2026-07-23T01:57:08.043Z" },
- { url = "https://files.pythonhosted.org/packages/19/fe/26f9c5e6458385aa86497836b0dea6fb2f027827d63f37c7856cce9286ee/aiohttp-3.14.3-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:bd52f811e65f6fb634b1047159657c98f52b407f8efec907bcfc09da9a4c0a25", size = 1668895, upload-time = "2026-07-23T01:57:10.837Z" },
- { url = "https://files.pythonhosted.org/packages/ec/4c/618b1db9b9ba079b8875d2cdf78e7c4a3bf72903bd5850fee7dd9544600a/aiohttp-3.14.3-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:f0f177d1b195b9e06376cfd7d308d8a1b920909a609d03ac82a8c73bbb16d3b9", size = 1883833, upload-time = "2026-07-23T01:57:13.672Z" },
- { url = "https://files.pythonhosted.org/packages/94/c6/bd959bd1e4771f9fd944e9e436224c48c77b018b73b519b5aad346335bcc/aiohttp-3.14.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:498c6c623134f8e09a3c4e60bcd607a0b4590dd7dbf08dd40851b27cbb520ccb", size = 1844251, upload-time = "2026-07-23T01:57:16.593Z" },
- { url = "https://files.pythonhosted.org/packages/5e/19/08d41839658bdd44a0ed2480f3891705ecb487ce28c0dde62c9040c997e0/aiohttp-3.14.3-cp314-cp314t-win32.whl", hash = "sha256:b304db572b4368edd8dda8a2274f73156fe15558fca4a917cb8a09fc47af5963", size = 474180, upload-time = "2026-07-23T01:57:19.306Z" },
- { url = "https://files.pythonhosted.org/packages/99/5d/3cd6ef0a2b2851f7ab913b5b079334781bd50ff56a323e4454063377a080/aiohttp-3.14.3-cp314-cp314t-win_amd64.whl", hash = "sha256:b20032766aedf6261c7a566585a40867d092ac03a0d81592d5370ef9b054f99b", size = 500528, upload-time = "2026-07-23T01:57:21.762Z" },
- { url = "https://files.pythonhosted.org/packages/a4/37/cfd1ed540a4d318da025590d96b728e63713c09e9377950fc655dadeb856/aiohttp-3.14.3-cp314-cp314t-win_arm64.whl", hash = "sha256:2e1161602f45a54de2ce0905243a95f58cb42dcd378402f3697f5e0b21e9d2e7", size = 469280, upload-time = "2026-07-23T01:57:24.241Z" },
+sdist = { url = "https://files.pythonhosted.org/packages/6c/4c/bdccd81e9ee225b69c60e7766c9a5b05364f118f4d383713b89a682d772d/aiohttp-3.14.5.tar.gz", hash = "sha256:5558a7f5a05af9ecf744af91e5baefc436f93c9333e656c27ec253f9a6bbe178", size = 8078052, upload-time = "2026-10-11T01:05:12.408Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/d8/f3/8997f18890a92c79f77fcfbb4f78ca17c2d4ab109e9eb6d31b4e9de194a0/aiohttp-3.14.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d51db97c96384fbfcaf8f4c65922183a68b94f891c3c10c862ef5f6df2adbb1f", size = 832358, upload-time = "2026-10-11T00:59:42.195Z" },
+ { url = "https://files.pythonhosted.org/packages/8e/42/084651e9efb5cadb99265f786df60f2a7b353cead7bfd2c87003cb4867ad/aiohttp-3.14.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ae53924aa853a7a2ca20ed4142c7c6b56338e4d4cd999e2980075b9efc2e257a", size = 559636, upload-time = "2026-10-11T00:59:43.677Z" },
+ { url = "https://files.pythonhosted.org/packages/3d/fe/92838944e601f0fe195fd3f3ada37e29fbee3d19bfd323fe15937ec79d36/aiohttp-3.14.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a2c473a355f9239efcb72c92d5abfd8fcdb0cc78c8e9af607e72ca12dbb36593", size = 552588, upload-time = "2026-10-11T00:59:45.592Z" },
+ { url = "https://files.pythonhosted.org/packages/8f/b8/dd9b95c5c20ceae1b47738e656bd79e9883e3117a9cc8b143901eb604e9a/aiohttp-3.14.5-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:32e8fa6644e541fcd7e02430588c7fc93b602c1778ea0bc345505db76b61cfb4", size = 1928224, upload-time = "2026-10-11T00:59:47.294Z" },
+ { url = "https://files.pythonhosted.org/packages/c6/47/70010cd2ba8746968d53d433ff328c33f06a66c99da5f3de759c64a6b2eb/aiohttp-3.14.5-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:579f97d5120f2971876d2ddca2968135f6944d00c44c3a6590ad7d86ca9b403f", size = 1877674, upload-time = "2026-10-11T00:59:49.472Z" },
+ { url = "https://files.pythonhosted.org/packages/c5/a1/b026f071dbd87f0bdba86b92d47e46f3899e3ad7143b6e0fe7e7887090b4/aiohttp-3.14.5-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:24409db442e2fb6e766bc7f3943851a8381dec3098140e43bb2e843b79e31b12", size = 1985850, upload-time = "2026-10-11T00:59:51.296Z" },
+ { url = "https://files.pythonhosted.org/packages/36/d1/f7b6f6f8c3cb5a71b53baeddc2e70c224c28b12a23a55c42994c504019b7/aiohttp-3.14.5-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5e8f97c0488ffda3082766ac0f2c8150a9a58c4d05788330e479cfd449b37939", size = 2105471, upload-time = "2026-10-11T00:59:53.191Z" },
+ { url = "https://files.pythonhosted.org/packages/42/74/2a2b22953de15c6c8a80debf26db3047e4e8a5a5db6dd7c2c6c01eec0605/aiohttp-3.14.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:50a195903119008fe9cc68710535eb37f556ffffd6a7759afe70a2c145587045", size = 1929915, upload-time = "2026-10-11T00:59:55.609Z" },
+ { url = "https://files.pythonhosted.org/packages/33/ad/f80e8d33933d0eacd0217efa3b7fb32c9f48ed480ed0db53cf9948bf474f/aiohttp-3.14.5-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0133c3c3b54a0bf1e71fa5c1ad95c93f07fd54e24ef1fe182f5122e1573d2bf1", size = 1773832, upload-time = "2026-10-11T00:59:57.611Z" },
+ { url = "https://files.pythonhosted.org/packages/04/a4/0273d239f3e3bb69438f209c64c82e1f98dc60d5db264795e41f7dd05dcb/aiohttp-3.14.5-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c172db893e516e1358e65a95ee20b7ce7173963eefe318b6ab2a2220688b999e", size = 1901001, upload-time = "2026-10-11T01:00:00.605Z" },
+ { url = "https://files.pythonhosted.org/packages/16/ed/7dd439d26c654645bc34ca3c9a822fc11c1c51801fed1cefdfe1cc41c1f6/aiohttp-3.14.5-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:f2a7966bda23dd85051f1661ce0ace38d6890e05ec6c357ecae9d2479cba377e", size = 1907218, upload-time = "2026-10-11T01:00:02.699Z" },
+ { url = "https://files.pythonhosted.org/packages/32/dd/86249c3b8248562a17fd3e22ee0c164378d65766f01aceef62cf52783710/aiohttp-3.14.5-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:4887d130a7bbfed3a85493bb5a25e5b5b558d40c1d986dd16970d2bb26d63793", size = 1958650, upload-time = "2026-10-11T01:00:04.851Z" },
+ { url = "https://files.pythonhosted.org/packages/bc/0b/ca4d53d68f683ce195807fd0aeb063bf6d1c6b39343fff234c9524e8d5a9/aiohttp-3.14.5-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:225c579c23b68b343cccea27a7e06e3bd8ec23a09c30b427eb3f1e4ca6239b20", size = 1760057, upload-time = "2026-10-11T01:00:06.978Z" },
+ { url = "https://files.pythonhosted.org/packages/6b/42/005437ffd7fa56c2ce3347add40404b654a32754ce91f2e2a14b9e5ab2bc/aiohttp-3.14.5-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:ab52d8f1fc1b64821c1fbad64a647ed6203627004059a6d1ed4f0858a1499703", size = 1978081, upload-time = "2026-10-11T01:00:08.868Z" },
+ { url = "https://files.pythonhosted.org/packages/03/71/3a5b66fe1b7b23d3c6524350817ed55de5feb7fbb4cccba7cbe044d118dd/aiohttp-3.14.5-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:cb131d775a1573c1aee66656bd78b023577bbdb6cb8349a07773bd4f73e68a6e", size = 1922954, upload-time = "2026-10-11T01:00:11.035Z" },
+ { url = "https://files.pythonhosted.org/packages/69/84/d08a554f281d42fd7c6b2b6dd7738f3e3a7a9f657ddd87e11ca2091cdfe3/aiohttp-3.14.5-cp311-cp311-win32.whl", hash = "sha256:e87046c8ff77a8decdb6a41d8ab25824b47531b2da933aeab0c1e21c7acff329", size = 488101, upload-time = "2026-10-11T01:00:12.933Z" },
+ { url = "https://files.pythonhosted.org/packages/0f/15/52b5e65f02b33686ae49f1518548ae4f5a7adaf31d9d3c54fa12a143137b/aiohttp-3.14.5-cp311-cp311-win_amd64.whl", hash = "sha256:6f275c11d1aa6d4c458e05a68be084efe3c55a113d99e3f46a318098e52948fc", size = 512575, upload-time = "2026-10-11T01:00:14.743Z" },
+ { url = "https://files.pythonhosted.org/packages/b0/b9/bb75012635f3defb0f7cbb7c4ae391e36bb9cb3fbdca3b9944e2ebebf743/aiohttp-3.14.5-cp311-cp311-win_arm64.whl", hash = "sha256:b032a0023eb41d768ce77d83210ab2a3c389bc0b09313273c7e1eca48c10a755", size = 493179, upload-time = "2026-10-11T01:00:16.961Z" },
+ { url = "https://files.pythonhosted.org/packages/d5/94/6ba86efddcb616c811b40e6a0dfdd862738f647e4e3860a961075d5e9ed8/aiohttp-3.14.5-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:df37b620684e19b5e25724412518ccafc3b1a49cdac706fdbd2f983fad943450", size = 817499, upload-time = "2026-10-11T01:00:18.901Z" },
+ { url = "https://files.pythonhosted.org/packages/5e/e1/7bca6d84dabd228aa8eb4b7f9feac2586aaa9be5505d7d65bf287a615c43/aiohttp-3.14.5-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:ef60869969180ec2464f1349aff07138ae35ca2200f0946cb3552e49e8f301a8", size = 549467, upload-time = "2026-10-11T01:00:20.854Z" },
+ { url = "https://files.pythonhosted.org/packages/64/91/11b89f45ca486252dd67dd5f3231fec04bf5518da39a95cb3997619f17fb/aiohttp-3.14.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d079c0a0135c36e7beb6f1c88087c8f108dc5891cdd0b5eafa778421bda70ed2", size = 548067, upload-time = "2026-10-11T01:00:22.659Z" },
+ { url = "https://files.pythonhosted.org/packages/22/ff/c6615806c14aab34f82b9424ccde8ce6e417315fd57ce1c5b4d4747888e1/aiohttp-3.14.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:abfda5cb094a829f7bc25216a32f7db2e85cc65bd59910f8e7b40b3d9b224764", size = 1896245, upload-time = "2026-10-11T01:00:24.638Z" },
+ { url = "https://files.pythonhosted.org/packages/39/b2/25a8c971ae6a92c8394d77e42422d7f38989e05cf41a5ceb92d73d67ab7e/aiohttp-3.14.5-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:9cc882cf8619109583c906b4d4a85d6a111a98afa34b7a450d1e08118d016820", size = 1872180, upload-time = "2026-10-11T01:00:26.838Z" },
+ { url = "https://files.pythonhosted.org/packages/2f/d5/99f93ea36cc5205e47c1e5a803e087f2ad21b5430b5db2e942cb6e988a37/aiohttp-3.14.5-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7457580535e019e1247ea35d6a02bf081ad30c26d0cbc210c93f6c3ab67a0835", size = 1937261, upload-time = "2026-10-11T01:00:28.74Z" },
+ { url = "https://files.pythonhosted.org/packages/40/a6/9ac9c9e6695040bd73d2584a1b59a9388f6433c76d5294a7bf591e21ffe5/aiohttp-3.14.5-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:c5ed596aedb9c42afd3fe0aae3117725378ac73d2cc5ddc735056fbdb96c5d02", size = 2064994, upload-time = "2026-10-11T01:00:30.623Z" },
+ { url = "https://files.pythonhosted.org/packages/da/e4/aa172eb534b7f02f1f8ff1c3213347eaf3cf218db91a727c6863c22f1035/aiohttp-3.14.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:20f085697d7e911f1f73c43ed03fafbed1e7121797e2eb5428efa80398060584", size = 1919630, upload-time = "2026-10-11T01:00:32.548Z" },
+ { url = "https://files.pythonhosted.org/packages/06/7d/4eedafc5bababa8932636c141e346806966eade12c0b7e5946d43bf8218b/aiohttp-3.14.5-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:74b0a9c8270f9b0a11410e124ff8d4f18bfc1f1837440ec84da5ae7b50927b5d", size = 1710016, upload-time = "2026-10-11T01:00:34.471Z" },
+ { url = "https://files.pythonhosted.org/packages/b2/94/eee018537ba19da0ceb2ac79cab83faed4ac49568e08376e2799043f2538/aiohttp-3.14.5-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:19e2ba471507c34f8252402ab50f5ab512398b9ea8c8f1cb26beb3f75793ba30", size = 1858112, upload-time = "2026-10-11T01:00:36.581Z" },
+ { url = "https://files.pythonhosted.org/packages/68/76/354653a306547238f3427283905972d796ba7c292ba9977abec9f2b6f260/aiohttp-3.14.5-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:d418ce2af40c6bb685b3f663e9e8de27cb0a22431d8e88a167348d7f01878073", size = 1896371, upload-time = "2026-10-11T01:00:38.478Z" },
+ { url = "https://files.pythonhosted.org/packages/f2/ec/63e8c7136b570e356345ad3174e3820fdc973ea10712cb6c649bf875755a/aiohttp-3.14.5-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:70cb4008ac2ed1e0ca9e824deb4b53d3aa0d939109698ebf1e723a84337bd794", size = 1905836, upload-time = "2026-10-11T01:00:40.527Z" },
+ { url = "https://files.pythonhosted.org/packages/57/d8/11365bda144b127928cd42533d0eff78a55613c9e28f81941bd6630ea887/aiohttp-3.14.5-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:a23fe35d776bc03cb495938b9594450d047e3bc08c5255315a82323e9cb7d2dd", size = 1696534, upload-time = "2026-10-11T01:00:42.686Z" },
+ { url = "https://files.pythonhosted.org/packages/2f/3d/82df0461b18e00b2998f205c03e0d3010222478c43640aceb8e03dcd7e8f/aiohttp-3.14.5-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:3e0eb43bed3c6801a6cee315195377789e90b2a72c2277a475b578535312488d", size = 1933970, upload-time = "2026-10-11T01:00:44.71Z" },
+ { url = "https://files.pythonhosted.org/packages/03/ad/6ddfe0aacd931c17b53533336d97e9d11a98b96d6ae815a9da0b19f82ccf/aiohttp-3.14.5-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3be7dd397d64ca3e1869626fa9318aaebb54b7bf93bc72d7a205448d83e4f748", size = 1899501, upload-time = "2026-10-11T01:00:46.629Z" },
+ { url = "https://files.pythonhosted.org/packages/9e/8e/189bdd9ae4793059bb09f6dc880f211a6c6c7859cebcbf33912dbfab7dd7/aiohttp-3.14.5-cp312-cp312-win32.whl", hash = "sha256:eb324e2009fb54db30a071dad7caf6998ee2879c4704007efb244514dad1fec1", size = 480370, upload-time = "2026-10-11T01:00:48.468Z" },
+ { url = "https://files.pythonhosted.org/packages/ae/ce/1f08114679d49655b30a6e0a29858375c94b82c1de1a0bd0a20c2fee8b02/aiohttp-3.14.5-cp312-cp312-win_amd64.whl", hash = "sha256:2cc38a4f2b516bef1714e690df87a0e043faf1a7693c82d860091684453d5111", size = 506141, upload-time = "2026-10-11T01:00:50.272Z" },
+ { url = "https://files.pythonhosted.org/packages/79/d4/c7b4f60b16a1b7e43249fa9031ae05e7e8c341ba4b7d1866f914dafeaa0e/aiohttp-3.14.5-cp312-cp312-win_arm64.whl", hash = "sha256:a63afd1f757de949028387e65a7127b61ad0f775432dbb0e62816ae619fe69ac", size = 488108, upload-time = "2026-10-11T01:00:52.321Z" },
+ { url = "https://files.pythonhosted.org/packages/d3/e1/2841e020ebb7aefae5513586193e011e06313d9a6bdbd296622afbbce204/aiohttp-3.14.5-cp313-cp313-android_24_arm64_v8a.whl", hash = "sha256:9ad7e6aa38c20da1be697874349c4c273c8a03b7887169665081706398d0439a", size = 538932, upload-time = "2026-10-11T01:00:54.3Z" },
+ { url = "https://files.pythonhosted.org/packages/f7/a6/7fb8ea8fe96bcc7b7c7a36d10f021d99d01a8dc8a4b3f0ddacecfad9a80e/aiohttp-3.14.5-cp313-cp313-android_24_x86_64.whl", hash = "sha256:f59c7673465908cbe506117176156c127f29f917677afceada34957179221d91", size = 553329, upload-time = "2026-10-11T01:00:56.442Z" },
+ { url = "https://files.pythonhosted.org/packages/de/64/d056e3c27647dc25af1a592cf356245382ea7c808171b9dac7677afedfc8/aiohttp-3.14.5-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:1b5416552740edf07234cc9437d0706f2acb67b93c198670b1a68e1b2b587dec", size = 521367, upload-time = "2026-10-11T01:00:58.345Z" },
+ { url = "https://files.pythonhosted.org/packages/3e/e4/95226147e11d4db916fd1d495dcf85af8e3816e38333e42718241196e848/aiohttp-3.14.5-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:43351bdb5e4c3cb7d1772368e988534e869a74db7778079a83782c11c69535c7", size = 528322, upload-time = "2026-10-11T01:01:00.211Z" },
+ { url = "https://files.pythonhosted.org/packages/17/cd/1d3c9192cafdb51cad62b2d3ded96cff9cc8af51893210aadd448a325389/aiohttp-3.14.5-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:c8c4478bef6d57fcfda15dae461ea3c9f06aa7b257c58df3f2300174ccbb185a", size = 539874, upload-time = "2026-10-11T01:01:02.06Z" },
+ { url = "https://files.pythonhosted.org/packages/f6/0c/dfa33aecc7d4d1dc75e05248f5eac5a0edf4d09e7b44d93ab62529b0c1db/aiohttp-3.14.5-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:c2c30484dd1417ef98b51021ffa2cc0d7f3c78918adaaaab7e70817335ab3e02", size = 813836, upload-time = "2026-10-11T01:01:04.01Z" },
+ { url = "https://files.pythonhosted.org/packages/33/17/4a63738052d20567d55529d6daa1b9480d906fd52930fbcf6d3fbed618f0/aiohttp-3.14.5-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:dab9ac5a67c8d1f070c00fa8fccb7cbd1b8dcc1a8d6b42f37540df9b3d4cc603", size = 548070, upload-time = "2026-10-11T01:01:06.035Z" },
+ { url = "https://files.pythonhosted.org/packages/15/e5/b57e58695a757fd4c02497c033fced96a69c631b13866c43d336530c9670/aiohttp-3.14.5-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e1cc2bfaee8c214f06080a7c7d5772419b8a1108e8e5349236189811823fb02a", size = 545786, upload-time = "2026-10-11T01:01:07.817Z" },
+ { url = "https://files.pythonhosted.org/packages/9a/68/8c2c67a3aedf46e00f3c42f04fbc6983de80d4ed5786151e33681ba45883/aiohttp-3.14.5-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:74efb69332b85675b1eabd760a8cfc2e2cf42c60607c66f88014c1bdfb40942d", size = 1886492, upload-time = "2026-10-11T01:01:09.834Z" },
+ { url = "https://files.pythonhosted.org/packages/ab/4b/74aab5e8d28c62e8f795b4fe8f38cf5586fd264a9a27bd2141ef6490333d/aiohttp-3.14.5-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:42b5e616946dbaf505e2bff18c9af2cd4ef9e7ef300ee58a6e951a5b7cf147ae", size = 1870057, upload-time = "2026-10-11T01:01:12.045Z" },
+ { url = "https://files.pythonhosted.org/packages/a8/f7/eafc3b1988302b1815d9fd4a21071be5c360d616c0a430d02fd92dc97688/aiohttp-3.14.5-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f9033b43f511f27547c557dcaba0177649e10a3725336ccd2cce0fdc1dc4850d", size = 1925119, upload-time = "2026-10-11T01:01:14.09Z" },
+ { url = "https://files.pythonhosted.org/packages/a1/04/78d8f294f74dd570f3898ff20402349fce524176045df98ba727d6846a68/aiohttp-3.14.5-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:15a310d3c71398e3d7bfc93a1a73fbe664315cd9e9016b8efc1cff85eeab7155", size = 2053137, upload-time = "2026-10-11T01:01:16.344Z" },
+ { url = "https://files.pythonhosted.org/packages/32/51/395d225ef36f5a50d8e548dcd3141bfdbcd31fb6eed859022c573d2c4d66/aiohttp-3.14.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1ffa3a523a36d8628f98c06492ae16a31a23d14c0b4ec721757b477319f656d6", size = 1911038, upload-time = "2026-10-11T01:01:18.653Z" },
+ { url = "https://files.pythonhosted.org/packages/ff/a4/2aec1aa06d82e8a244843b5dae31d78061e5e76744270a86dd0ee051c889/aiohttp-3.14.5-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:5fb6a6e919bfb703227bc1ce6579281b84b1a2ba57deb9794dfdbec7dcd1e40c", size = 1702205, upload-time = "2026-10-11T01:01:20.904Z" },
+ { url = "https://files.pythonhosted.org/packages/16/27/6051bfde7b6f418f70edd60d655fa426abb3355fa0981764739d87ecf160/aiohttp-3.14.5-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:43e1b7994a8b038125f722bff07492ef501110722c2727c408995d9fb864c421", size = 1848588, upload-time = "2026-10-11T01:01:22.918Z" },
+ { url = "https://files.pythonhosted.org/packages/9e/44/55efc06fc26c4e6e1c095f231b4c222bf2d86d64a8eebbc24b2bb5958ea8/aiohttp-3.14.5-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:5f3e96071686755d9cd3600c3880183eb94b012178e92746d68101800f0ed8a3", size = 1887540, upload-time = "2026-10-11T01:01:25.278Z" },
+ { url = "https://files.pythonhosted.org/packages/48/dc/1502bfdc2a65760d386ac6a00090b0addaa8a3c9c60b3f8127fad3a9afb2/aiohttp-3.14.5-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:cd88b01f3d37b7a2a34f91d98f14720206f1ea3d540843fab2d649dd5fb91fec", size = 1895030, upload-time = "2026-10-11T01:01:27.316Z" },
+ { url = "https://files.pythonhosted.org/packages/93/7e/44174bb6288264418c9eec07a5e35180969c0d5a796c7af544db3cb8a33a/aiohttp-3.14.5-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:f2ed8b64dc0c651c0f5a9c926777719770021251b8f336d97c4b80b660836ce1", size = 1693244, upload-time = "2026-10-11T01:01:29.39Z" },
+ { url = "https://files.pythonhosted.org/packages/47/dd/b507d64e50db23888582fff08eda13998b12f9dea70c072edaac19218380/aiohttp-3.14.5-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:a9918e58faf62ba2c7147927d06057aec78f42475aff5048047ec47e7265a600", size = 1926308, upload-time = "2026-10-11T01:01:31.634Z" },
+ { url = "https://files.pythonhosted.org/packages/98/4b/5b51b4f63e3f2793151f4aea49c48fe1e00baeb7cec9c7a206de499f8de0/aiohttp-3.14.5-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:42f320d4a5b00b9af0bddcfec5407dc6f2d9816f006b2f79ebbaa31f16895df3", size = 1888406, upload-time = "2026-10-11T01:01:33.715Z" },
+ { url = "https://files.pythonhosted.org/packages/ff/13/d5e818a5eaba9f822016727299f41c0e1075799f82a6433ec508a93ab867/aiohttp-3.14.5-cp313-cp313-win32.whl", hash = "sha256:3ae800a20947e2c2e53088047d021e6bf7d51560cc49f6a0737a1f79d2e3a13c", size = 479970, upload-time = "2026-10-11T01:01:35.677Z" },
+ { url = "https://files.pythonhosted.org/packages/8d/d0/8eca2c65aa467320990d78fb2005f38ed3588944280c39ff9deb6423fef1/aiohttp-3.14.5-cp313-cp313-win_amd64.whl", hash = "sha256:d05e94cdfe0d15d0206f970722d2554780ce562787b21b218b275447f8751319", size = 505985, upload-time = "2026-10-11T01:01:37.574Z" },
+ { url = "https://files.pythonhosted.org/packages/7a/f8/4cdd65305d2fca14b886bea9ed2abb1fe726287872524e56e3d26692b47d/aiohttp-3.14.5-cp313-cp313-win_arm64.whl", hash = "sha256:f001b571ead90ca1770f1e616db255351a1703317f20374c361ef22f12c06d09", size = 487629, upload-time = "2026-10-11T01:01:39.477Z" },
+ { url = "https://files.pythonhosted.org/packages/43/be/3184a1d34a8be665569eadb7e9e764b4629e4f3413e241cb2e4d6fecf3b3/aiohttp-3.14.5-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:939042d5cda21d41a6f512e7cc8b8e33a2aebff863352251da495fbd91b673b5", size = 540673, upload-time = "2026-10-11T01:01:41.354Z" },
+ { url = "https://files.pythonhosted.org/packages/60/2a/d35f3ba4cf157b072e3b674bf9983047ca5ea5173c995d32d877e1191d36/aiohttp-3.14.5-cp314-cp314-android_24_x86_64.whl", hash = "sha256:6da32b5ff3fd78d244e37300463434c7145162bfd2b6e9e915ab164da37f7343", size = 554087, upload-time = "2026-10-11T01:01:43.719Z" },
+ { url = "https://files.pythonhosted.org/packages/fc/d2/61a33880ca4eaca95a9c60ca3f6beed15555af1028652dfaac601627787b/aiohttp-3.14.5-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:1b438b73c38111818d0c9d6a5c2bfed8584c8e503a49ef085d70e874ec846738", size = 522613, upload-time = "2026-10-11T01:01:46.154Z" },
+ { url = "https://files.pythonhosted.org/packages/31/1d/de579b299d2225dc2c6fd99d579d91f16c02a913fb5af9a3cf2fe9bd88ba/aiohttp-3.14.5-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:755933b107ea7a6a9ac916f635a70595a5b1a32fac10a8ff0b9f2ab88555550c", size = 529682, upload-time = "2026-10-11T01:01:48.477Z" },
+ { url = "https://files.pythonhosted.org/packages/f4/4a/ddb923564e15e053b6e060b0036e1694dcadcb13aa476c5a87dcad20e336/aiohttp-3.14.5-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:b3cc509327c7b27f6f4727a8830f4004f6df7766e179f2f4b8e54e65c0bec5d3", size = 540120, upload-time = "2026-10-11T01:01:50.474Z" },
+ { url = "https://files.pythonhosted.org/packages/3d/36/a640fbecaa53727a5900b892bdbe17b5f3e8cc88903e22864fe41b654def/aiohttp-3.14.5-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:7bd8ac754ebd6733a3e2a0dd1674c4d8ab086196803fd8dcd776f07b4e2607d9", size = 818795, upload-time = "2026-10-11T01:01:52.665Z" },
+ { url = "https://files.pythonhosted.org/packages/ef/b6/d52ca608859e271b5fa7944074802dc45f60e52c318a4ddc34edbf73586e/aiohttp-3.14.5-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:e724a7b6091f0b1ac064f9d1b15ff9ec52e6033a86cdae649e5f086e32a3c0db", size = 549667, upload-time = "2026-10-11T01:01:54.65Z" },
+ { url = "https://files.pythonhosted.org/packages/ce/b5/05b8ac39a76ff4bca89f42a4c2471560c71f894ff6e4bc16158c951874e3/aiohttp-3.14.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c32e26310cc10e547f53cd13d39a369034f69dcb7d749d5cb0e5f67bc196b6ba", size = 548922, upload-time = "2026-10-11T01:01:56.547Z" },
+ { url = "https://files.pythonhosted.org/packages/19/b0/5aa186d56ce2334dabe29b70bd99dc8ae926ee44184c0de64a53d415a4f3/aiohttp-3.14.5-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1eb8167961ec4dfcc8cb9dd50bd0ee72519f7ef496be95203e49e27b01618382", size = 1882422, upload-time = "2026-10-11T01:01:59.258Z" },
+ { url = "https://files.pythonhosted.org/packages/db/f7/7d5c91bb9620db300c8ddb05337a9014301acb626223faff3abcb8ea47d7/aiohttp-3.14.5-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c1d60eafd9c7e8e74abd03a5b00df44e7febfe6d9b89b559c0a6551eef0699d4", size = 1843621, upload-time = "2026-10-11T01:02:01.417Z" },
+ { url = "https://files.pythonhosted.org/packages/30/0a/b208953b96d8f24b75f6da704f508e6c5cf3022f52b60c61933df082e89c/aiohttp-3.14.5-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:137351bf20bbed9a65e839f4a4452ac377389bdb2f2857d2acffef38f5e9f2d1", size = 1927915, upload-time = "2026-10-11T01:02:03.697Z" },
+ { url = "https://files.pythonhosted.org/packages/f6/79/90ebcccb55e2d1e11a1fed581d83bb966e38fb35fb4b2577fdc980f8707a/aiohttp-3.14.5-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:fba47bc2c3d7303c3d027c6cf4d07626c37b1314ac81f5820c31032e0ca1f677", size = 2036339, upload-time = "2026-10-11T01:02:06.046Z" },
+ { url = "https://files.pythonhosted.org/packages/a6/66/55a8904b3a129fafdf94f9cc0a2e4ca09a3c914650be52355db7ad0bbdb6/aiohttp-3.14.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:94684b879ac1d71e4238850c99b62dc1b28d9086b156a2555f082010b85a865c", size = 1888041, upload-time = "2026-10-11T01:02:08.384Z" },
+ { url = "https://files.pythonhosted.org/packages/0b/b8/96b25da7329a52e42c812b1e8b076386039ec4fc312afa043d173d8147fc/aiohttp-3.14.5-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:56572c42e3ecd636de8d2c3dd54cf5fc939cb5c32eb56297f176a0d366fac622", size = 1703849, upload-time = "2026-10-11T01:02:10.903Z" },
+ { url = "https://files.pythonhosted.org/packages/1b/43/fbf976e3ae4c038d6f5c84945ab2150298c2d71201674d4e53d158063e75/aiohttp-3.14.5-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:a95529a92a446db351675f4aab518feaf5e99842f63f5dd17160c2b74f382db3", size = 1849703, upload-time = "2026-10-11T01:02:13.15Z" },
+ { url = "https://files.pythonhosted.org/packages/8b/7d/218e912f4c1d89bde7ac551409be57ad2f6121638e56942d395a7cb1fa58/aiohttp-3.14.5-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:3edbece0379b8b4aaa67619b8aa2399bb66fce372cd5911098a434ea77220aa0", size = 1852695, upload-time = "2026-10-11T01:02:15.295Z" },
+ { url = "https://files.pythonhosted.org/packages/5a/42/252a1b9287e3b6e393a1c3bd1776f36af30f5f25f071bbf2b0cb7eba9116/aiohttp-3.14.5-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:56d9828f204331a5ca8850fcfe2bcce95a149f1f223f60cc7216e5524978e480", size = 1893493, upload-time = "2026-10-11T01:02:17.93Z" },
+ { url = "https://files.pythonhosted.org/packages/78/97/71cae83d5100556fad1521684f7cd1e3e578432644f850245ed3bd969310/aiohttp-3.14.5-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:20064a177a070d789ee64a50b01a9161d3468e989baacfc6c714aa685c4b332f", size = 1693468, upload-time = "2026-10-11T01:02:20.666Z" },
+ { url = "https://files.pythonhosted.org/packages/1f/69/73d88e97a8b5f0ca7a946d0011c0de99fb188b1687c7948ecd0553dc5bf0/aiohttp-3.14.5-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:81c2b3dfd56c62bee6108e4852d5970b4cf9086390b6983f52b666e878c1f115", size = 1915398, upload-time = "2026-10-11T01:02:23.011Z" },
+ { url = "https://files.pythonhosted.org/packages/05/f0/881644bcb15d4b258daea9b720a0af9dc4330496cc8d6ade9090cdd0cffc/aiohttp-3.14.5-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:09ec102b4b8c9a920275733bbc11fdbb615efe6f9231a06007c0218d336fb77a", size = 1871470, upload-time = "2026-10-11T01:02:25.278Z" },
+ { url = "https://files.pythonhosted.org/packages/7f/de/19d9ebbcce5aedaa3242d8a99ff8816a60bdb7629fb0084bf4a45bfd1f62/aiohttp-3.14.5-cp314-cp314-win32.whl", hash = "sha256:9c428eb2bd8817588d16a0ab898aa4eb5d141f896aa2b394cc79a4cf61d9a8e2", size = 485517, upload-time = "2026-10-11T01:02:27.579Z" },
+ { url = "https://files.pythonhosted.org/packages/a9/74/8cdaf0e58c2588371670d5a9a8215bbb971d36940b6e5d051967dd05c07d/aiohttp-3.14.5-cp314-cp314-win_amd64.whl", hash = "sha256:6f967dde489ca6a8c02d093ab245d2cbf50ccb5c36adf0188b17b0ca39d24b67", size = 511755, upload-time = "2026-10-11T01:02:29.685Z" },
+ { url = "https://files.pythonhosted.org/packages/1a/6b/e0100e25502430a531c7cf1482a378d0b65bf728ab60c01ee270e56bc469/aiohttp-3.14.5-cp314-cp314-win_arm64.whl", hash = "sha256:1d2d981b53dd09a319e3570ef8cc3bbc3ef86f5a7abef0f6b2bff3867db3a9e7", size = 495151, upload-time = "2026-10-11T01:02:32.163Z" },
+ { url = "https://files.pythonhosted.org/packages/9d/c2/ca2ead7b655688c53c03aeeb6e96e6851c9ff08d6be7b13802f53a6ae8fd/aiohttp-3.14.5-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:9ce66feae6ac65327379460380549bf1b8df8e17c4e25df2a2bcf168272e3bed", size = 855396, upload-time = "2026-10-11T01:02:34.443Z" },
+ { url = "https://files.pythonhosted.org/packages/a7/70/22206fea409255a240c926ce11de48de354ae2bb90ca44f709c05497585d/aiohttp-3.14.5-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:27c2322e03f66101acb09869ce1cf1efc04994ee95e1735b69827bf8c8b9d781", size = 567734, upload-time = "2026-10-11T01:02:36.644Z" },
+ { url = "https://files.pythonhosted.org/packages/ce/e5/79a36c118308b56f8667d67e05d2fb6dc638ab45985704cdb199631bedaa/aiohttp-3.14.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ff75a7537413a86e7cafe98e0e1d6e3dc4b15c6349896e7d5c6b881bfdb6d550", size = 567379, upload-time = "2026-10-11T01:02:38.757Z" },
+ { url = "https://files.pythonhosted.org/packages/63/a3/2ebec7dece3b1f02c30d2e484647f6f7b13952b1bb40a4cb285b849e8432/aiohttp-3.14.5-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c061aa954daaf57d2a4b8374f9fca621ef0e1b603584431c220c22458c59b6d", size = 2050686, upload-time = "2026-10-11T01:02:41.169Z" },
+ { url = "https://files.pythonhosted.org/packages/3a/d2/7e4d093db2f4450482652e7ef19a9e19919028f5135aa52bc4078c3beb80/aiohttp-3.14.5-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:1612fa5857b37bf32e5c1eaeefb96e3b01e9c70679eec81f0934e8a600080863", size = 1915077, upload-time = "2026-10-11T01:02:43.563Z" },
+ { url = "https://files.pythonhosted.org/packages/a6/88/bd40d09958442a0a1df67da81de496361d6e2afc04f9db2950d835da750b/aiohttp-3.14.5-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:adbeee7d6fd4cf5fe0aece2fb3edc4243615d3180430ba8149d01a90670cac99", size = 2027204, upload-time = "2026-10-11T01:02:46.185Z" },
+ { url = "https://files.pythonhosted.org/packages/63/eb/3a601c1f8d3103c1a60ea981f20924855da9f575d2007fc38f8898b792fb/aiohttp-3.14.5-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b2966998927d7bed9db12c0a4647b0c7b179755878fc9c357fe1ffd3e3b0c1a5", size = 2149520, upload-time = "2026-10-11T01:02:48.812Z" },
+ { url = "https://files.pythonhosted.org/packages/22/d0/4e41bfe1b1ce1cb6f6d2e59fa7a88ef5cf92c402b2d07e9018778ba9edbc/aiohttp-3.14.5-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8e317e0fb6b16212c881d2205a7d87414c29acd69320b3aa6dce9d9c7b86fe4f", size = 2002039, upload-time = "2026-10-11T01:02:51.293Z" },
+ { url = "https://files.pythonhosted.org/packages/6f/5e/72067019545c502b881b031153c437752ecef48d7d213bc0218ccebb4bfb/aiohttp-3.14.5-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:50343c1757b4b6f6708eeaf24534b32f19dfb99fb1b762c00420867a62fc81e0", size = 1786164, upload-time = "2026-10-11T01:02:53.533Z" },
+ { url = "https://files.pythonhosted.org/packages/d9/fe/7741efd6119bfb7a00827fe6f7b84b4409de58d888ae21adc5a9a6824992/aiohttp-3.14.5-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:083673c7a94c3ea035caaa5ca04288bdb44887abfe1f5ba23294e6a4b03efd2d", size = 1970689, upload-time = "2026-10-11T01:02:55.888Z" },
+ { url = "https://files.pythonhosted.org/packages/43/e7/342a13bf67f34d269bf2f7e870ecd72b99c832cc6f0a271a9210c0ebfb84/aiohttp-3.14.5-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:2528cb4c6b92008c76ac9ac6298624069bb2db91ff4929905512d1d84485f658", size = 1951967, upload-time = "2026-10-11T01:02:58.467Z" },
+ { url = "https://files.pythonhosted.org/packages/e7/d4/fdb3b27340617e5e64df18a70fa89097778652ea5c7c7e2f79def76999c3/aiohttp-3.14.5-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:b1b8ece1e71132d2afba4dbc0c3d62c766e25165990b25db1196c04969eb3d84", size = 1968511, upload-time = "2026-10-11T01:03:00.883Z" },
+ { url = "https://files.pythonhosted.org/packages/83/b2/e8f88298de78d1a951f36f9f966d38ec6ed1d4721303ba02064a545e8aa6/aiohttp-3.14.5-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:fce9523df31cea6284f3e2c479876750d7687cf671d7b25d32b19effc0e86441", size = 1778497, upload-time = "2026-10-11T01:03:03.206Z" },
+ { url = "https://files.pythonhosted.org/packages/22/68/9ccdb93d664345c546be7f34480b921774d8c0d98f47e70d7e03b115d475/aiohttp-3.14.5-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:09e0eb18c7e0c8777e2f9149de63799195b9b3ca1b5c81ba6f32f2c6b8628210", size = 1999676, upload-time = "2026-10-11T01:03:05.829Z" },
+ { url = "https://files.pythonhosted.org/packages/57/4a/a33cfa6dcb00e94194ae4fe710432ca4ed111e016356b4ba4d2f4c3a124c/aiohttp-3.14.5-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6774814fd5c338e72ee0da5cbb9432816df450e69c019f72b5d29bdec2a1792d", size = 1963437, upload-time = "2026-10-11T01:03:08.196Z" },
+ { url = "https://files.pythonhosted.org/packages/f4/20/eacbecfea3b5c3dcbfc9b023e3a5460f43e5dda16d06a2877ebe7184c3f3/aiohttp-3.14.5-cp314-cp314t-win32.whl", hash = "sha256:33f706574e32c6e694f352a856e05caf18f7f2c871b3e87b41c55ea452b409ab", size = 503973, upload-time = "2026-10-11T01:03:10.481Z" },
+ { url = "https://files.pythonhosted.org/packages/ff/78/18eec294f6c8c5dc845dcf6d730a0147d8d0f17e86138a7bdb85e43a30fa/aiohttp-3.14.5-cp314-cp314t-win_amd64.whl", hash = "sha256:5ba14a839fbe87cf7c12a6b5661c05f324a296eb8363141edb3944ba63d4c9d3", size = 531190, upload-time = "2026-10-11T01:03:12.716Z" },
+ { url = "https://files.pythonhosted.org/packages/9d/39/e53f8169acc85271ebd12b5b32ad7f1541b35639ccbe0f49034c64785d10/aiohttp-3.14.5-cp314-cp314t-win_arm64.whl", hash = "sha256:1061b364556e8172e8d46b0b183adeeb73e8c42d30ebc745591e1bd89acad52e", size = 510360, upload-time = "2026-10-11T01:03:15.08Z" },
+ { url = "https://files.pythonhosted.org/packages/68/30/173960c42b05a6c59f7558e4b12a4b0d9ba376cf6aa9bde7f9e08a30ca8d/aiohttp-3.14.5-py3-none-any.whl", hash = "sha256:efc21a454892828368b11c2c780de0ff8bc991f73f6b99c6b66e56205470929b", size = 279517, upload-time = "2026-10-11T01:05:08.523Z" },
]
[[package]]
@@ -4473,6 +4474,24 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/54/29/6ae42ba32b153ae0a44ae125f0caff2188bbe62d99c82d1768da30864e72/opentelemetry_exporter_otlp_proto_grpc-1.44.0-py3-none-any.whl", hash = "sha256:6a1a645ea182a2f59440c51fa8301d309f3324a8f9d65f8395584b064b67ee4e", size = 19624, upload-time = "2026-07-16T15:25:19.096Z" },
]
+[[package]]
+name = "opentelemetry-exporter-otlp-proto-http"
+version = "1.44.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "googleapis-common-protos" },
+ { name = "opentelemetry-api" },
+ { name = "opentelemetry-exporter-otlp-proto-common" },
+ { name = "opentelemetry-proto" },
+ { name = "opentelemetry-sdk" },
+ { name = "requests" },
+ { name = "typing-extensions" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/1a/87/95e2a5aaa795b4e2260d74e16df2d5541deb2ea9de010bcd615f4dee2654/opentelemetry_exporter_otlp_proto_http-1.44.0.tar.gz", hash = "sha256:c633d7270ad6b57cd4cfbe8b0007a9e2e7c0cb50bd6c50fe2a7b245f721a09d8", size = 25806, upload-time = "2026-07-16T15:25:39.162Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/cd/d0/fdeb1a98d8d3a6205f5f297c51b4a9bfe65126ab60339669bbe3dd54c2e2/opentelemetry_exporter_otlp_proto_http-1.44.0-py3-none-any.whl", hash = "sha256:838592fce774c1c8bb7b9a0a7facbfa82e17be5a8a4e94cef10cb84ae026bae3", size = 21850, upload-time = "2026-07-16T15:25:20.006Z" },
+]
+
[[package]]
name = "opentelemetry-instrumentation"
version = "0.65b0"
@@ -7066,6 +7085,7 @@ cloud = [
{ name = "openai-agents" },
{ name = "opentelemetry-distro" },
{ name = "opentelemetry-exporter-otlp-proto-grpc" },
+ { name = "opentelemetry-exporter-otlp-proto-http" },
{ name = "opentelemetry-instrumentation-aiohttp-client" },
{ name = "opentelemetry-instrumentation-asyncio" },
{ name = "opentelemetry-instrumentation-asyncpg" },
@@ -7280,6 +7300,7 @@ cloud = [
{ name = "openai-agents", specifier = ">=0.14.8,<0.15" },
{ name = "opentelemetry-distro", specifier = ">=0.60b1,<1" },
{ name = "opentelemetry-exporter-otlp-proto-grpc", specifier = ">=1.41.1,<2" },
+ { name = "opentelemetry-exporter-otlp-proto-http", specifier = ">=1.41.1,<2" },
{ name = "opentelemetry-instrumentation-aiohttp-client", specifier = ">=0.60b1,<1" },
{ name = "opentelemetry-instrumentation-asyncio", specifier = ">=0.60b1,<1" },
{ name = "opentelemetry-instrumentation-asyncpg", specifier = ">=0.60b1,<1" },
@@ -8326,124 +8347,101 @@ wheels = [
[[package]]
name = "yarl"
-version = "1.23.0"
+version = "1.25.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "idna" },
{ name = "multidict" },
{ name = "propcache" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/23/6e/beb1beec874a72f23815c1434518bfc4ed2175065173fb138c3705f658d4/yarl-1.23.0.tar.gz", hash = "sha256:53b1ea6ca88ebd4420379c330aea57e258408dd0df9af0992e5de2078dc9f5d5", size = 194676, upload-time = "2026-03-01T22:07:53.373Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/a2/aa/60da938b8f0997ba3a911263c40d82b6f645a67902a490b46f3355e10fae/yarl-1.23.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:b35d13d549077713e4414f927cdc388d62e543987c572baee613bf82f11a4b99", size = 123641, upload-time = "2026-03-01T22:04:42.841Z" },
- { url = "https://files.pythonhosted.org/packages/24/84/e237607faf4e099dbb8a4f511cfd5efcb5f75918baad200ff7380635631b/yarl-1.23.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cbb0fef01f0c6b38cb0f39b1f78fc90b807e0e3c86a7ff3ce74ad77ce5c7880c", size = 86248, upload-time = "2026-03-01T22:04:44.757Z" },
- { url = "https://files.pythonhosted.org/packages/b2/0d/71ceabc14c146ba8ee3804ca7b3d42b1664c8440439de5214d366fec7d3a/yarl-1.23.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dc52310451fc7c629e13c4e061cbe2dd01684d91f2f8ee2821b083c58bd72432", size = 85988, upload-time = "2026-03-01T22:04:46.365Z" },
- { url = "https://files.pythonhosted.org/packages/8c/6c/4a90d59c572e46b270ca132aca66954f1175abd691f74c1ef4c6711828e2/yarl-1.23.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b2c6b50c7b0464165472b56b42d4c76a7b864597007d9c085e8b63e185cf4a7a", size = 100566, upload-time = "2026-03-01T22:04:47.639Z" },
- { url = "https://files.pythonhosted.org/packages/49/fb/c438fb5108047e629f6282a371e6e91cf3f97ee087c4fb748a1f32ceef55/yarl-1.23.0-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:aafe5dcfda86c8af00386d7781d4c2181b5011b7be3f2add5e99899ea925df05", size = 92079, upload-time = "2026-03-01T22:04:48.925Z" },
- { url = "https://files.pythonhosted.org/packages/d9/13/d269aa1aed3e4f50a5a103f96327210cc5fa5dd2d50882778f13c7a14606/yarl-1.23.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9ee33b875f0b390564c1fb7bc528abf18c8ee6073b201c6ae8524aca778e2d83", size = 108741, upload-time = "2026-03-01T22:04:50.838Z" },
- { url = "https://files.pythonhosted.org/packages/85/fb/115b16f22c37ea4437d323e472945bea97301c8ec6089868fa560abab590/yarl-1.23.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4c41e021bc6d7affb3364dc1e1e5fa9582b470f283748784bd6ea0558f87f42c", size = 108099, upload-time = "2026-03-01T22:04:52.499Z" },
- { url = "https://files.pythonhosted.org/packages/9a/64/c53487d9f4968045b8afa51aed7ca44f58b2589e772f32745f3744476c82/yarl-1.23.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:99c8a9ed30f4164bc4c14b37a90208836cbf50d4ce2a57c71d0f52c7fb4f7598", size = 102678, upload-time = "2026-03-01T22:04:55.176Z" },
- { url = "https://files.pythonhosted.org/packages/85/59/cd98e556fbb2bf8fab29c1a722f67ad45c5f3447cac798ab85620d1e70af/yarl-1.23.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f2af5c81a1f124609d5f33507082fc3f739959d4719b56877ab1ee7e7b3d602b", size = 100803, upload-time = "2026-03-01T22:04:56.588Z" },
- { url = "https://files.pythonhosted.org/packages/9e/c0/b39770b56d4a9f0bb5f77e2f1763cd2d75cc2f6c0131e3b4c360348fcd65/yarl-1.23.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:6b41389c19b07c760c7e427a3462e8ab83c4bb087d127f0e854c706ce1b9215c", size = 100163, upload-time = "2026-03-01T22:04:58.492Z" },
- { url = "https://files.pythonhosted.org/packages/e7/64/6980f99ab00e1f0ff67cb84766c93d595b067eed07439cfccfc8fb28c1a6/yarl-1.23.0-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:1dc702e42d0684f42d6519c8d581e49c96cefaaab16691f03566d30658ee8788", size = 93859, upload-time = "2026-03-01T22:05:00.268Z" },
- { url = "https://files.pythonhosted.org/packages/38/69/912e6c5e146793e5d4b5fe39ff5b00f4d22463dfd5a162bec565ac757673/yarl-1.23.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:0e40111274f340d32ebcc0a5668d54d2b552a6cca84c9475859d364b380e3222", size = 108202, upload-time = "2026-03-01T22:05:02.273Z" },
- { url = "https://files.pythonhosted.org/packages/59/97/35ca6767524687ad64e5f5c31ad54bc76d585585a9fcb40f649e7e82ffed/yarl-1.23.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:4764a6a7588561a9aef92f65bda2c4fb58fe7c675c0883862e6df97559de0bfb", size = 99866, upload-time = "2026-03-01T22:05:03.597Z" },
- { url = "https://files.pythonhosted.org/packages/d3/1c/1a3387ee6d73589f6f2a220ae06f2984f6c20b40c734989b0a44f5987308/yarl-1.23.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:03214408cfa590df47728b84c679ae4ef00be2428e11630277be0727eba2d7cc", size = 107852, upload-time = "2026-03-01T22:05:04.986Z" },
- { url = "https://files.pythonhosted.org/packages/a4/b8/35c0750fcd5a3f781058bfd954515dd4b1eab45e218cbb85cf11132215f1/yarl-1.23.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:170e26584b060879e29fac213e4228ef063f39128723807a312e5c7fec28eff2", size = 102919, upload-time = "2026-03-01T22:05:06.397Z" },
- { url = "https://files.pythonhosted.org/packages/e5/1c/9a1979aec4a81896d597bcb2177827f2dbee3f5b7cc48b2d0dadb644b41d/yarl-1.23.0-cp311-cp311-win32.whl", hash = "sha256:51430653db848d258336cfa0244427b17d12db63d42603a55f0d4546f50f25b5", size = 82602, upload-time = "2026-03-01T22:05:08.444Z" },
- { url = "https://files.pythonhosted.org/packages/93/22/b85eca6fa2ad9491af48c973e4c8cf6b103a73dbb271fe3346949449fca0/yarl-1.23.0-cp311-cp311-win_amd64.whl", hash = "sha256:bf49a3ae946a87083ef3a34c8f677ae4243f5b824bfc4c69672e72b3d6719d46", size = 87461, upload-time = "2026-03-01T22:05:10.145Z" },
- { url = "https://files.pythonhosted.org/packages/93/95/07e3553fe6f113e6864a20bdc53a78113cda3b9ced8784ee52a52c9f80d8/yarl-1.23.0-cp311-cp311-win_arm64.whl", hash = "sha256:b39cb32a6582750b6cc77bfb3c49c0f8760dc18dc96ec9fb55fbb0f04e08b928", size = 82336, upload-time = "2026-03-01T22:05:11.554Z" },
- { url = "https://files.pythonhosted.org/packages/88/8a/94615bc31022f711add374097ad4144d569e95ff3c38d39215d07ac153a0/yarl-1.23.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:1932b6b8bba8d0160a9d1078aae5838a66039e8832d41d2992daa9a3a08f7860", size = 124737, upload-time = "2026-03-01T22:05:12.897Z" },
- { url = "https://files.pythonhosted.org/packages/e3/6f/c6554045d59d64052698add01226bc867b52fe4a12373415d7991fdca95d/yarl-1.23.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:411225bae281f114067578891bc75534cfb3d92a3b4dfef7a6ca78ba354e6069", size = 87029, upload-time = "2026-03-01T22:05:14.376Z" },
- { url = "https://files.pythonhosted.org/packages/19/2a/725ecc166d53438bc88f76822ed4b1e3b10756e790bafd7b523fe97c322d/yarl-1.23.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:13a563739ae600a631c36ce096615fe307f131344588b0bc0daec108cdb47b25", size = 86310, upload-time = "2026-03-01T22:05:15.71Z" },
- { url = "https://files.pythonhosted.org/packages/99/30/58260ed98e6ff7f90ba84442c1ddd758c9170d70327394a6227b310cd60f/yarl-1.23.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9cbf44c5cb4a7633d078788e1b56387e3d3cf2b8139a3be38040b22d6c3221c8", size = 97587, upload-time = "2026-03-01T22:05:17.384Z" },
- { url = "https://files.pythonhosted.org/packages/76/0a/8b08aac08b50682e65759f7f8dde98ae8168f72487e7357a5d684c581ef9/yarl-1.23.0-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:53ad387048f6f09a8969631e4de3f1bf70c50e93545d64af4f751b2498755072", size = 92528, upload-time = "2026-03-01T22:05:18.804Z" },
- { url = "https://files.pythonhosted.org/packages/52/07/0b7179101fe5f8385ec6c6bb5d0cb9f76bd9fb4a769591ab6fb5cdbfc69a/yarl-1.23.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4a59ba56f340334766f3a4442e0efd0af895fae9e2b204741ef885c446b3a1a8", size = 105339, upload-time = "2026-03-01T22:05:20.235Z" },
- { url = "https://files.pythonhosted.org/packages/d3/8a/36d82869ab5ec829ca8574dfcb92b51286fcfb1e9c7a73659616362dc880/yarl-1.23.0-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:803a3c3ce4acc62eaf01eaca1208dcf0783025ef27572c3336502b9c232005e7", size = 105061, upload-time = "2026-03-01T22:05:22.268Z" },
- { url = "https://files.pythonhosted.org/packages/66/3e/868e5c3364b6cee19ff3e1a122194fa4ce51def02c61023970442162859e/yarl-1.23.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a3d2bff8f37f8d0f96c7ec554d16945050d54462d6e95414babaa18bfafc7f51", size = 100132, upload-time = "2026-03-01T22:05:23.638Z" },
- { url = "https://files.pythonhosted.org/packages/cf/26/9c89acf82f08a52cb52d6d39454f8d18af15f9d386a23795389d1d423823/yarl-1.23.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c75eb09e8d55bceb4367e83496ff8ef2bc7ea6960efb38e978e8073ea59ecb67", size = 99289, upload-time = "2026-03-01T22:05:25.749Z" },
- { url = "https://files.pythonhosted.org/packages/6f/54/5b0db00d2cb056922356104468019c0a132e89c8d3ab67d8ede9f4483d2a/yarl-1.23.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:877b0738624280e34c55680d6054a307aa94f7d52fa0e3034a9cc6e790871da7", size = 96950, upload-time = "2026-03-01T22:05:27.318Z" },
- { url = "https://files.pythonhosted.org/packages/f6/40/10fa93811fd439341fad7e0718a86aca0de9548023bbb403668d6555acab/yarl-1.23.0-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:b5405bb8f0e783a988172993cfc627e4d9d00432d6bbac65a923041edacf997d", size = 93960, upload-time = "2026-03-01T22:05:28.738Z" },
- { url = "https://files.pythonhosted.org/packages/bc/d2/8ae2e6cd77d0805f4526e30ec43b6f9a3dfc542d401ac4990d178e4bf0cf/yarl-1.23.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:1c3a3598a832590c5a3ce56ab5576361b5688c12cb1d39429cf5dba30b510760", size = 104703, upload-time = "2026-03-01T22:05:30.438Z" },
- { url = "https://files.pythonhosted.org/packages/2f/0c/b3ceacf82c3fe21183ce35fa2acf5320af003d52bc1fcf5915077681142e/yarl-1.23.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:8419ebd326430d1cbb7efb5292330a2cf39114e82df5cc3d83c9a0d5ebeaf2f2", size = 98325, upload-time = "2026-03-01T22:05:31.835Z" },
- { url = "https://files.pythonhosted.org/packages/9d/e0/12900edd28bdab91a69bd2554b85ad7b151f64e8b521fe16f9ad2f56477a/yarl-1.23.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:be61f6fff406ca40e3b1d84716fde398fc08bc63dd96d15f3a14230a0973ed86", size = 105067, upload-time = "2026-03-01T22:05:33.358Z" },
- { url = "https://files.pythonhosted.org/packages/15/61/74bb1182cf79c9bbe4eb6b1f14a57a22d7a0be5e9cedf8e2d5c2086474c3/yarl-1.23.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3ceb13c5c858d01321b5d9bb65e4cf37a92169ea470b70fec6f236b2c9dd7e34", size = 100285, upload-time = "2026-03-01T22:05:35.4Z" },
- { url = "https://files.pythonhosted.org/packages/69/7f/cd5ef733f2550de6241bd8bd8c3febc78158b9d75f197d9c7baa113436af/yarl-1.23.0-cp312-cp312-win32.whl", hash = "sha256:fffc45637bcd6538de8b85f51e3df3223e4ad89bccbfca0481c08c7fc8b7ed7d", size = 82359, upload-time = "2026-03-01T22:05:36.811Z" },
- { url = "https://files.pythonhosted.org/packages/f5/be/25216a49daeeb7af2bec0db22d5e7df08ed1d7c9f65d78b14f3b74fd72fc/yarl-1.23.0-cp312-cp312-win_amd64.whl", hash = "sha256:f69f57305656a4852f2a7203efc661d8c042e6cc67f7acd97d8667fb448a426e", size = 87674, upload-time = "2026-03-01T22:05:38.171Z" },
- { url = "https://files.pythonhosted.org/packages/d2/35/aeab955d6c425b227d5b7247eafb24f2653fedc32f95373a001af5dfeb9e/yarl-1.23.0-cp312-cp312-win_arm64.whl", hash = "sha256:6e87a6e8735b44816e7db0b2fbc9686932df473c826b0d9743148432e10bb9b9", size = 81879, upload-time = "2026-03-01T22:05:40.006Z" },
- { url = "https://files.pythonhosted.org/packages/9a/4b/a0a6e5d0ee8a2f3a373ddef8a4097d74ac901ac363eea1440464ccbe0898/yarl-1.23.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:16c6994ac35c3e74fb0ae93323bf8b9c2a9088d55946109489667c510a7d010e", size = 123796, upload-time = "2026-03-01T22:05:41.412Z" },
- { url = "https://files.pythonhosted.org/packages/67/b6/8925d68af039b835ae876db5838e82e76ec87b9782ecc97e192b809c4831/yarl-1.23.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:4a42e651629dafb64fd5b0286a3580613702b5809ad3f24934ea87595804f2c5", size = 86547, upload-time = "2026-03-01T22:05:42.841Z" },
- { url = "https://files.pythonhosted.org/packages/ae/50/06d511cc4b8e0360d3c94af051a768e84b755c5eb031b12adaaab6dec6e5/yarl-1.23.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:7c6b9461a2a8b47c65eef63bb1c76a4f1c119618ffa99ea79bc5bb1e46c5821b", size = 85854, upload-time = "2026-03-01T22:05:44.85Z" },
- { url = "https://files.pythonhosted.org/packages/c4/f4/4e30b250927ffdab4db70da08b9b8d2194d7c7b400167b8fbeca1e4701ca/yarl-1.23.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2569b67d616eab450d262ca7cb9f9e19d2f718c70a8b88712859359d0ab17035", size = 98351, upload-time = "2026-03-01T22:05:46.836Z" },
- { url = "https://files.pythonhosted.org/packages/86/fc/4118c5671ea948208bdb1492d8b76bdf1453d3e73df051f939f563e7dcc5/yarl-1.23.0-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e9d9a4d06d3481eab79803beb4d9bd6f6a8e781ec078ac70d7ef2dcc29d1bea5", size = 92711, upload-time = "2026-03-01T22:05:48.316Z" },
- { url = "https://files.pythonhosted.org/packages/56/11/1ed91d42bd9e73c13dc9e7eb0dd92298d75e7ac4dd7f046ad0c472e231cd/yarl-1.23.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f514f6474e04179d3d33175ed3f3e31434d3130d42ec153540d5b157deefd735", size = 106014, upload-time = "2026-03-01T22:05:50.028Z" },
- { url = "https://files.pythonhosted.org/packages/ce/c9/74e44e056a23fbc33aca71779ef450ca648a5bc472bdad7a82339918f818/yarl-1.23.0-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:fda207c815b253e34f7e1909840fd14299567b1c0eb4908f8c2ce01a41265401", size = 105557, upload-time = "2026-03-01T22:05:51.416Z" },
- { url = "https://files.pythonhosted.org/packages/66/fe/b1e10b08d287f518994f1e2ff9b6d26f0adeecd8dd7d533b01bab29a3eda/yarl-1.23.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34b6cf500e61c90f305094911f9acc9c86da1a05a7a3f5be9f68817043f486e4", size = 101559, upload-time = "2026-03-01T22:05:52.872Z" },
- { url = "https://files.pythonhosted.org/packages/72/59/c5b8d94b14e3d3c2a9c20cb100119fd534ab5a14b93673ab4cc4a4141ea5/yarl-1.23.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d7504f2b476d21653e4d143f44a175f7f751cd41233525312696c76aa3dbb23f", size = 100502, upload-time = "2026-03-01T22:05:54.954Z" },
- { url = "https://files.pythonhosted.org/packages/77/4f/96976cb54cbfc5c9fd73ed4c51804f92f209481d1fb190981c0f8a07a1d7/yarl-1.23.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:578110dd426f0d209d1509244e6d4a3f1a3e9077655d98c5f22583d63252a08a", size = 98027, upload-time = "2026-03-01T22:05:56.409Z" },
- { url = "https://files.pythonhosted.org/packages/63/6e/904c4f476471afdbad6b7e5b70362fb5810e35cd7466529a97322b6f5556/yarl-1.23.0-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:609d3614d78d74ebe35f54953c5bbd2ac647a7ddb9c30a5d877580f5e86b22f2", size = 95369, upload-time = "2026-03-01T22:05:58.141Z" },
- { url = "https://files.pythonhosted.org/packages/9d/40/acfcdb3b5f9d68ef499e39e04d25e141fe90661f9d54114556cf83be8353/yarl-1.23.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:4966242ec68afc74c122f8459abd597afd7d8a60dc93d695c1334c5fd25f762f", size = 105565, upload-time = "2026-03-01T22:06:00.286Z" },
- { url = "https://files.pythonhosted.org/packages/5e/c6/31e28f3a6ba2869c43d124f37ea5260cac9c9281df803c354b31f4dd1f3c/yarl-1.23.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:e0fd068364a6759bc794459f0a735ab151d11304346332489c7972bacbe9e72b", size = 99813, upload-time = "2026-03-01T22:06:01.712Z" },
- { url = "https://files.pythonhosted.org/packages/08/1f/6f65f59e72d54aa467119b63fc0b0b1762eff0232db1f4720cd89e2f4a17/yarl-1.23.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:39004f0ad156da43e86aa71f44e033de68a44e5a31fc53507b36dd253970054a", size = 105632, upload-time = "2026-03-01T22:06:03.188Z" },
- { url = "https://files.pythonhosted.org/packages/a3/c4/18b178a69935f9e7a338127d5b77d868fdc0f0e49becd286d51b3a18c61d/yarl-1.23.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e5723c01a56c5028c807c701aa66722916d2747ad737a046853f6c46f4875543", size = 101895, upload-time = "2026-03-01T22:06:04.651Z" },
- { url = "https://files.pythonhosted.org/packages/8f/54/f5b870b5505663911dba950a8e4776a0dbd51c9c54c0ae88e823e4b874a0/yarl-1.23.0-cp313-cp313-win32.whl", hash = "sha256:1b6b572edd95b4fa8df75de10b04bc81acc87c1c7d16bcdd2035b09d30acc957", size = 82356, upload-time = "2026-03-01T22:06:06.04Z" },
- { url = "https://files.pythonhosted.org/packages/7a/84/266e8da36879c6edcd37b02b547e2d9ecdfea776be49598e75696e3316e1/yarl-1.23.0-cp313-cp313-win_amd64.whl", hash = "sha256:baaf55442359053c7d62f6f8413a62adba3205119bcb6f49594894d8be47e5e3", size = 87515, upload-time = "2026-03-01T22:06:08.107Z" },
- { url = "https://files.pythonhosted.org/packages/00/fd/7e1c66efad35e1649114fa13f17485f62881ad58edeeb7f49f8c5e748bf9/yarl-1.23.0-cp313-cp313-win_arm64.whl", hash = "sha256:fb4948814a2a98e3912505f09c9e7493b1506226afb1f881825368d6fb776ee3", size = 81785, upload-time = "2026-03-01T22:06:10.181Z" },
- { url = "https://files.pythonhosted.org/packages/9c/fc/119dd07004f17ea43bb91e3ece6587759edd7519d6b086d16bfbd3319982/yarl-1.23.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:aecfed0b41aa72b7881712c65cf764e39ce2ec352324f5e0837c7048d9e6daaa", size = 130719, upload-time = "2026-03-01T22:06:11.708Z" },
- { url = "https://files.pythonhosted.org/packages/e6/0d/9f2348502fbb3af409e8f47730282cd6bc80dec6630c1e06374d882d6eb2/yarl-1.23.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:a41bcf68efd19073376eb8cf948b8d9be0af26256403e512bb18f3966f1f9120", size = 89690, upload-time = "2026-03-01T22:06:13.429Z" },
- { url = "https://files.pythonhosted.org/packages/50/93/e88f3c80971b42cfc83f50a51b9d165a1dbf154b97005f2994a79f212a07/yarl-1.23.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:cde9a2ecd91668bcb7f077c4966d8ceddb60af01b52e6e3e2680e4cf00ad1a59", size = 89851, upload-time = "2026-03-01T22:06:15.53Z" },
- { url = "https://files.pythonhosted.org/packages/1c/07/61c9dd8ba8f86473263b4036f70fb594c09e99c0d9737a799dfd8bc85651/yarl-1.23.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5023346c4ee7992febc0068e7593de5fa2bf611848c08404b35ebbb76b1b0512", size = 95874, upload-time = "2026-03-01T22:06:17.553Z" },
- { url = "https://files.pythonhosted.org/packages/9e/e9/f9ff8ceefba599eac6abddcfb0b3bee9b9e636e96dbf54342a8577252379/yarl-1.23.0-cp313-cp313t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:d1009abedb49ae95b136a8904a3f71b342f849ffeced2d3747bf29caeda218c4", size = 88710, upload-time = "2026-03-01T22:06:19.004Z" },
- { url = "https://files.pythonhosted.org/packages/eb/78/0231bfcc5d4c8eec220bc2f9ef82cb4566192ea867a7c5b4148f44f6cbcd/yarl-1.23.0-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a8d00f29b42f534cc8aa3931cfe773b13b23e561e10d2b26f27a8d309b0e82a1", size = 101033, upload-time = "2026-03-01T22:06:21.203Z" },
- { url = "https://files.pythonhosted.org/packages/cd/9b/30ea5239a61786f18fd25797151a17fbb3be176977187a48d541b5447dd4/yarl-1.23.0-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:95451e6ce06c3e104556d73b559f5da6c34a069b6b62946d3ad66afcd51642ea", size = 100817, upload-time = "2026-03-01T22:06:22.738Z" },
- { url = "https://files.pythonhosted.org/packages/62/e2/a4980481071791bc83bce2b7a1a1f7adcabfa366007518b4b845e92eeee3/yarl-1.23.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:531ef597132086b6cf96faa7c6c1dcd0361dd5f1694e5cc30375907b9b7d3ea9", size = 97482, upload-time = "2026-03-01T22:06:24.21Z" },
- { url = "https://files.pythonhosted.org/packages/e5/1e/304a00cf5f6100414c4b5a01fc7ff9ee724b62158a08df2f8170dfc72a2d/yarl-1.23.0-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:88f9fb0116fbfcefcab70f85cf4b74a2b6ce5d199c41345296f49d974ddb4123", size = 95949, upload-time = "2026-03-01T22:06:25.697Z" },
- { url = "https://files.pythonhosted.org/packages/68/03/093f4055ed4cae649ac53bca3d180bd37102e9e11d048588e9ab0c0108d0/yarl-1.23.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:e7b0460976dc75cb87ad9cc1f9899a4b97751e7d4e77ab840fc9b6d377b8fd24", size = 95839, upload-time = "2026-03-01T22:06:27.309Z" },
- { url = "https://files.pythonhosted.org/packages/b9/28/4c75ebb108f322aa8f917ae10a8ffa4f07cae10a8a627b64e578617df6a0/yarl-1.23.0-cp313-cp313t-musllinux_1_2_armv7l.whl", hash = "sha256:115136c4a426f9da976187d238e84139ff6b51a20839aa6e3720cd1026d768de", size = 90696, upload-time = "2026-03-01T22:06:29.048Z" },
- { url = "https://files.pythonhosted.org/packages/23/9c/42c2e2dd91c1a570402f51bdf066bfdb1241c2240ba001967bad778e77b7/yarl-1.23.0-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:ead11956716a940c1abc816b7df3fa2b84d06eaed8832ca32f5c5e058c65506b", size = 100865, upload-time = "2026-03-01T22:06:30.525Z" },
- { url = "https://files.pythonhosted.org/packages/74/05/1bcd60a8a0a914d462c305137246b6f9d167628d73568505fce3f1cb2e65/yarl-1.23.0-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:fe8f8f5e70e6dbdfca9882cd9deaac058729bcf323cf7a58660901e55c9c94f6", size = 96234, upload-time = "2026-03-01T22:06:32.692Z" },
- { url = "https://files.pythonhosted.org/packages/90/b2/f52381aac396d6778ce516b7bc149c79e65bfc068b5de2857ab69eeea3b7/yarl-1.23.0-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:a0e317df055958a0c1e79e5d2aa5a5eaa4a6d05a20d4b0c9c3f48918139c9fc6", size = 100295, upload-time = "2026-03-01T22:06:34.268Z" },
- { url = "https://files.pythonhosted.org/packages/e5/e8/638bae5bbf1113a659b2435d8895474598afe38b4a837103764f603aba56/yarl-1.23.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:6f0fd84de0c957b2d280143522c4f91a73aada1923caee763e24a2b3fda9f8a5", size = 97784, upload-time = "2026-03-01T22:06:35.864Z" },
- { url = "https://files.pythonhosted.org/packages/80/25/a3892b46182c586c202629fc2159aa13975d3741d52ebd7347fd501d48d5/yarl-1.23.0-cp313-cp313t-win32.whl", hash = "sha256:93a784271881035ab4406a172edb0faecb6e7d00f4b53dc2f55919d6c9688595", size = 88313, upload-time = "2026-03-01T22:06:37.39Z" },
- { url = "https://files.pythonhosted.org/packages/43/68/8c5b36aa5178900b37387937bc2c2fe0e9505537f713495472dcf6f6fccc/yarl-1.23.0-cp313-cp313t-win_amd64.whl", hash = "sha256:dd00607bffbf30250fe108065f07453ec124dbf223420f57f5e749b04295e090", size = 94932, upload-time = "2026-03-01T22:06:39.579Z" },
- { url = "https://files.pythonhosted.org/packages/c6/cc/d79ba8292f51f81f4dc533a8ccfb9fc6992cabf0998ed3245de7589dc07c/yarl-1.23.0-cp313-cp313t-win_arm64.whl", hash = "sha256:ac09d42f48f80c9ee1635b2fcaa819496a44502737660d3c0f2ade7526d29144", size = 84786, upload-time = "2026-03-01T22:06:41.988Z" },
- { url = "https://files.pythonhosted.org/packages/90/98/b85a038d65d1b92c3903ab89444f48d3cee490a883477b716d7a24b1a78c/yarl-1.23.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:21d1b7305a71a15b4794b5ff22e8eef96ff4a6d7f9657155e5aa419444b28912", size = 124455, upload-time = "2026-03-01T22:06:43.615Z" },
- { url = "https://files.pythonhosted.org/packages/39/54/bc2b45559f86543d163b6e294417a107bb87557609007c007ad889afec18/yarl-1.23.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:85610b4f27f69984932a7abbe52703688de3724d9f72bceb1cca667deff27474", size = 86752, upload-time = "2026-03-01T22:06:45.425Z" },
- { url = "https://files.pythonhosted.org/packages/24/f9/e8242b68362bffe6fb536c8db5076861466fc780f0f1b479fc4ffbebb128/yarl-1.23.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:23f371bd662cf44a7630d4d113101eafc0cfa7518a2760d20760b26021454719", size = 86291, upload-time = "2026-03-01T22:06:46.974Z" },
- { url = "https://files.pythonhosted.org/packages/ea/d8/d1cb2378c81dd729e98c716582b1ccb08357e8488e4c24714658cc6630e8/yarl-1.23.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4a80f77dc1acaaa61f0934176fccca7096d9b1ff08c8ba9cddf5ae034a24319", size = 99026, upload-time = "2026-03-01T22:06:48.459Z" },
- { url = "https://files.pythonhosted.org/packages/0a/ff/7196790538f31debe3341283b5b0707e7feb947620fc5e8236ef28d44f72/yarl-1.23.0-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:bd654fad46d8d9e823afbb4f87c79160b5a374ed1ff5bde24e542e6ba8f41434", size = 92355, upload-time = "2026-03-01T22:06:50.306Z" },
- { url = "https://files.pythonhosted.org/packages/c1/56/25d58c3eddde825890a5fe6aa1866228377354a3c39262235234ab5f616b/yarl-1.23.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:682bae25f0a0dd23a056739f23a134db9f52a63e2afd6bfb37ddc76292bbd723", size = 106417, upload-time = "2026-03-01T22:06:52.1Z" },
- { url = "https://files.pythonhosted.org/packages/51/8a/882c0e7bc8277eb895b31bce0138f51a1ba551fc2e1ec6753ffc1e7c1377/yarl-1.23.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a82836cab5f197a0514235aaf7ffccdc886ccdaa2324bc0aafdd4ae898103039", size = 106422, upload-time = "2026-03-01T22:06:54.424Z" },
- { url = "https://files.pythonhosted.org/packages/42/2b/fef67d616931055bf3d6764885990a3ac647d68734a2d6a9e1d13de437a2/yarl-1.23.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1c57676bdedc94cd3bc37724cf6f8cd2779f02f6aba48de45feca073e714fe52", size = 101915, upload-time = "2026-03-01T22:06:55.895Z" },
- { url = "https://files.pythonhosted.org/packages/18/6a/530e16aebce27c5937920f3431c628a29a4b6b430fab3fd1c117b26ff3f6/yarl-1.23.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c7f8dc16c498ff06497c015642333219871effba93e4a2e8604a06264aca5c5c", size = 100690, upload-time = "2026-03-01T22:06:58.21Z" },
- { url = "https://files.pythonhosted.org/packages/88/08/93749219179a45e27b036e03260fda05190b911de8e18225c294ac95bbc9/yarl-1.23.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:5ee586fb17ff8f90c91cf73c6108a434b02d69925f44f5f8e0d7f2f260607eae", size = 98750, upload-time = "2026-03-01T22:06:59.794Z" },
- { url = "https://files.pythonhosted.org/packages/d9/cf/ea424a004969f5d81a362110a6ac1496d79efdc6d50c2c4b2e3ea0fc2519/yarl-1.23.0-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:17235362f580149742739cc3828b80e24029d08cbb9c4bda0242c7b5bc610a8e", size = 94685, upload-time = "2026-03-01T22:07:01.375Z" },
- { url = "https://files.pythonhosted.org/packages/e2/b7/14341481fe568e2b0408bcf1484c652accafe06a0ade9387b5d3fd9df446/yarl-1.23.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:0793e2bd0cf14234983bbb371591e6bea9e876ddf6896cdcc93450996b0b5c85", size = 106009, upload-time = "2026-03-01T22:07:03.151Z" },
- { url = "https://files.pythonhosted.org/packages/0a/e6/5c744a9b54f4e8007ad35bce96fbc9218338e84812d36f3390cea616881a/yarl-1.23.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:3650dc2480f94f7116c364096bc84b1d602f44224ef7d5c7208425915c0475dd", size = 100033, upload-time = "2026-03-01T22:07:04.701Z" },
- { url = "https://files.pythonhosted.org/packages/0c/23/e3bfc188d0b400f025bc49d99793d02c9abe15752138dcc27e4eaf0c4a9e/yarl-1.23.0-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:f40e782d49630ad384db66d4d8b73ff4f1b8955dc12e26b09a3e3af064b3b9d6", size = 106483, upload-time = "2026-03-01T22:07:06.231Z" },
- { url = "https://files.pythonhosted.org/packages/72/42/f0505f949a90b3f8b7a363d6cbdf398f6e6c58946d85c6d3a3bc70595b26/yarl-1.23.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:94f8575fbdf81749008d980c17796097e645574a3b8c28ee313931068dad14fe", size = 102175, upload-time = "2026-03-01T22:07:08.4Z" },
- { url = "https://files.pythonhosted.org/packages/aa/65/b39290f1d892a9dd671d1c722014ca062a9c35d60885d57e5375db0404b5/yarl-1.23.0-cp314-cp314-win32.whl", hash = "sha256:c8aa34a5c864db1087d911a0b902d60d203ea3607d91f615acd3f3108ac32169", size = 83871, upload-time = "2026-03-01T22:07:09.968Z" },
- { url = "https://files.pythonhosted.org/packages/a9/5b/9b92f54c784c26e2a422e55a8d2607ab15b7ea3349e28359282f84f01d43/yarl-1.23.0-cp314-cp314-win_amd64.whl", hash = "sha256:63e92247f383c85ab00dd0091e8c3fa331a96e865459f5ee80353c70a4a42d70", size = 89093, upload-time = "2026-03-01T22:07:11.501Z" },
- { url = "https://files.pythonhosted.org/packages/e0/7d/8a84dc9381fd4412d5e7ff04926f9865f6372b4c2fd91e10092e65d29eb8/yarl-1.23.0-cp314-cp314-win_arm64.whl", hash = "sha256:70efd20be968c76ece7baa8dafe04c5be06abc57f754d6f36f3741f7aa7a208e", size = 83384, upload-time = "2026-03-01T22:07:13.069Z" },
- { url = "https://files.pythonhosted.org/packages/dd/8d/d2fad34b1c08aa161b74394183daa7d800141aaaee207317e82c790b418d/yarl-1.23.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:9a18d6f9359e45722c064c97464ec883eb0e0366d33eda61cb19a244bf222679", size = 131019, upload-time = "2026-03-01T22:07:14.903Z" },
- { url = "https://files.pythonhosted.org/packages/19/ff/33009a39d3ccf4b94d7d7880dfe17fb5816c5a4fe0096d9b56abceea9ac7/yarl-1.23.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:2803ed8b21ca47a43da80a6fd1ed3019d30061f7061daa35ac54f63933409412", size = 89894, upload-time = "2026-03-01T22:07:17.372Z" },
- { url = "https://files.pythonhosted.org/packages/0c/f1/dab7ac5e7306fb79c0190766a3c00b4cb8d09a1f390ded68c85a5934faf5/yarl-1.23.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:394906945aa8b19fc14a61cf69743a868bb8c465efe85eee687109cc540b98f4", size = 89979, upload-time = "2026-03-01T22:07:19.361Z" },
- { url = "https://files.pythonhosted.org/packages/aa/b1/08e95f3caee1fad6e65017b9f26c1d79877b502622d60e517de01e72f95d/yarl-1.23.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:71d006bee8397a4a89f469b8deb22469fe7508132d3c17fa6ed871e79832691c", size = 95943, upload-time = "2026-03-01T22:07:21.266Z" },
- { url = "https://files.pythonhosted.org/packages/c0/cc/6409f9018864a6aa186c61175b977131f373f1988e198e031236916e87e4/yarl-1.23.0-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:62694e275c93d54f7ccedcfef57d42761b2aad5234b6be1f3e3026cae4001cd4", size = 88786, upload-time = "2026-03-01T22:07:23.129Z" },
- { url = "https://files.pythonhosted.org/packages/76/40/cc22d1d7714b717fde2006fad2ced5efe5580606cb059ae42117542122f3/yarl-1.23.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a31de1613658308efdb21ada98cbc86a97c181aa050ba22a808120bb5be3ab94", size = 101307, upload-time = "2026-03-01T22:07:24.689Z" },
- { url = "https://files.pythonhosted.org/packages/8f/0d/476c38e85ddb4c6ec6b20b815bdd779aa386a013f3d8b85516feee55c8dc/yarl-1.23.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:fb1e8b8d66c278b21d13b0a7ca22c41dd757a7c209c6b12c313e445c31dd3b28", size = 100904, upload-time = "2026-03-01T22:07:26.287Z" },
- { url = "https://files.pythonhosted.org/packages/72/32/0abe4a76d59adf2081dcb0397168553ece4616ada1c54d1c49d8936c74f8/yarl-1.23.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:50f9d8d531dfb767c565f348f33dd5139a6c43f5cbdf3f67da40d54241df93f6", size = 97728, upload-time = "2026-03-01T22:07:27.906Z" },
- { url = "https://files.pythonhosted.org/packages/b7/35/7b30f4810fba112f60f5a43237545867504e15b1c7647a785fbaf588fac2/yarl-1.23.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:575aa4405a656e61a540f4a80eaa5260f2a38fff7bfdc4b5f611840d76e9e277", size = 95964, upload-time = "2026-03-01T22:07:30.198Z" },
- { url = "https://files.pythonhosted.org/packages/2d/86/ed7a73ab85ef00e8bb70b0cb5421d8a2a625b81a333941a469a6f4022828/yarl-1.23.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:041b1a4cefacf65840b4e295c6985f334ba83c30607441ae3cf206a0eed1a2e4", size = 95882, upload-time = "2026-03-01T22:07:32.132Z" },
- { url = "https://files.pythonhosted.org/packages/19/90/d56967f61a29d8498efb7afb651e0b2b422a1e9b47b0ab5f4e40a19b699b/yarl-1.23.0-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:d38c1e8231722c4ce40d7593f28d92b5fc72f3e9774fe73d7e800ec32299f63a", size = 90797, upload-time = "2026-03-01T22:07:34.404Z" },
- { url = "https://files.pythonhosted.org/packages/72/00/8b8f76909259f56647adb1011d7ed8b321bcf97e464515c65016a47ecdf0/yarl-1.23.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:d53834e23c015ee83a99377db6e5e37d8484f333edb03bd15b4bc312cc7254fb", size = 101023, upload-time = "2026-03-01T22:07:35.953Z" },
- { url = "https://files.pythonhosted.org/packages/ac/e2/cab11b126fb7d440281b7df8e9ddbe4851e70a4dde47a202b6642586b8d9/yarl-1.23.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:2e27c8841126e017dd2a054a95771569e6070b9ee1b133366d8b31beb5018a41", size = 96227, upload-time = "2026-03-01T22:07:37.594Z" },
- { url = "https://files.pythonhosted.org/packages/c2/9b/2c893e16bfc50e6b2edf76c1a9eb6cb0c744346197e74c65e99ad8d634d0/yarl-1.23.0-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:76855800ac56f878847a09ce6dba727c93ca2d89c9e9d63002d26b916810b0a2", size = 100302, upload-time = "2026-03-01T22:07:39.334Z" },
- { url = "https://files.pythonhosted.org/packages/28/ec/5498c4e3a6d5f1003beb23405671c2eb9cdbf3067d1c80f15eeafe301010/yarl-1.23.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:e09fd068c2e169a7070d83d3bde728a4d48de0549f975290be3c108c02e499b4", size = 98202, upload-time = "2026-03-01T22:07:41.717Z" },
- { url = "https://files.pythonhosted.org/packages/fe/c3/cd737e2d45e70717907f83e146f6949f20cc23cd4bf7b2688727763aa458/yarl-1.23.0-cp314-cp314t-win32.whl", hash = "sha256:73309162a6a571d4cbd3b6a1dcc703c7311843ae0d1578df6f09be4e98df38d4", size = 90558, upload-time = "2026-03-01T22:07:43.433Z" },
- { url = "https://files.pythonhosted.org/packages/e1/19/3774d162f6732d1cfb0b47b4140a942a35ca82bb19b6db1f80e9e7bdc8f8/yarl-1.23.0-cp314-cp314t-win_amd64.whl", hash = "sha256:4503053d296bc6e4cbd1fad61cf3b6e33b939886c4f249ba7c78b602214fabe2", size = 97610, upload-time = "2026-03-01T22:07:45.773Z" },
- { url = "https://files.pythonhosted.org/packages/51/47/3fa2286c3cb162c71cdb34c4224d5745a1ceceb391b2bd9b19b668a8d724/yarl-1.23.0-cp314-cp314t-win_arm64.whl", hash = "sha256:44bb7bef4ea409384e3f8bc36c063d77ea1b8d4a5b2706956c0d6695f07dcc25", size = 86041, upload-time = "2026-03-01T22:07:49.026Z" },
- { url = "https://files.pythonhosted.org/packages/69/68/c8739671f5699c7dc470580a4f821ef37c32c4cb0b047ce223a7f115757f/yarl-1.23.0-py3-none-any.whl", hash = "sha256:a2df6afe50dea8ae15fa34c9f824a3ee958d785fd5d089063d960bae1daa0a3f", size = 48288, upload-time = "2026-03-01T22:07:51.388Z" },
+sdist = { url = "https://files.pythonhosted.org/packages/75/16/e8be8e2fb175bbf41a0680381a319f1199fae256588241a2ac8677eafb49/yarl-1.25.1.tar.gz", hash = "sha256:03dd38de09bc213e9a8b29761eec33ee1d5318dac0e49d8af36e4d27830e23a7", size = 246245, upload-time = "2026-09-15T19:35:02.264Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/83/b3/2cea721d495ca57f8f414aa4867ee263f486b274e07463158cf52f02ba7f/yarl-1.25.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9d693bf4bf534e9ba3ae2780cfd577f5135629f7b5ac653490859d0b77864865", size = 143794, upload-time = "2026-09-15T19:30:26.946Z" },
+ { url = "https://files.pythonhosted.org/packages/55/e6/cd145cff8e5cf60b8b3c41fbecfa2a45028a8dec3fbc52bec03595ff3d3b/yarl-1.25.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ab2054c5531af2a9ba7b69b8ec91e4f884420e83a8c5e579b013084cb57e5e5d", size = 103993, upload-time = "2026-09-15T19:30:28.661Z" },
+ { url = "https://files.pythonhosted.org/packages/ce/7c/fbb40fe2d53747c40aa36a9e2bd2178a202f942bda0b670f3306d4aefbce/yarl-1.25.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:564fdc7085d2245ab84f88882fdb1d6ac0723124bff6ded35bfb1c00f812630d", size = 104010, upload-time = "2026-09-15T19:30:31.069Z" },
+ { url = "https://files.pythonhosted.org/packages/f0/0b/5a516f70641092283f57cf3670bdb75e7327bcc0dcb5038697e4dfbfd569/yarl-1.25.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:acae6b45d1ace09b6ba3876da43b88366ef368f73b988c7f57e14231753d4420", size = 116444, upload-time = "2026-09-15T19:30:32.894Z" },
+ { url = "https://files.pythonhosted.org/packages/b6/8a/d1a627f827b0a404ae0f5647cab0534959081cde13b0756a783469fb3b5e/yarl-1.25.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:1fb2a01ba8cd9c5d2c5dc1ec35e0fc951d04b4f037541d4ac090c993ce58b3d7", size = 107565, upload-time = "2026-09-15T19:30:35.188Z" },
+ { url = "https://files.pythonhosted.org/packages/aa/cf/c8e0aaec886840a6c4480fe44eaec7cd4319f79a563b79321473be79c56f/yarl-1.25.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e92b6bcc741b86d67606c40d3cb9c7cc8e6c737f81e31f4a94efc204456c92e3", size = 125006, upload-time = "2026-09-15T19:30:37.1Z" },
+ { url = "https://files.pythonhosted.org/packages/50/26/0cce366d54a93cdc8342965dc7663385e4db161625cc1e8b18e786753d24/yarl-1.25.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:72c34ac7ad4314c19362d5ce27626dcc8429bd30bbf8c179f4234078851f9492", size = 128717, upload-time = "2026-09-15T19:30:38.904Z" },
+ { url = "https://files.pythonhosted.org/packages/95/0c/a71501bbc1a674ff72c4d6c2b75f4d9a5af819f5244c3a7558080a8802c5/yarl-1.25.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d5add7b4ca7afeea91d52e4d4e4db3b1fe9885b71f07054560d8c4296b7441a2", size = 117728, upload-time = "2026-09-15T19:30:40.809Z" },
+ { url = "https://files.pythonhosted.org/packages/e7/6f/c3267ca01defeed9ed9c4ff9b17bd54915432c405945233265b707475d1c/yarl-1.25.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:def538065f9e4d4cf1ae164bd59aba00dfa84f03923e0de4c3788f252d6bcd17", size = 116224, upload-time = "2026-09-15T19:30:42.818Z" },
+ { url = "https://files.pythonhosted.org/packages/8f/69/fad57ee52d648431718ee0f1f68966a99c1352c3924688ffbdcc9d3fe51a/yarl-1.25.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a191bfdb30a79b98e5d175d75285f9fcb78bf0e46ba5efda042e1c72071a0de", size = 116299, upload-time = "2026-09-15T19:30:44.966Z" },
+ { url = "https://files.pythonhosted.org/packages/2a/d4/6a8c1e29f33338687ca278cba0a8fbf6525a322c2c02a9a500ccbe041152/yarl-1.25.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:71f42c5b9a948c113bbdebfa544598321431d064ff959d32e99b1feb61d68345", size = 108625, upload-time = "2026-09-15T19:30:46.874Z" },
+ { url = "https://files.pythonhosted.org/packages/e8/d2/3a35ae791c9cb6522c106923ff25c3230d999091e5e65511bca23bbd9914/yarl-1.25.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:72849d892954be4d09e569b8b831ac39ce58417fedc767d4308a0fe542018a40", size = 124515, upload-time = "2026-09-15T19:30:49.082Z" },
+ { url = "https://files.pythonhosted.org/packages/be/fd/2b022109a6b4af0f7dc371cf7500af380b0d4f034010243e1b0ce218dc93/yarl-1.25.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:efb01a106f971cb3752856bca2318bbdf7f01bd8823779c461586cbe5ffd5258", size = 115711, upload-time = "2026-09-15T19:30:51.208Z" },
+ { url = "https://files.pythonhosted.org/packages/18/59/f7586271136c3ddb0126bbfe661844699369b76b555fe38c4efe86870b2e/yarl-1.25.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:a1daf47cd95a7c3a63456336bc5aaa8c86dd3a47d07ed3d0e76132ae4666a5a1", size = 122751, upload-time = "2026-09-15T19:30:53.535Z" },
+ { url = "https://files.pythonhosted.org/packages/a0/0b/07f7a2d881f7e16c385b47fc1753382600847cad305dcc7fa0c25828acf8/yarl-1.25.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9489e6abf47ba37f332075a91444c7cfedb03e6ce99fbb2f116bfe1ce810da3b", size = 117983, upload-time = "2026-09-15T19:30:55.277Z" },
+ { url = "https://files.pythonhosted.org/packages/aa/9d/8cdceec66a9b940700cb45931741403f045b162afd79bcb93c41cadd0972/yarl-1.25.1-cp311-cp311-win_amd64.whl", hash = "sha256:d7306dee25b8a0e737363f347362b875094b4dc4e367311470656ae420fdbf8e", size = 102894, upload-time = "2026-09-15T19:30:57.606Z" },
+ { url = "https://files.pythonhosted.org/packages/17/f1/7ec357db1d3ad2863542d71e8fe64a126bbec17b134cd7d30951196809a5/yarl-1.25.1-cp311-cp311-win_arm64.whl", hash = "sha256:abb1384477f5901d436b5d2e5465954de46ea6098f59163d243660b5c4461d35", size = 98609, upload-time = "2026-09-15T19:30:59.705Z" },
+ { url = "https://files.pythonhosted.org/packages/75/b3/cd32ac66ae622b854c2df0ac52106dda220d361b65a64fde7d5b3684aa3f/yarl-1.25.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:94d7aa6debf92a1dd14cb5280b083a764169a13cfb23a452111160274ed989f4", size = 144798, upload-time = "2026-09-15T19:31:01.821Z" },
+ { url = "https://files.pythonhosted.org/packages/61/fb/a2c52a8007c2051ba74662afb112ecf3d00346af4c25e33df9d80fd14fb8/yarl-1.25.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:83d4a37e4b95da4d8bda930d6d35b75b4cdadbacbb4980cae290ea3100b5d51d", size = 104583, upload-time = "2026-09-15T19:31:04.05Z" },
+ { url = "https://files.pythonhosted.org/packages/be/dd/ee38aec8e09fdf957e50d4085453fbe202f56c6c3b4cf07b81cdb4f09ee9/yarl-1.25.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e029648f9c951db30e98a7d7ec90835db88ec4b32820efe2a9bdc2287e032eb6", size = 104325, upload-time = "2026-09-15T19:31:06.338Z" },
+ { url = "https://files.pythonhosted.org/packages/1e/b3/058dbfb1857b484c9cf9cc135659f50b85ce66e03c99e44dc2f7b6161f55/yarl-1.25.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4d781294bb815ecb5ea57ff6bbf8038e0a31a95fdf3e1788f66e0dc100d64b58", size = 115358, upload-time = "2026-09-15T19:31:08.593Z" },
+ { url = "https://files.pythonhosted.org/packages/db/39/29693446cf0cf6b15a0e2f75a5d40f93c56819b05b0622196f45e95b5cc0/yarl-1.25.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e12c538e00e7c1b286a07061046b90e8124e6a9793efae2c70db6a4aad07faad", size = 107658, upload-time = "2026-09-15T19:31:10.802Z" },
+ { url = "https://files.pythonhosted.org/packages/86/b3/3c4dd7e1af43b931fba95e0a722737f2ea94a6d199c802585282831d7abd/yarl-1.25.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7e4de3ac4adbad3d0bc7c6f4360a7dbff5de2f15e3b723be3198074e17fd9c40", size = 122660, upload-time = "2026-09-15T19:31:12.84Z" },
+ { url = "https://files.pythonhosted.org/packages/bd/b5/1b60dbc3cfc9c5712b15148c206748f2bc93953ffdbe25ea75b63dfc89c9/yarl-1.25.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:419f392a1da624877975709e3864dfe833af6cc7671b39318086d456e288380c", size = 126506, upload-time = "2026-09-15T19:31:15.088Z" },
+ { url = "https://files.pythonhosted.org/packages/bc/7b/ca212cbe170ac8b96e45317ecbcf9c3c3ecf0cdec98d5b088a9c4088929b/yarl-1.25.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c6f117789d22dce188e5754e8bc65b7e6ebf8cb73963b9fa761f672a5883769d", size = 117050, upload-time = "2026-09-15T19:31:17.241Z" },
+ { url = "https://files.pythonhosted.org/packages/cb/c3/72b4938cdbe619ad71ac156182faef4908846b84dc3ca4dbb4c4e6f84014/yarl-1.25.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:80e47012e730da131c9f059c80936783f9659aae22dc31c03c0595590d11ed54", size = 114174, upload-time = "2026-09-15T19:31:19.294Z" },
+ { url = "https://files.pythonhosted.org/packages/e8/43/268717870f9ba0cc9701a95181587f6dc8c5f387aab4aeecc83158f38a79/yarl-1.25.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e80f557716fd765439577131e526b8942ffc2c07bdbc5e39fa62f660ba1e963f", size = 114944, upload-time = "2026-09-15T19:31:21.414Z" },
+ { url = "https://files.pythonhosted.org/packages/da/84/baa5bf504d51fe062c4bcaf62936da97fffb43285978d0b39984824231fd/yarl-1.25.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:f61964f235a43738bfac50da46fc4254943a7eea3051aeb0b6fc7c992c29fadc", size = 108263, upload-time = "2026-09-15T19:31:23.388Z" },
+ { url = "https://files.pythonhosted.org/packages/a4/28/779a2ed9e0152a601a27039bed9aead3f0b79797a67e2c44bfa444622dd8/yarl-1.25.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:e546fe1d4a93ebc2910f0d768baff19faa09843ab3f2036a67ed6e69fae4419d", size = 122184, upload-time = "2026-09-15T19:31:25.343Z" },
+ { url = "https://files.pythonhosted.org/packages/f8/1f/118e9e5b8f07694d63fd3222e801d7782270003f1a222aa798df3f8d5933/yarl-1.25.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:cce0727fd5ac04d372fa9bbfde9febc2bcf209aadfcf0468e45dec72719895d1", size = 114001, upload-time = "2026-09-15T19:31:27.465Z" },
+ { url = "https://files.pythonhosted.org/packages/0f/ae/a4cf1cf372313734b17996d4007f9f73596e7a178b9485802e5494ecf484/yarl-1.25.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:af4ea5b37403ef4e30f3927eaed540db942bde01d8d3ff083527c0704d1c9c68", size = 120565, upload-time = "2026-09-15T19:31:29.47Z" },
+ { url = "https://files.pythonhosted.org/packages/05/79/ad94f93ca731bc9e44d321833ab96b82a4f9f5f63cf773f81a4aeea5ecc1/yarl-1.25.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:68782fdb4027b8d1eee25ec35e9a6db05e863b899eb0310b3a33b6c3fef55707", size = 117060, upload-time = "2026-09-15T19:31:31.367Z" },
+ { url = "https://files.pythonhosted.org/packages/bb/cc/51a7b4abf4ac593b8e7eb3794b28e5a35ae26eed8bc04787628d215af82f/yarl-1.25.1-cp312-cp312-win_amd64.whl", hash = "sha256:7d575b54cb3863ef9bc290ea4b009999d55dc237326131e4853cf33e888fee03", size = 102593, upload-time = "2026-09-15T19:31:33.329Z" },
+ { url = "https://files.pythonhosted.org/packages/9d/21/0941a6b93a58b59a1ec75e5333bf06929b671309c43c0cd201c172d9c39f/yarl-1.25.1-cp312-cp312-win_arm64.whl", hash = "sha256:bc3ac7bf569f6b64dad04dd7808c7872dae8a97df657856eac05e9b7e3614a85", size = 97697, upload-time = "2026-09-15T19:31:35.855Z" },
+ { url = "https://files.pythonhosted.org/packages/7b/ed/2f3129bbcc9a5c8ba12cc2b29d8060a3bab9c8043c456cfd4b5ca3188890/yarl-1.25.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:25868beca8b6765f8f7d0e11fe6dd7c66dd4b0793b9500286d20cc92352126a5", size = 143623, upload-time = "2026-09-15T19:31:37.966Z" },
+ { url = "https://files.pythonhosted.org/packages/17/e1/f1bc3390fdca352826676b531d0712736f156919090206700421d46b2c37/yarl-1.25.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:10b2fd95332f0d716d5eee3c9fb2ce8eada19082de7fee83d32e37992fd75c26", size = 104011, upload-time = "2026-09-15T19:31:40.25Z" },
+ { url = "https://files.pythonhosted.org/packages/a8/aa/50acc5c3e5da04172ae3c281c75405af4d2ca911e16120ab0563f4dffb66/yarl-1.25.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0f12afda4eea8c8994a76d4df1875c765194f5fbe8a9d197929ea303caee29ec", size = 103677, upload-time = "2026-09-15T19:31:42.46Z" },
+ { url = "https://files.pythonhosted.org/packages/30/d2/7d1e0ab9f8390e1fbcede5a6dbf70d23c96ad09b8c5567f3a514d1ddb0e2/yarl-1.25.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:14b79a30a93a3ce2e8832603fd0ab780ada281b0ba5110b519a634f2d7d7d1fc", size = 115392, upload-time = "2026-09-15T19:31:44.371Z" },
+ { url = "https://files.pythonhosted.org/packages/71/e1/5ba1e3a2a22139213655e760919038e8ed7e2d4a99826d0bbddb3beb96e5/yarl-1.25.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:4bd6340d20ae2c7ca719b87b426e808e90743b676d05d4c26c4fb5ca71f41184", size = 107493, upload-time = "2026-09-15T19:31:46.273Z" },
+ { url = "https://files.pythonhosted.org/packages/f5/53/780653d5e0f73831f467cf13548912e5eec97f21dc49fc8daf21da027df4/yarl-1.25.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:126a2533570c554719ca40a1288fdee1700b6bc82e7131aa69fa85252d92e651", size = 122537, upload-time = "2026-09-15T19:31:48.654Z" },
+ { url = "https://files.pythonhosted.org/packages/03/92/d54fa70236c6036271c9c9c09fd978df5cbe3ef49ef6c46e9b833476d215/yarl-1.25.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a3faadac7d812ddac258feb57b9846b60c1b437c4f4b9ad42595c6f6fe4390df", size = 126170, upload-time = "2026-09-15T19:31:50.872Z" },
+ { url = "https://files.pythonhosted.org/packages/0e/b7/a82a49bf88340b837ef6972b508a1604ae377b9e6904b46b10cf5f1cf925/yarl-1.25.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:be80550d9bfe83d9b62398a37081a90434e6df2d978ec345c3d2820de6beddab", size = 117012, upload-time = "2026-09-15T19:31:53.189Z" },
+ { url = "https://files.pythonhosted.org/packages/ef/78/5d684b411e3f3602464ee9b538db48205038f8605872985f61efb809ced0/yarl-1.25.1-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e07595c7d6f4db270ceede356a1bd1c07a34f1c26f958d1ed0cd7b48e0d2bba3", size = 114950, upload-time = "2026-09-15T19:31:55.694Z" },
+ { url = "https://files.pythonhosted.org/packages/2f/11/51d82b852c64f7fad0fc7a7ff3031517204887e874c722bbca839c0b23ac/yarl-1.25.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:eb96ed1ae6c7d072d60840c0434aef07a2df611812810807fbc54263a6053e9a", size = 115428, upload-time = "2026-09-15T19:31:57.966Z" },
+ { url = "https://files.pythonhosted.org/packages/e4/49/9d1978049bf646b9ea918313926453c6901b71c92f097467777d47d36a88/yarl-1.25.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:3feb99222553a8cbedfa52c2f59dd84c3f50d5b582c728d522caf8d72769a54b", size = 108428, upload-time = "2026-09-15T19:32:00.048Z" },
+ { url = "https://files.pythonhosted.org/packages/43/35/7b8f1ebb45d7ec3dda7d1909bf44f458de41ef91e2937f107733582a5166/yarl-1.25.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:a2ed0ba415ccdf08f14bf544cb78346d0f76086707ffee24921a2c84dbf1305a", size = 121961, upload-time = "2026-09-15T19:32:02.436Z" },
+ { url = "https://files.pythonhosted.org/packages/63/d6/d8b689ab7ca26edeb85f6ff28812aac7a25376eefc1780e303a7bfbaceff/yarl-1.25.1-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:2b49375d22299b0a834c2bca72f39aaecc270d96fb24c30424899676f487b22a", size = 114961, upload-time = "2026-09-15T19:32:04.456Z" },
+ { url = "https://files.pythonhosted.org/packages/cf/d5/1a1798ea4dc6b7ee3260010a27907ebc697c95dae99817d817ed446d24aa/yarl-1.25.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:ef74070ac553c59eb4f04258722066d6c6135b7baa03b2e9f2da65c096e96d98", size = 120036, upload-time = "2026-09-15T19:32:06.5Z" },
+ { url = "https://files.pythonhosted.org/packages/91/8d/b1b35ed7903da6669b1d367cb2c09436acd4ff508029b4f39a0c0c2058fc/yarl-1.25.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:0a66db89ea473abeac4b70523cafd94db3772380e565f9d28af7a179b7af71fa", size = 117276, upload-time = "2026-09-15T19:32:09.401Z" },
+ { url = "https://files.pythonhosted.org/packages/3a/8f/4db01cef62caff0d7a4593ed694fb8a41a27a11158cab80d290221f13e57/yarl-1.25.1-cp313-cp313-win_amd64.whl", hash = "sha256:1f51020b2eb8a003c84925638ec63c21a750a4bddd3a22ec8eac6a742dadf1b9", size = 101945, upload-time = "2026-09-15T19:32:11.545Z" },
+ { url = "https://files.pythonhosted.org/packages/c0/5e/3ce00497c5c0babb74d4130c10c3828ccd215b4819d12020c42429f991ac/yarl-1.25.1-cp313-cp313-win_arm64.whl", hash = "sha256:b10dd0557ba422715b5206b3743192135a6022acca8baec51aa127d0a75db8fe", size = 97270, upload-time = "2026-09-15T19:32:14.127Z" },
+ { url = "https://files.pythonhosted.org/packages/80/cf/54023edfab7aa773b860503db0c56e962ccab0922803ee97988c176ea090/yarl-1.25.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:a9ca696eb02e5c02a8afd872ada510eba9b7fe6e68b9572c2e9a9b1941e31e2e", size = 143975, upload-time = "2026-09-15T19:32:16.416Z" },
+ { url = "https://files.pythonhosted.org/packages/d7/a8/e6c1be0e6761d0f2d10bbf33a3e1e02b99dc83874d92945d7b461a72481e/yarl-1.25.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:a5877f2255aab518ebe528289037699201d5dc5f045f2396cb30aa02db22f57f", size = 104018, upload-time = "2026-09-15T19:32:18.364Z" },
+ { url = "https://files.pythonhosted.org/packages/6e/bb/dda344765ffd3430afe1a1c66c866a57fae67786537d4f14607df6505ac1/yarl-1.25.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:7a5c3115595995779ee21f2567035793911c3802a43c74f3fbb0314929ec67ac", size = 104156, upload-time = "2026-09-15T19:32:20.459Z" },
+ { url = "https://files.pythonhosted.org/packages/e5/5f/ed1538bcd06009fe990d6d283dd7667f639e62a81e35c6d8c6ef6c08fb3c/yarl-1.25.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:77e5099b99b37f3cf79c246998ca9f7313a78054cd1809ec46bc1afad47e1c4c", size = 116025, upload-time = "2026-09-15T19:32:22.766Z" },
+ { url = "https://files.pythonhosted.org/packages/a2/af/2185daf56b99830d3356ecfada46faaa49945de6626e842b7728088d4980/yarl-1.25.1-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:6efaf45df6a849cef613a03a94c845647456662f85438c886bb67a9c027c8c2c", size = 106985, upload-time = "2026-09-15T19:32:24.749Z" },
+ { url = "https://files.pythonhosted.org/packages/c1/65/bc1ae564fb4b04a30b6a8f250e787772581c57e4c3d5cf07ac3359de3103/yarl-1.25.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d5f90e44653c4e0f78501ed9bb7d3fce835a8d62b7c6ed0cb16557534087e743", size = 123030, upload-time = "2026-09-15T19:32:27.084Z" },
+ { url = "https://files.pythonhosted.org/packages/6a/3e/e2afcde10d74e53b3fa889960991efb3019beda2b1682a01de720a302056/yarl-1.25.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:632da579b2d879f6bad20f2cfa35ded1efe2f4f77f8abb26a6234a5b236acd2f", size = 126765, upload-time = "2026-09-15T19:32:29.332Z" },
+ { url = "https://files.pythonhosted.org/packages/a2/be/415b00c0fe5a0615b062a456b26623d7ec91c2bee20faea1a14045aa0469/yarl-1.25.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:30eec96e8a91bd588ce897c9543f6d5d8d34b28fbcba28a4dedf20ebeae9fe57", size = 117199, upload-time = "2026-09-15T19:32:31.49Z" },
+ { url = "https://files.pythonhosted.org/packages/97/27/3d8c63ddd3e8bcfd033748ab93876678ce59bacd66e4cb1ed851c9c5b37e/yarl-1.25.1-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:12b6bc4906e11f5e1a1cdcb12296e7afbd366c783cc8073403cd2fb74334e453", size = 115187, upload-time = "2026-09-15T19:32:34.137Z" },
+ { url = "https://files.pythonhosted.org/packages/39/b7/7a81d0be1a502a26a0d4326c6f2ecb736c824f570ea1c6529f2b0b227b50/yarl-1.25.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:9d6ed3d17bccce4c05343e1ca8da13bc5c02c812a4e7282ddd05e8769322d3fc", size = 116085, upload-time = "2026-09-15T19:32:36.438Z" },
+ { url = "https://files.pythonhosted.org/packages/f0/69/39fff459916aa0fab42215dc47b759586fd80f94aa56dfc4a7c15ba6e0dc/yarl-1.25.1-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:f38a70074041d3b7e138e452799f5174198bae5bd5ab2000917badf403908c5f", size = 107996, upload-time = "2026-09-15T19:32:38.959Z" },
+ { url = "https://files.pythonhosted.org/packages/c0/39/80b9a55a3335590451d9ecf3eb593a8c635351f4c905ef056d7e8a8fd9e7/yarl-1.25.1-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:4ca89e4e21854ed27ec753297dde84b16c9f8e53b14a4866fb44457d643c19f8", size = 122549, upload-time = "2026-09-15T19:32:41.151Z" },
+ { url = "https://files.pythonhosted.org/packages/42/7d/a179c6757818bb59372a4adafd09f7f26a3b4a0f04c3ae404b544c0b0c82/yarl-1.25.1-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:1ab7618921a93767387a4b83776f751588f5b5ae9bb5bc96620e2e2e00bca868", size = 115107, upload-time = "2026-09-15T19:32:43.072Z" },
+ { url = "https://files.pythonhosted.org/packages/32/2b/a773ac867e4ab53a98ed98e5cefe3bae31e6f550252ca9d1de266f1a40c5/yarl-1.25.1-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:0ae12ff2b805fa02c4dab838005caef735e39986322698c48588d3beacb65c62", size = 120666, upload-time = "2026-09-15T19:32:45.061Z" },
+ { url = "https://files.pythonhosted.org/packages/bc/41/52be6505e85b0f76b4f85b01b5de7e06a0512201abc2c95e14e099549174/yarl-1.25.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:90c30ed53546da833c700115c0064c22120d1b1560f474699fd31f22dd668233", size = 117505, upload-time = "2026-09-15T19:32:47.177Z" },
+ { url = "https://files.pythonhosted.org/packages/f5/01/349c0386caedbbe488d519f252df54efac8a1459282d466c474bdd84a620/yarl-1.25.1-cp314-cp314-win_amd64.whl", hash = "sha256:acfa7e22aa6c6e7a5996a41d275bfa01efa7ea56ab890590280e9063e2cf5c1b", size = 103446, upload-time = "2026-09-15T19:32:49.615Z" },
+ { url = "https://files.pythonhosted.org/packages/5c/f0/8ec63180f77912f0dc4e5a42760cb8c08d20da1d5ace3578a01b84d1f3d8/yarl-1.25.1-cp314-cp314-win_arm64.whl", hash = "sha256:8e7d98cdbb6d71e726f7d525952867096053d1f290dd4e3c50d7d313a136f414", size = 99159, upload-time = "2026-09-15T19:32:51.686Z" },
+ { url = "https://files.pythonhosted.org/packages/47/7d/92d2220d6886b70ab1ed8579533ac2af2dfac716d5d929001daff7986df9/yarl-1.25.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:d21f0fa80a02d05299207eeaafef345d812ace96d5306e4ef265e1d419a615fa", size = 150071, upload-time = "2026-09-15T19:32:53.911Z" },
+ { url = "https://files.pythonhosted.org/packages/64/fc/b245e448124bcda9340df38e3553fa222b50260fca027a84095e9bd8642d/yarl-1.25.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:17c9877a89fb6e2bca6f9087eb24cd7fb434653946ef5075e470d23d49b52287", size = 106780, upload-time = "2026-09-15T19:32:56.443Z" },
+ { url = "https://files.pythonhosted.org/packages/51/e2/9a6ce2e334ebf218a30335ae76fb1696459430d42f733b8cb0d7d65b84d3/yarl-1.25.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:29273edf1530e397bd07cb784db1fbe0d2590b77569f2e24679a9c0a2d763b94", size = 107361, upload-time = "2026-09-15T19:32:58.827Z" },
+ { url = "https://files.pythonhosted.org/packages/ed/70/66e8c76b569b450d16e190f15071c916c3df70b0e33927e415ac497cf0c2/yarl-1.25.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b7abffdf37af1cec6a2ad69b827aa84320db5894791bc8ed932dc93fb274b7e9", size = 114396, upload-time = "2026-09-15T19:33:02.24Z" },
+ { url = "https://files.pythonhosted.org/packages/73/23/0d82838a05c57fdc05bc8b66e8c92dcc0df15e27463a5f163142d521c682/yarl-1.25.1-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:2239a02249d9326655419e0168a28ca9008938eaab31dc29fc875c217927a6c0", size = 104882, upload-time = "2026-09-15T19:33:04.494Z" },
+ { url = "https://files.pythonhosted.org/packages/86/d4/ea08615c4edaa6049a13a2f1128944d068d1893abda7d708d4d7ea01599a/yarl-1.25.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:664ec6a520b74a1df2810666eb67695fcb77fa663e6ea0a25aaf2e529cb24dfa", size = 119485, upload-time = "2026-09-15T19:33:06.583Z" },
+ { url = "https://files.pythonhosted.org/packages/1a/82/0898bdce9b1ae403b308b9c733d0d24af4a3464270c2c081f457b16c3e0d/yarl-1.25.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4f1c91f5a5980a937ff8e238e98e6897e1ad74a4b1e2c0d68c73b5ffbb3f5c0b", size = 122490, upload-time = "2026-09-15T19:33:08.653Z" },
+ { url = "https://files.pythonhosted.org/packages/d1/38/97d79b81c342b78246cfedb74809e68841f3198d21653e10d3232bd9c622/yarl-1.25.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7c88edaec8c349ad4c5ad4c486a3defcc4b80ceb2f074436ffa0a87caf5e76a6", size = 115336, upload-time = "2026-09-15T19:33:11.056Z" },
+ { url = "https://files.pythonhosted.org/packages/8e/9d/2577896554cd310dc470adb6da0b7dd0b435cb63e2565204a7ac240e504c/yarl-1.25.1-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:35dcbea443fafb3eece757ad4e514560ddeb6c34cfae1582c620d7b293d7feee", size = 111825, upload-time = "2026-09-15T19:33:13.204Z" },
+ { url = "https://files.pythonhosted.org/packages/29/6b/7ac49d8ba84a5c4bd73415a4c949d22c749cb3762579b3d50e48019a78aa/yarl-1.25.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:882569ff613758cac762a457a5d72d6e211b28d4bcfea89d1d71ea942b02eac0", size = 114655, upload-time = "2026-09-15T19:33:15.553Z" },
+ { url = "https://files.pythonhosted.org/packages/e5/18/e5942a16723f5b72f9b1297fd5a85a54f6300cd15c0dcb5005b90cd89156/yarl-1.25.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:d0f1489233a254bb3643d2f05de7d59019254d81daeca6b9162fe9edef57e0c7", size = 106395, upload-time = "2026-09-15T19:33:17.599Z" },
+ { url = "https://files.pythonhosted.org/packages/7b/2d/549fa46240781513ebc47ae7eb418df428a163a2a3d644cc9cbb3ecb7846/yarl-1.25.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:f41753a76f4f63927d03a0d8ba8f5ce0f2083bec29a8cfaccc55371b1564b96b", size = 119277, upload-time = "2026-09-15T19:33:19.973Z" },
+ { url = "https://files.pythonhosted.org/packages/76/16/4763f78dcdc0b3b9fb3842b04afe72b9320857c6a69300c62a0eab03d119/yarl-1.25.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:8fb0eb4955adf0579001581f2f71a126e8781ba61bcd120f127b0401163c6c2d", size = 112504, upload-time = "2026-09-15T19:33:22.464Z" },
+ { url = "https://files.pythonhosted.org/packages/ae/b4/974e3edfe0d188393ce1cb9de400111c63fe61f4eb3b772a500d84c970d1/yarl-1.25.1-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:a1e32763e641a1566507d90a8d3b19bfc3cc04a9d4e5ae3e32189874ed4b58a3", size = 116243, upload-time = "2026-09-15T19:33:24.788Z" },
+ { url = "https://files.pythonhosted.org/packages/b0/aa/157b940428da80c104ca09666a740e51c94963df65d5b112e06b52e4d7a8/yarl-1.25.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:65b5b2066651b7432d389e9799d979c703bcc6ef44266bb8153ef54e91e4aab3", size = 115822, upload-time = "2026-09-15T19:33:26.886Z" },
+ { url = "https://files.pythonhosted.org/packages/7e/af/19fbdce41412e1b96825544cc52cd7029d3724655d0988237972f078bd29/yarl-1.25.1-cp314-cp314t-win_amd64.whl", hash = "sha256:734f6e5400352ac4254456003d462866c684703570929cff7a7bde015d0cb371", size = 107386, upload-time = "2026-09-15T19:33:29.009Z" },
+ { url = "https://files.pythonhosted.org/packages/2a/99/f6431c8968e89be608d74b28ae2d024521b2953f27dd44e0dece5e04f67a/yarl-1.25.1-cp314-cp314t-win_arm64.whl", hash = "sha256:287e99ff5aa4dc1c7630bfc683ded6f106d756c99dec432a2d7f197a784f51c6", size = 102094, upload-time = "2026-09-15T19:33:31.151Z" },
+ { url = "https://files.pythonhosted.org/packages/54/22/318c7980066769c6bcd9221ed2248294f5698811da099013098c670565ed/yarl-1.25.1-py3-none-any.whl", hash = "sha256:681c758b0490f9e96b78e5fa8e8dc6e648e9185bb6eaebe73183c33ea0c445f3", size = 63617, upload-time = "2026-09-15T19:34:59.616Z" },
]
[[package]]