Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
SKY-15248 Prove a completed run owns its requested outputs (#8327)
Aaron Perez6a0d992e1912
diff --git a/skyvern/forge/sdk/copilot/agent.py b/skyvern/forge/sdk/copilot/agent.pyindex 14a05f990..095107b93 100644--- a/skyvern/forge/sdk/copilot/agent.py+++ b/skyvern/forge/sdk/copilot/agent.py@@ -50,6 +50,7 @@ from skyvern.forge.sdk.copilot.browser_ablation import (resolve_copilot_tool_surface,)from skyvern.forge.sdk.copilot.build_test_outcome import (+ _TEXT_MAX,_VALUE_EXCERPT_MAX,BuildTestEvidencePacket,BuildTestFailedOperation,@@ -1082,10 +1083,14 @@ def _recorded_build_test_outcome_prompt(ctx: CopilotContext | None) -> str:if not isinstance(fact, dict):continuefields = []- for key in ("output_root", "output_path", "value_status", "reason_code"):+ # block_label included: two blocks can omit the same declared path, and identical+ # rendered lines would name only one of them for repair. Rendered at the ceiling the+ # facts themselves carry, because the line above tells the model to copy output_path+ # verbatim and a clipped path names nothing that exists.+ for key in ("output_root", "output_path", "block_label", "value_status", "reason_code"):value = fact.get(key)if isinstance(value, str) and value.strip():- fields.append(f"{key}={_clean_authoring_repair_prompt_atom(value)}")+ fields.append(f"{key}={_clean_authoring_repair_prompt_atom(value, max_chars=_TEXT_MAX)}")if fields:lines.append(f"- {'; '.join(fields)}")if outcome.workflow_run_id:diff --git a/skyvern/forge/sdk/copilot/build_test_outcome.py b/skyvern/forge/sdk/copilot/build_test_outcome.pyindex 72b4af178..b46c1b08f 100644--- a/skyvern/forge/sdk/copilot/build_test_outcome.py+++ b/skyvern/forge/sdk/copilot/build_test_outcome.py@@ -1001,6 +1001,7 @@ def recorded_outcome_from_run_blocks_result(authored_structure_signature: str | None = None,requested_output_parameter_payloads: Sequence[BuildTestPacketRequestedOutput] | None = None,registered_output_parameter_payloads: Sequence[Mapping[str, object]] | None = None,+ declared_goal_path_omissions: Sequence[Mapping[str, object]] | None = None,unbound_required_parameter_keys: Sequence[str] | None = None,block_parameter_keys: Mapping[str, Sequence[str]] | None = None,block_shape_hashes: Mapping[str, str] | None = None,@@ -1076,14 +1077,20 @@ def recorded_outcome_from_run_blocks_result(registered_output_models.append(BuildTestPacketRegisteredOutput.model_validate(payload))except ValueError:continue- typed_output_omission_facts = (- _typed_requested_output_omission_facts(- requested_output_payloads,- registered_output_models,+ typed_output_omission_facts = _merge_missing_requested_output_facts(+ (+ _typed_requested_output_omission_facts(+ requested_output_payloads,+ registered_output_models,+ authoritative_workflow_run_id,+ )+ if omission_registered_output_payloads is not None+ else []+ ),+ _declared_goal_path_omission_facts(+ declared_goal_path_omissions or [],authoritative_workflow_run_id,- )- if omission_registered_output_payloads is not None- else []+ ),)missing_output_facts = _merge_missing_requested_output_facts(_missing_requested_output_facts(completion_verification, blocks),@@ -2053,25 +2060,33 @@ def _typed_requested_output_omission_facts() -> list[dict[str, object]]:if not workflow_run_id:return []- registered_ids = {- output.output_parameter_id- for output in registered_outputs- if output.workflow_run_id == workflow_run_id and output.output_parameter_id- }+ registered_values_by_id: dict[str, list[JsonValue]] = {}+ for output in registered_outputs:+ if output.workflow_run_id != workflow_run_id or not output.output_parameter_id:+ continue+ registered_values_by_id.setdefault(output.output_parameter_id, []).append(output.value)facts: list[dict[str, object]] = []for requested in requested_outputs:if requested.workflow_run_id != workflow_run_id:continueoutput_parameter_id = requested.output_parameter_idoutput_parameter_key = requested.output_parameter_key- if output_parameter_id in registered_ids:+ registered_values = registered_values_by_id.get(output_parameter_id)+ if registered_values is None:+ reason_code, value_status = "registered_output_missing", "not_registered"+ elif all(value is None for value in registered_values):+ # A retained row proves the block ran, not that it produced what was asked for.+ # Only a null retained value reads as absent: an empty collection is a value the+ # code returned, and whether it is the right answer is the model's call, not this one.+ reason_code, value_status = "registered_output_null", "null_registered_value"+ else:continuefact: dict[str, object] = {"output_path": f"output.{_bounded_ref(output_parameter_key)}","output_root": _bounded_ref(output_parameter_key),"output_parameter_id": _bounded_ref(output_parameter_id),- "reason_code": "registered_output_missing",- "value_status": "not_registered",+ "reason_code": reason_code,+ "value_status": value_status,}block_label = requested.block_labelif block_label:@@ -2080,14 +2095,50 @@ def _typed_requested_output_omission_facts(return sorted(facts, key=lambda item: str(item["output_path"]))+def _declared_goal_path_omission_facts(+ declared_goal_path_omissions: Sequence[Mapping[str, object]],+ workflow_run_id: str,+) -> list[dict[str, object]]:+ """Same-run declared goal-value paths the completed run retained no value for."""+ if not workflow_run_id:+ return []+ facts: list[dict[str, object]] = []+ for omission in declared_goal_path_omissions:+ # The declared path is bounded at the prose ceiling, not the shorter identifier one: the+ # repair prompt tells the model to copy it verbatim, so a clipped path names nothing that+ # exists and costs a repair round. Declared metadata paths carry no length limit of their own.+ output_path = _bounded_text(omission.get("output_path"))+ if not output_path:+ continue+ fact: dict[str, object] = {+ "output_path": output_path,+ "reason_code": "declared_goal_path_absent",+ "value_status": "no_typed_value",+ }+ # A top-level array path such as ``[].number`` has no root to group under. The root is+ # diagnostic grouping only, so its absence must not withhold the path itself.+ output_root = _output_path_root(output_path)+ if output_root:+ fact["output_root"] = output_root+ block_label = _bounded_ref(omission.get("block_label"))+ if block_label:+ fact["block_label"] = block_label+ facts.append(fact)+ return sorted(facts, key=lambda item: str(item["output_path"]))++def _merge_missing_requested_output_facts(- first: Sequence[Mapping[str, object]], second: Sequence[Mapping[str, object]]+ *fact_groups: Sequence[Mapping[str, object]],) -> list[dict[str, object]]:- merged: dict[str, dict[str, object]] = {}- for fact in (*first, *second):+ # Two blocks can declare and omit the same path, so the owning label is part of the identity;+ # a fact with no label keys as before, which keeps cross-source dedup on the path alone.+ merged: dict[tuple[str, str], dict[str, object]] = {}+ for fact in (fact for group in fact_groups for fact in group):output_path = fact.get("output_path")if isinstance(output_path, str) and output_path:- merged.setdefault(output_path, dict(fact))+ block_label = fact.get("block_label")+ key = (output_path, block_label if isinstance(block_label, str) else "")+ merged.setdefault(key, dict(fact))return [merged[key] for key in sorted(merged)]diff --git a/skyvern/forge/sdk/copilot/output_utils.py b/skyvern/forge/sdk/copilot/output_utils.pyindex 273130643..408713f80 100644--- a/skyvern/forge/sdk/copilot/output_utils.py+++ b/skyvern/forge/sdk/copilot/output_utils.py@@ -15,6 +15,7 @@ import structlogfrom skyvern.forge.sdk.agents.context import sanitize_agent_tool_result_for_llm as sanitize_generic_tool_result_for_llmfrom skyvern.forge.sdk.copilot.blocker_signal import CopilotToolBlockerSignal, assert_clean_user_facing_textfrom skyvern.forge.sdk.copilot.build_test_outcome import (+ _TEXT_MAX,BuildTestEvidencePacket,BuildTestFailedOperation,BuildTestPacketLocatorObservation,@@ -927,10 +928,12 @@ def project_build_test_packet_for_llm(packet: BuildTestEvidencePacket) -> BuildTmax_chars=_BUILD_TEST_IDENTIFIER_MAX_CHARS,notices=notices,),+ # A declared goal path is copied back verbatim by the model, so it is bounded at+ # the ceiling the facts carry rather than the shorter identifier one."output_path": _bounded_packet_string(item.output_path,field_name="unfinished_items[].output_path",- max_chars=_BUILD_TEST_IDENTIFIER_MAX_CHARS,+ max_chars=max(_BUILD_TEST_IDENTIFIER_MAX_CHARS, _TEXT_MAX),notices=notices,),"reason_code": _bounded_packet_string(diff --git a/skyvern/forge/sdk/copilot/tools/blockers.py b/skyvern/forge/sdk/copilot/tools/blockers.pyindex f4d26d180..0e68b7a9c 100644--- a/skyvern/forge/sdk/copilot/tools/blockers.py+++ b/skyvern/forge/sdk/copilot/tools/blockers.py@@ -495,15 +495,17 @@ def _iter_goal_value_path_values(value: Any, path_parts: list[str]) -> list[Any]return _iter_goal_value_path_values(next_value, remaining)-def _code_output_goal_paths_have_content(value: Any, goal_value_paths: list[str]) -> bool:+def _unmet_code_output_goal_paths(value: Any, goal_value_paths: list[str]) -> list[str]:+ """The declared goal-value paths this output retained no content for, in declared order."""+ unmet: list[str] = []for path in goal_value_paths:path_parts = _normalize_goal_value_path(path)values = _iter_goal_value_path_values(value, path_parts)if not values and _goal_value_path_targets_registered_download(path):values = _registered_download_output_values(value)if not any(_code_output_goal_path_value_has_content(item) for item in values):- return False- return True+ unmet.append(".".join(path_parts) or path.strip())+ return unmetdef _code_output_goal_path_value_has_content(value: Any) -> bool:@@ -545,17 +547,17 @@ def _allows_post_run_current_page_inspection_budget_bypass(ctx: AgentContext, *,def _analyze_run_blocks(result: dict[str, Any], copilot_ctx: Any | None = None-) -> tuple[str | None, bool, list[dict] | None]:+) -> tuple[str | None, bool, list[dict] | None, list[dict[str, str]]]:"""Single-pass analysis of run result blocks.- Returns ``(anti_bot_match, has_empty_data_blocks, failure_categories)``- by iterating the block list once. When ``data["failure_categories"]`` is- already populated by a structured producer, honor it. Runtime prose and- block source never mint a second classification plane here.+ Returns ``(anti_bot_match, has_empty_data_blocks, failure_categories,+ unmet_goal_path_omissions)`` by iterating the block list once. When+ ``data["failure_categories"]`` is already populated by a structured producer, honor it.+ Runtime prose and block source never mint a second classification plane here."""data = result.get("data")if not isinstance(data, dict):- return None, False, None+ return None, False, None, []anti_bot_match: str | None = None@@ -565,12 +567,11 @@ def _analyze_run_blocks(if isinstance(cat, dict) and trusted_terminal_challenge_category_name(cat) is not None:anti_bot_match = cat.get("reasoning", "anti-bot pattern detected")break- return anti_bot_match, False, precomputed_categories+ return anti_bot_match, False, precomputed_categories, []has_data_blocks = Falseany_data_output = False- missing_metadata_goal_content = False- complete_structured_record_output = False+ unmet_goal_path_omissions: list[dict[str, str]] = []blocks = data.get("blocks")if isinstance(blocks, list):@@ -587,7 +588,8 @@ def _analyze_run_blocks(any_data_output = Trueelif _is_code_block_type(block_type):extracted = block.get("extracted_data")- if extracted is None:+ goal_value_paths = _goal_value_paths_for_code_block(copilot_ctx, block.get("label"))+ if extracted is None and not goal_value_paths:continuedeclared_keys = _declared_code_output_keys(copilot_ctx, block.get("label"))output_parameter_payloads = _workflow_output_parameter_payloads(extracted)@@ -595,8 +597,6 @@ def _analyze_run_blocks(has_data_blocks = Trueif any(_is_meaningful_extracted_data(value) for value in output_parameter_payloads.values()):any_data_output = True- if any(_structured_record_has_goal_content(value) for value in output_parameter_payloads.values()):- complete_structured_record_output = Trueextraction_schema = _extraction_schema_for_code_block(copilot_ctx, block.get("label"))# Array-typed schemas would coerce the keyed dict return to [] (fill_missing_fields), making the# goal-path check below read a real extraction as empty; the keyed-return floor guarantees a dict.@@ -606,12 +606,12 @@ def _analyze_run_blocks(and extraction_schema.get("type") != "array"):extracted = validate_and_fill_extraction_result(extracted, extraction_schema)- goal_value_paths = _goal_value_paths_for_code_block(copilot_ctx, block.get("label"))if goal_value_paths:has_data_blocks = True+ unmet_paths = _unmet_code_output_goal_paths(extracted, goal_value_paths)if (_code_output_has_registered_download_content(extracted)- or _code_output_goal_paths_have_content(extracted, goal_value_paths)+ or not unmet_pathsor _structured_record_has_goal_content(extracted)):any_data_output = True@@ -619,7 +619,11 @@ def _analyze_run_blocks(# Terminal goal paths are conjunctive: one missing# declared field means the block did not prove the# requested outcome, even if another path had data.- missing_metadata_goal_content = True+ label = block.get("label")+ unmet_goal_path_omissions.extend(+ {"block_label": label if isinstance(label, str) else "", "output_path": path}+ for path in unmet_paths+ )# Goal-path contracts supersede the generic collection-shape# fallback below; they are the stronger outcome evidence check.continue@@ -635,28 +639,15 @@ def _analyze_run_blocks(has_data_blocks = Trueif any(_is_meaningful_extracted_data(value) for value in top_level_output_payloads.values()):any_data_output = True- if any(_structured_record_has_goal_content(value) for value in top_level_output_payloads.values()):- complete_structured_record_output = Trueregistered_payloads = _registered_output_parameter_payloads(data)if registered_payloads:has_data_blocks = Truefor registered in registered_payloads:- value = registered.get("value")- if _is_meaningful_extracted_data(value):+ if _is_meaningful_extracted_data(registered.get("value")):any_data_output = True- if _structured_record_has_goal_content(value):- complete_structured_record_output = True- if complete_structured_record_output:- if missing_metadata_goal_content:- LOG.info(- "copilot run evidence: a complete structured-record output suppressed a "- "per-block missing-metadata-goal-content signal",- workflow_run_id=data.get("workflow_run_id"),- )- missing_metadata_goal_content = False- empty_data_blocks = (has_data_blocks and not any_data_output) or missing_metadata_goal_content- return anti_bot_match, empty_data_blocks, None+ empty_data_blocks = (has_data_blocks and not any_data_output) or bool(unmet_goal_path_omissions)+ return anti_bot_match, empty_data_blocks, None, unmet_goal_path_omissionsdef _structured_record_has_goal_content(value: Any) -> bool:diff --git a/skyvern/forge/sdk/copilot/tools/completion.py b/skyvern/forge/sdk/copilot/tools/completion.pyindex 664f590f6..5114e7cc5 100644--- a/skyvern/forge/sdk/copilot/tools/completion.py+++ b/skyvern/forge/sdk/copilot/tools/completion.py@@ -848,7 +848,7 @@ def _is_outcome_evidence_candidate(copilot_ctx: Any, result: dict[str, Any]) ->if not bool(result.get("ok", False)):return Falsestructured_blocker = _run_blocks_structured_blocker_message(result, copilot_ctx)- anti_bot, _empty_data_blocks, _categories = _analyze_run_blocks(result, copilot_ctx)+ anti_bot, _empty_data_blocks, _categories, _goal_path_omissions = _analyze_run_blocks(result, copilot_ctx)if structured_blocker and (anti_bot or _artifact_challenge_flag_from_result(result, copilot_ctx)):return Falsereturn Truediff --git a/skyvern/forge/sdk/copilot/tools/run_execution.py b/skyvern/forge/sdk/copilot/tools/run_execution.pyindex e58d279ca..a49f6bea3 100644--- a/skyvern/forge/sdk/copilot/tools/run_execution.py+++ b/skyvern/forge/sdk/copilot/tools/run_execution.py@@ -3992,7 +3992,9 @@ def _record_run_blocks_result(record_pending_runtime_authoring_repair_context(copilot_ctx, result)structured_blocker = _run_blocks_structured_blocker_message(result, copilot_ctx)- anti_bot_match, empty_data_blocks, failure_categories = _analyze_run_blocks(result, copilot_ctx)+ anti_bot_match, empty_data_blocks, failure_categories, goal_path_omissions = _analyze_run_blocks(+ result, copilot_ctx+ )infrastructure_runner_codes = _infrastructure_runner_error_codes(result)if infrastructure_runner_codes:copilot_ctx.last_infrastructure_tool_error = ", ".join(infrastructure_runner_codes)@@ -4155,7 +4157,7 @@ def _record_run_blocks_result(copilot_ctx.last_good_workflow = copilot_ctx.last_workflowcopilot_ctx.last_good_workflow_yaml = copilot_ctx.last_workflow_yaml_update_verification_evidence_from_run_result(copilot_ctx, result)- _record_build_test_outcome(copilot_ctx, result, recorded_outcome)+ _record_build_test_outcome(copilot_ctx, result, recorded_outcome, goal_path_omissions)return _stash_recorded_run_outcome(copilot_ctx, recorded_outcome)copilot_ctx.last_failed_workflow_yaml = getattr(copilot_ctx, "workflow_yaml", None)@@ -4183,7 +4185,7 @@ def _record_run_blocks_result(workflow_run_id=run_id if isinstance(run_id, str) else None,run_completed=False,)- _record_build_test_outcome(copilot_ctx, result, recorded_outcome)+ _record_build_test_outcome(copilot_ctx, result, recorded_outcome, goal_path_omissions)return _stash_recorded_run_outcome(copilot_ctx, recorded_outcome)@@ -4211,6 +4213,7 @@ def _build_recorded_build_test_outcome(copilot_ctx: CopilotContext,result: dict[str, Any],recorded_run_outcome: RecordedRunOutcome | None,+ declared_goal_path_omissions: Sequence[Mapping[str, str]] | None = None,) -> RecordedBuildTestOutcome | None:raw_result_data = result.get("data")result_data = raw_result_data if isinstance(raw_result_data, dict) else {}@@ -4258,6 +4261,7 @@ def _build_recorded_build_test_outcome(),requested_output_parameter_payloads=requested_output_parameter_payloads,registered_output_parameter_payloads=registered_output_parameter_payloads,+ declared_goal_path_omissions=declared_goal_path_omissions,unbound_required_parameter_keys=list(copilot_ctx.unbound_required_parameter_keys),block_parameter_keys=authored_block_parameter_keys_from_workflow(workflow_yaml,@@ -4272,10 +4276,16 @@ def _record_build_test_outcome(copilot_ctx: CopilotContext,result: dict[str, Any],recorded_run_outcome: RecordedRunOutcome | None,+ declared_goal_path_omissions: Sequence[Mapping[str, str]] | None = None,) -> None:record_build_test_outcome(copilot_ctx,- _build_recorded_build_test_outcome(copilot_ctx, result, recorded_run_outcome),+ _build_recorded_build_test_outcome(+ copilot_ctx,+ result,+ recorded_run_outcome,+ declared_goal_path_omissions,+ ),)@@ -4792,15 +4802,23 @@ def _packet_unfinished_items(if outcome_matches_runelse [])- missing_by_path: dict[str, str | None] = {}+ # Keyed by owning block as well as path: two blocks can omit the same declared path, and+ # collapsing them here would tell repair to fix one and leave the other broken.+ missing_by_path: dict[tuple[str, str | None], str | None] = {}if outcome is not None and outcome.workflow_run_id == run_id:for fact in outcome.missing_requested_output_facts:output_path = _packet_string(fact.get("output_path"))if output_path is not None:- missing_by_path[output_path] = _packet_string(fact.get("reason_code"))+ block_label = _packet_string(fact.get("block_label"))+ missing_by_path[(output_path, block_label)] = _packet_string(fact.get("reason_code"))unfinished.extend(- BuildTestPacketUnfinishedItem(kind="missing_requested_output", output_path=path, reason_code=reason_code)- for path, reason_code in missing_by_path.items()+ BuildTestPacketUnfinishedItem(+ kind="missing_requested_output",+ label=block_label,+ output_path=path,+ reason_code=reason_code,+ )+ for (path, block_label), reason_code in missing_by_path.items())return unfinisheddiff --git a/tests/unit/test_copilot_build_test_outcome.py b/tests/unit/test_copilot_build_test_outcome.pyindex 5907da36d..b425402f0 100644--- a/tests/unit/test_copilot_build_test_outcome.py+++ b/tests/unit/test_copilot_build_test_outcome.py@@ -57,7 +57,9 @@ from skyvern.forge.sdk.copilot.tools.run_execution import (build_test_evidence_packet,)from skyvern.forge.sdk.copilot.workflow_yaml import runner_code_block_associations-from skyvern.forge.sdk.workflow.models.parameter import OutputParameter+from skyvern.forge.sdk.workflow.models.block import CodeBlock+from skyvern.forge.sdk.workflow.models.parameter import OutputParameter, ParameterType+from skyvern.webeye.browser_artifacts import BrowserArtifactsfrom tests.unit.copilot_test_helpers import (failed_second_factor_run,make_stub_html_artifact,@@ -3585,3 +3587,641 @@ def test_the_carried_field_claims_only_that_the_pass_proves_nothing() -> None:assert carried["note"] == "this run passing does not establish that the earlier failure was resolved"for forbidden in ("add", "guard", "should", "must", "conditional", "if "):assert forbidden not in carried["note"].lower(), "the note prescribes a fix"+++def _completed_output_run_result(retained_value: object, *, register_row: bool = True) -> dict[str, object]:+ run_id = "wr_requested_output"+ registered_row = {+ "workflow_run_id": run_id,+ "output_parameter_id": "op_payment_options",+ "output_parameter_key": "collect_options_output",+ "block_label": "collect_options",+ "block_type": "code",+ "value": retained_value,+ }+ return {+ "ok": True,+ "data": {+ "workflow_run_id": run_id,+ "overall_status": "completed",+ "requested_block_labels": ["collect_options"],+ "executed_block_labels": ["collect_options"],+ "blocks": [+ {+ "label": "collect_options",+ "block_type": "code",+ "status": "completed",+ "extracted_data": {"collect_options_output": retained_value},+ }+ ],+ "requested_output_parameter_definitions": [+ {+ "workflow_run_id": run_id,+ "output_parameter_id": "op_payment_options",+ "output_parameter_key": "collect_options_output",+ "block_label": "collect_options",+ "block_type": "code",+ }+ ],+ "registered_output_parameter_values": [registered_row] if register_row else [],+ },+ }+++ ("case", "retained_value", "register_row", "expected_reason_code"),+ [+ ("no_row", {"payment_options": ["Visa"]}, False, "registered_output_missing"),+ ("null_value", None, True, "registered_output_null"),+ # An empty collection is a value the code returned. Whether "no options were offered" is+ # the right answer is the model's call; reporting it absent would invite invented data.+ ("empty_object", {}, True, None),+ ("empty_list", [], True, None),+ ("run_owned_value", {"payment_options": ["Visa", "PayPal"]}, True, None),+ ],+)+def test_a_completed_run_that_retained_no_requested_output_value_returns_to_ordinary_repair(+ case: str,+ retained_value: object,+ register_row: bool,+ expected_reason_code: str | None,+) -> None:+ """A retained row proves the block ran; it is not proof the requested output was produced."""+ result = _completed_output_run_result(retained_value, register_row=register_row)+ data = result["data"]+ assert isinstance(data, dict)++ outcome = recorded_outcome_from_run_blocks_result(+ result,+ recorded_run_outcome=RecordedRunOutcome(+ verdict="not_evaluated",+ workflow_run_id="wr_requested_output",+ run_completed=True,+ ),+ registered_output_parameter_payloads=data["registered_output_parameter_values"],+ )+ assert outcome is not None+ packet = project_build_test_packet_for_llm(+ build_test_evidence_packet(_locator_packet_ctx(), result, recorded_outcome=outcome)+ ).model_dump(mode="json", exclude_none=True)+ ordinary_input = _build_user_context(+ workflow_yaml="",+ chat_history_text="",+ global_llm_context="",+ debug_run_info_text=_prior_run_debug_text(packet),+ user_message="Repair the recorded run.",+ )++ if expected_reason_code is None:+ assert outcome.missing_requested_output_facts == []+ assert outcome.verdict == "not_authoritative"+ assert packet["unfinished_items"] == []+ if case == "run_owned_value":+ assert '"payment_options"' in ordinary_input, "the run-owned value is not handed back"+ return++ assert outcome.verdict == "repairable_failure"+ assert outcome.reason_code == "no_meaningful_output"+ assert outcome.is_authoritative is True+ assert [fact["reason_code"] for fact in outcome.missing_requested_output_facts] == [expected_reason_code]+ assert [fact["output_path"] for fact in outcome.missing_requested_output_facts] == ["output.collect_options_output"]+ assert {+ "kind": "missing_requested_output",+ "label": "collect_options",+ "output_path": "output.collect_options_output",+ "reason_code": expected_reason_code,+ } in packet["unfinished_items"]+ assert '"output_path": "output.collect_options_output"' in ordinary_input+ assert f'"reason_code": "{expected_reason_code}"' in ordinary_input+++def test_a_declared_goal_path_the_run_left_empty_reaches_repair_and_the_latch_from_one_source() -> None:+ """The terminal latch and ordinary repair read the same unmet declared goal paths."""+ run_id = "wr_goal_paths"+ ctx = _locator_packet_ctx()+ ctx.code_artifact_metadata = {+ "collect_options": {+ "claimed_outcomes": [+ {"id": "options", "goal_value_paths": ["$.payment_options", "$.cart_line_item"]},+ ]+ }+ }+ retained_value = {"url": "https://example.test/cart", "actions": ["click", "click"], "payment_options": ["Visa"]}+ result: dict[str, object] = {+ "ok": True,+ "data": {+ "workflow_run_id": run_id,+ "overall_status": "completed",+ "requested_block_labels": ["collect_options"],+ "executed_block_labels": ["collect_options"],+ "blocks": [+ {+ "label": "collect_options",+ "block_type": "code",+ "status": "completed",+ "extracted_data": retained_value,+ }+ ],+ },+ }++ _anti_bot, empty_data_blocks, _categories, goal_path_omissions = run_execution_module._analyze_run_blocks(+ result, ctx+ )+ outcome = recorded_outcome_from_run_blocks_result(+ result,+ recorded_run_outcome=RecordedRunOutcome(verdict="not_evaluated", workflow_run_id=run_id, run_completed=True),+ declared_goal_path_omissions=goal_path_omissions,+ )+ assert outcome is not None+ packet = project_build_test_packet_for_llm(+ build_test_evidence_packet(ctx, result, recorded_outcome=outcome)+ ).model_dump(mode="json", exclude_none=True)++ # The latch already refused this run; the same unmet paths now reach repair by name.+ assert empty_data_blocks is True+ assert goal_path_omissions == [{"block_label": "collect_options", "output_path": "cart_line_item"}]+ assert outcome.verdict == "repairable_failure"+ assert outcome.reason_code == "no_meaningful_output"+ assert outcome.missing_requested_output_facts == [+ {+ "output_path": "cart_line_item",+ "output_root": "cart_line_item",+ "reason_code": "declared_goal_path_absent",+ "value_status": "no_typed_value",+ "block_label": "collect_options",+ }+ ]+ assert {+ "kind": "missing_requested_output",+ "label": "collect_options",+ "output_path": "cart_line_item",+ "reason_code": "declared_goal_path_absent",+ } in packet["unfinished_items"]++ satisfied_result = json.loads(json.dumps(result))+ satisfied_result["data"]["blocks"][0]["extracted_data"]["cart_line_item"] = {"qty": 1}+ _anti_bot, satisfied_empty, _categories, satisfied_omissions = run_execution_module._analyze_run_blocks(+ satisfied_result, ctx+ )+ assert satisfied_empty is False+ assert satisfied_omissions == []+++def test_a_top_level_array_goal_path_is_not_dropped_for_having_no_root() -> None:+ """``$[*].number`` normalizes to ``[].number``, whose root is empty; the path still binds."""+ run_id = "wr_array_goal_path"+ ctx = _locator_packet_ctx()+ ctx.code_artifact_metadata = {+ "collect_rows": {"claimed_outcomes": [{"id": "rows", "goal_value_paths": ["$[*].number"]}]}+ }+ result: dict[str, object] = {+ "ok": True,+ "data": {+ "workflow_run_id": run_id,+ "overall_status": "completed",+ "requested_block_labels": ["collect_rows"],+ "executed_block_labels": ["collect_rows"],+ "blocks": [+ {+ "label": "collect_rows",+ "block_type": "code",+ "status": "completed",+ "extracted_data": {"url": "https://example.test/rows"},+ }+ ],+ },+ }++ _anti_bot, empty_data_blocks, _categories, goal_path_omissions = run_execution_module._analyze_run_blocks(+ result, ctx+ )+ outcome = recorded_outcome_from_run_blocks_result(+ result,+ recorded_run_outcome=RecordedRunOutcome(verdict="not_evaluated", workflow_run_id=run_id, run_completed=True),+ declared_goal_path_omissions=goal_path_omissions,+ )+ assert outcome is not None++ assert empty_data_blocks is True+ assert outcome.verdict == "repairable_failure"+ assert outcome.missing_requested_output_facts == [+ {+ "output_path": "[].number",+ "reason_code": "declared_goal_path_absent",+ "value_status": "no_typed_value",+ "block_label": "collect_rows",+ }+ ]+++def test_two_blocks_omitting_the_same_declared_path_both_reach_repair() -> None:+ """Deduping on the path alone would repair one block and leave the other silently broken."""+ run_id = "wr_shared_goal_path"+ ctx = _locator_packet_ctx()+ ctx.code_artifact_metadata = {+ label: {"claimed_outcomes": [{"id": label, "goal_value_paths": ["$.status"]}]}+ for label in ("collect_first", "collect_second")+ }+ result: dict[str, object] = {+ "ok": True,+ "data": {+ "workflow_run_id": run_id,+ "overall_status": "completed",+ "requested_block_labels": ["collect_first", "collect_second"],+ "executed_block_labels": ["collect_first", "collect_second"],+ "blocks": [+ {+ "label": label,+ "block_type": "code",+ "status": "completed",+ "extracted_data": {"url": f"https://example.test/{label}"},+ }+ for label in ("collect_first", "collect_second")+ ],+ },+ }++ _anti_bot, _empty, _categories, goal_path_omissions = run_execution_module._analyze_run_blocks(result, ctx)+ outcome = recorded_outcome_from_run_blocks_result(+ result,+ recorded_run_outcome=RecordedRunOutcome(verdict="not_evaluated", workflow_run_id=run_id, run_completed=True),+ declared_goal_path_omissions=goal_path_omissions,+ )+ assert outcome is not None++ assert [(fact["output_path"], fact["block_label"]) for fact in outcome.missing_requested_output_facts] == [+ ("status", "collect_first"),+ ("status", "collect_second"),+ ]++ # Retaining both facts is only half the fix: repair must be able to tell them apart.+ packet = project_build_test_packet_for_llm(+ build_test_evidence_packet(ctx, result, recorded_outcome=outcome)+ ).model_dump(mode="json", exclude_none=True)+ assert [+ (item["output_path"], item["label"])+ for item in packet["unfinished_items"]+ if item["kind"] == "missing_requested_output"+ ] == [("status", "collect_first"), ("status", "collect_second")]++ ctx.latest_recorded_build_test_outcome = outcome+ ctx.block_authoring_policy = BlockAuthoringPolicy.CODE_ONLY_BROWSER+ rendered = _recorded_build_test_outcome_prompt(ctx)+ assert "block_label=collect_first" in rendered+ assert "block_label=collect_second" in rendered+++def test_a_long_declared_goal_path_reaches_repair_uncut() -> None:+ """The prompt tells the model to copy output_path verbatim; a clipped path names nothing."""+ run_id = "wr_long_goal_path"+ long_path = "$.checkout.summary." + ".".join(f"level_{index:02d}" for index in range(15)) + ".amount_due"+ normalized = long_path.removeprefix("$.")+ # Wider than every ceiling the path crosses on its way to the model, and inside the one the+ # facts themselves carry, so a survivor proves the projections and not a shorter fixture.+ assert 160 < len(normalized) <= 180, "the fixture must exceed every downstream bound"++ ctx = _locator_packet_ctx()+ ctx.code_artifact_metadata = {+ "collect_total": {"claimed_outcomes": [{"id": "total", "goal_value_paths": [long_path]}]}+ }+ result: dict[str, object] = {+ "ok": True,+ "data": {+ "workflow_run_id": run_id,+ "overall_status": "completed",+ "requested_block_labels": ["collect_total"],+ "executed_block_labels": ["collect_total"],+ "blocks": [+ {+ "label": "collect_total",+ "block_type": "code",+ "status": "completed",+ "extracted_data": {"url": "https://example.test/checkout"},+ }+ ],+ },+ }++ _anti_bot, _empty, _categories, goal_path_omissions = run_execution_module._analyze_run_blocks(result, ctx)+ outcome = recorded_outcome_from_run_blocks_result(+ result,+ recorded_run_outcome=RecordedRunOutcome(verdict="not_evaluated", workflow_run_id=run_id, run_completed=True),+ declared_goal_path_omissions=goal_path_omissions,+ )+ assert outcome is not None++ assert [fact["output_path"] for fact in outcome.missing_requested_output_facts] == [normalized]++ packet = project_build_test_packet_for_llm(+ build_test_evidence_packet(ctx, result, recorded_outcome=outcome)+ ).model_dump(mode="json", exclude_none=True)+ assert [+ item["output_path"] for item in packet["unfinished_items"] if item["kind"] == "missing_requested_output"+ ] == [normalized]++ ctx.latest_recorded_build_test_outcome = outcome+ ctx.block_authoring_policy = BlockAuthoringPolicy.CODE_ONLY_BROWSER+ assert f"output_path={normalized}" in _recorded_build_test_outcome_prompt(ctx)+++def _goal_path_run_result(run_id: str, blocks: list[dict[str, object]]) -> dict[str, object]:+ labels = [str(block["label"]) for block in blocks]+ return {+ "ok": True,+ "data": {+ "workflow_run_id": run_id,+ "overall_status": "completed",+ "requested_block_labels": labels,+ "executed_block_labels": labels,+ "blocks": blocks,+ },+ }+++def test_a_sibling_blocks_complete_record_does_not_clear_another_blocks_omission() -> None:+ """A run must not be credited for a path one block omitted because a different block proved its own."""+ run_id = "wr_sibling_record"+ ctx = _locator_packet_ctx()+ ctx.code_artifact_metadata = {+ "collect_options": {+ "claimed_outcomes": [{"id": "options", "goal_value_paths": ["$.payment_options", "$.cart_line_item"]}]+ }+ }+ result = _goal_path_run_result(+ run_id,+ [+ {+ "label": "collect_options",+ "block_type": "code",+ "status": "completed",+ "extracted_data": {+ "url": "https://example.test/cart",+ "actions": ["click", "click"],+ "payment_options": ["Visa"],+ },+ },+ {+ "label": "lookup_record",+ "block_type": "code",+ "status": "completed",+ "extracted_data": {+ "lookup_record_output": {+ "entity_found": True,+ "entity_name": "Jordan Example",+ "record_number": "1234567890",+ "items": [{"item_label": "Sample Practice", "status": "Active"}],+ "overall_status": "Active",+ }+ },+ },+ ],+ )++ _anti_bot, empty_data_blocks, _categories, goal_path_omissions = run_execution_module._analyze_run_blocks(+ result, ctx+ )+ outcome = recorded_outcome_from_run_blocks_result(+ result,+ recorded_run_outcome=RecordedRunOutcome(verdict="not_evaluated", workflow_run_id=run_id, run_completed=True),+ declared_goal_path_omissions=goal_path_omissions,+ )+ assert outcome is not None++ assert goal_path_omissions == [{"block_label": "collect_options", "output_path": "cart_line_item"}]+ assert empty_data_blocks is True+ assert outcome.verdict == "repairable_failure"++ ctx.latest_recorded_build_test_outcome = outcome+ ctx.block_authoring_policy = BlockAuthoringPolicy.CODE_ONLY_BROWSER+ rendered = _recorded_build_test_outcome_prompt(ctx)+ assert "output_path=cart_line_item" in rendered+ assert "block_label=collect_options" in rendered+++def test_a_completed_block_that_retained_nothing_at_all_reports_every_declared_path() -> None:+ """Retaining no output is the strongest omission there is; it must not skip the arm that records it."""+ run_id = "wr_null_extracted"+ ctx = _locator_packet_ctx()+ ctx.code_artifact_metadata = {+ "collect_options": {+ "claimed_outcomes": [{"id": "options", "goal_value_paths": ["$.payment_options", "$.cart_line_item"]}]+ }+ }+ result = _goal_path_run_result(+ run_id,+ [{"label": "collect_options", "block_type": "code", "status": "completed", "extracted_data": None}],+ )++ _anti_bot, empty_data_blocks, _categories, goal_path_omissions = run_execution_module._analyze_run_blocks(+ result, ctx+ )+ outcome = recorded_outcome_from_run_blocks_result(+ result,+ recorded_run_outcome=RecordedRunOutcome(verdict="not_evaluated", workflow_run_id=run_id, run_completed=True),+ declared_goal_path_omissions=goal_path_omissions,+ )+ assert outcome is not None++ assert empty_data_blocks is True+ assert [omission["output_path"] for omission in goal_path_omissions] == ["payment_options", "cart_line_item"]+ assert outcome.verdict == "repairable_failure"++ packet = project_build_test_packet_for_llm(+ build_test_evidence_packet(ctx, result, recorded_outcome=outcome)+ ).model_dump(mode="json", exclude_none=True)+ assert sorted(+ item["output_path"] for item in packet["unfinished_items"] if item["kind"] == "missing_requested_output"+ ) == ["cart_line_item", "payment_options"]+++class _CheckoutPage:+ """The focused local fixture the repaired block reads; no browser, no network."""++ _TEXT = {+ "#cart-line-item": "Running Jacket / Size M / Qty 1 / 88.00",+ "#payment-methods": "Card, Wallet, Pay in 4",+ "#selected-product": "Running Jacket",+ }++ async def inner_text(self, selector: str) -> str:+ return self._TEXT[selector]+++_UNREPAIRED_CODE = """+url = "https://example.test/checkout"+actions = ["goto", "click", "click"]+"""++_REPAIRED_CODE = """+url = "https://example.test/checkout"+actions = ["goto", "click", "click"]+line_item_text = await page.inner_text("#cart-line-item")+name, size, quantity, price = [part.strip() for part in line_item_text.split("/")]+cart_line_item = {"name": name, "size": size, "quantity": quantity, "price": price}+payment_options = [option.strip() for option in (await page.inner_text("#payment-methods")).split(",")]+selection_output = {"product": await page.inner_text("#selected-product"), "price": price}+"""+++async def _execute_code_block(monkeypatch: pytest.MonkeyPatch, code: str) -> dict[str, object]:+ """Run the block through the real CodeBlock executor and return the output it produced."""++ class FakeBrowserState:+ def __init__(self) -> None:+ self.browser_artifacts = BrowserArtifacts()++ async def get_working_page(self) -> object:+ return _CheckoutPage()++ class FakeWorkflowRunContext:+ values: dict[str, object] = {}+ secrets: dict[str, object] = {}+ include_secrets_in_templates = False+ organization_id = None+ workflow_title = "Checkout"+ workflow_id = "w_checkout"+ workflow_permanent_id = "wpid_checkout"+ workflow_run_id = "wr_executor_witness"+ browser_session_id = None+ workflow_run_outputs: list[object] = []++ def get_block_metadata(self, label: str | None) -> dict[str, object]:+ return {}++ def build_workflow_run_summary(self) -> str:+ return ""++ def mask_secrets_in_data(self, data: object, mask: str = "*****") -> object:+ return data++ async def noop(*args: object, **kwargs: object) -> None:+ return None++ async def browser_state(*args: object, **kwargs: object) -> FakeBrowserState:+ return FakeBrowserState()++ monkeypatch.setattr("skyvern.forge.sdk.workflow.models.block.app.AGENT_FUNCTION.validate_code_block", noop)+ monkeypatch.setattr(CodeBlock, "get_or_create_browser_state", browser_state)+ monkeypatch.setattr(CodeBlock, "get_workflow_run_context", lambda *args: FakeWorkflowRunContext())+ monkeypatch.setattr(CodeBlock, "record_output_parameter_value", noop)++ now = datetime.now(UTC)+ block = CodeBlock(+ label="collect_payment_options",+ code=code,+ output_parameter=OutputParameter(+ parameter_type=ParameterType.OUTPUT,+ key="collect_payment_options_output",+ description="checkout facts",+ output_parameter_id="op_checkout",+ workflow_id="w_checkout",+ created_at=now,+ modified_at=now,+ ),+ )+ result = await block.execute(workflow_run_id="wr_executor_witness", workflow_run_block_id="")+ assert result.success is True, "the fixture block must execute"+ assert isinstance(result.output_parameter_value, dict)+ return result.output_parameter_value+++def _executor_witness_ctx() -> CopilotContext:+ ctx = _locator_packet_ctx()+ ctx.block_authoring_policy = BlockAuthoringPolicy.CODE_ONLY_BROWSER+ ctx.code_artifact_metadata = {+ "collect_payment_options": {+ "claimed_outcomes": [+ {+ "id": "checkout",+ "goal_value_paths": ["$.cart_line_item", "$.payment_options", "$.selection_output"],+ }+ ]+ }+ }+ return ctx+++async def test_the_repaired_block_executes_and_the_run_owns_the_outputs_it_was_asked_for(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """The whole chain on executed code: a completed run that owns nothing names the paths it owes,+ and the repaired block's own execution output clears them."""+ before_output = await _execute_code_block(monkeypatch, _UNREPAIRED_CODE)+ after_output = await _execute_code_block(monkeypatch, _REPAIRED_CODE)++ # The outputs under test came out of the executor, not out of a fixture file.+ assert set(before_output) == {"url", "actions"}+ assert after_output["payment_options"] == ["Card", "Wallet", "Pay in 4"]+ assert after_output["cart_line_item"] == {+ "name": "Running Jacket",+ "size": "Size M",+ "quantity": "Qty 1",+ "price": "88.00",+ }++ def recorded(output: dict[str, object]) -> tuple[CopilotContext, object]:+ ctx = _executor_witness_ctx()+ result = {+ "ok": True,+ "data": {+ "workflow_run_id": "wr_executor_witness",+ "overall_status": "completed",+ "requested_block_labels": ["collect_payment_options"],+ "executed_block_labels": ["collect_payment_options"],+ "blocks": [+ {+ "label": "collect_payment_options",+ "block_type": "code",+ "status": "completed",+ "extracted_data": output,+ }+ ],+ # The value the executor produced, on the surface the runtime registers it on.+ "registered_output_parameter_values": [+ {+ "workflow_run_id": "wr_executor_witness",+ "output_parameter_id": "op_checkout",+ "output_parameter_key": "collect_payment_options_output",+ "block_label": "collect_payment_options",+ "block_type": "code",+ "value": output,+ }+ ],+ },+ }+ run_execution_module._record_run_blocks_result(ctx, result, completion_verification=None)+ return ctx, result++ before_ctx, _before_result = recorded(before_output)+ after_ctx, after_result = recorded(after_output)++ before_outcome = before_ctx.latest_recorded_build_test_outcome+ assert before_outcome is not None+ assert before_outcome.verdict == "repairable_failure"+ assert sorted(fact["output_path"] for fact in before_outcome.missing_requested_output_facts) == [+ "cart_line_item",+ "payment_options",+ "selection_output",+ ]+ rendered = _recorded_build_test_outcome_prompt(before_ctx)+ for path in ("cart_line_item", "payment_options", "selection_output"):+ assert f"output_path={path}" in rendered++ after_outcome = after_ctx.latest_recorded_build_test_outcome+ assert after_outcome is not None+ assert after_outcome.missing_requested_output_facts == []+ assert after_outcome.verdict == "not_authoritative"++ # The corrected run hands back the values its own code produced.+ packet = project_build_test_packet_for_llm(+ build_test_evidence_packet(after_ctx, after_result, recorded_outcome=after_outcome)+ ).model_dump(mode="json", exclude_none=True)+ assert packet["unfinished_items"] == []+ run_owned = [+ output["value"]+ for output in packet["registered_outputs"]+ if output["output_parameter_key"] == "collect_payment_options_output"+ ]+ assert run_owned == [after_output], "the corrected run does not hand back the output its code produced"diff --git a/tests/unit/test_copilot_enforcement_pruning.py b/tests/unit/test_copilot_enforcement_pruning.pyindex 5af4387a3..e59083929 100644--- a/tests/unit/test_copilot_enforcement_pruning.py+++ b/tests/unit/test_copilot_enforcement_pruning.py@@ -330,14 +330,16 @@ _EXTRACTION_ENVELOPE_CASES: list[tuple[str, dict[str, Any], bool]] = [ids=[case_id for case_id, _, _ in _EXTRACTION_ENVELOPE_CASES],)def test_analyze_extraction_envelope(overrides: dict[str, Any], expected_empty: bool) -> None:- _, empty, _ = _analyze_run_blocks(_run_result([_extraction_block(_envelope(**overrides))]))+ _, empty, _, _ = _analyze_run_blocks(_run_result([_extraction_block(_envelope(**overrides))]))assert empty is expected_emptydef test_analyze_text_prompt_default_schema_is_not_empty() -> None:# TEXT_PROMPT blocks return the raw LLM response dict (no Task envelope).# Default schema is {"llm_response": "<text>"}.- _, empty, _ = _analyze_run_blocks(_run_result([_text_prompt_block({"llm_response": "the sentiment is positive"})]))+ _, empty, _, _ = _analyze_run_blocks(+ _run_result([_text_prompt_block({"llm_response": "the sentiment is positive"})])+ )assert empty is False@@ -346,14 +348,14 @@ def test_analyze_text_prompt_user_schema_named_extracted_information_is_not_slic# top-level field "extracted_information". The helper must not mistake# that for an EXTRACTION envelope and discard sibling fields.block = _text_prompt_block({"extracted_information": "ignored because this is TEXT_PROMPT", "summary": "x"})- _, empty, _ = _analyze_run_blocks(_run_result([block]))+ _, empty, _, _ = _analyze_run_blocks(_run_result([block]))assert empty is Falsedef test_analyze_text_prompt_all_null_is_empty() -> None:# Symmetric to {"price": None} — a text-prompt response with all-null# fields counts as no meaningful output.- _, empty, _ = _analyze_run_blocks(_run_result([_text_prompt_block({"summary": None})]))+ _, empty, _, _ = _analyze_run_blocks(_run_result([_text_prompt_block({"summary": None})]))assert empty is Truediff --git a/tests/unit/test_copilot_parameter_binding.py b/tests/unit/test_copilot_parameter_binding.pyindex 60d35fc60..bafe19672 100644--- a/tests/unit/test_copilot_parameter_binding.py+++ b/tests/unit/test_copilot_parameter_binding.py@@ -86,7 +86,7 @@ def test_analyze_run_blocks_returns_precomputed_categories() -> None:],},}- anti_bot, empty_data, categories = _analyze_run_blocks(result)+ anti_bot, empty_data, categories, _ = _analyze_run_blocks(result)assert categories is not Noneassert categories[0]["category"] == "PARAMETER_BINDING_ERROR"assert anti_bot is None@@ -109,7 +109,7 @@ def test_analyze_run_blocks_does_not_classify_unstructured_failure_prose() -> No],},}- _, _, categories = _analyze_run_blocks(result)+ _, _, categories, _ = _analyze_run_blocks(result)assert categories is Nonediff --git a/tests/unit/test_copilot_run_output_content_gate.py b/tests/unit/test_copilot_run_output_content_gate.pyindex 8c167a6ab..1a30ef7ef 100644--- a/tests/unit/test_copilot_run_output_content_gate.py+++ b/tests/unit/test_copilot_run_output_content_gate.py@@ -657,7 +657,7 @@ def test_genuine_success_run_keeps_clean_path() -> None:ctx = _ctx(result["data"]["blocks"])assert _run_blocks_structured_blocker_message(result) is None- _, empty_data_blocks, _ = _analyze_run_blocks(result)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result)assert empty_data_blocks is Falseassert _is_outcome_evidence_candidate(ctx, result) is True@@ -671,7 +671,7 @@ def test_nested_code_output_record_is_meaningful_and_not_suspicious_when_verifieresult = _nested_code_output_extraction_run_result()ctx = _ctx(result["data"]["blocks"])- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Falseassert _is_outcome_evidence_candidate(ctx, result) is True@@ -691,7 +691,7 @@ def test_registered_code_output_parameter_record_is_meaningful() -> None:result = _registered_code_output_parameter_run_result()ctx = _ctx([])- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is False@@ -703,7 +703,7 @@ def test_registered_code_output_parameter_record_is_current_run_scoped() -> None)["data"]["registered_output_parameter_values"]ctx = _ctx(result["data"]["blocks"])- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is True@@ -712,7 +712,7 @@ def test_structured_record_top_level_output_record_is_meaningful() -> None:result = _structured_record_qa_top_level_output_run_result()ctx = _ctx(result["data"]["blocks"])- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Falseassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1029,7 +1029,7 @@ def test_satisfied_interactive_completion_does_not_make_empty_output_terminal_reresult = _empty_extraction_run_result()ctx = _ctx(result["data"]["blocks"])- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is True_record_run_blocks_result(ctx, result, completion_verification=_satisfied("c0"))@@ -1064,7 +1064,7 @@ def test_all_null_metadata_goal_fields_are_flagged_as_no_goal_content() -> None:ctx.code_artifact_metadata = {"expand_result_rows": _terminal_metadata_with_goal_fields()}assert _run_blocks_structured_blocker_message(result) is None- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is True# Empty output remains a factual test-readiness floor. It does not invoke an# interactive outcome judge or convert the completed platform run to failure.@@ -1083,7 +1083,7 @@ def test_metadata_goal_fields_with_values_keep_clean_path() -> None:ctx = _ctx(result["data"]["blocks"])ctx.code_artifact_metadata = {"expand_result_rows": _terminal_metadata_with_goal_fields()}- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Falseassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1099,7 +1099,7 @@ def test_metadata_boolean_goal_paths_count_as_present_content() -> None:ctx = _ctx(result["data"]["blocks"])ctx.code_artifact_metadata = {"inspect_access_path": _terminal_metadata_with_boolean_goal_fields()}- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Falseassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1109,7 +1109,7 @@ def test_path_summary_goal_paths_with_boolean_flags_keep_clean_path() -> None:ctx = _ctx(result["data"]["blocks"])ctx.code_artifact_metadata = {"inspect_access_path": _terminal_metadata_with_path_summary_goal_fields()}- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Falseassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1119,7 +1119,7 @@ def test_goal_path_alias_without_exact_declared_path_is_flagged_as_no_goal_contectx = _ctx(result["data"]["blocks"])ctx.code_artifact_metadata = {"inspect_access_path": _terminal_metadata_with_path_summary_goal_fields()}- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Trueassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1129,7 +1129,7 @@ def test_null_goal_path_value_does_not_fall_back_to_alias_field() -> None:ctx = _ctx(result["data"]["blocks"])ctx.code_artifact_metadata = {"inspect_access_path": _terminal_metadata_with_path_summary_goal_fields()}- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Trueassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1139,7 +1139,7 @@ def test_partial_metadata_goal_fields_are_flagged_as_no_goal_content() -> None:ctx = _ctx(result["data"]["blocks"])ctx.code_artifact_metadata = {"expand_result_rows": _terminal_metadata_with_goal_fields()}- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Trueassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1153,7 +1153,7 @@ def test_top_level_array_goal_value_paths_keep_clean_path() -> None:ctx = _ctx(result["data"]["blocks"])ctx.code_artifact_metadata = {"expand_result_rows": _terminal_metadata_with_top_level_goal_fields()}- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Falseassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1182,7 +1182,7 @@ def test_downloaded_files_satisfy_registered_download_goal_paths() -> None:]ctx.code_artifact_metadata = {"download_statement": entry}- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Falseassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1197,7 +1197,7 @@ def test_array_goal_value_path_does_not_match_scalar_root() -> None:ctx = _ctx(result["data"]["blocks"])ctx.code_artifact_metadata = {"expand_result_rows": _terminal_metadata_with_top_level_goal_fields()}- _, empty_data_blocks, _ = _analyze_run_blocks(result, ctx)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, ctx)assert empty_data_blocks is Trueassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1219,7 +1219,7 @@ def test_empty_goal_collections_without_blocker_are_flagged() -> None:ctx = _ctx(result["data"]["blocks"])assert _run_blocks_structured_blocker_message(result) is None- _, empty_data_blocks, _ = _analyze_run_blocks(result)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result)assert empty_data_blocks is Trueassert _is_outcome_evidence_candidate(ctx, result) is True@@ -1231,7 +1231,7 @@ def test_empty_goal_collections_without_blocker_are_flagged() -> None:def test_neutral_status_string_does_not_redeem_empty_collections() -> None:result = _run_result([_code_block("search_registry_person", {"status": "completed", "records": []})])- _, empty_data_blocks, _ = _analyze_run_blocks(result)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result)assert empty_data_blocks is True@@ -1244,7 +1244,7 @@ def test_falsy_blocker_flags_and_action_only_outputs_do_not_trip() -> None:])assert _run_blocks_structured_blocker_message(result) is None- _, empty_data_blocks, _ = _analyze_run_blocks(result)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result)assert empty_data_blocks is False@@ -1268,7 +1268,7 @@ def test_verification_key_counts_as_goal_content_for_code_outputs() -> None:[_code_block("verify_listing", {"verification_results": [{"name": "DOE, JANE", "verified": True}]})])assert _run_blocks_structured_blocker_message(result) is None- _, empty_data_blocks, _ = _analyze_run_blocks(result)+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result)assert empty_data_blocks is False@@ -1316,7 +1316,7 @@ def test_declared_outcome_keys_exempt_from_blocker_term_matching() -> None:result = _run_result([block])assert _run_blocks_structured_blocker_message(result) is not Noneassert _run_blocks_structured_blocker_message(result, _MetadataCtx(metadata)) is None- _, empty_data_blocks, _ = _analyze_run_blocks(result, _MetadataCtx(metadata))+ _, empty_data_blocks, _, _ = _analyze_run_blocks(result, _MetadataCtx(metadata))assert empty_data_blocks is False