From b7b9770bba1d77b360aecd3df1c4d0029a1d23c5 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 15:55:00 -0700 Subject: [PATCH 01/16] refactor: consolidate recipe terminal targets --- src/autoskillit/core/types/recipe/_type_recipe_binding.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/autoskillit/core/types/recipe/_type_recipe_binding.py b/src/autoskillit/core/types/recipe/_type_recipe_binding.py index 8b04ea4214..d97e38944b 100644 --- a/src/autoskillit/core/types/recipe/_type_recipe_binding.py +++ b/src/autoskillit/core/types/recipe/_type_recipe_binding.py @@ -61,9 +61,6 @@ class ReadingToken: BoundScalar: TypeAlias = str | int | bool -_TERMINAL_BYPASS_TARGETS = frozenset({"done", "escalate"}) - - RECIPE_TERMINAL_TARGETS: frozenset[str] = frozenset({"done", "escalate"}) @@ -595,7 +592,7 @@ def _validate_projection_guards( raise ValueError("FinalizedRecipeProjection guards must name finalized steps") if any( guard.bypass_target not in ordered_step_names - and guard.bypass_target not in _TERMINAL_BYPASS_TARGETS + and guard.bypass_target not in RECIPE_TERMINAL_TARGETS for guard in guards ): raise ValueError( From 243b620b610789a4b96213ad2dcdf0a64d5a241f Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 16:06:59 -0700 Subject: [PATCH 02/16] fix: bind planner dispatch items to declared producers --- .../core/types/recipe/_type_recipe_binding.py | 2 + src/autoskillit/recipe/_binding.py | 4 +- src/autoskillit/recipe/_binding_input.py | 129 ++++++++ .../recipe/contracts/_contracts_types.py | 23 ++ src/autoskillit/recipe/rules/rules_inputs.py | 12 +- tests/recipe/test_contracts_types.py | 31 ++ tests/recipe/test_dispatch_item_binding.py | 281 ++++++++++++++++++ tests/recipe/test_planner_recipe.py | 38 ++- tests/recipe/test_rules_contracts.py | 50 ++++ .../recipe/test_rules_skill_input_template.py | 117 +++++++- .../test_runtime_skill_invocation_binding.py | 5 +- .../test_attestation_delivery_reachability.py | 70 +++-- .../server/test_attested_admission_replay.py | 159 ++++++---- ...st_attested_param_admission_conformance.py | 50 ++-- ...t_recipe_execution_receipt_completeness.py | 70 +++-- 15 files changed, 896 insertions(+), 145 deletions(-) create mode 100644 tests/recipe/test_dispatch_item_binding.py diff --git a/src/autoskillit/core/types/recipe/_type_recipe_binding.py b/src/autoskillit/core/types/recipe/_type_recipe_binding.py index d97e38944b..64939cf251 100644 --- a/src/autoskillit/core/types/recipe/_type_recipe_binding.py +++ b/src/autoskillit/core/types/recipe/_type_recipe_binding.py @@ -288,6 +288,7 @@ class BoundValueOrigin(StrEnum): RECIPE_INPUT = "recipe_input" CONTEXT = "context" TEMPLATE = "template" + DISPATCH_ITEM = "dispatch_item" ABSENT = "absent" @@ -376,6 +377,7 @@ class BindingFailureCode(StrEnum): AMBIGUOUS_SKILL_INPUT = "ambiguous_skill_input" INVALID_SKILL_INPUT_TYPE = "invalid_skill_input_type" INVALID_SKILL_COMMAND = "invalid_skill_command" + INVALID_DISPATCH_ITEMS = "invalid_dispatch_items" @dataclass(frozen=True, slots=True) diff --git a/src/autoskillit/recipe/_binding.py b/src/autoskillit/recipe/_binding.py index aaf43e9e07..e68d17b035 100644 --- a/src/autoskillit/recipe/_binding.py +++ b/src/autoskillit/recipe/_binding.py @@ -26,6 +26,7 @@ ) from autoskillit.recipe._binding_input import ( _AUTOSKILLIT_TEMPLATE_RE, + _apply_dispatch_fanout, _bound_value, _failure, _inline_skill_inputs, @@ -513,7 +514,7 @@ def bind_step_invocation( tuple(failures), ) - return _bind_run_skill_invocation( + invocation = _bind_run_skill_invocation( step_name, step, tool_name=tool_name, @@ -526,6 +527,7 @@ def bind_step_invocation( hidden_inputs=hidden_inputs, ingredient_values=ingredient_values, ) + return _apply_dispatch_fanout(invocation, declared_with) def bind_recipe( diff --git a/src/autoskillit/recipe/_binding_input.py b/src/autoskillit/recipe/_binding_input.py index 14e54e208f..c8bd2bd752 100644 --- a/src/autoskillit/recipe/_binding_input.py +++ b/src/autoskillit/recipe/_binding_input.py @@ -31,6 +31,7 @@ BindingFailure, BindingFailureCode, BoundScalar, + BoundStepInvocation, BoundValue, BoundValueOrigin, BoundValueState, @@ -49,6 +50,9 @@ _AUTOSKILLIT_TEMPLATE_RE: Final = re.compile(r"\{\{(AUTOSKILLIT_[A-Z0-9_]+)\}\}") _EXACT_CONTEXT_REF_RE: Final = re.compile(r"^\$\{\{\s*context\.([A-Za-z_]\w*)\s*\}\}$") _EXACT_INPUT_REF_RE: Final = re.compile(r"^\$\{\{\s*inputs\.([A-Za-z_]\w*)\s*\}\}$") +_DISPATCH_TOKEN_RE: Final = re.compile( + r"(? tuple[str, str] | None: + if isinstance(value, str): + for namespace, pattern in ( + ("context", _EXACT_CONTEXT_REF_RE), + ("inputs", _EXACT_INPUT_REF_RE), + ): + if match := pattern.fullmatch(value.strip()): + return namespace, match.group(1) + return None + + +def _dispatch_item_slot(values: tuple[BoundValue, ...]) -> tuple[BoundValue, str] | None: + occurrences = [ + (value, match.group(1)) + for value in values + if value.is_present and isinstance(value.declared_value, str) + for match in _DISPATCH_TOKEN_RE.finditer(value.declared_value) + ] + if len(occurrences) != 1: + return None + value, name = occurrences[0] + if not _DISPATCH_TOKEN_RE.fullmatch(str(value.declared_value).strip()): + return None + return value, name + + +def _dispatch_occurrence_error( + invocation: BoundStepInvocation, name: str, *, inline: bool +) -> str | None: + for value in invocation.mcp_kwargs: + if not value.is_present or not isinstance(value.declared_value, str): + continue + count = sum( + match.group(1) == name for match in _DISPATCH_TOKEN_RE.finditer(value.declared_value) + ) + expected = int(inline and value.name == "skill_command") + if count != expected: + return ( + f"dispatch_items placeholder {name!r} in MCP argument {value.name!r} " + f"must occur exactly {expected} time(s); only its inline command may repeat it" + ) + return None + + +def _invalid_dispatch_items(invocation: BoundStepInvocation, message: str) -> BoundStepInvocation: + return replace( + invocation, + failures=invocation.failures + + ( + _failure( + BindingFailureCode.INVALID_DISPATCH_ITEMS, + invocation.step_name, + "dispatch_items", + message, + ), + ), + ) + + +def _dispatch_dependency( + value: BoundValue, namespace: str, name: str, origin: BoundValueOrigin +) -> BoundValue: + context_dependencies = value.context_dependencies + input_dependencies = value.input_dependencies + if namespace == "context": + context_dependencies = tuple(dict.fromkeys((*context_dependencies, name))) + else: + input_dependencies = tuple(dict.fromkeys((*input_dependencies, name))) + return replace( + value, + origin=origin, + context_dependencies=context_dependencies, + input_dependencies=input_dependencies, + ) + + +def _apply_dispatch_fanout( + invocation: BoundStepInvocation, declared_with: Mapping[str, object] +) -> BoundStepInvocation: + if "dispatch_items" not in declared_with: + return invocation + producer = _dispatch_producer(declared_with["dispatch_items"]) + if producer is None: + return _invalid_dispatch_items( + invocation, + f"dispatch_items producer {declared_with['dispatch_items']!r} must be one exact " + "${{ context. }} or ${{ inputs. }} reference", + ) + slot = _dispatch_item_slot(invocation.skill_inputs) + if slot is None: + names = ", ".join(value.name for value in invocation.skill_inputs) + return _invalid_dispatch_items( + invocation, + "dispatch_items requires exactly one whole-value {placeholder} occurrence " + f"in one skill input ({names}); missing, repeated or embedded item tokens are invalid", + ) + candidate, name = slot + inline = declared_with.get("skill_inputs") is None + if error := _dispatch_occurrence_error(invocation, name, inline=inline): + return _invalid_dispatch_items(invocation, error) + namespace, producer_name = producer + return replace( + invocation, + skill_inputs=tuple( + _dispatch_dependency(value, namespace, producer_name, BoundValueOrigin.DISPATCH_ITEM) + if value is candidate + else value + for value in invocation.skill_inputs + ), + mcp_kwargs=tuple( + _dispatch_dependency( + value, + namespace, + producer_name, + BoundValueOrigin.TEMPLATE + if value.origin is BoundValueOrigin.LITERAL + else value.origin, + ) + if inline and value.name == "skill_command" + else value + for value in invocation.mcp_kwargs + ), + ) + + # === Skill-input type validation === diff --git a/src/autoskillit/recipe/contracts/_contracts_types.py b/src/autoskillit/recipe/contracts/_contracts_types.py index aa4208a9d3..b9a0120134 100644 --- a/src/autoskillit/recipe/contracts/_contracts_types.py +++ b/src/autoskillit/recipe/contracts/_contracts_types.py @@ -67,6 +67,12 @@ def accepts(self, value: object) -> bool: def admit_runtime_wire(self, value: BoundScalar, bound: BoundValue) -> BoundScalar | None: """Return the bound value, or None when the declared type rejects its wire form.""" + if ( + bound.origin is BoundValueOrigin.DISPATCH_ITEM + and isinstance(value, str) + and value.strip() == str(bound.declared_value).strip() + ): + return None if self.accepts(value): return value if bound.origin not in _EXACT_REFERENCE_ORIGINS: @@ -86,6 +92,23 @@ def admit_runtime_wire(self, value: BoundScalar, bound: BoundValue) -> BoundScal return None if text == bound.absence_value else text def wire_mismatch_message(self, value: BoundScalar, bound: BoundValue) -> str: + if ( + bound.origin is BoundValueOrigin.DISPATCH_ITEM + and isinstance(value, str) + and value.strip() == str(bound.declared_value).strip() + ): + producer = ", ".join( + f"{namespace}.{name}" + for namespace, dependencies in ( + ("context", bound.context_dependencies), + ("inputs", bound.input_dependencies), + ) + for name in dependencies + ) + return ( + f"per-item skill input {self.name!r} received its unsubstituted placeholder " + f"{value!r}; substitute one item from the step's dispatch_items {producer}" + ) message = ( f"runtime skill input {self.name!r} expects {self.type!r}; " f"received {type(value).__name__}" diff --git a/src/autoskillit/recipe/rules/rules_inputs.py b/src/autoskillit/recipe/rules/rules_inputs.py index 0c62b5c461..b0c1362aa2 100644 --- a/src/autoskillit/recipe/rules/rules_inputs.py +++ b/src/autoskillit/recipe/rules/rules_inputs.py @@ -34,7 +34,7 @@ logger = get_logger(__name__) -_WHOLE_VALUE_PLACEHOLDER_RE = re.compile(r"\{\{?\s*(?!AUTOSKILLIT_)[A-Za-z_]\w*\s*\}\}?") +_WHOLE_VALUE_PLACEHOLDER_RE = re.compile(r"\{\{?\s*(?!AUTOSKILLIT_)[A-Za-z_][\w.-]*\s*\}\}?") def _unresolved_template_reason(bound: BoundValue, *, per_item: bool) -> str | None: @@ -71,13 +71,14 @@ def _check_unresolved_skill_input_template(ctx: ValidationContext) -> list[RuleF invocation = ctx.binding_projection.for_step(step_name) if invocation is None or invocation.skill_name is None: continue - per_item = "dispatch_items" in (step.declared_with_args or {}) for bound in invocation.skill_inputs: if bound.state is not BoundValueState.PRESENT or not isinstance( bound.declared_value, str ): continue - reason = _unresolved_template_reason(bound, per_item=per_item) + reason = _unresolved_template_reason( + bound, per_item=bound.origin is BoundValueOrigin.DISPATCH_ITEM + ) if reason is not None: findings.append( make_finding( @@ -87,7 +88,9 @@ def _check_unresolved_skill_input_template(ctx: ValidationContext) -> list[RuleF f"Skill input '{bound.name}' declares {bound.declared_value!r}: " f"{reason}. " "Bind ${{ context. }} from a recipe-level producer step, " - "or ${{ inputs. }}." + "or ${{ inputs. }}. For a per-item fan-out, declare " + "dispatch_items: ${{ context. }} and use exactly one " + "{placeholder}." ), ) ) @@ -178,6 +181,7 @@ def _check_invalid_skill_invocation_binding( BindingFailureCode.AMBIGUOUS_SKILL_INPUT, BindingFailureCode.INVALID_SKILL_INPUT_TYPE, BindingFailureCode.INVALID_SKILL_COMMAND, + BindingFailureCode.INVALID_DISPATCH_ITEMS, } for step_name, step in ctx.recipe.steps.items(): if step.tool not in SKILL_TOOLS: diff --git a/tests/recipe/test_contracts_types.py b/tests/recipe/test_contracts_types.py index e495a55575..d3dccbfe0a 100644 --- a/tests/recipe/test_contracts_types.py +++ b/tests/recipe/test_contracts_types.py @@ -6,6 +6,8 @@ from __future__ import annotations +from dataclasses import replace + import pytest from autoskillit.core import BoundValue, BoundValueOrigin, BoundValueState @@ -163,6 +165,35 @@ def test_skill_input_admits_only_declared_type_wire_values( assert admitted == expected +@pytest.mark.parametrize( + ("dependency_field", "producer"), + [ + pytest.param("context_dependencies", "context.phase_ids", id="context-producer"), + pytest.param("input_dependencies", "inputs.phase_ids", id="input-producer"), + ], +) +def test_dispatch_item_rejects_its_own_placeholder(dependency_field: str, producer: str) -> None: + skill_input = SkillInput(name="target_phase_id", type="str", required=True) + bound = replace( + _bound_value( + "target_phase_id", + BoundValueOrigin.LITERAL, + declared_value="{phase_id}", + ), + origin=BoundValueOrigin.DISPATCH_ITEM, + **{dependency_field: ("phase_ids",)}, + ) + + assert skill_input.admit_runtime_wire("{phase_id}", bound) is None + assert skill_input.admit_runtime_wire(" {phase_id} ", bound) is None + assert skill_input.admit_runtime_wire("P1", bound) == "P1" + + message = skill_input.wire_mismatch_message("{phase_id}", bound) + assert "target_phase_id" in message + assert "unsubstituted placeholder" in message + assert producer in message + + @pytest.mark.parametrize( "wire", [pytest.param(10**19, id="19-digits"), pytest.param(10**5000, id="5000-digits")], diff --git a/tests/recipe/test_dispatch_item_binding.py b/tests/recipe/test_dispatch_item_binding.py new file mode 100644 index 0000000000..d21fb72f01 --- /dev/null +++ b/tests/recipe/test_dispatch_item_binding.py @@ -0,0 +1,281 @@ +"""Tests for compiling per-item skill inputs from recipe dispatch declarations.""" + +from __future__ import annotations + +import pytest + +from autoskillit.core import ( + BindingFailureCode, + BoundStepInvocation, + BoundValue, + BoundValueOrigin, +) +from autoskillit.recipe import _binding_input +from autoskillit.recipe._binding import bind_step_invocation +from autoskillit.recipe.contracts._contracts_manifest import load_bundled_manifest +from autoskillit.recipe.rules import rules_inputs +from autoskillit.recipe.schema import RecipeStep + +pytestmark = [pytest.mark.layer("recipe"), pytest.mark.small] + +_DISPATCH_ITEMS = "${{ context.phase_ids }}" +_SKILL_NAME = "planner-elaborate-phase" +_NO_DISPATCH = object() + + +def _structured_skill_inputs( + target_phase_id: object, + *, + output_dir: object = "${{ context.planner_dir }}/phases", +) -> dict[str, object]: + return { + "plan_snapshot_path": "${{ context.plan_snapshot_path }}", + "target_phase_id": target_phase_id, + "output_dir": output_dir, + } + + +def _step( + *, + phase_token: str = "{phase_id}", + dispatch_items: object = _DISPATCH_ITEMS, + skill_inputs: dict[str, object] | None = None, + output_dir: str = "${{ context.planner_dir }}", +) -> RecipeStep: + skill_command = f"/autoskillit:{_SKILL_NAME}" + if skill_inputs is None: + skill_command += ( + f" ${{{{ context.plan_snapshot_path }}}} {phase_token}" + " ${{ context.planner_dir }}/phases" + ) + with_args: dict[str, object] = { + "skill_command": skill_command, + "cwd": "${{ inputs.source_dir }}", + "output_dir": output_dir, + } + if dispatch_items is not _NO_DISPATCH: + with_args["dispatch_items"] = dispatch_items + if skill_inputs is not None: + with_args["skill_inputs"] = skill_inputs + return RecipeStep(name="elaborate_phases", tool="run_skill", with_args=with_args) + + +def _bind(step: RecipeStep) -> BoundStepInvocation: + return bind_step_invocation("elaborate_phases", step, manifest=load_bundled_manifest()) + + +def _assert_dispatch_slot( + invocation: BoundStepInvocation, *, origin: BoundValueOrigin +) -> BoundValue: + phase_input = invocation.skill_input("target_phase_id") + assert phase_input is not None + assert phase_input.origin is origin + assert phase_input.is_present + return phase_input + + +@pytest.mark.parametrize( + "phase_token", + ["{phase_id}", '"{ phase_id }"', "{phase-id}", "{phase.id}"], +) +def test_inline_dispatch_step_binds_one_dispatch_item(phase_token: str) -> None: + invocation = _bind(_step(phase_token=phase_token)) + + assert invocation.is_valid, invocation.failures + assert invocation.attested + dispatch_inputs = [ + value + for value in invocation.skill_inputs + if value.is_present and value.origin is BoundValueOrigin.DISPATCH_ITEM + ] + assert len(dispatch_inputs) == 1 + phase_input = _assert_dispatch_slot(invocation, origin=BoundValueOrigin.DISPATCH_ITEM) + assert phase_input.context_dependencies == ("phase_ids",) + assert phase_input.is_dynamic + assert dispatch_inputs == [phase_input] + + skill_command = next(value for value in invocation.mcp_kwargs if value.name == "skill_command") + assert "phase_ids" in skill_command.context_dependencies + + +def test_structured_dispatch_step_binds_identically() -> None: + invocation = _bind(_step(skill_inputs=_structured_skill_inputs("{phase_id}"))) + + assert invocation.is_valid, invocation.failures + assert invocation.attested + phase_input = _assert_dispatch_slot(invocation, origin=BoundValueOrigin.DISPATCH_ITEM) + assert phase_input.context_dependencies == ("phase_ids",) + assert phase_input.is_dynamic + + +def test_inputs_producer_is_accepted() -> None: + invocation = _bind(_step(dispatch_items="${{ inputs.phase_ids }}")) + + assert invocation.is_valid, invocation.failures + phase_input = _assert_dispatch_slot(invocation, origin=BoundValueOrigin.DISPATCH_ITEM) + assert phase_input.input_dependencies == ("phase_ids",) + assert phase_input.is_dynamic + + +def test_unrelated_literal_brace_kwarg_stays_static() -> None: + step = _step(output_dir="/tmp/{build_id}/out.json") + invocation = _bind(step) + baseline = _bind(_step(dispatch_items=_NO_DISPATCH, output_dir="/tmp/{build_id}/out.json")) + + assert invocation.attested + output = next(value for value in invocation.mcp_kwargs if value.name == "output_dir") + assert output == next(value for value in baseline.mcp_kwargs if value.name == "output_dir") + assert output.origin is BoundValueOrigin.LITERAL + assert not output.is_dynamic + + +def test_literal_inline_command_receives_dispatch_dependency() -> None: + invocation = _bind( + RecipeStep( + name="elaborate_phases", + tool="run_skill", + with_args={ + "skill_command": "/autoskillit:planner-elaborate-phase /snapshot {phase_id} /out", + "cwd": "/repo", + "dispatch_items": _DISPATCH_ITEMS, + }, + ) + ) + + assert invocation.attested + command = next(value for value in invocation.mcp_kwargs if value.name == "skill_command") + assert command.origin is BoundValueOrigin.TEMPLATE + assert command.context_dependencies == ("phase_ids",) + + +def test_step_without_dispatch_items_is_unchanged() -> None: + invocation = _bind(_step(dispatch_items=_NO_DISPATCH)) + + assert invocation.is_valid, invocation.failures + phase_input = _assert_dispatch_slot(invocation, origin=BoundValueOrigin.LITERAL) + assert phase_input.declared_value == "{phase_id}" + assert phase_input.context_dependencies == () + assert phase_input.input_dependencies == () + + +@pytest.mark.parametrize( + ("dispatch_items", "skill_inputs", "output_dir", "producer_contexts"), + [ + pytest.param("P1,P2", None, "${{ context.planner_dir }}", (), id="literal-producer"), + pytest.param( + "${{ context.a }},${{ context.b }}", + None, + "${{ context.planner_dir }}", + ("a", "b"), + id="non-exact-producer", + ), + pytest.param( + _DISPATCH_ITEMS, + _structured_skill_inputs("{phase_id}", output_dir="{other}"), + "${{ context.planner_dir }}", + ("phase_ids",), + id="distinct-item-placeholders", + ), + pytest.param( + _DISPATCH_ITEMS, + _structured_skill_inputs("{phase_id}", output_dir="{phase_id}"), + "${{ context.planner_dir }}", + ("phase_ids",), + id="same-placeholder-in-two-inputs", + ), + pytest.param( + _DISPATCH_ITEMS, + _structured_skill_inputs("{phase_id}/{phase_id}"), + "${{ context.planner_dir }}", + ("phase_ids",), + id="repeated-placeholder-in-one-input", + ), + pytest.param( + _DISPATCH_ITEMS, + _structured_skill_inputs("/out/{phase_id}/x.json"), + "${{ context.planner_dir }}", + ("phase_ids",), + id="embedded-item-value", + ), + pytest.param( + _DISPATCH_ITEMS, + _structured_skill_inputs("{phase_id"), + "${{ context.planner_dir }}", + ("phase_ids",), + id="unterminated-item-value", + ), + pytest.param( + _DISPATCH_ITEMS, + _structured_skill_inputs("P1"), + "/tmp/{build_id}/out.json", + ("phase_ids",), + id="mcp-path-is-not-an-item-input", + ), + pytest.param( + _DISPATCH_ITEMS, + None, + "/tmp/{phase_id}/out.json", + ("phase_ids",), + id="item-token-also-in-mcp-kwarg", + ), + ], +) +def test_invalid_dispatch_declaration_is_not_attested( + dispatch_items: object, + skill_inputs: dict[str, object] | None, + output_dir: str, + producer_contexts: tuple[str, ...], +) -> None: + invocation = _bind( + _step( + dispatch_items=dispatch_items, + skill_inputs=skill_inputs, + output_dir=output_dir, + ) + ) + baseline = _bind( + _step( + dispatch_items=_NO_DISPATCH, + skill_inputs=skill_inputs, + output_dir=output_dir, + ) + ) + + failure = next( + failure + for failure in invocation.failures + if failure.code is BindingFailureCode.INVALID_DISPATCH_ITEMS + ) + assert failure.name == "dispatch_items" + assert "dispatch_items" in failure.message + assert failure.message.strip() + assert any( + reason in failure.message.lower() for reason in ("must", "requires", "expected", "only") + ) + assert not invocation.attested + assert invocation.skill_inputs == baseline.skill_inputs + assert invocation.mcp_kwargs == baseline.mcp_kwargs + assert invocation.failures == (*baseline.failures, failure) + assert invocation.skill_input("plan_snapshot_path") is not None + assert invocation.skill_input("target_phase_id") is not None + assert invocation.skill_input("output_dir") is not None + for value in invocation.skill_inputs: + assert not (set(producer_contexts) & set(value.context_dependencies)) + + +@pytest.mark.parametrize("phase_token", ["{phase_id}", "{ phase_id }", "{phase-id}", "{phase.id}"]) +def test_dispatch_tokens_match_general_whole_value_placeholders(phase_token: str) -> None: + dispatch_token_re = _binding_input._DISPATCH_TOKEN_RE + + assert dispatch_token_re.fullmatch(phase_token) + assert rules_inputs._WHOLE_VALUE_PLACEHOLDER_RE.fullmatch(phase_token) + + +@pytest.mark.parametrize("value", ["{AUTOSKILLIT_TEMP}", "{{AUTOSKILLIT_TEMP}}"]) +def test_dispatch_token_excludes_reserved_autoskillit_names(value: str) -> None: + assert _binding_input._DISPATCH_TOKEN_RE.search(value) is None + + +@pytest.mark.parametrize("value", ["${VAR}", "${{ context.phase_ids }}", "{}", '{"a": 1}']) +def test_dispatch_token_excludes_non_item_syntax(value: str) -> None: + assert _binding_input._DISPATCH_TOKEN_RE.search(value) is None diff --git a/tests/recipe/test_planner_recipe.py b/tests/recipe/test_planner_recipe.py index 1bd5e4720b..2cbcf3ed47 100644 --- a/tests/recipe/test_planner_recipe.py +++ b/tests/recipe/test_planner_recipe.py @@ -1,11 +1,13 @@ """Structural assertions for the planner recipe.""" import importlib +import re from pathlib import Path import pytest -from autoskillit.core.types import Severity +from autoskillit.core.io import load_yaml +from autoskillit.core.types import BoundValueOrigin, Severity from autoskillit.recipe._api import load_and_validate from autoskillit.recipe.io import builtin_recipes_dir, load_recipe from autoskillit.recipe.validator import run_semantic_rules @@ -394,6 +396,40 @@ def test_refine_tier_steps_all_use_dispatch_items(planner_recipe, step_name): ) +def test_every_dispatch_step_binds_exactly_one_dispatch_item(): + loaded = load_and_validate( + "planner", + project_dir=_PROJECT_ROOT, + include_finalized_projection=True, + ) + assert loaded["valid"], loaded.get("errors") + assert "_finalized_projection" in loaded + + raw_steps = load_yaml(loaded["content"])["steps"] + dispatch_steps = { + name: raw_step + for name, raw_step in raw_steps.items() + if "dispatch_items" in raw_step.get("with", {}) + } + assert dispatch_steps + + invocations = loaded["_finalized_projection"].binding_projection.invocations + for name, raw_step in dispatch_steps.items(): + invocation = invocations[name] + dispatch_inputs = [ + value + for value in invocation.skill_inputs + if value.is_present and value.origin is BoundValueOrigin.DISPATCH_ITEM + ] + assert len(dispatch_inputs) == 1, name + + dispatch_items = raw_step["with"]["dispatch_items"] + match = re.fullmatch(r"\$\{\{\s*context\.([A-Za-z_]\w*)\s*\}\}", dispatch_items) + assert match is not None, name + assert dispatch_inputs[0].context_dependencies == (match.group(1),), name + assert invocation.attested, name + + def test_planner_recipe_valid_on_codex_backend(): """Planner recipe must compose valid=True under codex backend capability overrides.""" result = load_and_validate( diff --git a/tests/recipe/test_rules_contracts.py b/tests/recipe/test_rules_contracts.py index 6d81bf1322..535c92ae53 100644 --- a/tests/recipe/test_rules_contracts.py +++ b/tests/recipe/test_rules_contracts.py @@ -139,6 +139,56 @@ def test_mapped_skill_context_accepts_explicit_vacancy(monkeypatch) -> None: assert not _check_mapped_skill_context_definitions(ctx) +def test_dispatch_source_requires_definition_even_for_optional_child_input( + monkeypatch, +) -> None: + from autoskillit.recipe._analysis import make_validation_context + from autoskillit.recipe._binding import bind_recipe + from autoskillit.recipe.rules.rules_contracts import ( + _check_mapped_skill_context_definitions, + ) + + manifest = { + "skills": { + "demo": { + "inputs": [ + { + "name": "item", + "type": "string", + "required": False, + "absence_value": "", + } + ] + } + } + } + recipe = Recipe( + name="optional-dispatch", + description="test", + steps={ + "consumer": RecipeStep( + tool="run_skill", + optional_context_refs=["items"], + with_args={ + "skill_command": "/autoskillit:demo {item}", + "dispatch_items": "${{ context.items }}", + }, + ) + }, + ) + monkeypatch.setattr(_rc, "load_bundled_manifest", lambda: manifest) + ctx = make_validation_context( + recipe, + binding_projection=bind_recipe(recipe, manifest=manifest), + ) + + findings = _check_mapped_skill_context_definitions(ctx) + assert any( + finding.rule == "mapped-skill-context-definition" and "items" in finding.message + for finding in findings + ) + + def test_rule_flags_skills_with_empty_output_patterns() -> None: """The missing-output-patterns rule exists and emits no warnings on bundled recipes.""" recipe_path = pkg_root() / "recipes" / "implementation.yaml" diff --git a/tests/recipe/test_rules_skill_input_template.py b/tests/recipe/test_rules_skill_input_template.py index 6af1df28a3..98e9cff714 100644 --- a/tests/recipe/test_rules_skill_input_template.py +++ b/tests/recipe/test_rules_skill_input_template.py @@ -2,8 +2,8 @@ Composite values such as ``PR-{pr_number}`` and exotic forms such as ``{0}``, ``{x!r}``, ``${x}``, and ```` remain outside the rule's scope. The -``dispatch_items`` exemption preserves inline arguments for per-item fan-out; -revisit that exemption with #5307. +``dispatch_items`` exemption applies only to the per-item slot of an accepted +``dispatch_items`` fan-out (origin ``DISPATCH_ITEM``). """ from __future__ import annotations @@ -12,7 +12,9 @@ import pytest +from autoskillit.core import BindingFailureCode from autoskillit.core.types import Severity +from autoskillit.recipe._binding import bind_recipe from autoskillit.recipe.registry import ( RuleFinding, compute_recipe_validity, @@ -47,6 +49,117 @@ def _assert_error_names_input(findings: list[RuleFinding], input_name: str) -> N assert input_name in findings[0].message +def _planner_dispatch_with( + item_argument: str, *, dispatch_items: str = "${{ context.phase_ids }}" +) -> dict[str, Any]: + return { + "skill_command": ( + f"/autoskillit:planner-elaborate-phase /tmp/plan.json {item_argument} /tmp/phases" + ), + "dispatch_items": dispatch_items, + } + + +@pytest.mark.parametrize( + "item_argument", + [ + pytest.param("{phase_id}", id="named-placeholder"), + pytest.param('"{ phase_id }"', id="quoted-inline-argument"), + pytest.param("{phase-id}", id="hyphenated-placeholder"), + pytest.param("{phase.id}", id="dotted-placeholder"), + ], +) +def test_dispatch_items_without_producer_reports_placeholder(item_argument: str) -> None: + findings = _skill_input_template_findings( + _planner_dispatch_with(item_argument, dispatch_items="P1,P2"), + step_name="elaborate_phases", + ) + + _assert_error_names_input(findings, "target_phase_id") + + +def test_dispatch_step_with_two_placeholder_names_reports_them() -> None: + findings = _skill_input_template_findings( + { + "skill_command": "/autoskillit:planner-elaborate-phase", + "skill_inputs": { + "plan_snapshot_path": "/tmp/plan.json", + "target_phase_id": "{phase_id}", + "output_dir": "{other}", + }, + "dispatch_items": "P1,P2", + }, + step_name="elaborate_phases", + ) + + assert len(findings) == 2 + assert all(finding.severity == Severity.ERROR for finding in findings) + assert any("target_phase_id" in finding.message for finding in findings) + assert any("output_dir" in finding.message for finding in findings) + + +@pytest.mark.parametrize( + "item_argument", + [ + pytest.param("prefix{phase_id}", id="embedded-placeholder"), + pytest.param("{phase_id", id="unterminated-placeholder"), + pytest.param("{phase_id} {phase_id}", id="duplicate-slot"), + ], +) +def test_invalid_dispatch_shape_reports_binding_error(item_argument: str) -> None: + recipe = _make_workflow( + { + "elaborate_phases": { + "tool": "run_skill", + "with": _planner_dispatch_with(item_argument), + "on_success": "done", + }, + "done": {"action": "stop", "message": "Done"}, + } + ) + invocation = bind_recipe(recipe).for_step("elaborate_phases") + assert invocation is not None + failure = next( + failure + for failure in invocation.failures + if failure.code is BindingFailureCode.INVALID_DISPATCH_ITEMS + ) + assert failure.name == "dispatch_items" + + findings = run_semantic_rules(recipe) + assert any( + finding.rule == "invalid-skill-invocation-binding" + and finding.severity == Severity.ERROR + and "dispatch_items" in finding.message + for finding in findings + ) + + +def test_well_formed_dispatch_slot_is_not_reported() -> None: + with_args = _planner_dispatch_with("{phase_id}") + recipe = _make_workflow( + { + "elaborate_phases": { + "tool": "run_skill", + "with": with_args, + "on_success": "done", + }, + "done": {"action": "stop", "message": "Done"}, + } + ) + invocation = bind_recipe(recipe).for_step("elaborate_phases") + assert invocation is not None + assert not any( + failure.code is BindingFailureCode.INVALID_DISPATCH_ITEMS + for failure in invocation.failures + ) + assert not any( + finding.rule == "invalid-skill-invocation-binding" and "dispatch_items" in finding.message + for finding in run_semantic_rules(recipe) + ) + assert _skill_input_template_findings(with_args, step_name="elaborate_phases") == [] + + @pytest.mark.parametrize( "value", [ diff --git a/tests/recipe/test_runtime_skill_invocation_binding.py b/tests/recipe/test_runtime_skill_invocation_binding.py index 4c41a967ba..6222dc669f 100644 --- a/tests/recipe/test_runtime_skill_invocation_binding.py +++ b/tests/recipe/test_runtime_skill_invocation_binding.py @@ -229,7 +229,10 @@ def test_runtime_binding_admits_explicit_advertised_default_without_auto_fill() def test_non_handler_param_is_authorable_but_not_a_compiled_mcp_kwarg() -> None: - template = _template(dispatch_items="P1,P2") + template = _template( + dispatch_items="${{ context.plan_paths }}", + skill_inputs={"plan_path": "{plan_path}"}, + ) assert "dispatch_items" not in {value.name for value in template.invocation.mcp_kwargs} assert _bind(template) == (("plan_path", "/tmp/plan.md"),) diff --git a/tests/server/test_attestation_delivery_reachability.py b/tests/server/test_attestation_delivery_reachability.py index ab7ec63c1f..67df41cb9f 100644 --- a/tests/server/test_attestation_delivery_reachability.py +++ b/tests/server/test_attestation_delivery_reachability.py @@ -33,6 +33,8 @@ from autoskillit.server.recipe._recipe_delivery_helpers import _attested_render from autoskillit.server.recipe._recipe_execution import ( RecipeExecutionAdmissionError, + bind_attested_runtime_invocation, + get_recipe_execution, install_recipe_execution, ) from autoskillit.server.recipe._recipe_generation import RecipeGenerationStore @@ -42,6 +44,11 @@ recipe_initialization_receipt, ) from tests._helpers import kitchen_identity_fields +from tests._run_skill_caller_oracle import ( + ORCHESTRATOR_SAMPLES, + build_run_skill_payload, + run_skill_actual_mcp_kwargs, +) from tests.conftest import _make_result from tests.contracts.test_delivery_bound_fitness import _full_open_kitchen_generation from tests.server._pipeline_test_helpers import _write_tracker @@ -387,40 +394,43 @@ async def test_tool_ctx_ready_recipe_fixture_yields_genuine_attestation( ) ) - # A step may declare no skill_inputs: sub-key and instead carry its child - # inputs as placeholders inside skill_command; omitting the parameter lets - # the runtime binder derive them rather than guessing key names. declared_inputs = with_args.get("skill_inputs") - optional_inputs = ( - {"skill_inputs": {name: "probe value" for name in declared_inputs}} - if declared_inputs - else {} - ) - - genuine = json.loads( - await run_skill( - with_args["skill_command"], - str(work_dir), - step_name=ready.step_name, - output_dir=with_args["output_dir"], - recipe_execution_id=ready.credential["execution_id"], - invocation_template_digest=ready.template_digest, - **optional_inputs, + if "dispatch_items" in ready.step_body.get("with", {}): + payload = build_run_skill_payload( + ready.step_name, + ready.step_body, + ready.credential, + cwd=str(work_dir), ) - ) + installed = get_recipe_execution(ready.tool_ctx) + assert installed is not None + bound_inputs, _ = bind_attested_runtime_invocation( + installed, + execution_id=payload["recipe_execution_id"], + step_name=payload["step_name"], + template_digest=payload["invocation_template_digest"], + skill_command=payload["skill_command"], + skill_inputs=payload.get("skill_inputs"), + actual_mcp_kwargs=run_skill_actual_mcp_kwargs(payload), + ) + assert ORCHESTRATOR_SAMPLES["item"]["phase_id"] in dict(bound_inputs).values() + else: + payload = { + "skill_command": with_args["skill_command"], + "cwd": str(work_dir), + "step_name": ready.step_name, + "output_dir": with_args["output_dir"], + "recipe_execution_id": ready.credential["execution_id"], + "invocation_template_digest": ready.template_digest, + } + if declared_inputs: + payload["skill_inputs"] = {name: "probe value" for name in declared_inputs} + + genuine = json.loads(await run_skill(**payload)) assert genuine.get("stage") != "preflight:recipe_execution", genuine - fabricated = json.loads( - await run_skill( - with_args["skill_command"], - str(work_dir), - step_name=ready.step_name, - output_dir=with_args["output_dir"], - recipe_execution_id=ready.credential["execution_id"], - invocation_template_digest="sha256:" + "0" * 64, - **optional_inputs, - ) - ) + fabricated_payload = {**payload, "invocation_template_digest": "sha256:" + "0" * 64} + fabricated = json.loads(await run_skill(**fabricated_payload)) assert fabricated.get("stage") == "preflight:recipe_execution", fabricated diff --git a/tests/server/test_attested_admission_replay.py b/tests/server/test_attested_admission_replay.py index 5c8e0b305b..676379fbfc 100644 --- a/tests/server/test_attested_admission_replay.py +++ b/tests/server/test_attested_admission_replay.py @@ -5,6 +5,7 @@ from __future__ import annotations +import re from functools import cache from pathlib import Path from types import SimpleNamespace @@ -26,6 +27,8 @@ build_recipe_execution_snapshot, ) from tests._run_skill_caller_oracle import ( + _SINGLE_BRACE_TOKEN, + ORCHESTRATOR_SAMPLES, AdmissionDefect, build_run_skill_payload, run_skill_actual_mcp_kwargs, @@ -36,66 +39,6 @@ REPO_ROOT = Path(__file__).resolve().parents[2] _PINNED: dict[tuple[str, str], Any] = { - ("planner", "elaborate_phases"): pytest.param( - "planner", - "elaborate_phases", - "recipe_execution_static_input_mismatch", - "static skill input 'target_phase_id'", - id="planner-elaborate_phases", - marks=pytest.mark.xfail( - strict=True, - raises=AdmissionDefect, - reason="Blocked by #5307: planner item placeholders compile as static inputs", - ), - ), - ("planner", "elaborate_assignments"): pytest.param( - "planner", - "elaborate_assignments", - "recipe_execution_static_input_mismatch", - "static skill input 'context_file'", - id="planner-elaborate_assignments", - marks=pytest.mark.xfail( - strict=True, - raises=AdmissionDefect, - reason="Blocked by #5307: planner item placeholders compile as static inputs", - ), - ), - ("planner", "refine_assignments"): pytest.param( - "planner", - "refine_assignments", - "recipe_execution_static_input_mismatch", - "static skill input 'context_file'", - id="planner-refine_assignments", - marks=pytest.mark.xfail( - strict=True, - raises=AdmissionDefect, - reason="Blocked by #5307: planner item placeholders compile as static inputs", - ), - ), - ("planner", "elaborate_wps"): pytest.param( - "planner", - "elaborate_wps", - "recipe_execution_static_input_mismatch", - "static skill input 'context_file'", - id="planner-elaborate_wps", - marks=pytest.mark.xfail( - strict=True, - raises=AdmissionDefect, - reason="Blocked by #5307: planner item placeholders compile as static inputs", - ), - ), - ("planner", "refine_wps"): pytest.param( - "planner", - "refine_wps", - "recipe_execution_static_input_mismatch", - "static skill input 'context_file'", - id="planner-refine_wps", - marks=pytest.mark.xfail( - strict=True, - raises=AdmissionDefect, - reason="Blocked by #5307: planner item placeholders compile as static inputs", - ), - ), ("bem-wrapper", "run_bem"): pytest.param( "bem-wrapper", "run_bem", @@ -160,6 +103,46 @@ def _replay_parameters() -> list[Any]: return parameters +def _dispatch_step_parameters() -> list[Any]: + dispatch_steps: list[tuple[str, str]] = [] + for info in tracked_recipe_load_result(REPO_ROOT).items: + if info.source is not RecipeSource.BUILTIN or info.kind is RecipeKind.CAMPAIGN: + continue + loaded, _, _, steps = _load_recipe(info.name) + post_prune_steps = loaded["post_prune_step_names"] + for step_name, step_body in steps.items(): + with_value = step_body.get("with", {}) + if ( + step_name in post_prune_steps + and step_body.get("tool") == "run_skill" + and isinstance(with_value, dict) + and "dispatch_items" in with_value + ): + dispatch_steps.append((info.name, step_name)) + + assert dispatch_steps, "no builtin run_skill dispatch steps were found" + assert ("planner", "elaborate_phases") in dispatch_steps + return [pytest.param(recipe, step, id=f"{recipe}-{step}") for recipe, step in dispatch_steps] + + +_DISPATCH_STEP_PARAMETERS = _dispatch_step_parameters() +_DISPATCH_ITEM_INPUTS = {"phase_id": "target_phase_id", "context_path": "context_file"} + + +def _dispatch_item_name(step_body: dict[str, Any]) -> str: + with_value = step_body.get("with") + if not isinstance(with_value, dict): + raise AssertionError("dispatch step must declare a with mapping") + names = { + match.group(1).strip() + for value in with_value.values() + for match in _SINGLE_BRACE_TOKEN.finditer(repr(value)) + } + if len(names) != 1: + raise AssertionError(f"expected one dispatch item placeholder, found {sorted(names)}") + return next(iter(names)) + + def _dynamic_step_outcome(step_name: str) -> NoReturn: pytest.skip( f"{step_name}: dynamic skill command requires runtime resolution before admission replay" @@ -340,6 +323,62 @@ def test_payload_uses_credential_input_order_and_requires_caller_values( assert list(skill_inputs.items()) == [("required", 7), ("optional", "")] +@pytest.mark.parametrize(("recipe", "step"), _DISPATCH_STEP_PARAMETERS) +def test_dispatch_steps_bind_the_orchestrator_item( + recipe: str, + step: str, + tmp_path: Path, +) -> None: + _, installed, credential, steps = _load_recipe(recipe) + payload = build_run_skill_payload(step, steps[step], credential, cwd=str(tmp_path)) + + bound_inputs, admitted_template = bind_attested_runtime_invocation( + installed, + execution_id=payload["recipe_execution_id"], + step_name=payload["step_name"], + template_digest=payload["invocation_template_digest"], + skill_command=payload["skill_command"], + skill_inputs=payload.get("skill_inputs"), + actual_mcp_kwargs=run_skill_actual_mcp_kwargs(payload), + ) + + assert admitted_template is installed.snapshot.templates[step] + item_name = _dispatch_item_name(steps[step]) + assert ORCHESTRATOR_SAMPLES["item"][item_name] in dict(bound_inputs).values() + + +@pytest.mark.parametrize(("recipe", "step"), _DISPATCH_STEP_PARAMETERS) +def test_unsubstituted_dispatch_item_is_rejected( + recipe: str, + step: str, + tmp_path: Path, +) -> None: + _, installed, credential, steps = _load_recipe(recipe) + payload = build_run_skill_payload(step, steps[step], credential, cwd=str(tmp_path)) + item_name = _dispatch_item_name(steps[step]) + sample = str(ORCHESTRATOR_SAMPLES["item"][item_name]) + command = payload.get("skill_command") + assert isinstance(command, str) + sample_token = re.compile(rf"(? Date: Sat, 24 Oct 2026 16:11:33 -0700 Subject: [PATCH 03/16] test: use valid dispatch fixtures throughout attested admission --- tests/contracts/test_tool_param_roles.py | 2 ++ .../test_attested_param_admission_conformance.py | 10 +++++++++- .../test_recipe_execution_receipt_completeness.py | 12 +++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/contracts/test_tool_param_roles.py b/tests/contracts/test_tool_param_roles.py index f3407f8a10..4048a94130 100644 --- a/tests/contracts/test_tool_param_roles.py +++ b/tests/contracts/test_tool_param_roles.py @@ -159,6 +159,8 @@ def test_compiled_mcp_kwargs_are_exactly_the_kwarg_view() -> None: ) for param in tool_def.params } + with_args["dispatch_items"] = "${{ context.plan_paths }}" + with_args["skill_inputs"] = {"plan_path": "{plan_path}"} step = RecipeStep(name="verify", tool="run_skill", with_args=with_args) invocation = bind_step_invocation( diff --git a/tests/server/test_attested_param_admission_conformance.py b/tests/server/test_attested_param_admission_conformance.py index 6bc5461498..9bfb279903 100644 --- a/tests/server/test_attested_param_admission_conformance.py +++ b/tests/server/test_attested_param_admission_conformance.py @@ -248,11 +248,19 @@ async def test_model_delivered_from_recipe_step_without_caller_forwarding( work_dir.mkdir() _write_tracker_for(ready) + samples = { + **ORCHESTRATOR_SAMPLES, + "context": { + **ORCHESTRATOR_SAMPLES["context"], + "planner_dir": ".autoskillit/temp/planner/run-test", + }, + } payload = build_run_skill_payload( ready.step_name, ready.step_body, ready.credential, cwd=str(work_dir), + samples=samples, ) installed = get_recipe_execution(ready.tool_ctx) assert installed is not None @@ -270,5 +278,5 @@ async def test_model_delivered_from_recipe_step_without_caller_forwarding( result = json.loads(await run_skill(**payload)) assert result.get("stage") != "preflight:recipe_execution", result - assert len(executor.calls) == 1 + assert len(executor.calls) == 1, result assert executor.calls[0].model == "opus[1m]" diff --git a/tests/server/test_recipe_execution_receipt_completeness.py b/tests/server/test_recipe_execution_receipt_completeness.py index 8da8990632..4a3c1fe890 100644 --- a/tests/server/test_recipe_execution_receipt_completeness.py +++ b/tests/server/test_recipe_execution_receipt_completeness.py @@ -21,6 +21,7 @@ get_recipe_execution, ) from tests._run_skill_caller_oracle import ( + _SINGLE_BRACE_TOKEN, ORCHESTRATOR_SAMPLES, build_run_skill_payload, literal_run_skill_payload, @@ -220,7 +221,8 @@ async def test_following_the_recovery_yields_an_admitted_digest( receipt = json.loads(await complete_recipe_initialization(initialization_id=recovery_id)) assert receipt["success"] is True, receipt credential = receipt["recipe_execution"] - with_value = ready.step_body.get("with", {}) + current_step = ready.tool_ctx.active_recipe_steps[step_name] + with_value = current_step.declared_with_args or current_step.with_args planner_dispatch = ( ready.tool_ctx.recipe_initialization_state.recipe_name == "planner" and isinstance(with_value, dict) @@ -229,7 +231,7 @@ async def test_following_the_recovery_yields_an_admitted_digest( if planner_dispatch: payload = build_run_skill_payload( step_name, - ready.step_body, + {"with": with_value}, credential, cwd=str(git_checkout), ) @@ -274,7 +276,11 @@ async def test_following_the_recovery_yields_an_admitted_digest( ) assert admitted_template is expected_template if planner_dispatch: - assert ORCHESTRATOR_SAMPLES["item"]["phase_id"] in dict(bound_inputs).values() + item = _SINGLE_BRACE_TOKEN.search(with_value["skill_command"]) + assert item is not None + assert ( + ORCHESTRATOR_SAMPLES["item"][item.group(1).strip()] in dict(bound_inputs).values() + ) else: assert dict(bound_inputs) == skill_inputs From 006618558fd607e6ad2cc587933b8fd7f69d920d Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 16:21:33 -0700 Subject: [PATCH 04/16] test: read dispatch metadata from finalized step args --- tests/server/test_recipe_execution_receipt_completeness.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/server/test_recipe_execution_receipt_completeness.py b/tests/server/test_recipe_execution_receipt_completeness.py index 4a3c1fe890..fd13a2e171 100644 --- a/tests/server/test_recipe_execution_receipt_completeness.py +++ b/tests/server/test_recipe_execution_receipt_completeness.py @@ -222,7 +222,7 @@ async def test_following_the_recovery_yields_an_admitted_digest( assert receipt["success"] is True, receipt credential = receipt["recipe_execution"] current_step = ready.tool_ctx.active_recipe_steps[step_name] - with_value = current_step.declared_with_args or current_step.with_args + with_value = current_step.with_args planner_dispatch = ( ready.tool_ctx.recipe_initialization_state.recipe_name == "planner" and isinstance(with_value, dict) From 32e8cfb455e486c44e38f20932a45d5c3b08821b Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:13:48 -0700 Subject: [PATCH 05/16] fix(review): describe dispatch token occurrence rules accurately --- src/autoskillit/recipe/_binding_input.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/autoskillit/recipe/_binding_input.py b/src/autoskillit/recipe/_binding_input.py index c8bd2bd752..75c1c59bb9 100644 --- a/src/autoskillit/recipe/_binding_input.py +++ b/src/autoskillit/recipe/_binding_input.py @@ -163,9 +163,10 @@ def _dispatch_occurrence_error( ) expected = int(inline and value.name == "skill_command") if count != expected: - return ( - f"dispatch_items placeholder {name!r} in MCP argument {value.name!r} " - f"must occur exactly {expected} time(s); only its inline command may repeat it" + return f"dispatch_items placeholder {name!r} in MCP argument {value.name!r} " + ( + "must occur exactly once in the inline skill command" + if expected + else "must not occur outside the inline skill command" ) return None From c6af45a437c96f8730062d3685e55ad59afc92fc Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:15:07 -0700 Subject: [PATCH 06/16] refactor(review): avoid converting dispatch strings twice --- src/autoskillit/recipe/_binding_input.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/autoskillit/recipe/_binding_input.py b/src/autoskillit/recipe/_binding_input.py index 75c1c59bb9..4100c33ff0 100644 --- a/src/autoskillit/recipe/_binding_input.py +++ b/src/autoskillit/recipe/_binding_input.py @@ -23,7 +23,7 @@ from collections.abc import Mapping from dataclasses import replace -from typing import Final, TypeGuard +from typing import Final, TypeGuard, cast import regex as re @@ -147,7 +147,7 @@ def _dispatch_item_slot(values: tuple[BoundValue, ...]) -> tuple[BoundValue, str if len(occurrences) != 1: return None value, name = occurrences[0] - if not _DISPATCH_TOKEN_RE.fullmatch(str(value.declared_value).strip()): + if not _DISPATCH_TOKEN_RE.fullmatch(cast(str, value.declared_value).strip()): return None return value, name From f2a689be5862be875944382188db2280a4a6b122 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:16:29 -0700 Subject: [PATCH 07/16] refactor(review): share dispatch placeholder admission predicate --- .../recipe/contracts/_contracts_types.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/autoskillit/recipe/contracts/_contracts_types.py b/src/autoskillit/recipe/contracts/_contracts_types.py index b9a0120134..8447251348 100644 --- a/src/autoskillit/recipe/contracts/_contracts_types.py +++ b/src/autoskillit/recipe/contracts/_contracts_types.py @@ -29,6 +29,14 @@ _EXACT_REFERENCE_ORIGINS = frozenset({BoundValueOrigin.CONTEXT, BoundValueOrigin.RECIPE_INPUT}) +def _is_unsubstituted_dispatch_item(value: BoundScalar, bound: BoundValue) -> bool: + return ( + bound.origin is BoundValueOrigin.DISPATCH_ITEM + and isinstance(value, str) + and value.strip() == str(bound.declared_value).strip() + ) + + @dataclasses.dataclass(frozen=True, slots=True) class SkillInput: name: str @@ -66,12 +74,8 @@ def accepts(self, value: object) -> bool: return False def admit_runtime_wire(self, value: BoundScalar, bound: BoundValue) -> BoundScalar | None: - """Return the bound value, or None when the declared type rejects its wire form.""" - if ( - bound.origin is BoundValueOrigin.DISPATCH_ITEM - and isinstance(value, str) - and value.strip() == str(bound.declared_value).strip() - ): + """Return the bound value, or None when its wire form violates the input contract.""" + if _is_unsubstituted_dispatch_item(value, bound): return None if self.accepts(value): return value @@ -92,11 +96,7 @@ def admit_runtime_wire(self, value: BoundScalar, bound: BoundValue) -> BoundScal return None if text == bound.absence_value else text def wire_mismatch_message(self, value: BoundScalar, bound: BoundValue) -> str: - if ( - bound.origin is BoundValueOrigin.DISPATCH_ITEM - and isinstance(value, str) - and value.strip() == str(bound.declared_value).strip() - ): + if _is_unsubstituted_dispatch_item(value, bound): producer = ", ".join( f"{namespace}.{name}" for namespace, dependencies in ( From bddaa9b5f7258c21bf7df09c81f18642bb038d15 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:17:55 -0700 Subject: [PATCH 08/16] refactor(review): share placeholder names and test distinct brace forms --- src/autoskillit/recipe/_binding_input.py | 6 ++--- .../recipe/contracts/_contracts_types.py | 3 +++ src/autoskillit/recipe/rules/rules_inputs.py | 6 ++--- tests/recipe/test_dispatch_item_binding.py | 24 ++++++++++++++----- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/autoskillit/recipe/_binding_input.py b/src/autoskillit/recipe/_binding_input.py index 4100c33ff0..a9a62c82d0 100644 --- a/src/autoskillit/recipe/_binding_input.py +++ b/src/autoskillit/recipe/_binding_input.py @@ -41,6 +41,9 @@ SkillContract, SkillInput, ) +from autoskillit.recipe.contracts._contracts_types import ( + DISPATCH_TOKEN_RE as _DISPATCH_TOKEN_RE, +) from autoskillit.recipe.contracts._contracts_types import ( INPUT_REF_RE as _INPUT_REF_RE, ) @@ -50,9 +53,6 @@ _AUTOSKILLIT_TEMPLATE_RE: Final = re.compile(r"\{\{(AUTOSKILLIT_[A-Z0-9_]+)\}\}") _EXACT_CONTEXT_REF_RE: Final = re.compile(r"^\$\{\{\s*context\.([A-Za-z_]\w*)\s*\}\}$") _EXACT_INPUT_REF_RE: Final = re.compile(r"^\$\{\{\s*inputs\.([A-Za-z_]\w*)\s*\}\}$") -_DISPATCH_TOKEN_RE: Final = re.compile( - r"(? str | None: value = cast(str, bound.declared_value) scan = value diff --git a/tests/recipe/test_dispatch_item_binding.py b/tests/recipe/test_dispatch_item_binding.py index d21fb72f01..e8283ab991 100644 --- a/tests/recipe/test_dispatch_item_binding.py +++ b/tests/recipe/test_dispatch_item_binding.py @@ -263,12 +263,24 @@ def test_invalid_dispatch_declaration_is_not_attested( assert not (set(producer_contexts) & set(value.context_dependencies)) -@pytest.mark.parametrize("phase_token", ["{phase_id}", "{ phase_id }", "{phase-id}", "{phase.id}"]) -def test_dispatch_tokens_match_general_whole_value_placeholders(phase_token: str) -> None: - dispatch_token_re = _binding_input._DISPATCH_TOKEN_RE - - assert dispatch_token_re.fullmatch(phase_token) - assert rules_inputs._WHOLE_VALUE_PLACEHOLDER_RE.fullmatch(phase_token) +@pytest.mark.parametrize( + ("phase_token", "dispatch", "unresolved"), + [ + ("{phase_id}", True, True), + ("{ phase_id }", True, True), + ("{phase-id}", True, True), + ("{phase.id}", True, True), + ("{{phase_id}}", False, True), + ("{{phase_id}", False, True), + ("{phase_id}}", False, True), + ("${{ context.phase_ids }}", False, False), + ], +) +def test_placeholder_grammar_distinguishes_dispatch_tokens( + phase_token: str, dispatch: bool, unresolved: bool +) -> None: + assert bool(_binding_input._DISPATCH_TOKEN_RE.fullmatch(phase_token)) is dispatch + assert bool(rules_inputs._WHOLE_VALUE_PLACEHOLDER_RE.fullmatch(phase_token)) is unresolved @pytest.mark.parametrize("value", ["{AUTOSKILLIT_TEMP}", "{{AUTOSKILLIT_TEMP}}"]) From 0a7a0b91826b24b46607550da3b37fb9c7732be4 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:19:03 -0700 Subject: [PATCH 09/16] fix(review): document both dispatch producer namespaces --- src/autoskillit/recipe/rules/rules_inputs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/autoskillit/recipe/rules/rules_inputs.py b/src/autoskillit/recipe/rules/rules_inputs.py index 40de792b8c..34d637176a 100644 --- a/src/autoskillit/recipe/rules/rules_inputs.py +++ b/src/autoskillit/recipe/rules/rules_inputs.py @@ -89,7 +89,8 @@ def _check_unresolved_skill_input_template(ctx: ValidationContext) -> list[RuleF f"{reason}. " "Bind ${{ context. }} from a recipe-level producer step, " "or ${{ inputs. }}. For a per-item fan-out, declare " - "dispatch_items: ${{ context. }} and use exactly one " + "dispatch_items: ${{ context. }} or " + "${{ inputs. }} and use exactly one " "{placeholder}." ), ) From 643cb0e92319d21512348b08a05123dd559cf39b Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:20:20 -0700 Subject: [PATCH 10/16] test(review): require specific dispatch declaration failure reasons --- tests/recipe/test_dispatch_item_binding.py | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/recipe/test_dispatch_item_binding.py b/tests/recipe/test_dispatch_item_binding.py index e8283ab991..d49afd82f7 100644 --- a/tests/recipe/test_dispatch_item_binding.py +++ b/tests/recipe/test_dispatch_item_binding.py @@ -159,14 +159,22 @@ def test_step_without_dispatch_items_is_unchanged() -> None: @pytest.mark.parametrize( - ("dispatch_items", "skill_inputs", "output_dir", "producer_contexts"), + ("dispatch_items", "skill_inputs", "output_dir", "producer_contexts", "expected_reason"), [ - pytest.param("P1,P2", None, "${{ context.planner_dir }}", (), id="literal-producer"), + pytest.param( + "P1,P2", + None, + "${{ context.planner_dir }}", + (), + "must be one exact", + id="literal-producer", + ), pytest.param( "${{ context.a }},${{ context.b }}", None, "${{ context.planner_dir }}", ("a", "b"), + "must be one exact", id="non-exact-producer", ), pytest.param( @@ -174,6 +182,7 @@ def test_step_without_dispatch_items_is_unchanged() -> None: _structured_skill_inputs("{phase_id}", output_dir="{other}"), "${{ context.planner_dir }}", ("phase_ids",), + "requires exactly one whole-value {placeholder}", id="distinct-item-placeholders", ), pytest.param( @@ -181,6 +190,7 @@ def test_step_without_dispatch_items_is_unchanged() -> None: _structured_skill_inputs("{phase_id}", output_dir="{phase_id}"), "${{ context.planner_dir }}", ("phase_ids",), + "requires exactly one whole-value {placeholder}", id="same-placeholder-in-two-inputs", ), pytest.param( @@ -188,6 +198,7 @@ def test_step_without_dispatch_items_is_unchanged() -> None: _structured_skill_inputs("{phase_id}/{phase_id}"), "${{ context.planner_dir }}", ("phase_ids",), + "requires exactly one whole-value {placeholder}", id="repeated-placeholder-in-one-input", ), pytest.param( @@ -195,6 +206,7 @@ def test_step_without_dispatch_items_is_unchanged() -> None: _structured_skill_inputs("/out/{phase_id}/x.json"), "${{ context.planner_dir }}", ("phase_ids",), + "requires exactly one whole-value {placeholder}", id="embedded-item-value", ), pytest.param( @@ -202,6 +214,7 @@ def test_step_without_dispatch_items_is_unchanged() -> None: _structured_skill_inputs("{phase_id"), "${{ context.planner_dir }}", ("phase_ids",), + "requires exactly one whole-value {placeholder}", id="unterminated-item-value", ), pytest.param( @@ -209,6 +222,7 @@ def test_step_without_dispatch_items_is_unchanged() -> None: _structured_skill_inputs("P1"), "/tmp/{build_id}/out.json", ("phase_ids",), + "requires exactly one whole-value {placeholder}", id="mcp-path-is-not-an-item-input", ), pytest.param( @@ -216,6 +230,7 @@ def test_step_without_dispatch_items_is_unchanged() -> None: None, "/tmp/{phase_id}/out.json", ("phase_ids",), + "in MCP argument 'output_dir' must not occur outside the inline skill command", id="item-token-also-in-mcp-kwarg", ), ], @@ -225,6 +240,7 @@ def test_invalid_dispatch_declaration_is_not_attested( skill_inputs: dict[str, object] | None, output_dir: str, producer_contexts: tuple[str, ...], + expected_reason: str, ) -> None: invocation = _bind( _step( @@ -248,10 +264,7 @@ def test_invalid_dispatch_declaration_is_not_attested( ) assert failure.name == "dispatch_items" assert "dispatch_items" in failure.message - assert failure.message.strip() - assert any( - reason in failure.message.lower() for reason in ("must", "requires", "expected", "only") - ) + assert expected_reason in failure.message assert not invocation.attested assert invocation.skill_inputs == baseline.skill_inputs assert invocation.mcp_kwargs == baseline.mcp_kwargs From 7c7cac806d8301fb482dec13242ee70ac05b188f Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:20:56 -0700 Subject: [PATCH 11/16] test(review): use dispatch producer grammar for planner provenance --- tests/recipe/test_planner_recipe.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/recipe/test_planner_recipe.py b/tests/recipe/test_planner_recipe.py index 2cbcf3ed47..5ca574274b 100644 --- a/tests/recipe/test_planner_recipe.py +++ b/tests/recipe/test_planner_recipe.py @@ -1,7 +1,6 @@ """Structural assertions for the planner recipe.""" import importlib -import re from pathlib import Path import pytest @@ -9,6 +8,7 @@ from autoskillit.core.io import load_yaml from autoskillit.core.types import BoundValueOrigin, Severity from autoskillit.recipe._api import load_and_validate +from autoskillit.recipe._binding_input import _dispatch_producer from autoskillit.recipe.io import builtin_recipes_dir, load_recipe from autoskillit.recipe.validator import run_semantic_rules from tests.recipe.conftest import assert_no_rule_errors @@ -424,9 +424,15 @@ def test_every_dispatch_step_binds_exactly_one_dispatch_item(): assert len(dispatch_inputs) == 1, name dispatch_items = raw_step["with"]["dispatch_items"] - match = re.fullmatch(r"\$\{\{\s*context\.([A-Za-z_]\w*)\s*\}\}", dispatch_items) - assert match is not None, name - assert dispatch_inputs[0].context_dependencies == (match.group(1),), name + producer = _dispatch_producer(dispatch_items) + assert producer is not None, name + namespace, producer_name = producer + assert dispatch_inputs[0].context_dependencies == ( + (producer_name,) if namespace == "context" else () + ), name + assert dispatch_inputs[0].input_dependencies == ( + (producer_name,) if namespace == "inputs" else () + ), name assert invocation.attested, name From d95e359e5933890c3ddaf4a0e569d00556e90847 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:21:46 -0700 Subject: [PATCH 12/16] test(review): derive dispatch rejection slot from bound provenance --- tests/server/test_attested_admission_replay.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/server/test_attested_admission_replay.py b/tests/server/test_attested_admission_replay.py index 676379fbfc..d9cbc60d79 100644 --- a/tests/server/test_attested_admission_replay.py +++ b/tests/server/test_attested_admission_replay.py @@ -14,6 +14,7 @@ import pytest from autoskillit.core import ( + BoundValueOrigin, InstalledRecipeExecution, RecipeSource, build_recipe_execution_credential, @@ -126,7 +127,6 @@ def _dispatch_step_parameters() -> list[Any]: _DISPATCH_STEP_PARAMETERS = _dispatch_step_parameters() -_DISPATCH_ITEM_INPUTS = {"phase_id": "target_phase_id", "context_path": "context_file"} def _dispatch_item_name(step_body: dict[str, Any]) -> str: @@ -375,7 +375,12 @@ def test_unsubstituted_dispatch_item_is_rejected( ) assert exc_info.value.code == "recipe_execution_input_type" - assert _DISPATCH_ITEM_INPUTS[item_name] in str(exc_info.value) + dispatch_input = next( + value + for value in installed.snapshot.templates[step].invocation.skill_inputs + if value.origin is BoundValueOrigin.DISPATCH_ITEM + ) + assert dispatch_input.name in str(exc_info.value) assert "unsubstituted" in str(exc_info.value).lower() From 6ecdc67d8e3f447e09b5b9227b16b2f513728a15 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:22:18 -0700 Subject: [PATCH 13/16] test(review): derive delivery dispatch samples from the bound item slot --- .../test_attestation_delivery_reachability.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/server/test_attestation_delivery_reachability.py b/tests/server/test_attestation_delivery_reachability.py index 67df41cb9f..f05ded015d 100644 --- a/tests/server/test_attestation_delivery_reachability.py +++ b/tests/server/test_attestation_delivery_reachability.py @@ -20,6 +20,7 @@ from autoskillit.core import ( RECIPE_EXECUTION_CREDENTIAL_WIRE_FIELDS, RECIPE_EXECUTION_CREDENTIAL_WIRE_KEY, + BoundValueOrigin, RecipeDeliveryMode, build_recipe_execution_credential, ) @@ -45,6 +46,7 @@ ) from tests._helpers import kitchen_identity_fields from tests._run_skill_caller_oracle import ( + _SINGLE_BRACE_TOKEN, ORCHESTRATOR_SAMPLES, build_run_skill_payload, run_skill_actual_mcp_kwargs, @@ -413,7 +415,19 @@ async def test_tool_ctx_ready_recipe_fixture_yields_genuine_attestation( skill_inputs=payload.get("skill_inputs"), actual_mcp_kwargs=run_skill_actual_mcp_kwargs(payload), ) - assert ORCHESTRATOR_SAMPLES["item"]["phase_id"] in dict(bound_inputs).values() + dispatch_input = next( + value + for value in installed.snapshot.templates[ready.step_name].invocation.skill_inputs + if value.origin is BoundValueOrigin.DISPATCH_ITEM + ) + declared = dispatch_input.declared_value + assert isinstance(declared, str) + item = _SINGLE_BRACE_TOKEN.fullmatch(declared.strip()) + assert item is not None + assert ( + dict(bound_inputs)[dispatch_input.name] + == ORCHESTRATOR_SAMPLES["item"][item.group(1).strip()] + ) else: payload = { "skill_command": with_args["skill_command"], From 6962c610b202d85d8dac63a5bc123fa3556d4648 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:22:52 -0700 Subject: [PATCH 14/16] test(review): assert every recovered dispatch input is preserved --- .../test_recipe_execution_receipt_completeness.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tests/server/test_recipe_execution_receipt_completeness.py b/tests/server/test_recipe_execution_receipt_completeness.py index fd13a2e171..a6cad68abc 100644 --- a/tests/server/test_recipe_execution_receipt_completeness.py +++ b/tests/server/test_recipe_execution_receipt_completeness.py @@ -21,8 +21,6 @@ get_recipe_execution, ) from tests._run_skill_caller_oracle import ( - _SINGLE_BRACE_TOKEN, - ORCHESTRATOR_SAMPLES, build_run_skill_payload, literal_run_skill_payload, run_skill_actual_mcp_kwargs, @@ -275,14 +273,7 @@ async def test_following_the_recovery_yields_an_admitted_digest( actual_mcp_kwargs=run_skill_actual_mcp_kwargs(payload), ) assert admitted_template is expected_template - if planner_dispatch: - item = _SINGLE_BRACE_TOKEN.search(with_value["skill_command"]) - assert item is not None - assert ( - ORCHESTRATOR_SAMPLES["item"][item.group(1).strip()] in dict(bound_inputs).values() - ) - else: - assert dict(bound_inputs) == skill_inputs + assert dict(bound_inputs) == skill_inputs @pytest.mark.parametrize("tool_ctx_ready_recipe", _RECIPE_FIXTURE_PARAMETERS, indirect=True) From 14741aac8f7a3357da1d7a861c16682b87ea9293 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:23:27 -0700 Subject: [PATCH 15/16] refactor(review): reuse the recovered step arguments in receipt tests --- tests/server/test_recipe_execution_receipt_completeness.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/server/test_recipe_execution_receipt_completeness.py b/tests/server/test_recipe_execution_receipt_completeness.py index a6cad68abc..37528ced4e 100644 --- a/tests/server/test_recipe_execution_receipt_completeness.py +++ b/tests/server/test_recipe_execution_receipt_completeness.py @@ -236,7 +236,7 @@ async def test_following_the_recovery_yields_an_admitted_digest( else: payload = literal_run_skill_payload( step_name, - {"with": ready.tool_ctx.active_recipe_steps[step_name].with_args}, + {"with": with_value}, credential, cwd=str(git_checkout), ) From 62669b5167f283e621ce2fa0f4497c1bdce91689 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sat, 24 Oct 2026 18:24:39 -0700 Subject: [PATCH 16/16] test(review): derive complete inline dispatch expectations from caller samples --- .../server/test_recipe_execution_receipt_completeness.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/server/test_recipe_execution_receipt_completeness.py b/tests/server/test_recipe_execution_receipt_completeness.py index 37528ced4e..b371162440 100644 --- a/tests/server/test_recipe_execution_receipt_completeness.py +++ b/tests/server/test_recipe_execution_receipt_completeness.py @@ -21,6 +21,8 @@ get_recipe_execution, ) from tests._run_skill_caller_oracle import ( + ORCHESTRATOR_SAMPLES, + _substitute_scalar, build_run_skill_payload, literal_run_skill_payload, run_skill_actual_mcp_kwargs, @@ -245,6 +247,10 @@ async def test_following_the_recovery_yields_an_admitted_digest( expected_template = installed.snapshot.templates[step_name] if planner_dispatch: skill_inputs = payload.get("skill_inputs") + expected_inputs = { + name: _substitute_scalar(value, ORCHESTRATOR_SAMPLES) + for name, value in expected_template.invocation.canonical_child_invocation + } else: invocation = expected_template.invocation contract = get_skill_contract(invocation.skill_name, load_bundled_manifest()) @@ -263,6 +269,7 @@ async def test_following_the_recovery_yields_an_admitted_digest( if input_defs[value.name].accepts(sample) ) skill_inputs[value.name] = actual + expected_inputs = skill_inputs bound_inputs, admitted_template = bind_attested_runtime_invocation( installed, execution_id=credential["execution_id"], @@ -273,7 +280,7 @@ async def test_following_the_recovery_yields_an_admitted_digest( actual_mcp_kwargs=run_skill_actual_mcp_kwargs(payload), ) assert admitted_template is expected_template - assert dict(bound_inputs) == skill_inputs + assert dict(bound_inputs) == expected_inputs @pytest.mark.parametrize("tool_ctx_ready_recipe", _RECIPE_FIXTURE_PARAMETERS, indirect=True)