Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix(SKY-11948): consume output-contract grants at dispatch (#7188)
Andrew Neilson95d1e966fa20
diff --git a/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.test.ts b/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.test.tsindex 417f8b18c..c30666700 100644--- a/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.test.ts+++ b/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.test.ts@@ -1,10 +1,11 @@-import { describe, expect, it } from "vitest";+import { describe, expect, it, vi } from "vitest";import type { GoogleOAuthCredential } from "@/api/types";import {getGoogleOAuthCredentialScopesGranted,getGoogleOAuthCredentialScopesRequested,matchesGoogleOAuthIntegrationScopes,normalizeGoogleOAuthScopes,+ safePostCredentialsInvalidate,} from "./useGoogleOAuthCredentials";const baseCredential: GoogleOAuthCredential = {@@ -83,3 +84,33 @@ describe("Google OAuth credential scope helpers", () => {).toBe(true);});});++describe("safePostCredentialsInvalidate", () => {+ it("posts on a live channel", () => {+ const postMessage = vi.fn();+ safePostCredentialsInvalidate({ postMessage });+ expect(postMessage).toHaveBeenCalledWith("invalidate");+ });++ it("no-ops when the channel is null", () => {+ expect(() => safePostCredentialsInvalidate(null)).not.toThrow();+ });++ it("swallows errors from a disposed channel", () => {+ const postMessage = vi.fn(() => {+ throw new DOMException("channel is closed", "InvalidStateError");+ });+ expect(() => safePostCredentialsInvalidate({ postMessage })).not.toThrow();+ expect(postMessage).toHaveBeenCalledWith("invalidate");+ });++ it("rethrows unexpected postMessage errors", () => {+ const postMessage = vi.fn(() => {+ throw new Error("unexpected broadcast failure");+ });++ expect(() => safePostCredentialsInvalidate({ postMessage })).toThrow(+ "unexpected broadcast failure",+ );+ });+});diff --git a/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.ts b/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.tsindex 1991b6850..3598d88c6 100644--- a/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.ts+++ b/skyvern-frontend/src/hooks/useGoogleOAuthCredentials.ts@@ -21,8 +21,25 @@ const credentialBroadcastChannel: BroadcastChannel | null =? new BroadcastChannel(BROADCAST_CHANNEL_NAME): null;+// The channel can be disposed by the runtime (e.g. an embedded webview tearing+// down its native bridge during auth navigation) before this fires, in which+// case postMessage throws InvalidStateError. Cross-tab invalidation is+// best-effort, so swallow the failure rather than surfacing it.+export function safePostCredentialsInvalidate(+ channel: Pick<BroadcastChannel, "postMessage"> | null,+): void {+ try {+ channel?.postMessage("invalidate");+ } catch (error) {+ if (error instanceof DOMException && error.name === "InvalidStateError") {+ return;+ }+ throw error;+ }+}+function broadcastCredentialsChanged() {- credentialBroadcastChannel?.postMessage("invalidate");+ safePostCredentialsInvalidate(credentialBroadcastChannel);}export function normalizeGoogleOAuthScopes(diff --git a/skyvern/config.py b/skyvern/config.pyindex 1825e580f..15d268d04 100644--- a/skyvern/config.py+++ b/skyvern/config.py@@ -205,6 +205,7 @@ class Settings(BaseSettings):# Experimental Workflow Copilot v2 branch mode.# Off = standard block authoring. On = prefer code blocks for browser work.WORKFLOW_COPILOT_CODE_BLOCK_MODE: bool = False+ WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY: bool = False# Default code_only for MCP block/workflow tools. Off = permissive.MCP_CODE_ONLY_MODE: bool = False# Default for the bounded code-block self-heal; off by default.diff --git a/skyvern/forge/sdk/api/files.py b/skyvern/forge/sdk/api/files.pyindex a19d48840..9ec5be281 100644--- a/skyvern/forge/sdk/api/files.py+++ b/skyvern/forge/sdk/api/files.py@@ -6,6 +6,7 @@ import reimport shutilimport tempfileimport zipfile+from http import HTTPStatusfrom pathlib import Pathfrom typing import TYPE_CHECKINGfrom urllib.parse import parse_qsl, unquote, urlparse@@ -17,9 +18,20 @@ from yarl import URLfrom skyvern.config import settingsfrom skyvern.constants import BROWSER_DOWNLOAD_TIMEOUT, BROWSER_DOWNLOADING_SUFFIX, REPO_ROOT_DIR-from skyvern.exceptions import DownloadFileMaxSizeExceeded, DownloadFileMaxWaitingTime+from skyvern.exceptions import DownloadFileMaxSizeExceeded, DownloadFileMaxWaitingTime, SkyvernHTTPExceptionfrom skyvern.forge import app-from skyvern.utils.url_validators import encode_url+from skyvern.forge.sdk.core.aiohttp_helper import (+ SSRFGuardedResolver,+ ssrf_guarded_tcp_connector,+ strip_cross_origin_redirect_credentials,+ validate_and_pin_fetch_url,+ validate_and_pin_redirect_url,+)+from skyvern.utils.url_validators import (+ MAX_SAFE_REDIRECTS,+ SAFE_REDIRECT_STATUS_CODES,+ encode_url,+)if TYPE_CHECKING:from skyvern.forge.sdk.core.skyvern_context import SkyvernContext@@ -209,70 +221,93 @@ async def download_file(LOG.info("Downloading file from local file system", url=url)return local_path- async with aiohttp.ClientSession(raise_for_status=True) as session:+ resolver = SSRFGuardedResolver()+ current_url = await validate_and_pin_fetch_url(url, resolver)+ request_headers = dict(headers or {})+ async with aiohttp.ClientSession(+ raise_for_status=True, connector=ssrf_guarded_tcp_connector(resolver)+ ) as session:LOG.info("Starting to download file", url=url)- encoded_url = encode_url(url)- async with session.get(URL(encoded_url, encoded=True), headers=headers) as response:- # Check the content length if available- if max_size_mb and response.content_length and response.content_length > max_size_mb * 1024 * 1024:- # todo: move to root exception.py- raise DownloadFileMaxSizeExceeded(max_size_mb)-- # Get the file name- if output_dir:- download_dir_path = Path(output_dir)- download_dir_path.mkdir(parents=True, exist_ok=True)- else:- download_dir_path = Path(make_temp_directory(prefix="skyvern_downloads_"))-- download_dir_resolved = download_dir_path.resolve()- # response.headers stays a CIMultiDictProxy: dict() would make header- # lookups case-sensitive and miss lowercase wire headers.- file_name = _determine_download_filename(filename, response.headers, url)- allowed_dir = os.path.realpath(download_dir_resolved)- resolved_final_path = os.path.realpath(os.path.join(allowed_dir, file_name))- # sanitize_filename strips separators but keeps dots, so a dots-only name can- # still resolve outside the download dir; require a direct child. Checked- # before streaming so a rejected name downloads zero bytes.- if (- resolved_final_path == allowed_dir- or not resolved_final_path.startswith(allowed_dir + os.sep)- or os.path.dirname(resolved_final_path) != allowed_dir- ):- raise ValueError(f"Unsafe filename derived from download: {file_name!r}")- final_path = Path(resolved_final_path)-- temp_file = tempfile.NamedTemporaryFile(mode="wb", dir=download_dir_resolved, delete=False)- file_path = Path(temp_file.name).resolve()- if file_path != download_dir_resolved and not file_path.is_relative_to(download_dir_resolved):- temp_file.close()- raise ValueError("Unsafe temporary file path created for download")-- LOG.info("Downloading file to temporary path", file_path=str(file_path))- try:- with temp_file as f:- # Write the content of the request into the file- total_bytes_downloaded = 0- async for chunk in response.content.iter_chunked(1024):- f.write(chunk)- total_bytes_downloaded += len(chunk)- if max_size_mb and total_bytes_downloaded > max_size_mb * 1024 * 1024:- raise DownloadFileMaxSizeExceeded(max_size_mb)-- file_path.replace(final_path)- except BaseException:- # An orphaned temp file in a run download dir would get synced to storage- # under the tmpXXXX name; drop it on any failure (incl. cancellation).- file_path.unlink(missing_ok=True)- raise-- LOG.info(f"File downloaded successfully to {final_path}")- return str(final_path)+ for _ in range(MAX_SAFE_REDIRECTS + 1):+ encoded_url = encode_url(current_url)+ async with session.get(+ URL(encoded_url, encoded=True), headers=request_headers, allow_redirects=False+ ) as response:+ if response.status in SAFE_REDIRECT_STATUS_CODES and response.headers.get("Location"):+ next_url = await validate_and_pin_redirect_url(+ current_url, response.headers["Location"], resolver+ )+ request_headers, _ = strip_cross_origin_redirect_credentials(+ request_headers, None, current_url, next_url+ )+ current_url = next_url+ continue++ # Check the content length if available+ if max_size_mb and response.content_length and response.content_length > max_size_mb * 1024 * 1024:+ # todo: move to root exception.py+ raise DownloadFileMaxSizeExceeded(max_size_mb)++ # Get the file name+ if output_dir:+ download_dir_path = Path(output_dir)+ download_dir_path.mkdir(parents=True, exist_ok=True)+ else:+ download_dir_path = Path(make_temp_directory(prefix="skyvern_downloads_"))++ download_dir_resolved = download_dir_path.resolve()+ # response.headers stays a CIMultiDictProxy: dict() would make header+ # lookups case-sensitive and miss lowercase wire headers.+ file_name = _determine_download_filename(filename, response.headers, url)+ allowed_dir = os.path.realpath(download_dir_resolved)+ resolved_final_path = os.path.realpath(os.path.join(allowed_dir, file_name))+ # sanitize_filename strips separators but keeps dots, so a dots-only name can+ # still resolve outside the download dir; require a direct child. Checked+ # before streaming so a rejected name downloads zero bytes.+ if (+ resolved_final_path == allowed_dir+ or not resolved_final_path.startswith(allowed_dir + os.sep)+ or os.path.dirname(resolved_final_path) != allowed_dir+ ):+ raise ValueError(f"Unsafe filename derived from download: {file_name!r}")+ final_path = Path(resolved_final_path)++ temp_file = tempfile.NamedTemporaryFile(mode="wb", dir=download_dir_resolved, delete=False)+ file_path = Path(temp_file.name).resolve()+ if file_path != download_dir_resolved and not file_path.is_relative_to(download_dir_resolved):+ temp_file.close()+ raise ValueError("Unsafe temporary file path created for download")++ LOG.info("Downloading file to temporary path", file_path=str(file_path))+ try:+ with temp_file as f:+ # Write the content of the request into the file+ total_bytes_downloaded = 0+ async for chunk in response.content.iter_chunked(1024):+ f.write(chunk)+ total_bytes_downloaded += len(chunk)+ if max_size_mb and total_bytes_downloaded > max_size_mb * 1024 * 1024:+ raise DownloadFileMaxSizeExceeded(max_size_mb)++ file_path.replace(final_path)+ except BaseException:+ # An orphaned temp file in a run download dir would get synced to storage+ # under the tmpXXXX name; drop it on any failure (incl. cancellation).+ file_path.unlink(missing_ok=True)+ raise++ LOG.info(f"File downloaded successfully to {final_path}")+ return str(final_path)+ raise SkyvernHTTPException(+ message=f"Too many redirects while downloading file: {current_url}",+ status_code=HTTPStatus.BAD_REQUEST,+ )except aiohttp.ClientResponseError as e:- LOG.exception(f"Failed to download file, status code: {e.status}")+ # Re-raised and handled at the action/block boundary; server rejections are external.+ LOG.warning(f"Failed to download file, status code: {e.status}", exc_info=True)raiseexcept DownloadFileMaxSizeExceeded as e:- LOG.exception(f"Failed to download file, max size exceeded: {e.max_size}")+ LOG.warning(f"Failed to download file, max size exceeded: {e.max_size}", exc_info=True)raiseexcept PermissionError as e:LOG.warning(@@ -282,6 +317,10 @@ async def download_file(reason=str(e),)raise+ except aiohttp.InvalidURL:+ # Malformed customer-provided URL - a client-data error, not a platform fault.+ LOG.warning("Failed to download file, invalid URL", exc_info=True)+ raiseexcept Exception:LOG.exception("Failed to download file")raisediff --git a/skyvern/forge/sdk/copilot/build_test_outcome.py b/skyvern/forge/sdk/copilot/build_test_outcome.pyindex e28a1544f..c7b53c72d 100644--- a/skyvern/forge/sdk/copilot/build_test_outcome.py+++ b/skyvern/forge/sdk/copilot/build_test_outcome.py@@ -539,8 +539,7 @@ def _grounding_payload_from_evidence(challenge_gated = _challenge_gated_page_evidence(evidence)capture_degraded = not has_bounded_page_schema(evidence)observed_empty_page = _observed_empty_page_evidence(evidence)- if (challenge_gated or capture_degraded or observed_empty_page) and not (isinstance(run_id, str) and run_id):- return None+ # No-run degraded captures are typed grounding evidence; downstream binding remains a separate gate.diagnostic_reason: Literal["none", "empty_page", "challenge_gated", "capture_degraded"] = "none"if challenge_gated:diagnostic_reason = "challenge_gated"diff --git a/skyvern/forge/sdk/copilot/enforcement.py b/skyvern/forge/sdk/copilot/enforcement.pyindex a7f06067d..f2016e264 100644--- a/skyvern/forge/sdk/copilot/enforcement.py+++ b/skyvern/forge/sdk/copilot/enforcement.py@@ -102,6 +102,7 @@ from skyvern.forge.sdk.copilot.run_outcome import (RecordedRunOutcome,run_outcome_display_reason,)+from skyvern.forge.sdk.copilot.runtime import AuthorTimeGateAblationPayload, record_author_time_gate_ablation_eventfrom skyvern.forge.sdk.copilot.screenshot_utils import ScreenshotEntryfrom skyvern.forge.sdk.copilot.terminal_predicates import (artifact_health_blocked,@@ -2384,7 +2385,7 @@ def _uncovered_output_reject_rescout_key(canonical_paths: set[str], structural_fdef _active_uncovered_output_reject_paths(ctx: AgentContext) -> set[str]:canonical = {_canonical_output_path(path)- for path in author_time_reject_missing_output_paths(ctx.latest_recorded_build_test_outcome)+ for path in author_time_reject_missing_output_paths(getattr(ctx, "latest_recorded_build_test_outcome", None))}return canonical & uncovered_requested_output_paths(ctx) if canonical else set()@@ -2425,6 +2426,19 @@ def uncovered_output_reject_scout_steer_signal(ctx: AgentContext, tool_name: strkey = _uncovered_output_reject_rescout_key(active, latest.structural_failure_identity)if ctx.uncovered_output_rescout_steer_key == key:return None+ payload: AuthorTimeGateAblationPayload = {+ "uncovered_output_paths": sorted(active),+ "structural_failure_identity": latest.structural_failure_identity,+ }+ if record_author_time_gate_ablation_event(+ ctx,+ gate_id="uncovered_output_rescout_steer",+ reason_code=UNCOVERED_OUTPUT_RESCOUT_STEER_REASON_CODE,+ fingerprint=key,+ blocked_tool=tool_name,+ payload=payload,+ ):+ return Nonectx.uncovered_output_rescout_steer_key = keynamed_paths = ", ".join(sorted(active))return CopilotToolBlockerSignal(diff --git a/skyvern/forge/sdk/copilot/runtime.py b/skyvern/forge/sdk/copilot/runtime.pyindex a7e372482..db987191a 100644--- a/skyvern/forge/sdk/copilot/runtime.py+++ b/skyvern/forge/sdk/copilot/runtime.py@@ -4,6 +4,7 @@ from __future__ import annotationsimport asyncioimport inspect+from collections.abc import Sequencefrom contextlib import asynccontextmanagerfrom dataclasses import dataclass, fieldfrom typing import TYPE_CHECKING, Any, AsyncIterator, Awaitable, NotRequired, TypeAlias, TypedDict, cast@@ -65,6 +66,16 @@ CodeArtifactMetadataValue: TypeAlias = (str | int | float | bool | None | list["CodeArtifactMetadataValue"] | dict[str, "CodeArtifactMetadataValue"])CodeArtifactMetadataPayload: TypeAlias = dict[str, CodeArtifactMetadataValue]+AuthorTimeGateAblationPayloadValue: TypeAlias = (+ str+ | int+ | float+ | bool+ | None+ | Sequence["AuthorTimeGateAblationPayloadValue"]+ | dict[str, "AuthorTimeGateAblationPayloadValue"]+)+AuthorTimeGateAblationPayload: TypeAlias = dict[str, AuthorTimeGateAblationPayloadValue]SdkActionWorkflowRunCacheKey: TypeAlias = tuple[str, str]@@ -144,6 +155,16 @@ class RegisteredArtifactEvidence:workflow_run_id: str+@dataclass(frozen=True)+class AuthorTimeGateAblationEvent:+ gate_id: str+ reason_code: str+ fingerprint: str+ log_only: bool+ blocked_tool: str | None = None+ payload: AuthorTimeGateAblationPayload = field(default_factory=dict)++class ScoutedInteraction(TypedDict):tool_name: strselector: NotRequired[str]@@ -423,6 +444,43 @@ class AgentContext:# extraction_schema declares fields that map to no output the block produces.# Surfaced into the persisted TurnOutcome so a later turn can report it.latest_schema_incompatibility: SchemaIncompatibility | None = None+ author_time_gate_ablation_events: list[AuthorTimeGateAblationEvent] = field(default_factory=list)+++def copilot_author_time_gate_log_only_enabled() -> bool:+ return not settings.is_cloud_environment() and settings.WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY+++def record_author_time_gate_ablation_event(+ ctx: AgentContext,+ *,+ gate_id: str,+ reason_code: str,+ fingerprint: str,+ blocked_tool: str | None = None,+ payload: AuthorTimeGateAblationPayload | None = None,+) -> bool:+ if not copilot_author_time_gate_log_only_enabled():+ return False+ event = AuthorTimeGateAblationEvent(+ gate_id=gate_id,+ reason_code=reason_code,+ fingerprint=fingerprint,+ blocked_tool=blocked_tool,+ payload=dict(payload or {}),+ log_only=True,+ )+ ctx.author_time_gate_ablation_events.append(event)+ LOG.info(+ "copilot_author_time_gate_ablation_event",+ gate_id=event.gate_id,+ reason_code=event.reason_code,+ fingerprint=event.fingerprint,+ blocked_tool=event.blocked_tool,+ log_only=event.log_only,+ payload=event.payload,+ )+ return Truedef output_contract_ladder_unresolved(ctx: AgentContext) -> bool:diff --git a/skyvern/forge/sdk/copilot/tools/__init__.py b/skyvern/forge/sdk/copilot/tools/__init__.pyindex 8d0ce4ca4..7cae2265f 100644--- a/skyvern/forge/sdk/copilot/tools/__init__.py+++ b/skyvern/forge/sdk/copilot/tools/__init__.py@@ -253,7 +253,7 @@ from .workflow_update import _record_workflow_update_result as _record_workflow_from .workflow_update import _scaffold_metadata_contract_for_update as _scaffold_metadata_contract_for_updatefrom .workflow_update import _update_workflow as _update_workflowfrom .workflow_update import (- consume_output_contract_advisory_grant_for_run as consume_output_contract_advisory_grant_for_run,+ consume_output_contract_advisory_grant_for_run_result as consume_output_contract_advisory_grant_for_run_result,)LOG = structlog.get_logger()@@ -468,8 +468,6 @@ async def run_blocks_tool()return json.dumps(result)- consume_output_contract_advisory_grant_for_run(copilot_ctx)-with copilot_span("run_blocks",data=_run_blocks_span_data(@@ -487,6 +485,7 @@ async def run_blocks_tool(block_outputs_to_seed=block_outputs_to_seed,frontier_start_label=frontier_start_label,)+ consume_output_contract_advisory_grant_for_run_result(copilot_ctx, result)completion_verification = await _verify_and_record_run_blocks_result(copilot_ctx, result, handler_start)tool_visible_result = _tool_visible_result_after_completion_verification(copilot_ctx,@@ -768,8 +767,6 @@ async def update_and_run_blocks_tool()return json.dumps(result)- consume_output_contract_advisory_grant_for_run(copilot_ctx)-with copilot_span("run_blocks",data=_run_blocks_span_data(@@ -787,6 +784,7 @@ async def update_and_run_blocks_tool(block_outputs_to_seed=block_outputs_to_seed,frontier_start_label=frontier_start_label,)+ consume_output_contract_advisory_grant_for_run_result(copilot_ctx, run_result)completion_verification = await _verify_and_record_run_blocks_result(copilot_ctx, run_result, handler_start)tool_visible_result = _tool_visible_result_after_completion_verification(copilot_ctx,diff --git a/skyvern/forge/sdk/copilot/tools/blockers.py b/skyvern/forge/sdk/copilot/tools/blockers.pyindex be298c592..162499c49 100644--- a/skyvern/forge/sdk/copilot/tools/blockers.py+++ b/skyvern/forge/sdk/copilot/tools/blockers.py@@ -39,7 +39,12 @@ from skyvern.forge.sdk.copilot.failure_tracking import (from skyvern.forge.sdk.copilot.loop_detection import detect_failed_tool_step_loop_for_ctx, detect_tool_loopfrom skyvern.forge.sdk.copilot.reached_download_target import REGISTERED_DOWNLOAD_OUTPUT_KEYSfrom skyvern.forge.sdk.copilot.run_outcome import trusted_terminal_challenge_category_name-from skyvern.forge.sdk.copilot.runtime import AgentContext, output_contract_ladder_unresolved+from skyvern.forge.sdk.copilot.runtime import (+ AgentContext,+ AuthorTimeGateAblationPayload,+ output_contract_ladder_unresolved,+ record_author_time_gate_ablation_event,+)from skyvern.forge.sdk.workflow.models.workflow import WorkflowRun, WorkflowRunStatusfrom skyvern.schemas.workflows import BlockType@@ -1663,6 +1668,26 @@ def _recorded_outcome_grounding_signal(ctx: AgentContext, tool_name: str) -> Copreturn Noneif not recorded_outcome_grounding_requires_current_page(ctx):return None+ requirement = ctx.recorded_outcome_grounding_requirement+ if requirement is None:+ return None+ payload: AuthorTimeGateAblationPayload = {+ "phase": requirement.phase,+ "outcome_reason_code": requirement.reason_code,+ "workflow_run_id": requirement.workflow_run_id,+ "block_labels": list(requirement.block_labels),+ "required_tool": requirement.required_tool,+ "required_target_url": requirement.required_target_url,+ }+ if record_author_time_gate_ablation_event(+ ctx,+ gate_id="recorded_outcome_grounding",+ reason_code="recorded_outcome_grounding_required",+ fingerprint=requirement.structural_key,+ blocked_tool=tool_name,+ payload=payload,+ ):+ return Nonereturn CopilotToolBlockerSignal(blocker_kind="missing_required_context",agent_steering_text=(diff --git a/skyvern/forge/sdk/copilot/tools/workflow_update.py b/skyvern/forge/sdk/copilot/tools/workflow_update.pyindex 9652d8828..a76f0f8d2 100644--- a/skyvern/forge/sdk/copilot/tools/workflow_update.py+++ b/skyvern/forge/sdk/copilot/tools/workflow_update.py@@ -113,7 +113,14 @@ from skyvern.forge.sdk.copilot.request_policy import (RequestedOutputEvidenceSource,_coerce_requested_output_evidence_source,)-from skyvern.forge.sdk.copilot.runtime import AgentContext, ScoutedInteraction, output_contract_ladder_unresolved+from skyvern.forge.sdk.copilot.runtime import (+ AgentContext,+ AuthorTimeGateAblationPayload,+ ScoutedInteraction,+ copilot_author_time_gate_log_only_enabled,+ output_contract_ladder_unresolved,+ record_author_time_gate_ablation_event,+)from skyvern.forge.sdk.copilot.schema_incompatibility import (SCHEMA_INCOMPATIBILITY_FAILURE_TYPE,SchemaIncompatibility,@@ -1559,7 +1566,7 @@ def _recorded_outcome_convergence_reject(workflow_yaml: str,code_artifact_metadata: object,) -> _ConvergenceReject | None:- latest = ctx.latest_recorded_build_test_outcome+ latest = getattr(ctx, "latest_recorded_build_test_outcome", None)if not isinstance(latest, RecordedBuildTestOutcome) or not latest.is_authoritative:return Nonecandidate_signature = authored_structure_signature_from_workflow(workflow_yaml, code_artifact_metadata)@@ -1775,6 +1782,8 @@ _MAX_OUTPUT_CONTRACT_REJECTS = 4_MAX_OUTPUT_CONTRACT_DEFERRALS = 3_MAX_OUTPUT_CONTRACT_ACTUATIONS_WITHOUT_RUN = 3_OUTPUT_CONTRACT_PAGE_EXTRACT_VAR = "output_contract_page_values"+_OUTPUT_CONTRACT_ABLATION_GATE_ID = "output_contract_actuation"+_METADATA_PREFLIGHT_ABLATION_GATE_ID = "metadata_run_preflight_reject"@dataclass(frozen=True)@@ -1803,6 +1812,37 @@ class _OutputContractEvaluation:)+def _record_output_contract_ablation_event(+ ctx: AgentContext,+ evaluation: _OutputContractEvaluation,+ *,+ gate_id: str,+ blocked_tool: str,+ fingerprint: str,+) -> bool:+ reason_code = str(+ evaluation.payload.get("reason_code") or evaluation.reason_code or _OUTPUT_CONTRACT_REJECT_REASON_CODE+ )+ payload: AuthorTimeGateAblationPayload = {+ "block_label": evaluation.block_label,+ "canonical_output_contract_signature": evaluation.canonical_signature,+ "canonical_required_child_paths": sorted(evaluation.required_paths),+ "missing_metadata_paths": list(evaluation.missing_metadata_paths),+ "missing_schema_paths": list(evaluation.missing_schema_paths),+ "missing_return_paths": list(evaluation.missing_return_paths),+ "shape_violations": list(evaluation.shape_violations),+ "can_attempt_run": evaluation.can_attempt_run,+ }+ return record_author_time_gate_ablation_event(+ ctx,+ gate_id=gate_id,+ reason_code=reason_code,+ fingerprint=fingerprint,+ blocked_tool=blocked_tool,+ payload=payload,+ )++@dataclass(frozen=True)class _RuntimeOutputRepairContract:required_paths: set[str]@@ -2502,6 +2542,7 @@ def _adjudicate_output_contract_ladder_after_reject(required_paths=evaluation.required_paths,signature=signature,current_fingerprint=current_fingerprint,+ advisory_run_grantable=blockers == [_OUTPUT_CONTRACT_REJECT_REASON_CODE],)if actuation.kind == OutputContractActuationKind.BLOCKED_TERMINAL:_stash_output_source_unobservable_terminal(@@ -3154,8 +3195,6 @@ def _observed_required_output_values(ctx: AgentContext, required_paths: set[str]return Falseif covered & required_paths:return True- # Match on ancestor/descendant lineage, not the top-level root: every requested-output path- # shares the ``output`` root, so a root-only match would credit any coverage as the required value.return any(_output_paths_share_lineage(str(path), required) for path in covered for required in required_paths)@@ -3238,7 +3277,9 @@ def _grant_output_contract_advisory_run(ctx: AgentContext, signature: str) -> No)-def consume_output_contract_advisory_grant_for_run(ctx: AgentContext) -> list[str]:+def consume_output_contract_advisory_grant_for_run(+ ctx: AgentContext, *, workflow_run_id: str | None = None+) -> list[str]:consumed: list[str] = []for signature, state in list(ctx.output_contract_actuation_by_signature.items()):if state == OutputContractAdvisoryState.GRANTED:@@ -3248,6 +3289,7 @@ def consume_output_contract_advisory_grant_for_run(ctx: AgentContext) -> list[stLOG.info("copilot_output_contract_advisory_run_consumed",canonical_output_contract_signature=signature,+ workflow_run_id=workflow_run_id,)if ctx.output_contract_actuation_count_by_signature:ctx.output_contract_actuation_count_by_signature.clear()@@ -3256,6 +3298,37 @@ def consume_output_contract_advisory_grant_for_run(ctx: AgentContext) -> list[streturn consumed+def consume_output_contract_advisory_grant_for_run_result(+ ctx: AgentContext, run_result: Mapping[str, object]+) -> list[str]:+ workflow_run_id = _workflow_run_id_from_run_result(run_result)+ if workflow_run_id is None:+ data = run_result.get("data")+ if isinstance(data, Mapping):+ LOG.warning(+ "copilot_output_contract_advisory_run_result_missing_workflow_run_id",+ data_keys=sorted(str(key) for key in data),+ )+ return []+ consumed = consume_output_contract_advisory_grant_for_run(ctx, workflow_run_id=workflow_run_id)+ for signature in consumed:+ LOG.info(+ "copilot_output_contract_advisory_run_dispatched_at_seam",+ canonical_output_contract_signature=signature,+ workflow_run_id=workflow_run_id,+ )+ return consumed+++def _workflow_run_id_from_run_result(run_result: Mapping[str, object]) -> str | None:+ data = run_result.get("data")+ if isinstance(data, Mapping):+ workflow_run_id = data.get("workflow_run_id")+ if isinstance(workflow_run_id, str) and workflow_run_id.strip():+ return workflow_run_id+ return None++def _stash_output_source_unobservable_terminal(ctx: AgentContext,*,@@ -3267,6 +3340,23 @@ def _stash_output_source_unobservable_terminal() -> None:if ctx.turn_halt is not None:return+ payload: AuthorTimeGateAblationPayload = {+ "block_label": block_label,+ "canonical_output_contract_signature": signature,+ "canonical_required_child_paths": sorted(required_paths),+ "spine_split_blockers": list(blockers),+ }+ if copilot_author_time_gate_log_only_enabled() and ctx.output_contract_bail_actuated_this_call:+ return+ if record_author_time_gate_ablation_event(+ ctx,+ gate_id=_OUTPUT_CONTRACT_ABLATION_GATE_ID,+ reason_code=reason_code,+ fingerprint=signature,+ blocked_tool="update_workflow",+ payload=payload,+ ):+ returnsignal = build_output_source_unobservable_blocker_signal(reason_code=reason_code,required_paths=required_paths,@@ -3332,7 +3422,7 @@ def _registered_output_paths(result: object) -> set[str]:if isinstance(value, dict) and value:for key, child in value.items():absorb(f"{prefix}.{key}" if prefix else str(key), child)- elif prefix:+ elif prefix and _runtime_output_value_is_meaningful(value):paths.add(prefix)for block in data.get("blocks") or []:@@ -3360,9 +3450,8 @@ def record_output_contract_run_output_evidence(ctx: AgentContext, result: objectobserved_paths = {_strip_output_namespace_root(path) for path in _registered_output_paths(result)}for signature, paths in list(pending.items()):required_paths = {_strip_output_namespace_root(str(path)) for path in paths}- bound = any(- _output_paths_share_lineage(observed, required)- for observed in observed_paths+ bound = bool(required_paths) and all(+ any(_output_paths_share_lineage(observed, required) for observed in observed_paths)for required in required_paths)ctx.output_contract_run_output_observed_by_signature[signature] = True@@ -3404,15 +3493,6 @@ def _reopen_dispatch_lacked_bound_extraction(ctx: AgentContext, signature: str)return True-def _page_source_extraction_prompt(required_paths: set[str]) -> str:- fields = ", ".join(sorted(_metadata_contract_required_paths(required_paths))) or "the requested values"- return (- "Read the values currently shown on the page and return them keyed exactly to the requested output "- f"structure. Required output path(s): {fields}. Return only values visible on the page; if a value is "- "not present, return an empty string for it."- )--def _strip_top_level_returns(code: str) -> str:try:tree = ast.parse(code)@@ -3424,6 +3504,14 @@ def _strip_top_level_returns(code: str) -> str:return ast.unparse(ast.Module(body=kept, type_ignores=[]))+def _page_source_extraction_prompt(required_paths: set[str]) -> str:+ paths = ", ".join(sorted(_metadata_contract_required_paths(required_paths)))+ return (+ "Extract the requested output values visible on the current page. "+ f"Populate these output paths when visible: {paths}."+ )++def _page_source_extraction_code(target_code: str, required_paths: set[str]) -> str:body = _strip_top_level_returns(textwrap.dedent(target_code).strip())schema = _schema_template_for_required_paths(required_paths)@@ -3431,7 +3519,7 @@ def _page_source_extraction_code(target_code: str, required_paths: set[str]) ->f"{_OUTPUT_CONTRACT_PAGE_EXTRACT_VAR} = await page.extract(\n"f" prompt={json.dumps(_page_source_extraction_prompt(required_paths))},\n"f" schema={schema!r},\n"- f")\n"+ ")\n"f"return {_OUTPUT_CONTRACT_PAGE_EXTRACT_VAR}")return f"{body}\n{extract_block}" if body else extract_block@@ -3482,9 +3570,27 @@ def _actuate_output_contract_bail()if actuation.kind == OutputContractActuationKind.ADVISORY_RUN and not _run_authority_permits_dispatch(ctx):actuation = OutputContractActuation(OutputContractActuationKind.STRUCTURE_DIRECTIVE, actuation.family)+ payload: AuthorTimeGateAblationPayload = {+ "actuation_kind": actuation.kind.value,+ "family": actuation.family.value,+ "blockers": list(blockers),+ "canonical_required_child_paths": sorted(required_paths),+ "advisory_state": evidence.advisory_state.value,+ "advisory_run_grantable": evidence.advisory_run_grantable,+ }ctx.output_contract_bail_actuated_this_call = True+ if record_author_time_gate_ablation_event(+ ctx,+ gate_id=_OUTPUT_CONTRACT_ABLATION_GATE_ID,+ reason_code=actuation.reason_code or actuation.kind.value,+ fingerprint=current_fingerprint,+ blocked_tool="update_workflow",+ payload=payload,+ ):+ return actuationif actuation.kind == OutputContractActuationKind.ADVISORY_RUN:_grant_output_contract_advisory_run(ctx, signature)+ _arm_pending_run_evidence(ctx, signature, required_paths)elif actuation.kind == OutputContractActuationKind.STRUCTURE_DIRECTIVE and not evidence.prior_directive_unconsumed:_record_output_contract_actuation_progress(ctx, signature)if (@@ -3616,6 +3722,8 @@ def _impose_output_contract_envelope_after_steering(return workflow_yaml, raw_code_artifact_metadata, Falseif actuation.kind == OutputContractActuationKind.ADVISORY_RUN:return workflow_yaml, raw_code_artifact_metadata, False+ if copilot_author_time_gate_log_only_enabled():+ return workflow_yaml, raw_code_artifact_metadata, Falseattempt_key = _output_contract_spine_directive_attempt_key(signature=signature, block_label=label, workflow_yaml=workflow_yaml)@@ -3722,6 +3830,45 @@ def _metadata_contract_run_preflight_reject(workflow_yaml,raw_code_artifact_metadata,)+ convergence_reject = _recorded_outcome_convergence_reject(+ ctx,+ workflow_yaml=workflow_yaml,+ code_artifact_metadata=raw_code_artifact_metadata,+ )+ if convergence_reject is not None:+ block_labels = sorted(_workflow_yaml_code_blocks_by_label(workflow_yaml))+ _record_author_time_reject_outcome(+ ctx,+ reason_code="unchanged_after_recorded_outcome",+ summary="The authored code and output structure are unchanged after the last recorded test outcome.",+ structural_payload={+ "reason_code": "unchanged_after_recorded_outcome",+ "authored_structure_signature": convergence_reject.authored_structure_signature,+ "block_labels": block_labels,+ },+ authored_structure_signature=convergence_reject.authored_structure_signature,+ block_labels=block_labels,+ )+ _record_code_authoring_guardrail_reject(+ ctx, frontier_unchanged=convergence_reject.reason == "frontier_unchanged"+ )+ LOG.info(+ "copilot recorded outcome convergence behavior",+ convergence_reason=convergence_reject.reason,+ commit_early_terminal=convergence_reject.commit_early_terminal,+ block_labels=block_labels,+ )+ if convergence_reject.commit_early_terminal:+ _commit_recorded_outcome_early_terminal(ctx)+ return {+ "ok": False,+ "error": (+ "Submitted workflow left the frontier the last recorded test outcome named unchanged. "+ "Revise the code block or output metadata that owns that frontier before testing again."+ ),+ "user_facing_summary": _compiled_authoring_user_summary(),+ "data": _code_repair_progress_data(),+ }evaluation = _evaluate_output_contract_for_code_block(ctx,workflow_yaml,@@ -3730,33 +3877,31 @@ def _metadata_contract_run_preflight_reject()if evaluation is None or not evaluation.has_deficiencies:return None+ authored_fingerprint = _output_contract_structural_fingerprint(workflow_yaml, evaluation.canonical_signature)advisory_granted = _output_contract_advisory_granted(ctx, evaluation.canonical_signature)# A granted advisory must arm run-output evidence before the grant is consumed, even when the# workflow is otherwise run-attemptable — otherwise the dispatched run records no evidence.if evaluation.can_attempt_run and not advisory_granted:return None+ if _record_output_contract_ablation_event(+ ctx,+ evaluation,+ gate_id=_METADATA_PREFLIGHT_ABLATION_GATE_ID,+ blocked_tool="update_and_run_blocks",+ fingerprint=authored_fingerprint,+ ):+ return Nonepayload = _record_output_contract_reject(ctx,evaluation,summary="Submitted workflow does not satisfy the requested output contract before run.",- authored_structural_fingerprint=_output_contract_structural_fingerprint(- workflow_yaml, evaluation.canonical_signature- ),+ authored_structural_fingerprint=authored_fingerprint,workflow_yaml=workflow_yaml,)if advisory_granted:_arm_pending_run_evidence(ctx, evaluation.canonical_signature, set(evaluation.required_paths))- consume_output_contract_advisory_grant_for_run(ctx)- LOG.info(- "copilot_output_contract_advisory_run_dispatched_at_seam",- block_label=evaluation.block_label,- canonical_output_contract_signature=evaluation.canonical_signature,- )return None- if evaluation.repair_context is not None and (- evaluation.repair_context.required_block_structure- or evaluation.repair_context.reason_code == OUTPUT_OWNER_AMBIGUITY_REASON_CODE- ):+ if evaluation.repair_context is not None:ctx.last_code_authoring_repair_context = evaluation.repair_contextpayload = dict(payload)payload["output_contract_reason_code"] = payload.get("reason_code")@@ -5028,11 +5173,20 @@ def _should_impose_after_update_attempt(ctx: AgentContext) -> bool:def _author_time_reject_reopens_synthesized_imposition(ctx: AgentContext) -> bool:latest = ctx.latest_recorded_build_test_outcome- return (+ if not (isinstance(latest, RecordedBuildTestOutcome)and latest.is_authoritativeand latest.phase == "author_time_reject"- and latest.reason_code in {"metadata_reject", "synthesized_parameter_binding_ambiguous"}+ ):+ return False+ if latest.reason_code in {"metadata_reject", "synthesized_parameter_binding_ambiguous"}:+ return True+ repair_context = ctx.last_code_authoring_repair_context+ # Ambiguous bare selectors are repaired by the same strict imposition path as metadata gaps.+ return (+ latest.reason_code == "code_safety_reject"+ and isinstance(repair_context, CodeAuthoringRepairContext)+ and repair_context.reason_code == "ambiguous_bare_selector")@@ -8118,27 +8272,35 @@ async def _update_workflow(and output_contract_evaluation.has_deficienciesand not output_contract_static_advisory_allowed):- payload = _record_output_contract_reject(- ctx,- output_contract_evaluation,- summary="Submitted workflow does not satisfy the requested output contract.",- authored_structural_fingerprint=_output_contract_structural_fingerprint(- workflow_yaml, output_contract_evaluation.canonical_signature- ),- workflow_yaml=workflow_yaml,+ authored_fingerprint = _output_contract_structural_fingerprint(+ workflow_yaml, output_contract_evaluation.canonical_signature)- reject_result = _output_contract_reject_result(+ if not _record_output_contract_ablation_event(+ ctx,output_contract_evaluation,- payload=payload,- tool_name="update_workflow",- )- return reject(- error=str(reject_result["error"]),- user_facing_summary=str(reject_result.get("user_facing_summary") or _compiled_authoring_user_summary()),- data=reject_result.get("data") if isinstance(reject_result.get("data"), dict) else None,- repair_context=output_contract_evaluation.repair_context,- record_repair_context_outcome=False,- )+ gate_id=_OUTPUT_CONTRACT_ABLATION_GATE_ID,+ blocked_tool="update_workflow",+ fingerprint=authored_fingerprint,+ ):+ payload = _record_output_contract_reject(+ ctx,+ output_contract_evaluation,+ summary="Submitted workflow does not satisfy the requested output contract.",+ authored_structural_fingerprint=authored_fingerprint,+ workflow_yaml=workflow_yaml,+ )+ reject_result = _output_contract_reject_result(+ output_contract_evaluation,+ payload=payload,+ tool_name="update_workflow",+ )+ return reject(+ error=str(reject_result["error"]),+ user_facing_summary=str(reject_result.get("user_facing_summary") or _compiled_authoring_user_summary()),+ data=reject_result.get("data") if isinstance(reject_result.get("data"), dict) else None,+ repair_context=output_contract_evaluation.repair_context,+ record_repair_context_outcome=False,+ )missing_metadata_error = _missing_code_artifact_metadata_error(workflow_yaml,ctx,diff --git a/skyvern/forge/sdk/core/aiohttp_helper.py b/skyvern/forge/sdk/core/aiohttp_helper.pyindex 790ffa563..8d1a96b75 100644--- a/skyvern/forge/sdk/core/aiohttp_helper.py+++ b/skyvern/forge/sdk/core/aiohttp_helper.py@@ -1,15 +1,124 @@import asyncio+import ipaddressimport os+import socketfrom typing import Any+from urllib.parse import urlparseimport aiofilesimport aiohttpimport structlog+from aiohttp.abc import AbstractResolver, ResolveResult+from aiohttp.resolver import DefaultResolver-from skyvern.exceptions import HttpException+from skyvern.exceptions import HttpException, InvalidUrl+from skyvern.utils.url_validators import (+ MAX_SAFE_REDIRECTS,+ SAFE_REDIRECT_STATUS_CODES,+ resolve_fetch_host_ips,+ validate_fetch_url_with_resolved_ips,+ validate_redirect_url_with_resolved_ips,+)LOG = structlog.get_logger()DEFAULT_REQUEST_TIMEOUT = 30+_REDIRECT_CREDENTIAL_HEADERS = {"authorization", "cookie"}+++def _url_origin(url: str) -> tuple[str, str, int | None]:+ parsed = urlparse(url)+ scheme = parsed.scheme.lower()+ port = parsed.port+ if port is None:+ port = 443 if scheme == "https" else 80 if scheme == "http" else None+ return scheme, (parsed.hostname or "").lower().rstrip("."), port+++def strip_cross_origin_redirect_credentials(+ headers: dict[str, str],+ cookies: dict[str, str] | None,+ current_url: str,+ next_url: str,+) -> tuple[dict[str, str], dict[str, str] | None]:+ if _url_origin(current_url) == _url_origin(next_url):+ return headers, cookies+ return {key: value for key, value in headers.items() if key.lower() not in _REDIRECT_CREDENTIAL_HEADERS}, None+++class SSRFGuardedResolver(AbstractResolver):+ def __init__(self) -> None:+ self._pinned_host_ips: dict[str, tuple[str, ...]] = {}+ self._trusted_proxy_hosts: set[str] = set()+ self._default_resolver = DefaultResolver()++ @staticmethod+ def _host_key(host: str) -> str:+ return host.strip().lower().rstrip(".")++ def pin_host_ips(self, host: str, ips: tuple[str, ...]) -> None:+ if not ips:+ raise OSError(f"No safe addresses resolved for host: {host}")+ self._pinned_host_ips[self._host_key(host)] = ips++ def pin_url_ips(self, url: str, ips: tuple[str, ...]) -> None:+ host = urlparse(url).hostname+ if not host:+ raise InvalidUrl(url=url)+ self.pin_host_ips(host, ips)++ def trust_proxy_url(self, proxy: str) -> None:+ host = urlparse(proxy).hostname+ if host:+ self._trusted_proxy_hosts.add(self._host_key(host))++ async def resolve(+ self, host: str, port: int = 0, family: socket.AddressFamily = socket.AF_UNSPEC+ ) -> list[ResolveResult]:+ results: list[ResolveResult] = []+ host_key = self._host_key(host)+ if host_key in self._trusted_proxy_hosts:+ return await self._default_resolver.resolve(host, port, family)++ ips = self._pinned_host_ips.get(host_key)+ resolved_ips = await asyncio.to_thread(resolve_fetch_host_ips, host) if ips is None else ips+ for ip in resolved_ips:+ ip_family = (+ socket.AF_INET6 if isinstance(ipaddress.ip_address(ip), ipaddress.IPv6Address) else socket.AF_INET+ )+ if family not in (socket.AF_UNSPEC, ip_family):+ continue+ results.append(+ {+ "hostname": host,+ "host": ip,+ "port": port,+ "family": ip_family,+ "proto": 0,+ "flags": 0,+ }+ )+ if not results:+ raise OSError(f"No safe addresses resolved for host: {host}")+ return results++ async def close(self) -> None:+ await self._default_resolver.close()+++async def validate_and_pin_fetch_url(url: str, resolver: SSRFGuardedResolver) -> str:+ validated_url, ips = await asyncio.to_thread(validate_fetch_url_with_resolved_ips, url)+ resolver.pin_url_ips(validated_url, ips)+ return validated_url+++async def validate_and_pin_redirect_url(url: str, location: str, resolver: SSRFGuardedResolver) -> str:+ validated_url, ips = await asyncio.to_thread(validate_redirect_url_with_resolved_ips, url, location)+ resolver.pin_url_ips(validated_url, ips)+ return validated_url+++def ssrf_guarded_tcp_connector(resolver: SSRFGuardedResolver | None = None) -> aiohttp.TCPConnector:+ return aiohttp.TCPConnector(resolver=resolver or SSRFGuardedResolver(), use_dns_cache=False)async def aiohttp_request(@@ -44,64 +153,86 @@ async def aiohttp_request(Tuple of (status_code, response_headers, response_body)where response_body can be dict (for JSON) or str (for text)"""- async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=timeout)) as session:- # Ensure headers is always a dict for type safety- headers_dict: dict[str, str] = headers or {}- request_kwargs: dict[str, Any] = {- "url": url,- "headers": headers_dict,- "cookies": cookies,- "proxy": proxy,- "allow_redirects": follow_redirects,- }-- # Handle body based on content type and method- if method.upper() != "GET":- # If files are provided, use multipart/form-data+ resolver = SSRFGuardedResolver()+ if proxy:+ resolver.trust_proxy_url(proxy)+ current_url = await validate_and_pin_fetch_url(url, resolver)+ request_method = method.upper()+ request_headers = dict(headers or {})+ request_cookies = cookies+ strip_body_headers = False++ async with aiohttp.ClientSession(+ timeout=aiohttp.ClientTimeout(total=timeout), connector=ssrf_guarded_tcp_connector(resolver)+ ) as session:++ async def build_request_kwargs() -> dict[str, Any]:+ headers_dict = dict(request_headers)+ if strip_body_headers:+ headers_dict.pop("Content-Length", None)+ headers_dict.pop("content-length", None)+ request_kwargs: dict[str, Any] = {+ "headers": headers_dict,+ "cookies": request_cookies,+ "proxy": proxy,+ "allow_redirects": False,+ }++ if request_method == "GET":+ return request_kwargs+if files:form = aiohttp.FormData()-- # Add files to formfor field_name, file_path in files.items():if not os.path.exists(file_path):raise FileNotFoundError(f"File not found: {file_path}")filename = os.path.basename(file_path)async with aiofiles.open(file_path, "rb") as f:- file_content = await f.read()- form.add_field(field_name, file_content, filename=filename)+ form.add_field(field_name, await f.read(), filename=filename)- # Add data fields to form if providedif data is not None and isinstance(data, dict):for key, value in data.items():form.add_field(key, str(value))request_kwargs["data"] = form- # Remove Content-Type header if present, let aiohttp set it for multipart- # headers_dict is already typed as dict[str, str] from initialization- if "Content-Type" in headers_dict:- del headers_dict["Content-Type"]- if "content-type" in headers_dict:- del headers_dict["content-type"]- # Explicit overrides first+ headers_dict.pop("Content-Type", None)+ headers_dict.pop("content-type", None)elif json_data is not None:request_kwargs["json"] = json_dataelif data is not None:content_type = headers_dict.get("Content-Type") or headers_dict.get("content-type") or ""- if "application/json" in content_type.lower():- request_kwargs["json"] = data- else:- request_kwargs["data"] = data+ request_kwargs["json" if "application/json" in content_type.lower() else "data"] = data+ return request_kwargs- async with session.request(method.upper(), **request_kwargs) as response:- response_headers = dict(response.headers)+ for _ in range(MAX_SAFE_REDIRECTS + 1):+ request_kwargs = await build_request_kwargs()+ request_kwargs["url"] = current_url+ async with session.request(request_method, **request_kwargs) as response:+ if (+ follow_redirects+ and response.status in SAFE_REDIRECT_STATUS_CODES+ and response.headers.get("Location")+ ):+ next_url = await validate_and_pin_redirect_url(current_url, response.headers["Location"], resolver)+ request_headers, request_cookies = strip_cross_origin_redirect_credentials(+ request_headers, request_cookies, current_url, next_url+ )+ current_url = next_url+ if response.status == 303 or (response.status in (301, 302) and request_method == "POST"):+ request_method = "GET"+ strip_body_headers = True+ continue- try:- response_body = await response.json()- except (aiohttp.ContentTypeError, Exception):- response_body = await response.text()+ response_headers = dict(response.headers)++ try:+ response_body = await response.json()+ except (aiohttp.ContentTypeError, Exception):+ response_body = await response.text()- return response.status, response_headers, response_body+ return response.status, response_headers, response_body+ raise HttpException(400, current_url, "Too many redirects while making HTTP request")async def aiohttp_get_json(diff --git a/skyvern/forge/sdk/routes/credentials.py b/skyvern/forge/sdk/routes/credentials.pyindex 36ab6e0ff..16bf09447 100644--- a/skyvern/forge/sdk/routes/credentials.py+++ b/skyvern/forge/sdk/routes/credentials.py@@ -40,6 +40,7 @@ import pyotpimport structlogfrom fastapi import BackgroundTasks, Body, Depends, Header, HTTPException, Path, Query, Responsefrom onepassword.client import Client as OnePasswordClient+from onepassword.errors import DesktopSessionExpiredException, RateLimitExceededExceptionfrom skyvern.config import settingsfrom skyvern.exceptions import HttpException as SkyvernHttpException@@ -115,6 +116,8 @@ from skyvern.forge.sdk.services.credential.credential_vault_service import Credefrom skyvern.forge.sdk.services.credentials import (AuthenticatorTotpErrorCode,AuthenticatorTotpParseResult,+ extract_onepassword_upstream_5xx_status,+ is_onepassword_credential_error,normalize_totp_config,parse_totp_config,)@@ -2323,14 +2326,72 @@ async def list_onepassword_items()return OnePasswordItemsResponse(configured=True, items=items)+ except asyncio.TimeoutError as e:+ LOG.warning(+ "Timed out while listing 1Password items",+ organization_id=current_org.organization_id,+ exc_info=True,+ )+ raise HTTPException(+ status_code=502,+ detail="1Password is temporarily unavailable. Please retry in a few minutes.",+ ) from e+ except RateLimitExceededException as e:+ LOG.warning(+ "1Password rate limit exceeded while listing items",+ organization_id=current_org.organization_id,+ error=str(e),+ )+ raise HTTPException(+ status_code=429,+ detail="1Password rate limit exceeded. Please retry in a few minutes.",+ ) from e+ except DesktopSessionExpiredException as e:+ LOG.warning(+ "1Password session expired while listing items",+ organization_id=current_org.organization_id,+ error=str(e),+ )+ raise HTTPException(+ status_code=400,+ detail=(+ "Your 1Password session appears to be expired. Please update your token in Settings and try again."+ ),+ ) from eexcept Exception as e:+ raw = str(e)+ # The 1Password SDK exposes these as plain string exceptions; credential+ # evidence takes precedence over embedded status text.+ if is_onepassword_credential_error(raw):+ LOG.warning(+ "Invalid 1Password service account token while listing items",+ organization_id=current_org.organization_id,+ error=raw,+ )+ raise HTTPException(+ status_code=400,+ detail=(+ "Your 1Password service account token appears to be invalid or expired. "+ "Please update it in Settings and try again."+ ),+ ) from e+ upstream_status = extract_onepassword_upstream_5xx_status(raw)+ if upstream_status is not None:+ LOG.warning(+ "1Password is temporarily unavailable while listing items",+ organization_id=current_org.organization_id,+ upstream_status=upstream_status,+ )+ raise HTTPException(+ status_code=502,+ detail="1Password is temporarily unavailable. Please retry in a few minutes.",+ ) from eLOG.error(- "Failed to list 1Password items",+ "Unexpected failure while listing 1Password items",organization_id=current_org.organization_id,- error=str(e),exc_info=True,)- raise HTTPException(status_code=502, detail="Failed to list 1Password items") from e+ raise HTTPException(status_code=500, detail="Failed to list 1Password items.") from e@base_router.get(diff --git a/skyvern/forge/sdk/services/credentials.py b/skyvern/forge/sdk/services/credentials.pyindex c51959a8e..e35a5c2be 100644--- a/skyvern/forge/sdk/services/credentials.py+++ b/skyvern/forge/sdk/services/credentials.py@@ -10,6 +10,39 @@ LOG = structlog.get_logger()_SECRET_QUERY_PATTERN = re.compile(r"(?i)(?:^|[?&])secret=([^&#]+)")+# 1Password's Python SDK forwards generic 5xx upstream failures as plain Exceptions+# whose stringified message embeds the HTTP status.+_ONEPASSWORD_UPSTREAM_5XX_PATTERN = re.compile(+ r"(?i)"+ r"(?:\b(?:HTTP|status(?:\s+code)?|code|response)\s*[:=]?\s*(5\d{2})\b)"+ r"|"+ r"(?:\b(5\d{2})\s+(?:service\s+unavailable|bad\s+gateway|gateway\s+timeout|internal\s+server\s+error)\b)"+)+_ONEPASSWORD_CREDENTIAL_ERROR_PATTERN = re.compile(+ r"(?i)"+ r"(?:\b(?:unauthorized|forbidden|not\s+authenticated|authentication\s+failed)\b)"+ r"|"+ r"(?:\b(?:invalid|expired|malformed|parse(?:d)?)\b.{0,48}\b(?:token|credential|service\s+account)\b)"+ r"|"+ r"(?:\b(?:token|credential|service\s+account)\b.{0,48}\b(?:invalid|expired|malformed|not\s+valid|parse(?:d)?)\b)"+)+++def extract_onepassword_upstream_5xx_status(message: str) -> int | None:+ """Return the upstream 5xx HTTP status embedded in a 1Password SDK error message, if any.++ A match means the failure originated on 1Password's side.+ """+ match = _ONEPASSWORD_UPSTREAM_5XX_PATTERN.search(message)+ if not match:+ return None+ status_digits = match.group(1) or match.group(2)+ return int(status_digits) if status_digits else None+++def is_onepassword_credential_error(message: str) -> bool:+ return bool(_ONEPASSWORD_CREDENTIAL_ERROR_PATTERN.search(message))+class OnePasswordConstants(StrEnum):"""Constants for 1Password integration."""diff --git a/skyvern/forge/sdk/services/org_auth_service.py b/skyvern/forge/sdk/services/org_auth_service.pyindex 03b49a8d1..97d2d3235 100644--- a/skyvern/forge/sdk/services/org_auth_service.py+++ b/skyvern/forge/sdk/services/org_auth_service.py@@ -364,7 +364,8 @@ async def resolve_org_from_api_key(else:normalized_api_key, normalization_flags = _normalize_api_key_with_flags(x_api_key)api_key_debug_fields = _get_api_key_debug_fields(x_api_key, normalized_api_key, normalization_flags)- LOG.error(+ # Malformed client key rejected with 403 — a client error, not a server fault.+ LOG.warning("Error decoding JWT",error_type=type(exc).__name__,error_reason=_get_safe_auth_error_reason(exc),diff --git a/skyvern/forge/sdk/workflow/context_manager.py b/skyvern/forge/sdk/workflow/context_manager.pyindex e73c41d4b..d6224af72 100644--- a/skyvern/forge/sdk/workflow/context_manager.py+++ b/skyvern/forge/sdk/workflow/context_manager.py@@ -32,7 +32,12 @@ from skyvern.forge.sdk.schemas.credentials import CredentialVaultType, PasswordCfrom skyvern.forge.sdk.schemas.organizations import Organizationfrom skyvern.forge.sdk.schemas.tasks import TaskStatusfrom skyvern.forge.sdk.services.bitwarden import BitwardenConstants, BitwardenService-from skyvern.forge.sdk.services.credentials import AzureVaultConstants, OnePasswordConstants, normalize_totp_config+from skyvern.forge.sdk.services.credentials import (+ AzureVaultConstants,+ OnePasswordConstants,+ extract_onepassword_upstream_5xx_status,+ normalize_totp_config,+)from skyvern.forge.sdk.workflow.credential_selection import select_credential_for_runfrom skyvern.forge.sdk.workflow.exceptions import MissingJinjaVariables, OutputParameterKeyCollisionErrorfrom skyvern.forge.sdk.workflow.models.parameter import (@@ -76,14 +81,6 @@ _CREDENTIAL_PARAMETER_TYPES: tuple[type, ...] = (OnePasswordCredentialParameter,)-# 1Password's Python SDK forwards generic 5xx upstream failures as plain Exceptions-# whose stringified message embeds the HTTP status.-_ONEPASSWORD_5XX_PATTERN = re.compile(- r"(?i)"- r"(?:\b(?:HTTP|status(?:\s+code)?|code|response)\s*[:=]?\s*(5\d{2})\b)"- r"|"- r"(?:\b(5\d{2})\s+(?:service\s+unavailable|bad\s+gateway|gateway\s+timeout|internal\s+server\s+error)\b)"-)_SECRET_FIELD_KEY_PATTERN = re.compile(r"[^A-Za-z0-9_]+")@@ -822,11 +819,10 @@ class WorkflowRunContext:raise OnePasswordSessionExpiredError(f"{str(e)} {lookup_context}") from eexcept Exception as e:raw = str(e)- match = _ONEPASSWORD_5XX_PATTERN.search(raw)- if match:- status_digits = match.group(1) or match.group(2)+ upstream_status = extract_onepassword_upstream_5xx_status(raw)+ if upstream_status is not None:raise OnePasswordServiceUnavailableError(- status_code=int(status_digits),+ status_code=upstream_status,lookup_context=lookup_context,) from eraise OnePasswordGetItemError(f"{raw} {lookup_context}") from ediff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.pyindex 901a0517b..5d12dc718 100644--- a/skyvern/forge/sdk/workflow/service.py+++ b/skyvern/forge/sdk/workflow/service.py@@ -4388,7 +4388,8 @@ class WorkflowService:workflow_run = await self.mark_workflow_run_as_canceled(workflow_run_id=workflow_run_id)return workflow_run, Trueif block_result.status == BlockStatus.failed:- LOG.error(+ # Run-level outcome, recorded as the run's failure_reason below; not a platform fault.+ LOG.warning(f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} failed for workflow run {workflow_run_id}",block_type=block.block_type,workflow_run_id=workflow_run_id,diff --git a/skyvern/services/task_v2_service.py b/skyvern/services/task_v2_service.pyindex f1c3b3035..5002782de 100644--- a/skyvern/services/task_v2_service.py+++ b/skyvern/services/task_v2_service.py@@ -1372,7 +1372,8 @@ async def handle_block_result()elif block_result.status == BlockStatus.failed:- LOG.error(+ # Run-level outcome, surfaced via the run's failure handling below; not a platform fault.+ LOG.warning(f"Block with type {block.block_type} failed for workflow run {workflow_run_id}",block_type=block.block_type,workflow_run_id=workflow_run.workflow_run_id,diff --git a/skyvern/utils/url_validators.py b/skyvern/utils/url_validators.pyindex 7db2a565a..8cf15e26c 100644--- a/skyvern/utils/url_validators.py+++ b/skyvern/utils/url_validators.py@@ -1,12 +1,19 @@import ipaddress+import socketfrom http import HTTPStatus-from urllib.parse import quote, urlparse, urlsplit, urlunsplit+from urllib.parse import quote, urljoin, urlparse, urlsplit, urlunsplitfrom pydantic import HttpUrl, ValidationErrorfrom skyvern.config import settingsfrom skyvern.exceptions import BlockedHost, InvalidUrl, SkyvernHTTPException+SAFE_REDIRECT_STATUS_CODES = {301, 302, 303, 307, 308}+MAX_SAFE_REDIRECTS = 10++_BLOCKED_INTERNAL_HOSTNAMES = frozenset({"localhost", "metadata.google.internal", "kubernetes.default.svc"})+_BLOCKED_INTERNAL_SUFFIXES = (".local", ".localhost", ".internal", ".cluster.local")+def strip_query_params(url: str) -> str:"""Return scheme://host/path with query string, fragment, and userinfo removed.@@ -65,32 +72,146 @@ def prepend_scheme_and_validate_url(url: str) -> str:return url-def is_blocked_host(host: str) -> bool:+def _normalize_host(host: str) -> str:# RFC 3986 wraps IPv6 literals in [...]; ip_address() only accepts the bare form.- bare = host[1:-1] if host.startswith("[") and host.endswith("]") else host+ return (host[1:-1] if host.startswith("[") and host.endswith("]") else host).strip().lower().rstrip(".")+++def _normalize_ip(ip: ipaddress.IPv4Address | ipaddress.IPv6Address) -> ipaddress.IPv4Address | ipaddress.IPv6Address:+ if isinstance(ip, ipaddress.IPv6Address) and ip.ipv4_mapped is not None:+ return ip.ipv4_mapped+ return ip+++def _is_blocked_ip(ip: ipaddress.IPv4Address | ipaddress.IPv6Address) -> bool:+ ip = _normalize_ip(ip)+ return bool(+ ip.is_private or ip.is_link_local or ip.is_loopback or ip.is_reserved or ip.is_multicast or ip.is_unspecified+ )+++def _is_allowed_host(host: str) -> bool:+ normalized = _normalize_host(host)ip: ipaddress.IPv4Address | ipaddress.IPv6Address | Nonetry:- ip = ipaddress.ip_address(bare)- if isinstance(ip, ipaddress.IPv6Address) and ip.ipv4_mapped is not None:- ip = ip.ipv4_mapped+ ip = _normalize_ip(ipaddress.ip_address(normalized))except ValueError:ip = Noneexcept Exception:return False- candidate_forms = {host.lower(), bare.lower()}+ candidate_forms = {host.lower(), normalized}if ip is not None:candidate_forms.add(str(ip).lower())allowed = {h.lower() for h in settings.ALLOWED_HOSTS}- if candidate_forms & allowed:+ return bool(candidate_forms & allowed)+++def _is_internal_hostname(host: str) -> bool:+ normalized = _normalize_host(host)+ if normalized in _BLOCKED_INTERNAL_HOSTNAMES:+ return True+ if normalized.endswith(_BLOCKED_INTERNAL_SUFFIXES):+ return True+ return normalized.endswith(".svc")+++def is_blocked_host(host: str, *, resolve_dns: bool = False) -> bool:+ normalized = _normalize_host(host)+ if not normalized:+ return True++ if _is_allowed_host(host):+ return False++ blocked = {b.lower().rstrip(".") for b in settings.BLOCKED_HOSTS}+ if normalized in blocked or _is_internal_hostname(normalized):+ return True++ ip: ipaddress.IPv4Address | ipaddress.IPv6Address | None+ try:+ ip = ipaddress.ip_address(normalized)+ except ValueError:+ ip = None+ except Exception:+ return True++ if ip is not None:+ return _is_blocked_ip(ip)++ if not resolve_dns:return False+ try:+ infos = socket.getaddrinfo(normalized, None, type=socket.SOCK_STREAM)+ except OSError:+ return True++ resolved_any = False+ for info in infos:+ sockaddr = info[4]+ ip_str = sockaddr[0] if sockaddr else None+ if not ip_str:+ continue+ try:+ resolved_ip = ipaddress.ip_address(ip_str)+ except ValueError:+ continue+ resolved_any = True+ if _is_blocked_ip(resolved_ip):+ return True+ return not resolved_any+++def resolve_fetch_host_ips(host: str) -> tuple[str, ...]:+ normalized = _normalize_host(host)+ if not normalized:+ raise BlockedHost(host=host)++ allowed = _is_allowed_host(host)+ if not allowed and (normalized in {b.lower().rstrip(".") for b in settings.BLOCKED_HOSTS}):+ raise BlockedHost(host=host)+ if not allowed and _is_internal_hostname(normalized):+ raise BlockedHost(host=host)++ try:+ ip = ipaddress.ip_address(normalized)+ except ValueError:+ ip = None+ except Exception:+ raise BlockedHost(host=host)+if ip is not None:- return ip.is_private or ip.is_link_local or ip.is_loopback or ip.is_reserved+ normalized_ip = _normalize_ip(ip)+ if not allowed and _is_blocked_ip(normalized_ip):+ raise BlockedHost(host=host)+ return (str(normalized_ip),)- blocked = {b.lower() for b in settings.BLOCKED_HOSTS}- return host.lower() in blocked+ try:+ infos = socket.getaddrinfo(normalized, None, type=socket.SOCK_STREAM)+ except OSError:+ raise BlockedHost(host=host)++ resolved_ips: list[str] = []+ for info in infos:+ sockaddr = info[4]+ ip_str = sockaddr[0] if sockaddr else None+ if not ip_str:+ continue+ try:+ resolved_ip = _normalize_ip(ipaddress.ip_address(ip_str))+ except ValueError:+ continue+ if not allowed and _is_blocked_ip(resolved_ip):+ raise BlockedHost(host=host)+ resolved_ip_str = str(resolved_ip)+ if resolved_ip_str not in resolved_ips:+ resolved_ips.append(resolved_ip_str)++ if not resolved_ips:+ raise BlockedHost(host=host)+ return tuple(resolved_ips)def validate_url(url: str) -> str | None:@@ -109,6 +230,30 @@ def validate_url(url: str) -> str | None:return str(v)+def validate_fetch_url_with_resolved_ips(url: str) -> tuple[str, tuple[str, ...]]:+ try:+ url = prepend_scheme_and_validate_url(url=url)+ v = HttpUrl(url=url)+ except Exception as e:+ raise SkyvernHTTPException(message=str(e), status_code=HTTPStatus.BAD_REQUEST)++ if not v.host:+ raise InvalidUrl(url=url)+ return str(v), resolve_fetch_host_ips(v.host)+++def validate_fetch_url(url: str) -> str:+ return validate_fetch_url_with_resolved_ips(url)[0]+++def validate_redirect_url_with_resolved_ips(url: str, location: str) -> tuple[str, tuple[str, ...]]:+ return validate_fetch_url_with_resolved_ips(urljoin(url, location))+++def validate_redirect_url(url: str, location: str) -> str:+ return validate_redirect_url_with_resolved_ips(url, location)[0]++def encode_url(url: str) -> str:parts = list(urlsplit(url))# Encode the path while preserving "/" and "%"diff --git a/skyvern/webeye/actions/handler.py b/skyvern/webeye/actions/handler.pyindex 730683a47..7438c5957 100644--- a/skyvern/webeye/actions/handler.py+++ b/skyvern/webeye/actions/handler.py@@ -61,6 +61,7 @@ from skyvern.exceptions import (NoSuitableAutoCompleteOption,OptionIndexOutOfBound,PhoneNumberInputMismatch,+ SkyvernException,)from skyvern.experimentation.wait_utils import get_or_create_wait_config, get_wait_timefrom skyvern.forge import app@@ -3748,6 +3749,12 @@ async def handle_select_option_action(return resultssuggested_value = result.value+ except SkyvernException as e:+ # Expected selection outcomes on non-standard dropdowns (no matching option,+ # no incremental elements); recorded as ActionFailure like any other miss.+ LOG.warning("Custom select error", exc_info=True)+ results.append(ActionFailure(exception=e))+ return resultsexcept Exception as e:LOG.exception("Custom select error")results.append(ActionFailure(exception=e))diff --git a/skyvern/webeye/actions/handler_utils.py b/skyvern/webeye/actions/handler_utils.pyindex 96ed79194..466eb9efd 100644--- a/skyvern/webeye/actions/handler_utils.py+++ b/skyvern/webeye/actions/handler_utils.py@@ -27,10 +27,12 @@ async def download_file(try:return await download_file_api(file_url, organization_id=organization_id)except Exception:- LOG.exception(+ # Fully self-recovering: the action proceeds without the file.+ LOG.warning("Failed to download file, continuing without it",action=action,file_url=file_url,+ exc_info=True,)return []diff --git a/tests/unit/test_aiohttp_helper.py b/tests/unit/test_aiohttp_helper.pyindex fddfa1699..54d74c4d9 100644--- a/tests/unit/test_aiohttp_helper.py+++ b/tests/unit/test_aiohttp_helper.py@@ -1,4 +1,5 @@import os+import socketimport tempfilefrom typing import Anyfrom unittest.mock import AsyncMock, MagicMock, patch@@ -6,7 +7,89 @@ from unittest.mock import AsyncMock, MagicMock, patchimport aiohttpimport pytest-from skyvern.forge.sdk.core.aiohttp_helper import aiohttp_request+from skyvern.exceptions import BlockedHost, HttpException+from skyvern.forge.sdk.core.aiohttp_helper import SSRFGuardedResolver, aiohttp_request+from skyvern.utils.url_validators import MAX_SAFE_REDIRECTS, validate_fetch_url++[email protected](autouse=True)+def public_dns(monkeypatch: pytest.MonkeyPatch) -> None:+ def resolves_public(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ return [(socket.AF_INET, socket.SOCK_STREAM, 0, "", ("93.184.216.34", port or 0))]++ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", resolves_public)+++async def test_ssrf_guarded_resolver_blocks_dns_rebind_after_validation(monkeypatch: pytest.MonkeyPatch) -> None:+ dns_answers = iter(+ [+ [(socket.AF_INET, socket.SOCK_STREAM, 0, "", ("93.184.216.34", 0))],+ [(socket.AF_INET, socket.SOCK_STREAM, 0, "", ("169.254.169.254", 0))],+ ]+ )++ def rebinding_dns(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ return next(dns_answers)++ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", rebinding_dns)++ assert validate_fetch_url("https://rebind.example.test/file.pdf") is not None+ with pytest.raises(BlockedHost):+ await SSRFGuardedResolver().resolve("rebind.example.test", 443)+++async def test_ssrf_guarded_resolver_uses_pinned_ips_without_resolving(monkeypatch: pytest.MonkeyPatch) -> None:+ def unexpected_dns(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ raise AssertionError("pinned host should not be re-resolved")++ resolver = SSRFGuardedResolver()+ resolver.pin_url_ips("https://rebind.example.test/file.pdf", ("93.184.216.34",))+ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", unexpected_dns)++ results = await resolver.resolve("rebind.example.test", 443)++ assert [result["host"] for result in results] == ["93.184.216.34"]+++async def test_aiohttp_request_trusts_internal_proxy_without_trusting_target() -> None:+ captured_resolver: SSRFGuardedResolver | None = None++ def capture_connector(resolver: SSRFGuardedResolver | None = None) -> object:+ nonlocal captured_resolver+ captured_resolver = resolver+ return object()++ mock_response = AsyncMock()+ mock_response.status = 200+ mock_response.headers = {"Content-Type": "application/json"}+ mock_response.json = AsyncMock(return_value={"success": True})+ mock_response.text = AsyncMock(return_value='{"success": true}')+ mock_response.__aenter__ = AsyncMock(return_value=mock_response)+ mock_response.__aexit__ = AsyncMock(return_value=None)++ mock_session = MagicMock()+ mock_session.__aenter__ = AsyncMock(return_value=mock_session)+ mock_session.__aexit__ = AsyncMock(return_value=None)+ mock_session.request = MagicMock(return_value=mock_response)++ with (+ patch("skyvern.forge.sdk.core.aiohttp_helper.ssrf_guarded_tcp_connector", side_effect=capture_connector),+ patch("skyvern.forge.sdk.core.aiohttp_helper.aiohttp.ClientSession", return_value=mock_session),+ ):+ await aiohttp_request(+ method="GET",+ url="https://example.com/api",+ proxy="http://127.0.0.1:8080",+ )++ assert captured_resolver is not None+ proxy_results = await captured_resolver.resolve("127.0.0.1", 8080)+ assert proxy_results+ with pytest.raises(BlockedHost):+ await SSRFGuardedResolver().resolve("127.0.0.1", 8080)@pytest.mark.asyncio@@ -543,7 +626,7 @@ async def test_aiohttp_request_response_headers_dict() -> None:@pytest.mark.asyncioasync def test_aiohttp_request_follow_redirects() -> None:- """Test that follow_redirects parameter is passed correctly"""+ """Test that redirects are handled manually for SSRF validation."""captured_args: list[Any] = []captured_request_kwargs: dict[str, Any] = {}@@ -573,10 +656,202 @@ async def test_aiohttp_request_follow_redirects() -> None:follow_redirects=False,)- # Verify allow_redirects parameter was set correctly+ # aiohttp automatic redirects stay disabled so each Location target is SSRF-checked first.assert captured_request_kwargs["allow_redirects"] is False+async def test_aiohttp_request_follows_safe_redirect() -> None:+ redirect_response = AsyncMock()+ redirect_response.status = 302+ redirect_response.headers = {"Location": "https://example.com/final"}+ redirect_response.__aenter__ = AsyncMock(return_value=redirect_response)+ redirect_response.__aexit__ = AsyncMock(return_value=None)++ final_response = AsyncMock()+ final_response.status = 200+ final_response.headers = {"Content-Type": "application/json"}+ final_response.json = AsyncMock(return_value={"success": True})+ final_response.text = AsyncMock(return_value='{"success": true}')+ final_response.__aenter__ = AsyncMock(return_value=final_response)+ final_response.__aexit__ = AsyncMock(return_value=None)++ responses = [redirect_response, final_response]+ requested_urls: list[str] = []++ def capture_request(*args: Any, **kwargs: Any) -> AsyncMock:+ requested_urls.append(kwargs["url"])+ return responses.pop(0)++ mock_session = MagicMock()+ mock_session.__aenter__ = AsyncMock(return_value=mock_session)+ mock_session.__aexit__ = AsyncMock(return_value=None)+ mock_session.request = MagicMock(side_effect=capture_request)++ with patch("skyvern.forge.sdk.core.aiohttp_helper.aiohttp.ClientSession", return_value=mock_session):+ status, _headers, body = await aiohttp_request(+ method="GET",+ url="https://example.com/start",+ follow_redirects=True,+ )++ assert status == 200+ assert body == {"success": True}+ assert requested_urls == ["https://example.com/start", "https://example.com/final"]+++async def test_aiohttp_request_strips_credentials_on_cross_origin_redirect() -> None:+ redirect_response = AsyncMock()+ redirect_response.status = 302+ redirect_response.headers = {"Location": "https://other.example.com/final"}+ redirect_response.__aenter__ = AsyncMock(return_value=redirect_response)+ redirect_response.__aexit__ = AsyncMock(return_value=None)++ final_response = AsyncMock()+ final_response.status = 200+ final_response.headers = {"Content-Type": "application/json"}+ final_response.json = AsyncMock(return_value={"success": True})+ final_response.text = AsyncMock(return_value='{"success": true}')+ final_response.__aenter__ = AsyncMock(return_value=final_response)+ final_response.__aexit__ = AsyncMock(return_value=None)++ responses = [redirect_response, final_response]+ requested_headers: list[dict[str, str]] = []+ requested_cookies: list[dict[str, str] | None] = []++ def capture_request(*args: Any, **kwargs: Any) -> AsyncMock:+ requested_headers.append(kwargs["headers"])+ requested_cookies.append(kwargs["cookies"])+ return responses.pop(0)++ mock_session = MagicMock()+ mock_session.__aenter__ = AsyncMock(return_value=mock_session)+ mock_session.__aexit__ = AsyncMock(return_value=None)+ mock_session.request = MagicMock(side_effect=capture_request)++ with patch("skyvern.forge.sdk.core.aiohttp_helper.aiohttp.ClientSession", return_value=mock_session):+ await aiohttp_request(+ method="GET",+ url="https://example.com/start",+ headers={"Authorization": "Bearer secret", "Cookie": "sid=abc", "X-Keep": "1"},+ cookies={"session": "abc"},+ follow_redirects=True,+ )++ assert requested_headers[0]["Authorization"] == "Bearer secret"+ assert requested_headers[0]["Cookie"] == "sid=abc"+ assert requested_cookies[0] == {"session": "abc"}+ assert requested_headers[1] == {"X-Keep": "1"}+ assert requested_cookies[1] is None+++async def test_aiohttp_request_rebuilds_multipart_for_307_redirect() -> None:+ with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as tmp_file:+ tmp_file.write("test file content")+ tmp_file_path = tmp_file.name++ try:+ redirect_response = AsyncMock()+ redirect_response.status = 307+ redirect_response.headers = {"Location": "https://example.com/final"}+ redirect_response.__aenter__ = AsyncMock(return_value=redirect_response)+ redirect_response.__aexit__ = AsyncMock(return_value=None)++ final_response = AsyncMock()+ final_response.status = 200+ final_response.headers = {"Content-Type": "application/json"}+ final_response.json = AsyncMock(return_value={"success": True})+ final_response.text = AsyncMock(return_value='{"success": true}')+ final_response.__aenter__ = AsyncMock(return_value=final_response)+ final_response.__aexit__ = AsyncMock(return_value=None)++ responses = [redirect_response, final_response]+ multipart_bodies: list[aiohttp.FormData] = []++ def capture_request(*args: Any, **kwargs: Any) -> AsyncMock:+ multipart_bodies.append(kwargs["data"])+ return responses.pop(0)++ mock_session = MagicMock()+ mock_session.__aenter__ = AsyncMock(return_value=mock_session)+ mock_session.__aexit__ = AsyncMock(return_value=None)+ mock_session.request = MagicMock(side_effect=capture_request)++ with patch("skyvern.forge.sdk.core.aiohttp_helper.aiohttp.ClientSession", return_value=mock_session):+ status, _headers, body = await aiohttp_request(+ method="POST",+ url="https://example.com/start",+ files={"file": tmp_file_path},+ follow_redirects=True,+ )++ assert status == 200+ assert body == {"success": True}+ assert len(multipart_bodies) == 2+ assert multipart_bodies[0] is not multipart_bodies[1]+ finally:+ if os.path.exists(tmp_file_path):+ os.unlink(tmp_file_path)+++async def test_aiohttp_request_rejects_unsafe_redirect_target() -> None:+ redirect_response = AsyncMock()+ redirect_response.status = 302+ redirect_response.headers = {"Location": "http://169.254.169.254/latest/meta-data"}+ redirect_response.__aenter__ = AsyncMock(return_value=redirect_response)+ redirect_response.__aexit__ = AsyncMock(return_value=None)++ requested_urls: list[str] = []++ def capture_request(*args: Any, **kwargs: Any) -> AsyncMock:+ requested_urls.append(kwargs["url"])+ return redirect_response++ mock_session = MagicMock()+ mock_session.__aenter__ = AsyncMock(return_value=mock_session)+ mock_session.__aexit__ = AsyncMock(return_value=None)+ mock_session.request = MagicMock(side_effect=capture_request)++ with patch("skyvern.forge.sdk.core.aiohttp_helper.aiohttp.ClientSession", return_value=mock_session):+ with pytest.raises(BlockedHost):+ await aiohttp_request(+ method="GET",+ url="https://example.com/start",+ follow_redirects=True,+ )++ assert requested_urls == ["https://example.com/start"]+++async def test_aiohttp_request_redirect_limit_raises_http_exception() -> None:+ redirect_response = AsyncMock()+ redirect_response.status = 302+ redirect_response.headers = {"Location": "https://example.com/next"}+ redirect_response.__aenter__ = AsyncMock(return_value=redirect_response)+ redirect_response.__aexit__ = AsyncMock(return_value=None)++ mock_session = MagicMock()+ mock_session.__aenter__ = AsyncMock(return_value=mock_session)+ mock_session.__aexit__ = AsyncMock(return_value=None)+ mock_session.request = MagicMock(return_value=redirect_response)++ with patch("skyvern.forge.sdk.core.aiohttp_helper.aiohttp.ClientSession", return_value=mock_session):+ with pytest.raises(HttpException) as exc_info:+ await aiohttp_request(+ method="GET",+ url="https://example.com/start",+ follow_redirects=True,+ )++ assert exc_info.value.status_code == 400+ assert "Too many redirects" in (exc_info.value.error_message or "")+ assert mock_session.request.call_count == MAX_SAFE_REDIRECTS + 1++@pytest.mark.asyncioasync def test_aiohttp_request_proxy_passed_correctly() -> None:"""Test that proxy parameter is passed correctly"""@@ -646,10 +921,12 @@ async def test_aiohttp_request_with_files_uses_multipart() -> None:mock_session.__aexit__ = AsyncMock(return_value=None)mock_session.request = MagicMock(side_effect=capture_request)+ headers = {"Content-Type": "multipart/form-data", "X-Test": "value"}with patch("skyvern.forge.sdk.core.aiohttp_helper.aiohttp.ClientSession", return_value=mock_session):await aiohttp_request(method="POST",url="https://example.com/api/upload",+ headers=headers,files={"file": tmp_file_path},)@@ -660,6 +937,7 @@ async def test_aiohttp_request_with_files_uses_multipart() -> None:# Verify Content-Type header was removed (aiohttp will set it for multipart)assert "Content-Type" not in captured_request_kwargs["headers"]assert "content-type" not in captured_request_kwargs["headers"]+ assert headers == {"Content-Type": "multipart/form-data", "X-Test": "value"}finally:# Clean up temporary fileif os.path.exists(tmp_file_path):diff --git a/tests/unit/test_copilot_code_block_persist_seam.py b/tests/unit/test_copilot_code_block_persist_seam.pyindex c242d4d96..e6dbea27f 100644--- a/tests/unit/test_copilot_code_block_persist_seam.py+++ b/tests/unit/test_copilot_code_block_persist_seam.py@@ -24,6 +24,7 @@ from skyvern.forge.sdk.copilot.build_test_outcome import (BuildTestOutcomeReasonCode,RecordedBuildTestOutcome,RecordedOutcomeBindingConstraint,+ authored_block_signatures_from_workflow,authored_structure_signature_from_workflow,latest_recorded_build_test_outcome_repeated,recorded_outcome_from_author_time_reject,@@ -2979,6 +2980,69 @@ class TestCodeRepairProgressClassification:assert run_eval.payload["static_return_advisory_paths"] == ["output.record_id"]assert run_eval.can_attempt_run is True+ def test_complete_metadata_without_code_return_is_run_preflight_advisory(self) -> None:+ ctx = _code_only_ctx()+ required_paths = {"output.account_number", "output.confirmation_number"}+ ctx.request_policy = RequestPolicy(+ completion_criteria=[+ SimpleNamespace(+ id="requested_account",+ output_path="output.account_number",+ level="run",+ method_mandated=False,+ kind="outcome",+ ),+ SimpleNamespace(+ id="requested_confirmation",+ output_path="output.confirmation_number",+ level="run",+ method_mandated=False,+ kind="outcome",+ ),+ ]+ )+ schema = workflow_update_module._schema_template_text_for_required_paths(required_paths)+ metadata = [+ {+ "block_label": "submit_service_request",+ "claimed_outcomes": [{"goal_value_paths": sorted(required_paths), "extraction_schema": schema}],+ "terminal_verifier_expectations": [+ {"goal_value_paths": sorted(required_paths), "extraction_schema": schema}+ ],+ }+ ]+ workflow_yaml = _yaml(+ """+ title: Service request+ workflow_definition:+ blocks:+ - block_type: code+ label: submit_service_request+ code: |+ await page.get_by_role("button", name="Submit").click()+ """+ )+ signature = workflow_update_module._output_contract_signature(+ ctx=ctx,+ workflow_yaml=workflow_yaml,+ source="requested_output_contract",+ reason_code="requested_output_contract_missing_output_coverage",+ required_paths=required_paths,+ )+ ctx.output_contract_reject_count_by_signature = {signature: 2}++ evaluation = workflow_update_module._evaluate_output_contract_for_code_block(+ ctx, workflow_yaml, metadata, allow_static_return_advisory=True+ )+ result = workflow_update_module._metadata_contract_run_preflight_reject(ctx, workflow_yaml, metadata)++ assert evaluation is not None+ assert evaluation.can_attempt_run is True+ assert evaluation.missing_return_paths == []+ assert evaluation.payload["static_return_advisory_paths"] == sorted(required_paths)+ assert evaluation.payload["post_steering_static_return_advisory"] is True+ assert result is None+@pytest.mark.asyncioasync def test_save_only_update_rejects_post_steering_static_return_gap(self, monkeypatch: pytest.MonkeyPatch@@ -3797,6 +3861,79 @@ class TestCodeRepairProgressClassification:)assert sanitized["data"]["metadata_repair_contract"] == result["data"]["metadata_repair_contract"]+ def test_metadata_contract_run_preflight_preserves_run_backed_convergence_terminal(self) -> None:+ ctx = _code_only_ctx()+ ctx.request_policy = RequestPolicy(+ completion_criteria=[+ SimpleNamespace(+ id="requested_account",+ output_path="output.account_number",+ level="run",+ method_mandated=False,+ kind="outcome",+ )+ ]+ )+ workflow_yaml = _yaml(+ """+ title: Service request+ workflow_definition:+ blocks:+ - block_type: code+ label: submit_service_request+ code: |+ await page.get_by_role("button", name="Submit").click()+ """+ )+ metadata = [+ {+ "artifact_id": "code_artifact:submit_service_request",+ "block_label": "submit_service_request",+ "claimed_outcomes": [+ {+ "goal_value_paths": ["output.account_number"],+ "extraction_schema": (+ '{"type":"object","properties":{"output":{"type":"object","properties":'+ '{"account_number":{}}}}}'+ ),+ }+ ],+ }+ ]+ ctx.latest_recorded_build_test_outcome = RecordedBuildTestOutcome(+ phase="persisted_block_run",+ attempted_tool="update_and_run_blocks",+ verdict="repairable_failure",+ reason_code="outcome_not_demonstrated",+ workflow_run_id="wr_recorded",+ block_labels=["submit_service_request"],+ structural_failure_identity="completion:typed-output",+ authored_structure_signature="previous-authoring-signature",+ )+ recorded_sig = authored_block_signatures_from_workflow(workflow_yaml, metadata)["submit_service_request"]+ ctx.recorded_outcome_binding_constraint = RecordedOutcomeBindingConstraint(+ repeated_structural_key=ctx.latest_recorded_build_test_outcome.structural_key or "",+ phase="persisted_block_run",+ reason_code="outcome_not_demonstrated",+ frontier_facet="value_shape",+ owning_block_labels=["submit_service_request"],+ diagnostic_reason="empty_page",+ workflow_run_id="wr_recorded",+ recorded_block_signatures={"submit_service_request": recorded_sig},+ )++ result = workflow_update_module._metadata_contract_run_preflight_reject(ctx, workflow_yaml, metadata)++ assert result is not None+ assert result["ok"] is False+ assert "frontier" in result["error"]+ assert ctx.turn_halt is not None+ assert ctx.turn_halt.kind is TurnHaltKind.REPAIR_CEILING_REACHED+ outcome = ctx.latest_recorded_build_test_outcome+ assert outcome is not None+ assert outcome.reason_code == "unchanged_after_recorded_outcome"+ assert outcome.workflow_run_id is None+def test_metadata_contract_run_preflight_budget_remains_repair_before_run(self) -> None:ctx = _code_only_ctx()ctx.turn_id = "preflight-no-run-contract"@@ -5931,7 +6068,7 @@ class TestSeparatedSpineViolationActuation:assert ctx.turn_halt is Noneassert len(ctx.output_contract_spine_directive_blockers_by_attempt_key) == 1- def test_granted_advisory_arms_run_evidence_before_consume_when_run_attemptable(+ def test_granted_advisory_arms_run_evidence_without_preflight_consume_when_run_attemptable(self, monkeypatch: pytest.MonkeyPatch) -> None:ctx = _spine_actuation_ctx()@@ -5975,7 +6112,7 @@ class TestSeparatedSpineViolationActuation:assert result is Noneassert ctx.output_contract_pending_run_evidence.get(signature) == ["output.confirmation_number"]- assert ctx.output_contract_actuation_by_signature[signature] == OutputContractAdvisoryState.CONSUMED+ assert ctx.output_contract_actuation_by_signature[signature] == OutputContractAdvisoryState.GRANTEDrun_result = {"data": {"blocks": [{"label": "extract_record", "extracted_data": {"confirmation_number": "R-9"}}]}@@ -10805,6 +10942,23 @@ class TestWholeTrajectoryImposition:assert repair["unresolved_names"] == ["provider_name"]assert ctx.workflow_yaml == _SUBMITTED_LITERAL_YAML+ def test_author_ambiguous_selector_reject_reopens_strict_imposition_with_typed_repair_context(self) -> None:+ ctx = _resale_ctx()+ ctx.update_workflow_called = True+ ctx.latest_recorded_build_test_outcome = _author_time_reject_outcome("code_safety_reject")+ ctx.last_code_authoring_repair_context = CodeAuthoringRepairContext(+ block_label="order_status",+ reason_code="ambiguous_bare_selector",+ selector="button",+ )++ result = workflow_update_module._maybe_impose_synthesized_code_block(_resale_submitted_yaml(), ctx)++ assert result.violations == []+ assert result.substitutions is not None+ block = _single_code_block(parse_workflow_yaml(result.workflow_yaml))+ assert 'button[data-action=\\"status\\"]' in str(block["code"])+def test_author_schema_incompatibility_does_not_reopen_collapsed_code_block(self) -> None:ctx = _quote_ctx()ctx.update_workflow_called = Truediff --git a/tests/unit/test_copilot_completion_verification.py b/tests/unit/test_copilot_completion_verification.pyindex 9b0d75368..ec8f30693 100644--- a/tests/unit/test_copilot_completion_verification.py+++ b/tests/unit/test_copilot_completion_verification.py@@ -1341,6 +1341,29 @@ def test_terminal_goal_record_self_asserted_boolean_without_identifier_remains_u)+def test_submit_terminal_still_rejects_false_submit_with_author_time_log_only(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ snapshot = RunEvidenceSnapshot(block_outputs={"terminal_result": _terminal_goal_payload(submitted=False)})++ assert (+ grade_terminal_goal_record_criteria(+ [+ _criterion(+ "c0",+ "a commercial water service request is submitted",+ kind="terminal_action",+ terminal_action_family="request",+ )+ ],+ snapshot,+ )+ == []+ )++@pytest.mark.parametrize("payload",[@@ -9143,6 +9166,21 @@ async def test_maybe_run_completion_verification_unavailable_on_low_budget(monkeassert no_handler_result.is_fully_satisfied() is False+async def test_completion_verification_still_fails_closed_with_author_time_log_only(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ _patch_completion_handler(monkeypatch, None)++ result = await _maybe_run_completion_verification(_run_ctx(), _clean_success_result(), time.monotonic())++ assert result is not None+ assert result.status == "unavailable"+ assert result.is_fully_satisfied() is False++def test_completion_contract_not_violated_unavailable_blocks_surfacing() -> None:ctx = SimpleNamespace(completion_verification_result=CompletionVerificationResult("unavailable"),diff --git a/tests/unit/test_copilot_enforcement_pruning.py b/tests/unit/test_copilot_enforcement_pruning.pyindex 24b9f07d7..fb7f5d4dc 100644--- a/tests/unit/test_copilot_enforcement_pruning.py+++ b/tests/unit/test_copilot_enforcement_pruning.py@@ -16,7 +16,12 @@ from unittest.mock import AsyncMock, MagicMockimport pytestfrom agents import RunConfig-from skyvern.forge.sdk.copilot.blocker_signal import CopilotToolBlockerSignal, stash_blocker_signal+from skyvern.config import settings+from skyvern.forge.sdk.copilot.blocker_signal import (+ UNCOVERED_OUTPUT_RESCOUT_STEER_REASON_CODE,+ CopilotToolBlockerSignal,+ stash_blocker_signal,+)from skyvern.forge.sdk.copilot.build_test_outcome import (RecordedBuildTestOutcome,author_time_reject_missing_output_paths,@@ -75,6 +80,11 @@ from skyvern.forge.sdk.copilot.verification_evidence import WorkflowVerificationfrom tests.unit.conftest import make_copilot_context[email protected](autouse=True)+def _disable_author_time_gate_log_only(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", False)++class _Ctx:"""Minimal stand-in for CopilotContext used in enforcement checks.@@ -117,6 +127,7 @@ class _Ctx:self.last_run_blocks_workflow_run_id = Noneself.completion_criteria_turn_state = Noneself.reached_download_target: ReachedDownloadTarget | None = None+ self.author_time_gate_ablation_events = []class TestSynthesizedOfferPersistenceGate:@@ -2264,6 +2275,30 @@ class TestScoutOutputCoverageGate:assert steer.cleared_by_tools == frozenset({"evaluate"})assert steer.blocked_tool == "update_workflow"+ def test_log_only_rescout_steer_records_without_consuming(+ self,+ monkeypatch: pytest.MonkeyPatch,+ ) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ ctx = self._authoring_ctx(_criterion("output.document_name", "the order status document name is captured"))+ ctx.update_workflow_called = True+ ctx.latest_recorded_build_test_outcome = _author_time_reject_outcome("output.document_name")+ consume_uncovered_output_reopen_event(ctx)++ steer = uncovered_output_reject_scout_steer_signal(ctx, "update_workflow")++ assert steer is None+ assert ctx.uncovered_output_rescout_steer_key is None+ event = ctx.author_time_gate_ablation_events[-1]+ assert event.gate_id == "uncovered_output_rescout_steer"+ assert event.reason_code == UNCOVERED_OUTPUT_RESCOUT_STEER_REASON_CODE+ assert event.blocked_tool == "update_workflow"+ assert event.fingerprint == (+ f"{ctx.latest_recorded_build_test_outcome.structural_failure_identity}|output.document_name"+ )+ assert event.log_only is True+def test_steer_inert_without_reopen_latch(self) -> None:ctx = self._authoring_ctx(_criterion("output.document_name", "the order status document name is captured"))ctx.latest_recorded_build_test_outcome = _author_time_reject_outcome("output.document_name")diff --git a/tests/unit/test_copilot_output_contract_actuation.py b/tests/unit/test_copilot_output_contract_actuation.pyindex 659a99929..8a4741464 100644--- a/tests/unit/test_copilot_output_contract_actuation.py+++ b/tests/unit/test_copilot_output_contract_actuation.py@@ -10,6 +10,9 @@ from __future__ import annotationsimport itertoolsfrom types import SimpleNamespace+import pytest++from skyvern.config import settingsfrom skyvern.forge.sdk.copilot.blocker_signal import (assert_clean_user_facing_text,build_output_source_unobservable_blocker_signal,@@ -25,7 +28,10 @@ from skyvern.forge.sdk.copilot.output_contracts import (classify_output_contract_bail_family,resolve_output_contract_actuation,)-from skyvern.forge.sdk.copilot.runtime import output_contract_ladder_unresolved+from skyvern.forge.sdk.copilot.runtime import (+ output_contract_ladder_unresolved,+ record_author_time_gate_ablation_event,+)from skyvern.forge.sdk.copilot.tools import workflow_update as wufrom skyvern.forge.sdk.copilot.turn_halt import TurnHaltKind, turn_halt_from_blocker_signal@@ -40,6 +46,11 @@ _ALL_SPLIT_BLOCKERS = [][email protected](autouse=True)+def _disable_author_time_gate_log_only(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", False)++def test_resolver_is_total_over_the_evidence_family_matrix() -> None:kinds = set()for (@@ -509,7 +520,9 @@ def _advisory_ctx() -> SimpleNamespace:output_contract_run_output_observed_by_signature={},output_contract_run_bound_required_path_by_signature={},output_contract_bail_actuated_this_call=False,+ author_time_gate_ablation_events=[],scouted_output_covered_paths=set(),+ composition_page_evidence=None,)@@ -540,6 +553,212 @@ def _actuate(ctx: SimpleNamespace, signature: str) -> OutputContractActuationKinreturn actuation.kind+def test_author_time_gate_log_only_requires_local_opt_in(monkeypatch: pytest.MonkeyPatch) -> None:+ ctx = _advisory_ctx()+ monkeypatch.setattr(settings, "ENV", "prod")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ assert (+ record_author_time_gate_ablation_event(+ ctx,+ gate_id="metadata_run_preflight_reject",+ reason_code="metadata_contract_required_before_run",+ fingerprint="sig",+ blocked_tool="update_and_run_blocks",+ )+ is False+ )+ assert ctx.author_time_gate_ablation_events == []++ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", False)+ assert (+ record_author_time_gate_ablation_event(+ ctx,+ gate_id="metadata_run_preflight_reject",+ reason_code="metadata_contract_required_before_run",+ fingerprint="sig",+ blocked_tool="update_and_run_blocks",+ )+ is False+ )+ assert ctx.author_time_gate_ablation_events == []++ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ assert (+ record_author_time_gate_ablation_event(+ ctx,+ gate_id="metadata_run_preflight_reject",+ reason_code="metadata_contract_required_before_run",+ fingerprint="sig",+ blocked_tool="update_and_run_blocks",+ )+ is True+ )+ assert ctx.author_time_gate_ablation_events[-1].log_only is True+++def test_log_only_output_contract_actuation_records_without_granting(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ signature = "sig_log_only"+ ctx = _arm_static_return_advisory_ctx(signature)++ assert _actuate(ctx, signature) == OutputContractActuationKind.ADVISORY_RUN++ assert ctx.output_contract_actuation_by_signature == {}+ assert ctx.output_contract_actuation_count_by_signature == {}+ assert ctx.output_contract_declick_attempted_by_signature == {}+ event = ctx.author_time_gate_ablation_events[-1]+ assert event.gate_id == "output_contract_actuation"+ assert event.reason_code == "advisory_run"+ assert event.blocked_tool == "update_workflow"+ assert event.fingerprint == _FINGERPRINT+ assert event.log_only is True+++def test_log_only_terminal_stash_does_not_duplicate_output_contract_event(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ signature = "sig_terminal_log_only"+ ctx = _advisory_ctx()+ ctx.turn_halt = None+ _mark_consumed_empty_run(ctx, signature, page_extraction=True)++ actuation = wu._actuate_output_contract_bail(+ ctx,+ blockers=list(_STATIC_RETURN_BLOCKERS),+ target_code=_PAGE_READ_CODE,+ required_paths={"output.confirmation_number"},+ signature=signature,+ current_fingerprint=_FINGERPRINT,+ )+ assert actuation.kind == OutputContractActuationKind.BLOCKED_TERMINAL+ wu._stash_output_source_unobservable_terminal(+ ctx,+ reason_code=actuation.reason_code,+ required_paths={"output.confirmation_number"},+ block_label="collect_confirmation",+ signature=signature,+ blockers=list(_STATIC_RETURN_BLOCKERS),+ )++ assert len(ctx.author_time_gate_ablation_events) == 1+ assert ctx.author_time_gate_ablation_events[0].fingerprint == _FINGERPRINT+ assert ctx.turn_halt is None+++def test_log_only_metadata_preflight_records_without_rejecting_or_consuming(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ signature = "sig_metadata"+ ctx = _advisory_ctx()+ ctx.output_contract_actuation_by_signature[signature] = OutputContractAdvisoryState.GRANTED+ evaluation = SimpleNamespace(+ has_deficiencies=True,+ canonical_signature=signature,+ can_attempt_run=False,+ payload={"reason_code": "output_contract_required"},+ reason_code="output_contract_required",+ block_label="collect_confirmation",+ required_paths={"output.confirmation_number"},+ missing_metadata_paths=["output.confirmation_number"],+ missing_schema_paths=[],+ missing_return_paths=[],+ shape_violations=[],+ )+ monkeypatch.setattr(wu, "_impose_output_contract_envelope_after_steering", lambda *args: (args[1], args[2], False))+ monkeypatch.setattr(wu, "_scaffold_metadata_contract_for_update", lambda *args: (args[2], False))+ monkeypatch.setattr(wu, "_evaluate_output_contract_for_code_block", lambda *args, **kwargs: evaluation)++ result = wu._metadata_contract_run_preflight_reject(ctx, "workflow: yaml", {})++ assert result is None+ assert ctx.output_contract_actuation_by_signature[signature] == OutputContractAdvisoryState.GRANTED+ assert ctx.output_contract_reject_count_by_signature == {}+ event = ctx.author_time_gate_ablation_events[-1]+ assert event.gate_id == "metadata_run_preflight_reject"+ assert event.reason_code == "output_contract_required"+ assert event.blocked_tool == "update_and_run_blocks"+ assert event.fingerprint == wu._output_contract_structural_fingerprint("workflow: yaml", signature)+ assert event.log_only is True+++def test_log_only_metadata_preflight_skips_run_attemptable_without_advisory(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ ctx = _advisory_ctx()+ evaluation = SimpleNamespace(+ has_deficiencies=True,+ canonical_signature="sig_run_attemptable",+ can_attempt_run=True,+ payload={"reason_code": "output_contract_required"},+ reason_code="output_contract_required",+ block_label="collect_confirmation",+ required_paths={"output.confirmation_number"},+ missing_metadata_paths=["output.confirmation_number"],+ missing_schema_paths=[],+ missing_return_paths=[],+ shape_violations=[],+ )+ monkeypatch.setattr(wu, "_impose_output_contract_envelope_after_steering", lambda *args: (args[1], args[2], False))+ monkeypatch.setattr(wu, "_scaffold_metadata_contract_for_update", lambda *args: (args[2], False))+ monkeypatch.setattr(wu, "_evaluate_output_contract_for_code_block", lambda *args, **kwargs: evaluation)++ result = wu._metadata_contract_run_preflight_reject(ctx, "workflow: yaml", {})++ assert result is None+ assert ctx.author_time_gate_ablation_events == []+ assert ctx.output_contract_reject_count_by_signature == {}+++def test_credential_scout_submit_gate_still_blocks_with_author_time_log_only(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ ctx = SimpleNamespace(+ block_authoring_policy=wu.BlockAuthoringPolicy.CODE_ONLY_BROWSER,+ workflow_yaml="",+ scout_trajectory=[+ {+ "tool_name": "fill_credential_field",+ "credential_id": "cred_safe",+ "credential_field": "password",+ "source_url": "https://login.example.test/login",+ }+ ],+ )+ workflow_yaml = """+workflow_definition:+ parameters:+ - parameter_type: workflow+ workflow_parameter_type: credential_id+ key: login_credentials+ default_value: cred_safe+ blocks:+ - block_type: code+ label: login+ parameter_keys:+ - login_credentials+ code: |+ await page.locator("#password").fill(login_credentials.password)+ await page.get_by_role("button", name="Submit").click()+"""++ errors = wu._credentialed_code_block_scout_gate_errors(workflow_yaml, ctx)++ assert len(errors) == 1+ assert "a later submit action on the same page" in errors[0]++def test_advisory_grant_survives_double_preflight_pass() -> None:signature = "sig_double_pass"ctx = _arm_static_return_advisory_ctx(signature)@@ -555,21 +774,48 @@ def test_advisory_grant_yields_exactly_one_adjudicating_run_per_signature() -> Nsignature = "sig_one_run"ctx = _arm_static_return_advisory_ctx(signature)assert _actuate(ctx, signature) == OutputContractActuationKind.ADVISORY_RUN- consumed = wu.consume_output_contract_advisory_grant_for_run(ctx)+ consumed = wu.consume_output_contract_advisory_grant_for_run_result(+ ctx, {"data": {"workflow_run_id": "wr_dispatched"}}+ )assert consumed == [signature]assert ctx.output_contract_actuation_by_signature[signature] == OutputContractAdvisoryState.CONSUMED- assert wu.consume_output_contract_advisory_grant_for_run(ctx) == []+ assert (+ wu.consume_output_contract_advisory_grant_for_run_result(ctx, {"data": {"workflow_run_id": "wr_dispatched"}})+ == []+ )_mark_consumed_empty_run(ctx, signature, page_extraction=True)assert _actuate(ctx, signature) == OutputContractActuationKind.BLOCKED_TERMINAL+def test_advisory_grant_is_not_consumed_without_workflow_run_id() -> None:+ signature = "sig_null_run"+ ctx = _arm_static_return_advisory_ctx(signature)+ assert _actuate(ctx, signature) == OutputContractActuationKind.ADVISORY_RUN++ consumed = wu.consume_output_contract_advisory_grant_for_run_result(ctx, {"data": {"workflow_run_id": None}})++ assert consumed == []+ assert ctx.output_contract_actuation_by_signature[signature] == OutputContractAdvisoryState.GRANTED+++def test_advisory_grant_arms_pending_run_output_evidence() -> None:+ signature = "sig_pending_output"+ ctx = _arm_static_return_advisory_ctx(signature)++ assert _actuate(ctx, signature) == OutputContractActuationKind.ADVISORY_RUN++ assert ctx.output_contract_pending_run_evidence[signature] == ["output.confirmation_number"]++def test_model_churn_keeps_grant_until_run_dispatch_consumes_it() -> None:signature = "sig_churn_then_dispatch"ctx = _arm_static_return_advisory_ctx(signature)assert _actuate(ctx, signature) == OutputContractActuationKind.ADVISORY_RUNassert _actuate(ctx, signature) == OutputContractActuationKind.ADVISORY_RUNassert ctx.output_contract_actuation_by_signature[signature] == OutputContractAdvisoryState.GRANTED- assert wu.consume_output_contract_advisory_grant_for_run(ctx) == [signature]+ assert wu.consume_output_contract_advisory_grant_for_run_result(ctx, {"data": {"workflow_run_id": "wr_1"}}) == [+ signature+ ]assert ctx.output_contract_actuation_by_signature[signature] == OutputContractAdvisoryState.CONSUMED@@ -700,14 +946,14 @@ def test_click_only_declick_flag_clears_when_source_becomes_observable() -> Nonedef test_observed_required_values_exact_and_lineage_match() -> None:- ctx = SimpleNamespace(scouted_output_covered_paths={"output.order.id"})+ ctx = SimpleNamespace(scouted_output_covered_paths={"output.order.id"}, composition_page_evidence=None)assert wu._observed_required_output_values(ctx, {"output.order.id"}) is Trueassert wu._observed_required_output_values(ctx, {"output.order"}) is Trueassert wu._observed_required_output_values(ctx, {"output.order.id.raw"}) is Truedef test_observed_required_values_rejects_sibling_root_only_overlap() -> None:- ctx = SimpleNamespace(scouted_output_covered_paths={"output.confirmation_number"})+ ctx = SimpleNamespace(scouted_output_covered_paths={"output.confirmation_number"}, composition_page_evidence=None)assert wu._observed_required_output_values(ctx, {"output.account_number"}) is False@@ -835,6 +1081,28 @@ def test_reject_seam_adjudication_grants_advisory_within_caps_when_imposition_eaassert ctx.turn_halt is None+def test_reject_seam_metadata_required_reaches_advisory_before_no_source_terminal() -> None:+ ctx = _ladder_ctx()+ signature = "sig_metadata_required"+ ctx.output_contract_declick_attempted_by_signature[signature] = True+ for _ in range(wu._MAX_OUTPUT_CONTRACT_ACTUATIONS_WITHOUT_RUN):+ wu._record_output_contract_actuation_progress(ctx, signature)+ workflow_yaml = (+ "workflow_definition:\n"+ " blocks:\n"+ " - block_type: code\n"+ " label: collect\n"+ " code: \"page.click('#submit')\"\n"+ )++ wu._adjudicate_output_contract_ladder_after_reject(+ ctx, _make_evaluation(signature, block_label="collect"), workflow_yaml=workflow_yaml, current_fingerprint="fp"+ )++ assert ctx.output_contract_actuation_by_signature[signature] == OutputContractAdvisoryState.GRANTED+ assert ctx.turn_halt is None++def test_reject_seam_adjudication_skips_when_imposition_already_actuated_this_call() -> None:ctx = _ladder_ctx()ctx.output_contract_bail_actuated_this_call = True@@ -992,6 +1260,59 @@ def test_run_output_evidence_binds_when_value_keyed_under_output_root() -> None:assert ctx.output_contract_run_bound_required_path_by_signature[signature] is True+def test_run_output_evidence_null_required_value_is_observed_but_unbound() -> None:+ signature = "sig_null_required"+ ctx = _advisory_ctx()+ wu._arm_pending_run_evidence(ctx, signature, {"output.confirmation_number"})+ result = {+ "data": {+ "blocks": [+ {+ "label": "collect",+ "extracted_data": {+ "output": {"confirmation_number": None},+ "blocker_type": "portal_unavailable",+ },+ }+ ]+ }+ }+ wu.record_output_contract_run_output_evidence(ctx, result)+ assert ctx.output_contract_run_output_observed_by_signature[signature] is True+ assert ctx.output_contract_run_bound_required_path_by_signature[signature] is False+++def test_run_output_evidence_partial_required_outputs_are_observed_but_unbound() -> None:+ signature = "sig_partial_required"+ ctx = _advisory_ctx()+ wu._arm_pending_run_evidence(+ ctx,+ signature,+ {"output.confirmation_number", "output.account_number", "output.selected_start_date"},+ )+ result = {+ "data": {+ "blocks": [+ {+ "label": "collect",+ "extracted_data": {+ "output": {+ "account_number": None,+ "confirmation_number": None,+ "selected_start_date": "2026-06-22",+ },+ "blocker_type": "portal_unavailable",+ "http_status": 404,+ },+ }+ ]+ }+ }+ wu.record_output_contract_run_output_evidence(ctx, result)+ assert ctx.output_contract_run_output_observed_by_signature[signature] is True+ assert ctx.output_contract_run_bound_required_path_by_signature[signature] is False++def test_run_output_evidence_deep_sibling_does_not_over_credit_ancestor() -> None:signature = "sig_deep_sibling"ctx = _advisory_ctx()@@ -1018,6 +1339,9 @@ def test_page_source_extraction_code_reads_page_and_is_not_click_only() -> None:required = {"output.confirmation_number", "output.account_number", "output.start_date"}keyed = wu._page_source_extraction_code(_CLICK_ONLY_CODE, required)assert "await page.extract(" in keyed+ assert "confirmation_number" in keyed+ assert "account_number" in keyed+ assert "start_date" in keyedassert keyed.strip().endswith(f"return {wu._OUTPUT_CONTRACT_PAGE_EXTRACT_VAR}")assert wu._output_contract_click_only_spine(keyed) is Falsediff --git a/tests/unit/test_copilot_output_policy.py b/tests/unit/test_copilot_output_policy.pyindex 9a9f0e694..befb08ec0 100644--- a/tests/unit/test_copilot_output_policy.py+++ b/tests/unit/test_copilot_output_policy.py@@ -12,6 +12,7 @@ from agents import GuardrailFunctionOutput, OutputGuardrail, ToolInputGuardrailDfrom agents.run_context import RunContextWrapperfrom agents.tool_context import ToolContext+from skyvern.config import settingsfrom skyvern.forge.sdk.copilot import agent as agent_modulefrom skyvern.forge.sdk.copilot.blocker_signal import CopilotToolBlockerSignalfrom skyvern.forge.sdk.copilot.build_phase import BuildPhase@@ -209,6 +210,19 @@ def test_rejects_raw_secret_echo_in_user_response() -> None:assert OutputPolicyReason.RAW_SECRET_LEAK in verdict.reason_codes+def test_output_policy_still_blocks_with_author_time_log_only(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)++ verdict = evaluate_output_policy(+ request_policy=_policy(),+ user_response="I used password: hunter2 to test the login.",+ )++ assert not verdict.allowed+ assert OutputPolicyReason.RAW_SECRET_LEAK in verdict.reason_codes++@pytest.mark.parametrize(("response_type", "user_response", "expected_type", "expected_response"),[@@ -586,6 +600,22 @@ def test_rejects_reply_when_request_policy_required_clarification() -> None:assert OutputPolicyReason.REQUEST_POLICY_CLARIFICATION_BYPASS in verdict.reason_codes+def test_request_policy_clarification_still_blocks_with_author_time_log_only(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)++ verdict = evaluate_output_policy(+ request_policy=_policy(user_response_policy="ask_clarification", allow_update_workflow=False),+ response_type="REPLY",+ user_response="I created the workflow with the credential.",+ )++ assert not verdict.allowed+ assert OutputPolicyReason.REQUEST_POLICY_CLARIFICATION_BYPASS in verdict.reason_codes++def test_avoidable_output_field_confirmation_is_hard_blocked() -> None:policy = _policy(user_response_policy="proceed",@@ -1193,6 +1223,19 @@ def test_rejects_approved_credential_on_different_login_origin() -> None:assert OutputPolicyReason.CREDENTIAL_SCOPE_BROADENED in verdict.reason_codes+def test_credential_scope_still_blocks_with_author_time_log_only(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)++ verdict = evaluate_output_policy(+ request_policy=_policy(),+ workflow_yaml=_workflow_yaml(url="https://evil.example.test/login"),+ )++ assert not verdict.allowed+ assert OutputPolicyReason.CREDENTIAL_SCOPE_BROADENED in verdict.reason_codes++def test_rejects_approved_credential_on_templated_login_origin() -> None:verdict = evaluate_output_policy(request_policy=_policy(),diff --git a/tests/unit/test_copilot_recorded_outcome_grounding.py b/tests/unit/test_copilot_recorded_outcome_grounding.pyindex cb219eb5c..583d9581d 100644--- a/tests/unit/test_copilot_recorded_outcome_grounding.py+++ b/tests/unit/test_copilot_recorded_outcome_grounding.py@@ -5,6 +5,7 @@ from types import SimpleNamespaceimport pytestfrom structlog.testing import capture_logs+from skyvern.config import settingsfrom skyvern.forge.sdk.copilot.agent import _recorded_build_test_outcome_promptfrom skyvern.forge.sdk.copilot.blocker_signal import CopilotToolBlockerSignal, stash_blocker_signalfrom skyvern.forge.sdk.copilot.build_test_outcome import (@@ -83,6 +84,11 @@ workflow_definition:"""[email protected](autouse=True)+def _disable_author_time_gate_log_only(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", False)++def _outcome(**updates: object) -> RecordedBuildTestOutcome:base = {"phase": "persisted_block_run",@@ -190,6 +196,29 @@ def test_repeated_authoritative_outcome_arms_grounding_before_repair_ceiling() -assert ctx.blocker_signal is None+def test_log_only_recorded_outcome_grounding_records_without_stashing(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)+ outcome = _outcome()+ ctx = _ctx(outcome)+ arm_recorded_outcome_grounding_requirement(ctx)++ result = _tool_loop_error(ctx, "update_workflow")++ assert result is None+ assert ctx.blocker_signal is None+ assert ctx.latest_tool_blocker_signal is None+ assert ctx.turn_halt is None+ event = ctx.author_time_gate_ablation_events[-1]+ assert event.gate_id == "recorded_outcome_grounding"+ assert event.reason_code == "recorded_outcome_grounding_required"+ assert event.blocked_tool == "update_workflow"+ assert event.fingerprint == outcome.structural_key+ assert event.log_only is True++def test_authoritative_persisted_outcome_arms_without_recorded_signature_prefix(monkeypatch: pytest.MonkeyPatch,) -> None:@@ -322,7 +351,27 @@ def test_grounding_rejection_logs_reason_and_run_id_fields(assert event["current_url_present"] is (reject_reason != "no_url")-def test_no_run_degraded_grounding_remains_unsatisfied_and_logs_degraded_page() -> None:+def test_evaluate_grounding_payload_requires_inspect_recovery() -> None:+ outcome = _outcome(phase="scout_evaluate", workflow_run_id=None, attempted_tool="evaluate")+ ctx = _ctx(outcome)+ arm_recorded_outcome_grounding_requirement(ctx)+ ctx.composition_page_evidence = _bounded_inspect_evidence(+ source_tool="evaluate",+ workflow_run_id=None,+ observed_after_workflow_run=False,+ )++ with capture_logs() as logs:+ assert maybe_satisfy_recorded_outcome_grounding_requirement(ctx) is False++ event = next(log for log in logs if log["event"] == "copilot recorded outcome grounding rejected")+ assert event["reject_reason"] == "not_inspect_source"+ assert event["source_tool"] == "evaluate"++ assert _tool_loop_error(ctx, "evaluate", {}) is None+++def test_no_run_degraded_grounding_satisfies_with_typed_capture_degraded_payload() -> None:outcome = _outcome(phase="scout_evaluate", workflow_run_id=None, attempted_tool="evaluate")ctx = _ctx(outcome)arm_recorded_outcome_grounding_requirement(ctx)@@ -335,11 +384,14 @@ def test_no_run_degraded_grounding_remains_unsatisfied_and_logs_degraded_page()challenge_controls=[],)- with capture_logs() as logs:- assert maybe_satisfy_recorded_outcome_grounding_requirement(ctx) is False+ assert maybe_satisfy_recorded_outcome_grounding_requirement(ctx) is True- event = next(log for log in logs if log["event"] == "copilot recorded outcome grounding rejected")- assert event["reject_reason"] == "degraded_page"+ requirement = ctx.recorded_outcome_grounding_requirement+ assert requirement is not None+ payload = requirement.payload+ assert payload is not None+ assert payload.capture_degraded is True+ assert payload.payload_workflow_run_id is Nonedef test_persisted_degraded_empty_grounding_satisfies_and_reaches_prompt() -> None:diff --git a/tests/unit/test_copilot_request_policy_workflow_credentials.py b/tests/unit/test_copilot_request_policy_workflow_credentials.pyindex 73ceb093d..8a2deba98 100644--- a/tests/unit/test_copilot_request_policy_workflow_credentials.py+++ b/tests/unit/test_copilot_request_policy_workflow_credentials.py@@ -6,6 +6,7 @@ from unittest.mock import AsyncMock, patchimport pytest+from skyvern.config import settingsfrom skyvern.forge.sdk.copilot.context import CredentialCheck, StructuredContextfrom skyvern.forge.sdk.copilot.request_policy import _workflow_credential_inputs_unbound, build_request_policy@@ -336,3 +337,25 @@ async def test_fallback_code_block_generic_one_time_code_does_not_skip_run() ->assert policy.allow_run_blocks is Trueassert policy.allow_missing_credentials_in_draft is Falseassert policy.testing_intent == "unspecified"+++async def test_request_policy_resolver_still_blocks_raw_secret_with_author_time_log_only(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(settings, "ENV", "local")+ monkeypatch.setattr(settings, "WORKFLOW_COPILOT_AUTHOR_TIME_GATE_LOG_ONLY", True)++ policy = await build_request_policy(+ user_message="Use password: Hunter99! to sign in.",+ workflow_yaml="",+ chat_history=[],+ global_llm_context="",+ organization_id="o_test",+ handler=None,+ )++ assert policy.raw_secret_detected is True+ assert policy.user_response_policy == "ask_clarification"+ assert policy.allow_update_workflow is False+ assert policy.allow_run_blocks is Falsediff --git a/tests/unit/test_file_download_access_control.py b/tests/unit/test_file_download_access_control.pyindex 905563751..175e3952b 100644--- a/tests/unit/test_file_download_access_control.py+++ b/tests/unit/test_file_download_access_control.py@@ -1,6 +1,9 @@from __future__ import annotationsimport os+import socket+from collections.abc import AsyncIterator+from pathlib import Pathfrom types import SimpleNamespacefrom unittest.mock import AsyncMock, MagicMock@@ -8,7 +11,9 @@ import pytestfrom skyvern.config import settingsfrom skyvern.constants import DOWNLOAD_FILE_PREFIX+from skyvern.exceptions import BlockedHost, SkyvernHTTPExceptionfrom skyvern.forge.sdk.api import files+from skyvern.utils.url_validators import MAX_SAFE_REDIRECTSATTACKER_ORG_ID = "o_attacker"VICTIM_ORG_ID = "o_victim"@@ -242,3 +247,122 @@ async def test_download_file_routes_gcs_uri_to_managed_storage(storage: SimpleNaassert f.read() == b"tenant-secret-bytes"finally:os.unlink(path)+++async def test_download_file_blocks_hostname_resolving_to_private_ip(monkeypatch: pytest.MonkeyPatch) -> None:+ def resolves_private(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ return [(socket.AF_INET, socket.SOCK_STREAM, 0, "", ("10.0.0.42", port or 0))]++ client_session = MagicMock()+ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", resolves_private)+ monkeypatch.setattr(files.aiohttp, "ClientSession", client_session)++ with pytest.raises(BlockedHost):+ await files.download_file("https://evil.example.test/secret.pdf")++ client_session.assert_not_called()+++async def test_download_file_rejects_unsafe_redirect_target(monkeypatch: pytest.MonkeyPatch) -> None:+ def resolves_public(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ return [(socket.AF_INET, socket.SOCK_STREAM, 0, "", ("93.184.216.34", port or 0))]++ redirect_response = AsyncMock()+ redirect_response.status = 302+ redirect_response.headers = {"Location": "http://169.254.169.254/latest/meta-data"}+ redirect_response.__aenter__ = AsyncMock(return_value=redirect_response)+ redirect_response.__aexit__ = AsyncMock(return_value=None)++ mock_session = MagicMock()+ mock_session.__aenter__ = AsyncMock(return_value=mock_session)+ mock_session.__aexit__ = AsyncMock(return_value=None)+ mock_session.get = MagicMock(return_value=redirect_response)++ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", resolves_public)+ monkeypatch.setattr(files.aiohttp, "ClientSession", MagicMock(return_value=mock_session))++ with pytest.raises(BlockedHost):+ await files.download_file("https://example.com/start.pdf")++ mock_session.get.assert_called_once()+++async def test_download_file_strips_credentials_on_cross_origin_redirect(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ def resolves_public(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ return [(socket.AF_INET, socket.SOCK_STREAM, 0, "", ("93.184.216.34", port or 0))]++ class Content:+ async def iter_chunked(self, chunk_size: int) -> AsyncIterator[bytes]:+ yield b"file-bytes"++ redirect_response = AsyncMock()+ redirect_response.status = 302+ redirect_response.headers = {"Location": "https://other.example.com/final.pdf"}+ redirect_response.__aenter__ = AsyncMock(return_value=redirect_response)+ redirect_response.__aexit__ = AsyncMock(return_value=None)++ final_response = AsyncMock()+ final_response.status = 200+ final_response.headers = {}+ final_response.content_length = len(b"file-bytes")+ final_response.content = Content()+ final_response.__aenter__ = AsyncMock(return_value=final_response)+ final_response.__aexit__ = AsyncMock(return_value=None)++ responses = [redirect_response, final_response]+ requested_headers: list[dict[str, str]] = []++ def capture_get(*args: object, **kwargs: object) -> AsyncMock:+ headers = kwargs["headers"]+ assert isinstance(headers, dict)+ requested_headers.append(headers)+ return responses.pop(0)++ mock_session = MagicMock()+ mock_session.__aenter__ = AsyncMock(return_value=mock_session)+ mock_session.__aexit__ = AsyncMock(return_value=None)+ mock_session.get = MagicMock(side_effect=capture_get)++ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", resolves_public)+ monkeypatch.setattr(files.aiohttp, "ClientSession", MagicMock(return_value=mock_session))++ result = await files.download_file(+ "https://example.com/start.pdf",+ headers={"Authorization": "Bearer secret", "Cookie": "sid=abc", "X-Keep": "1"},+ output_dir=str(tmp_path),+ )++ assert Path(result).read_bytes() == b"file-bytes"+ assert requested_headers[0]["Authorization"] == "Bearer secret"+ assert requested_headers[0]["Cookie"] == "sid=abc"+ assert requested_headers[1] == {"X-Keep": "1"}+++async def test_download_file_redirect_limit_raises_http_exception(monkeypatch: pytest.MonkeyPatch) -> None:+ def resolves_public(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ return [(socket.AF_INET, socket.SOCK_STREAM, 0, "", ("93.184.216.34", port or 0))]++ redirect_response = AsyncMock()+ redirect_response.status = 302+ redirect_response.headers = {"Location": "https://example.com/next.pdf"}+ redirect_response.__aenter__ = AsyncMock(return_value=redirect_response)+ redirect_response.__aexit__ = AsyncMock(return_value=None)++ mock_session = MagicMock()+ mock_session.__aenter__ = AsyncMock(return_value=mock_session)+ mock_session.__aexit__ = AsyncMock(return_value=None)+ mock_session.get = MagicMock(return_value=redirect_response)++ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", resolves_public)+ monkeypatch.setattr(files.aiohttp, "ClientSession", MagicMock(return_value=mock_session))++ with pytest.raises(SkyvernHTTPException, match="Too many redirects"):+ await files.download_file("https://example.com/start.pdf")++ assert mock_session.get.call_count == MAX_SAFE_REDIRECTS + 1diff --git a/tests/unit/test_files_resolve_local_or_download.py b/tests/unit/test_files_resolve_local_or_download.pyindex d5535b360..873e721ae 100644--- a/tests/unit/test_files_resolve_local_or_download.py+++ b/tests/unit/test_files_resolve_local_or_download.py@@ -17,6 +17,7 @@ class _FakeDownloadResponse:self._data = data# aiohttp exposes headers as a case-insensitive CIMultiDictProxy; mirror that.self.headers = CIMultiDictProxy(CIMultiDict(headers or {}))+ self.status = 200self.content_length = len(data) if advertise_length else Noneself.content = selfself.body_read = False@@ -36,7 +37,9 @@ class _FakeDownloadSession:def __init__(self, response: _FakeDownloadResponse) -> None:self._response = response- def get(self, url: object, headers: dict[str, str] | None = None) -> _FakeDownloadResponse:+ def get(+ self, url: object, headers: dict[str, str] | None = None, allow_redirects: bool = True+ ) -> _FakeDownloadResponse:return self._responseasync def __aenter__(self) -> _FakeDownloadSession:diff --git a/tests/unit/test_org_auth_service.py b/tests/unit/test_org_auth_service.pyindex eb5cdbb46..583c61206 100644--- a/tests/unit/test_org_auth_service.py+++ b/tests/unit/test_org_auth_service.py@@ -145,10 +145,10 @@ def test_debug_fields_handles_none_inputs() -> None:async def test_resolve_org_from_api_key_logs_decode_error_reason(monkeypatch) -> None:logged: dict[str, object] = {}- def fake_error(_message: str, **kwargs: object) -> None:+ def fake_warning(_message: str, **kwargs: object) -> None:logged.update(kwargs)- monkeypatch.setattr(org_auth_service.LOG, "error", fake_error)+ monkeypatch.setattr(org_auth_service.LOG, "warning", fake_warning)with pytest.raises(HTTPException) as exc_info:await org_auth_service.resolve_org_from_api_key("definitely-not-a-jwt", SimpleNamespace(), ())diff --git a/tests/unit/test_url_validators.py b/tests/unit/test_url_validators.pyindex 28727f055..f9154389a 100644--- a/tests/unit/test_url_validators.py+++ b/tests/unit/test_url_validators.py@@ -1,8 +1,16 @@+import socket+import pytestfrom skyvern.config import settingsfrom skyvern.exceptions import BlockedHost-from skyvern.utils.url_validators import encode_url, is_blocked_host, validate_url+from skyvern.utils.url_validators import (+ encode_url,+ is_blocked_host,+ validate_fetch_url,+ validate_redirect_url,+ validate_url,+)def test_encode_url_basic():@@ -121,3 +129,60 @@ def test_is_blocked_host_allowed_hosts_normalize_brackets_and_mapped(@pytest.mark.parametrize("host", ["LOCALHOST", "LocalHost", "localhost"])def test_is_blocked_host_blocked_hosts_case_insensitive(host: str) -> None:assert is_blocked_host(host) is True+++def test_validate_fetch_url_blocks_hostname_resolving_private_ip(monkeypatch: pytest.MonkeyPatch) -> None:+ def resolves_to_private(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ return [(socket.AF_INET, socket.SOCK_STREAM, 0, "", ("10.0.0.42", port or 0))]++ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", resolves_to_private)++ with pytest.raises(BlockedHost):+ validate_fetch_url("https://evil.example.test/file.pdf")+++def test_validate_fetch_url_fails_closed_on_dns_error(monkeypatch: pytest.MonkeyPatch) -> None:+ def fails_dns(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ raise OSError("dns unavailable")++ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", fails_dns)++ with pytest.raises(BlockedHost):+ validate_fetch_url("https://unresolvable.example.test/file.pdf")+++def test_validate_url_does_not_resolve_dns(monkeypatch: pytest.MonkeyPatch) -> None:+ def unexpected_dns(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ raise AssertionError("general URL validation should not resolve DNS")++ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", unexpected_dns)++ assert validate_url("https://webhook.example.com/receive") is not None+++ "url",+ [+ "https://metadata.google.internal/computeMetadata/v1/",+ "https://kubernetes.default.svc/api",+ "https://my-service.namespace.svc.cluster.local/api",+ "https://internal.local/api",+ ],+)+def test_validate_url_blocks_internal_hostnames(url: str, monkeypatch: pytest.MonkeyPatch) -> None:+ def unexpected_dns(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ raise AssertionError("internal hostname should be blocked before DNS")++ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", unexpected_dns)++ with pytest.raises(BlockedHost):+ validate_url(url)+++def test_is_blocked_host_allows_public_svc_subdomain() -> None:+ assert is_blocked_host("api.svc.example.com") is False+++def test_validate_redirect_url_rejects_private_redirect_target() -> None:+ with pytest.raises(BlockedHost):+ validate_redirect_url("https://example.com/file.pdf", "http://169.254.169.254/latest/meta-data")diff --git a/tests/unit/test_workflow_onepassword_errors.py b/tests/unit/test_workflow_onepassword_errors.pyindex 0f88e5ba5..58f63eaf2 100644--- a/tests/unit/test_workflow_onepassword_errors.py+++ b/tests/unit/test_workflow_onepassword_errors.py@@ -4,10 +4,13 @@ that names 1Password as the failing dependency rather than leaking the raw SDK efrom __future__ import annotations+import asynciofrom datetime import datetime, timezone+from types import SimpleNamespacefrom unittest.mock import AsyncMock, MagicMock, patchimport pytest+from fastapi import HTTPExceptionfrom onepassword.errors import DesktopSessionExpiredException, RateLimitExceededExceptionfrom skyvern.exceptions import (@@ -17,6 +20,11 @@ from skyvern.exceptions import (OnePasswordSessionExpiredError,)from skyvern.forge import app as forge_app+from skyvern.forge.sdk.routes.credentials import list_onepassword_items+from skyvern.forge.sdk.services.credentials import (+ extract_onepassword_upstream_5xx_status,+ is_onepassword_credential_error,+)from skyvern.forge.sdk.workflow.context_manager import WorkflowRunContextfrom skyvern.forge.sdk.workflow.models.parameter import OnePasswordCredentialParameter@@ -210,3 +218,112 @@ async def test_onepassword_status_keyword_5xx_classified_as_service_unavailable(await ctx.register_onepassword_credential_parameter_value(_make_parameter(), _make_organization())assert "504" in exc_info.value.message+++ "message, expected",+ [+ ("Server error: 503 Service Unavailable", 503),+ ("upstream returned 502 bad gateway", 502),+ ("request failed with status: 504", 504),+ ("HTTP 500 internal server error", 500),+ ],+)+def test_extract_onepassword_upstream_5xx_status_matches(message: str, expected: int) -> None:+ assert extract_onepassword_upstream_5xx_status(message) == expected+++ "message",+ [+ "invalid service account token",+ "authentication failed: token is not valid",+ "vault has 500 items, exceeded soft limit",+ "could not parse token",+ ],+)+def test_extract_onepassword_upstream_5xx_status_ignores_credential_errors(message: str) -> None:+ # Bad-token / non-upstream failures must not look like a 5xx. The route only+ # maps them to 4xx when the credential-error classifier has positive evidence.+ assert extract_onepassword_upstream_5xx_status(message) is None+++ "message",+ [+ "invalid service account token",+ "authentication failed: token is not valid",+ "request forbidden for this service account",+ "malformed credential payload",+ "could not parse token",+ ],+)+def test_is_onepassword_credential_error_matches_auth_failures(message: str) -> None:+ assert is_onepassword_credential_error(message)+++ "message",+ [+ "",+ "request timed out",+ "rate limit hit",+ "vault has 500 items, exceeded soft limit",+ "unexpected parser bug",+ ],+)+def test_is_onepassword_credential_error_ignores_unknown_failures(message: str) -> None:+ assert not is_onepassword_credential_error(message)+++def mocked_route_app_database():+ original = getattr(forge_app, "DATABASE", None)+ forge_app.DATABASE = MagicMock()+ forge_app.DATABASE.organizations.get_valid_org_auth_token = AsyncMock(+ return_value=SimpleNamespace(token="org-token")+ )+ yield forge_app.DATABASE+ if original is None:+ del forge_app.DATABASE+ else:+ forge_app.DATABASE = original+++ "sdk_error, expected_status, expected_detail",+ [+ (+ Exception("invalid service account token"),+ 400,+ "service account token appears to be invalid or expired",+ ),+ (+ Exception("authentication failed, error code: 500"),+ 400,+ "service account token appears to be invalid or expired",+ ),+ (Exception("Server error: 503 Service Unavailable"), 502, "temporarily unavailable"),+ (asyncio.TimeoutError(), 502, "temporarily unavailable"),+ (RateLimitExceededException("rate limit hit"), 429, "rate limit exceeded"),+ (DesktopSessionExpiredException("session expired"), 400, "session appears to be expired"),+ (Exception("unexpected parser bug"), 500, "Failed to list 1Password items"),+ ],+)+async def test_list_onepassword_items_classifies_failures(+ mocked_route_app_database,+ sdk_error: Exception,+ expected_status: int,+ expected_detail: str,+) -> None:+ with patch(+ "skyvern.forge.sdk.routes.credentials.OnePasswordClient.authenticate",+ new_callable=AsyncMock,+ side_effect=sdk_error,+ ):+ with pytest.raises(HTTPException) as exc_info:+ await list_onepassword_items(_make_organization())++ assert exc_info.value.status_code == expected_status+ assert expected_detail in exc_info.value.detaildiff --git a/tests/unit/workflow/test_http_request_block.py b/tests/unit/workflow/test_http_request_block.pyindex f187cca98..637bcc916 100644--- a/tests/unit/workflow/test_http_request_block.py+++ b/tests/unit/workflow/test_http_request_block.py@@ -1,6 +1,7 @@import json+import socketfrom datetime import datetime, timezone-from unittest.mock import AsyncMock+from unittest.mock import AsyncMock, MagicMockimport pytest@@ -193,6 +194,31 @@ class TestSecretResponsePaths:class TestHttpRequestBlockSecretResponsePaths:+ @pytest.mark.asyncio+ async def test_execute_rejects_hostname_resolving_to_private_ip_before_request(+ self, monkeypatch: pytest.MonkeyPatch+ ) -> None:+ context = _make_context()+ block = _http_block(url="https://evil.example.test/api")+ db_mock = AsyncMock()+ client_session = MagicMock()++ def resolves_private(host: str, port: int | None, *args: object, **kwargs: object) -> list[object]:+ return [(socket.AF_INET, socket.SOCK_STREAM, 0, "", ("10.0.0.42", port or 0))]++ monkeypatch.setattr(HttpRequestBlock, "get_workflow_run_context", lambda _self, _workflow_run_id: context)+ monkeypatch.setattr("skyvern.utils.url_validators.socket.getaddrinfo", resolves_private)+ monkeypatch.setattr("skyvern.forge.sdk.core.aiohttp_helper.aiohttp.ClientSession", client_session)+ monkeypatch.setattr(block_module.app, "DATABASE", db_mock)++ result = await block.execute(workflow_run_id="wr-1", workflow_run_block_id="wrb-1")++ assert result.success is False+ assert result.status == BlockStatus.failed+ assert result.failure_reason is not None+ assert "blocked" in result.failure_reason+ client_session.assert_not_called()+@pytest.mark.asyncioasync def test_execute_records_placeholder_and_masks_duplicate_echo(self, monkeypatch: pytest.MonkeyPatch) -> None:context = _make_context()diff --git a/uv.lock b/uv.lockindex 0da7bc3b4..55c7beff4 100644--- a/uv.lock+++ b/uv.lock@@ -6357,7 +6357,7 @@ wheels = [[[package]]name = "temporalio"-version = "1.26.0"+version = "1.30.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "nexus-rpc" },@@ -6365,13 +6365,13 @@ dependencies = [{ name = "types-protobuf" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/ae/d4/fa21150a225393f87732ed6fef3cc9735d9e751edc6be415fe6e375105c6/temporalio-1.26.0.tar.gz", hash = "sha256:f4bfb35125e6f5e8c7f7ed1277c7354d812c6fac7ed5f8dbd50536cf289aaaa7", size = 2388994, upload-time = "2026-04-15T23:43:00.911Z" }+sdist = { url = "https://files.pythonhosted.org/packages/00/b0/ad8fc3cd7425c6551a637bf23c798e8fdd8eb7a3ec4fee4f46f7678ba8d2/temporalio-1.30.0.tar.gz", hash = "sha256:7c025919511bb465392d547e48ccb85fd560a995db4ebcc82fdb43cddf088e6f", size = 2686876, upload-time = "2026-07-02T21:04:46.713Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/1e/27/8c421c622d18cc8e034247d5d72b89e6456937344b5bec1de40abef3c085/temporalio-1.26.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:5489040c0cf621edeb36984199dd9e4fbd2b3a07d61a4f2a8da1f2cb9820ef26", size = 14221070, upload-time = "2026-04-15T23:42:26.21Z" },- { url = "https://files.pythonhosted.org/packages/49/7c/d2b691d16ec5db87198c2e08dbfba58e286c096faee15753613a581abdce/temporalio-1.26.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:b18dd85771509c19ef059a31908bcd4e6130d1f67037c4db519702f3f2ad6d4a", size = 13583991, upload-time = "2026-04-15T23:42:34.357Z" },- { url = "https://files.pythonhosted.org/packages/05/ca/b8728451320ca9d8bb6e1680b9bd23767118f86d5b8644edf2304d533f1b/temporalio-1.26.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:46187d5f82ca2ae81f35ea5916a76db0e2f067210dc6b1852c3749475721946e", size = 13808036, upload-time = "2026-04-15T23:42:42.757Z" },- { url = "https://files.pythonhosted.org/packages/cb/54/3113f5e0ac58655790abac64656373e06191b351d74bfb94692e81bd6784/temporalio-1.26.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:03300c3e5237443367ac61bb20bd726c656b3daa50310bdd436599d5bdc7cf97", size = 14336604, upload-time = "2026-04-15T23:42:49.851Z" },- { url = "https://files.pythonhosted.org/packages/fd/9b/c50840a26af3587c0c8d9af04d9976743e22496996dc1a377efc75dcd316/temporalio-1.26.0-cp310-abi3-win_amd64.whl", hash = "sha256:1c4a0d82f0a3796cbf78864c799f8dca0b94cdaec68e7b8b224c859005686ec4", size = 14525849, upload-time = "2026-04-15T23:42:57.589Z" },+ { url = "https://files.pythonhosted.org/packages/02/39/842fdffe93388dd30ac12a53a698f71cbfb68b3bc938f30f3e5d6a36d4ad/temporalio-1.30.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:6773a6b708dee7675fcbb681bf28e48337ce43b8467ceba8f903e78ae68909f8", size = 14520026, upload-time = "2026-07-02T21:04:31.384Z" },+ { url = "https://files.pythonhosted.org/packages/40/f3/a2237d5265eb29de591abeac7610a48616b590a1b923b4919f60ee81adfa/temporalio-1.30.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:4038c3ce2d9acc12fef31dd16ef9be8cc7f721672da5662aa05e3942d0b5c9d1", size = 14018523, upload-time = "2026-07-02T21:04:34.405Z" },+ { url = "https://files.pythonhosted.org/packages/e6/57/dc648d812f4c688bd246a616f0d65c5f03b33675df2effb1b480e1df6d21/temporalio-1.30.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:108d1a56e174eabc18add58316084cdead230e239d3df22bbe999d6954986591", size = 14330502, upload-time = "2026-07-02T21:04:37.39Z" },+ { url = "https://files.pythonhosted.org/packages/1c/e1/dbd57de0f5090891850c2ee5490319834a12b704076b11f32a4a149998d4/temporalio-1.30.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47b156138de30c2cd6723d5bfc06a30abcf680344c5481abb31f2a98a9b1f809", size = 14833364, upload-time = "2026-07-02T21:04:40.454Z" },+ { url = "https://files.pythonhosted.org/packages/30/2a/6d41289c11465ba276a8b417f31d2e469f0fe4b8afacd61d5244151c5fce/temporalio-1.30.0-cp310-abi3-win_amd64.whl", hash = "sha256:3adee28d5ec47bd6309a5eeef7b00126373f119bc5c1b058a34de098542f4da7", size = 15181893, upload-time = "2026-07-02T21:04:43.609Z" },][package.optional-dependencies]