Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8fd2f6b
fix(recipe): drive PR merges from a shared ordered cursor
Trecek Oct 24, 2026
7643c9e
fix(recipe): reject unresolved skill input templates
Trecek Oct 24, 2026
3b05af5
fix(review): describe the template rule's checked scope
Trecek Oct 24, 2026
c3ed0f8
fix(review): reject result expressions mixed with skill input references
Trecek Oct 24, 2026
c470e8f
refactor(review): share PR advancement across merge modes
Trecek Oct 24, 2026
d8b4d88
test(review): keep one exact first-PR routing assertion
Trecek Oct 24, 2026
0452543
fix(review): preserve PR order paths in UTF-8 read errors
Trecek Oct 24, 2026
46d231a
refactor(review): name cursor values at their use sites
Trecek Oct 24, 2026
e9b51eb
style(review): keep cursor exports alphabetically ordered
Trecek Oct 24, 2026
fc51a21
test(review): remove cursor assertions implied by exact inventories
Trecek Oct 24, 2026
461ddca
test(review): annotate the order-file helper boundary
Trecek Oct 24, 2026
fe64f78
test(review): keep PR order fixtures focused on cursor fields
Trecek Oct 24, 2026
67a51be
test(review): name the dynamic-skill deferral behavior
Trecek Oct 24, 2026
27c360b
test(review): pin documented literal template forms
Trecek Oct 24, 2026
b44ac1a
fix(review): preserve routing boundaries while sharing cursor bindings
Trecek Oct 24, 2026
3790e58
fix(review): retain declarations required by guarded recipe delivery
Trecek Oct 24, 2026
2b35ca2
fix(recipe): refresh merge-prs diagram hash after rebase
Trecek Oct 24, 2026
aae7e14
test: retire resolved merge-pr admission xfail for #5306
Trecek Oct 24, 2026
4e76ef8
fix(recipe): refresh diagram after develop admission update
Trecek Oct 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions scripts/recipe/advance_queue_pr.sh

This file was deleted.

6 changes: 4 additions & 2 deletions src/autoskillit/recipe/_cmd_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from __future__ import annotations

from autoskillit.recipe.cmd_rpc._cmd_rpc import (
advance_queue_pr,
attempt_cheap_rebase,
batch_create_issues,
check_dropped_ci_loop,
Expand All @@ -21,9 +20,11 @@
emit_fallback_map,
ensure_results,
export_local_bundle,
first_ordered_pr,
force_push_and_wait_mergeability,
immediate_merge_conflict_fix,
main_repo_guard,
next_ordered_pr,
proactive_rebase_next_pr,
queue_ejected_fix,
refetch_issues,
Expand All @@ -36,7 +37,6 @@
)

__all__ = [
"advance_queue_pr",
"attempt_cheap_rebase",
"batch_create_issues",
"check_dropped_ci_loop",
Expand All @@ -50,9 +50,11 @@
"emit_fallback_map",
"ensure_results",
"export_local_bundle",
"first_ordered_pr",
"force_push_and_wait_mergeability",
"immediate_merge_conflict_fix",
"main_repo_guard",
"next_ordered_pr",
"proactive_rebase_next_pr",
"queue_ejected_fix",
"refetch_issues",
Expand Down
6 changes: 4 additions & 2 deletions src/autoskillit/recipe/_cmd_rpc_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
_attempt_rebase_with_conflict_report,
_detect_remote,
_write_rebase_conflict_report,
advance_queue_pr,
annotations,
atomic_write,
attempt_cheap_rebase,
create_persistent_integration,
direct_merge_conflict_fix,
first_ordered_pr,
force_push_and_wait_mergeability,
get_logger,
immediate_merge_conflict_fix,
logger,
next_ordered_pr,
proactive_rebase_next_pr,
queue_ejected_fix,
review_path_rebase,
Expand All @@ -39,16 +40,17 @@
"_attempt_rebase_with_conflict_report",
"_detect_remote",
"_write_rebase_conflict_report",
"advance_queue_pr",
"annotations",
"atomic_write",
"attempt_cheap_rebase",
"create_persistent_integration",
"direct_merge_conflict_fix",
"first_ordered_pr",
"force_push_and_wait_mergeability",
"get_logger",
"immediate_merge_conflict_fix",
"logger",
"next_ordered_pr",
"proactive_rebase_next_pr",
"queue_ejected_fix",
"review_path_rebase",
Expand Down
9 changes: 6 additions & 3 deletions src/autoskillit/recipe/cmd_rpc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

if TYPE_CHECKING:
from ._cmd_rpc import (
advance_queue_pr,
attempt_cheap_rebase,
batch_create_issues,
check_dropped_ci_loop,
Expand All @@ -25,9 +24,11 @@
emit_fallback_map,
ensure_results,
export_local_bundle,
first_ordered_pr,
force_push_and_wait_mergeability,
immediate_merge_conflict_fix,
main_repo_guard,
next_ordered_pr,
proactive_rebase_next_pr,
queue_ejected_fix,
refetch_issues,
Expand Down Expand Up @@ -112,7 +113,6 @@ def __getattr__(name: str):
)

_LAZY_SYMBOL_TO_MODULE: dict[str, str] = {
"advance_queue_pr": "_cmd_rpc_merge",
"attempt_cheap_rebase": "_cmd_rpc_merge",
"batch_create_issues": "_cmd_rpc_issues",
"check_dropped_ci_loop": "_cmd_rpc_guards",
Expand All @@ -126,9 +126,11 @@ def __getattr__(name: str):
"emit_fallback_map": "_cmd_rpc_issues",
"ensure_results": "_cmd_rpc_issues",
"export_local_bundle": "_cmd_rpc_issues",
"first_ordered_pr": "_cmd_rpc_merge",
"force_push_and_wait_mergeability": "_cmd_rpc_merge",
"immediate_merge_conflict_fix": "_cmd_rpc_merge",
"main_repo_guard": "_cmd_rpc_guards",
"next_ordered_pr": "_cmd_rpc_merge",
"proactive_rebase_next_pr": "_cmd_rpc_merge",
"queue_ejected_fix": "_cmd_rpc_merge",
"refetch_issues": "_cmd_rpc_issues",
Expand Down Expand Up @@ -202,7 +204,6 @@ def __getattr__(name: str):
"_strip_ticket_body",
"_validate_mutation_variables",
"_write_rebase_conflict_report",
"advance_queue_pr",
"atomic_write",
"attempt_cheap_rebase",
"batch_create_issues",
Expand All @@ -219,12 +220,14 @@ def __getattr__(name: str):
"emit_fallback_map",
"ensure_results",
"export_local_bundle",
"first_ordered_pr",
"force_push_and_wait_mergeability",
"get_logger",
"immediate_merge_conflict_fix",
"is_generated_path",
"logger",
"main_repo_guard",
"next_ordered_pr",
"proactive_rebase_next_pr",
"queue_ejected_fix",
"read_stable_contained_bytes",
Expand Down
3 changes: 2 additions & 1 deletion src/autoskillit/recipe/cmd_rpc/_cmd_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
refetch_issues,
)
from autoskillit.recipe.cmd_rpc._cmd_rpc_merge import ( # noqa: F401
advance_queue_pr,
attempt_cheap_rebase,
create_persistent_integration,
direct_merge_conflict_fix,
first_ordered_pr,
force_push_and_wait_mergeability,
immediate_merge_conflict_fix,
next_ordered_pr,
proactive_rebase_next_pr,
queue_ejected_fix,
review_path_rebase,
Expand Down
70 changes: 49 additions & 21 deletions src/autoskillit/recipe/cmd_rpc/_cmd_rpc_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,29 +310,57 @@ def force_push_and_wait_mergeability(
raise RuntimeError(msg)


def advance_queue_pr(
current_pr_number: str,
pr_order_file: str,
) -> dict[str, str]:
"""Find next PR in queue order file."""
if not current_pr_number:
return {"error": f"current_pr_number is required, got {current_pr_number!r}"}
_PR_COMPLEXITIES = frozenset({"simple", "needs_check"})


def _load_pr_order(pr_order_file: str) -> list[tuple[str, str]]:
if not Path(pr_order_file).is_absolute():
raise ValueError(f"pr_order_file must be absolute: {pr_order_file!r}")
try:
with open(pr_order_file) as f:
with open(pr_order_file, encoding="utf-8") as f:
order = json.load(f)
except (OSError, json.JSONDecodeError) as exc:
raise RuntimeError(str(exc)) from exc
current = int(current_pr_number)
idx = None
for i, entry in enumerate(order):
if entry.get("number") == current:
idx = i
break
if idx is None:
return {"current_pr_number": "done"}
if (idx + 1) < len(order):
return {"current_pr_number": str(order[idx + 1]["number"])}
return {"current_pr_number": "done"}
except (OSError, UnicodeError, json.JSONDecodeError) as exc:
raise RuntimeError(f"{pr_order_file}: {exc}") from exc
if not isinstance(order, dict) or not isinstance(order.get("prs"), list):
raise ValueError(f"{pr_order_file}: expected an object with a prs list")
entries: list[tuple[str, str]] = []
seen: set[int] = set()
for index, entry in enumerate(order["prs"]):
location = f"{pr_order_file}: prs[{index}]"
if not isinstance(entry, dict):
raise ValueError(f"{location}: expected an object")
number, complexity = entry.get("number"), entry.get("complexity")
if isinstance(number, bool) or not isinstance(number, int) or number <= 0:
raise ValueError(f"{location}: number must be a positive integer")
if not isinstance(complexity, str) or complexity not in _PR_COMPLEXITIES:
raise ValueError(f"{location}: complexity must be simple or needs_check")
if number in seen:
raise ValueError(f"{location}: duplicate PR number {number}")
seen.add(number)
entries.append((str(number), complexity))
return entries


def _cursor_result(entry: tuple[str, str], *, done: bool) -> dict[str, str]:
pr_number, complexity = entry
return {"pr_number": pr_number, "complexity": complexity, "done": "true" if done else "false"}


def first_ordered_pr(pr_order_file: str) -> dict[str, str]:
"""Select the first eligible PR from the analyze-prs order artifact."""
entries = _load_pr_order(pr_order_file)
return _cursor_result(entries[0] if entries else ("", ""), done=not entries)


def next_ordered_pr(pr_order_file: str, current_pr_number: str) -> dict[str, str]:
"""Advance by file order, retaining the last PR when the order is exhausted."""
entries = _load_pr_order(pr_order_file)
for index, entry in enumerate(entries):
pr_number, _ = entry
if pr_number == current_pr_number:
done = index + 1 == len(entries)
return _cursor_result(entry if done else entries[index + 1], done=done)
raise ValueError(f"{pr_order_file}: current_pr_number {current_pr_number!r} is not in prs")


def review_path_rebase(
Expand Down
63 changes: 63 additions & 0 deletions src/autoskillit/recipe/rules/rules_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from collections.abc import Iterator
from typing import cast

import regex as re
from packaging.version import Version
Expand All @@ -15,11 +16,13 @@
BindingFailureCode,
BoundValue,
BoundValueOrigin,
BoundValueState,
Severity,
get_logger,
)
from autoskillit.recipe._analysis import ValidationContext, bfs_reachable
from autoskillit.recipe.contracts import (
RESULT_CAPTURE_RE,
SkillInput,
get_skill_contract,
load_bundled_manifest,
Expand All @@ -31,6 +34,66 @@
logger = get_logger(__name__)


_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:
value = cast(str, bound.declared_value)
scan = value
for name in bound.template_dependencies:
scan = scan.replace("{{" + name + "}}", "")
if "${{" in scan and (
RESULT_CAPTURE_RE.search(scan)
or (not bound.context_dependencies and not bound.input_dependencies)
):
return (
"the binder treats this unresolved expression as static, so admission accepts only "
"the compiled effective value"
)
if not per_item and _WHOLE_VALUE_PLACEHOLDER_RE.fullmatch(value.strip()):
return "this is a whole-value placeholder the binder treats as a static literal"
return None


@semantic_rule(
name="unresolved-skill-input-template",
description=(
"Reject whole-value skill input placeholders and unresolved ${{ ... }} expressions "
"that compile to static values runtime admission cannot accept (recipe validation only)."
),
severity=Severity.ERROR,
)
def _check_unresolved_skill_input_template(ctx: ValidationContext) -> list[RuleFinding]:
findings: list[RuleFinding] = []
for step_name, step in ctx.recipe.steps.items():
if step.tool not in SKILL_TOOLS:
continue
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)
if reason is not None:
findings.append(
make_finding(
rule_name="unresolved-skill-input-template",
step_name=step_name,
message=(
f"Skill input '{bound.name}' declares {bound.declared_value!r}: "
f"{reason}. "
"Bind ${{ context.<var> }} from a recipe-level producer step, "
"or ${{ inputs.<name> }}."
),
)
)
return findings


@semantic_rule(
name="outdated-recipe-version",
description="Recipe's autoskillit_version is below the installed package version",
Expand Down
26 changes: 21 additions & 5 deletions src/autoskillit/recipe/skill_contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3683,20 +3683,36 @@ callable_contracts:
outputs:
- name: ok
type: str
autoskillit.recipe._cmd_rpc.advance_queue_pr:
autoskillit.recipe._cmd_rpc.first_ordered_pr:
inputs:
- name: current_pr_number
- name: pr_order_file
type: str
required: true
nullable: false
outputs:
- name: pr_number
type: str
- name: complexity
type: str
- name: done
type: str
allowed_values: ['true', 'false']
autoskillit.recipe._cmd_rpc.next_ordered_pr:
inputs:
- name: pr_order_file
type: str
required: true
outputs:
- name: current_pr_number
type: str
- name: error
required: true
nullable: false
outputs:
- name: pr_number
type: str
- name: complexity
type: str
- name: done
type: str
allowed_values: ['true', 'false']
autoskillit.recipe._cmd_rpc.proactive_rebase_next_pr:
inputs:
- name: work_dir
Expand Down
Loading
Loading