Skip to content

feat: Rust recipe runner integration with engine selection#2951

Merged
rysweet merged 7 commits intomainfrom
feature/rust-recipe-runner-integration
Mar 8, 2026
Merged

feat: Rust recipe runner integration with engine selection#2951
rysweet merged 7 commits intomainfrom
feature/rust-recipe-runner-integration

Conversation

@rysweet
Copy link
Owner

@rysweet rysweet commented Mar 8, 2026

Rust Recipe Runner Integration

Integrates the standalone Rust recipe runner into amplihack with automatic engine selection and startup dependency management.

What's included

  • src/amplihack/recipes/rust_runner.py — Binary wrapper with find_rust_binary(), ensure_rust_recipe_runner(), and run_recipe_via_rust(). Raises RustRunnerNotFoundError when the Rust engine is explicitly selected but the binary is missing (no silent fallback).
  • src/amplihack/recipes/__init__.py — Engine selection via RECIPE_RUNNER_ENGINE env var:
    • rust → Rust binary only (fails if not installed)
    • python → Python runner only
    • (not set) → auto-detect (Rust if binary found, Python otherwise)
  • src/amplihack/install.py — Step 6.5 automatically installs recipe-runner-rs during amplihack install if cargo is available
  • tests/recipes/test_rust_runner.py — 26 tests covering binary discovery, execution, JSON parsing, engine selection, and the ensure flow
  • docs/recipes/README.md — Documents engine selection table and auto-install
  • .gitignore — Excludes recipe runner checkout directory

Design Principles

  • No fallback — when RECIPE_RUNNER_ENGINE=rust, the binary must exist or execution fails with a clear error
  • Auto-detect is a convenience — if neither env var is set, the system picks the best available engine and logs which one was selected
  • Best-effort installensure_rust_recipe_runner() tries cargo install --git but doesn't block startup if it fails

Testing

uv run pytest tests/recipes/test_rust_runner.py -v  # 26 tests

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

🤖 Auto-fixed version bump

The version in pyproject.toml has been automatically bumped to the next patch version.

If you need a minor or major version bump instead, please update pyproject.toml manually and push the change.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

Repo Guardian - Passed

All files are durable repository content

Reviewed 6 changed files:

  • .gitignore - Repository configuration
  • docs/recipes/README.md - Feature documentation
  • pyproject.toml - Version metadata
  • src/amplihack/recipes/__init__.py - Engine selection logic
  • src/amplihack/recipes/rust_runner.py - Rust integration module
  • tests/recipes/test_rust_runner.py - Unit tests

No ephemeral content detected (no meeting notes, temporary scripts, or point-in-time documents).

AI generated by Repo Guardian

@rysweet rysweet force-pushed the feature/rust-recipe-runner-integration branch from 1c447a3 to 902cfa8 Compare March 8, 2026 03:44
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

🤖 Auto-fixed version bump

The version in pyproject.toml has been automatically bumped to the next patch version.

If you need a minor or major version bump instead, please update pyproject.toml manually and push the change.

@rysweet rysweet force-pushed the feature/rust-recipe-runner-integration branch from c5dd179 to c0d3e13 Compare March 8, 2026 03:45
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

🤖 Auto-fixed version bump

The version in pyproject.toml has been automatically bumped to the next patch version.

If you need a minor or major version bump instead, please update pyproject.toml manually and push the change.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

🤖 PR Triage Complete

Risk Level: Medium-High (6.5/10)
Priority: Medium
Status: ⚠️ Requires attention before merge


📊 Summary

This PR integrates a Rust recipe runner as an alternative execution engine with automatic selection and graceful fallback to Python.

Changes:

  • 626 additions, 4 deletions across 7 files
  • New rust_runner.py module with binary discovery and execution
  • Engine selection via RECIPE_RUNNER_ENGINE environment variable
  • Auto-install during amplihack install when cargo available
  • 26 comprehensive tests

⚠️ Critical Issues

  1. Merge Conflicts - mergeable_state: dirty - must be resolved before merging
  2. Cross-platform validation needed - Binary discovery may behave differently on Windows/macOS/Linux
  3. CI/CD impact - Rust toolchain availability in CI environments not validated

🎯 Strengths

  • ✅ Excellent test coverage (26 tests)
  • ✅ Clear error handling (no silent fallback when RECIPE_RUNNER_ENGINE=rust)
  • ✅ Backwards compatible (defaults to Python)
  • ✅ Well-documented engine selection
  • ✅ Graceful degradation pattern

🔍 Concerns

  • External dependency - Adds Rust toolchain requirement (optional but increases complexity)
  • Installation time - Auto-install may slow amplihack install process
  • Attack surface - New binary dependency requires security review
  • Platform coverage - Cross-platform binary discovery needs validation

📋 Recommended Actions

Before Merge:

  1. CRITICAL: Resolve merge conflicts
  2. ✅ Test on Windows, macOS, Linux to validate binary discovery
  3. ✅ Verify CI behavior when Rust unavailable
  4. ✅ Validate install.py handles cargo failures gracefully
  5. ⚙️ Consider performance benchmarks (Rust vs Python engine)

Post-Merge:

  • Monitor installation metrics for slowdowns
  • Collect engine selection telemetry to understand adoption
  • Document recommended environments for Rust engine

🏷️ Labels Applied

  • triage:complete
  • triage:needs-testing
  • triage:medium-risk

Triaged by PR Triage Agent on 2026-03-08T12:57:00Z

AI generated by PR Triage Agent

rysweet pushed a commit that referenced this pull request Mar 8, 2026
PR-M1: Split run_recipe_via_rust into focused helpers
PR-M2: Configurable timeouts via env vars
PR-M3: Remove point-in-time Python references in docs
PR-M4: Remove hardcoded counts from docs
PR-M5: Add tests for empty results and exception paths
PR-L1: Redact context values in log output
PR-L2: Lazy binary search path evaluation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

🟡 Triage Result: NEEDS CONFLICT RESOLUTION

Priority: MEDIUM-HIGH | Risk: HIGH

Assessment

High-value Rust recipe runner integration with manageable scope, but merge conflicts prevent automated merging.

Stats:

  • 9 files changed (+883/-13)
  • 6 commits, 15.5 hours old
  • Recent activity shows active development

Blockers

Merge conflicts - must be resolved before review

Recommended Action

  1. Resolve merge conflicts via rebase:

    git checkout feature/rust-recipe-runner-integration
    git fetch origin
    git rebase origin/main
    # Resolve conflicts
    git push --force-with-lease
  2. Manual review after conflicts resolved due to integration complexity

Why This Matters

Recipe runner integration is foundational infrastructure. Clean merge critical for:

  • Engine selection logic correctness
  • Startup dependency management
  • Python/Rust compatibility

Related Issues

  • See triage issue tracking merge conflict epidemic
  • Part of 75% PR conflict rate (3 of 4 PRs)

Automated triage by PR Triage Agent - Run #22827330377

AI generated by PR Triage Agent

Ubuntu and others added 6 commits March 8, 2026 20:46
Adds the Rust recipe runner binary integration with automatic engine
selection and startup dependency management.

- src/amplihack/recipes/rust_runner.py: Binary wrapper with find, ensure,
  and execute functions. RustRunnerNotFoundError for explicit failures.
  ensure_rust_recipe_runner() auto-installs via cargo if binary is missing.
- src/amplihack/recipes/__init__.py: Engine selection via RECIPE_RUNNER_ENGINE
  env var (rust/python/auto-detect). Exports ensure_rust_recipe_runner.
- src/amplihack/install.py: Step 6.5 ensures binary during amplihack install.
- tests/recipes/test_rust_runner.py: 26 tests covering discovery, execution,
  engine selection, and ensure flow.
- docs/recipes/README.md: Documents engine selection and auto-install.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Validate RECIPE_RUNNER_ENGINE values (raise ValueError on unknown)
- Add non-interactive footer to NestedSessionAdapter
- Add session depth tracking to NestedSessionAdapter

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PR-M1: Split run_recipe_via_rust into focused helpers
PR-M2: Configurable timeouts via env vars
PR-M3: Remove point-in-time Python references in docs
PR-M4: Remove hardcoded counts from docs
PR-M5: Add tests for empty results and exception paths
PR-L1: Redact context values in log output
PR-L2: Lazy binary search path evaluation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…th (C2-PR-1, C2-PR-2, C2-PR-6, C2-PR-9, C2-PR-10)

C2-PR-1: Raise ValueError on invalid RECIPE_RUNNER_ENGINE values
C2-PR-2: Log full traceback for ensure_rust_recipe_runner failures
C2-PR-6: Enforce AMPLIHACK_MAX_DEPTH in execute_agent_step
C2-PR-9: Add test for invalid engine value validation
C2-PR-10: Add test for execution timeout propagation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…g_dir (C2-INT-3/4/5/6/7/10)

C2-INT-3: Serialize Duration as f64 seconds (Rust repo)
C2-INT-4/5/6: Document Rust-only features in engine comparison table
C2-INT-7: Document all environment variables
C2-INT-10: Resolve working_dir to absolute path to prevent double-application

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ority test (C3-PR-1/2/3)

C3-PR-1: Print warning on install exception (was silent)
C3-PR-2: Return resolved path from find_rust_binary for env var path
C3-PR-3: Fix false-confidence test with discriminating mock

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rysweet rysweet force-pushed the feature/rust-recipe-runner-integration branch from 33e5b79 to 16928c8 Compare March 8, 2026 20:49
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

🤖 Auto-fixed version bump

The version in pyproject.toml has been automatically bumped to the next patch version.

If you need a minor or major version bump instead, please update pyproject.toml manually and push the change.

@rysweet rysweet merged commit 63409a0 into main Mar 8, 2026
1 check passed
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

Repo Guardian - Passed

All files are durable repository content

Reviewed 8 changed files:

  • .gitignore - Repository configuration
  • docs/recipes/README.md - Feature documentation
  • pyproject.toml - Version metadata
  • src/amplihack/install.py - Installation logic
  • src/amplihack/recipes/__init__.py - Engine selection logic
  • src/amplihack/recipes/adapters/nested_session.py - Adapter module
  • src/amplihack/recipes/rust_runner.py - Rust integration module
  • tests/recipes/test_rust_runner.py - Unit tests

No ephemeral content detected (no meeting notes, temporary scripts, or point-in-time documents).

AI generated by Repo Guardian

AI generated by Repo Guardian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant