Skip to content

Replace review.sh with run_agent.py and extract review prompt template#89

Merged
vm-mishchenko merged 4 commits into
mainfrom
universal-agent-runner
May 15, 2026
Merged

Replace review.sh with run_agent.py and extract review prompt template#89
vm-mishchenko merged 4 commits into
mainfrom
universal-agent-runner

Conversation

@vm-mishchenko
Copy link
Copy Markdown
Owner

Summary

Converted the review script from bash to Python for improved maintainability and testability. Extracted the review prompt from the script into a separate scripts/review.md template file. The new run_agent.py is a universal agent runner that:

  • Accepts a prompt template path (absolute or relative) and model name
  • Substitutes template variables from environment (DRAFT_REPO_DIR, DRAFT_BRANCH, DRAFT_BASE_BRANCH, DRAFT_SPEC_FILE)
  • Validates auggie authentication before execution
  • Forwards non-empty stdout as rejection signals, empty output as approval
  • Returns appropriate exit codes for integration with config.yaml review-implementation step

Test plan

  • Unit tests for template path resolution (absolute/relative paths)
  • Variable substitution with all four env vars, missing vars, repeated placeholders
  • Auggie authentication pre-flight checks with various failure modes
  • Subprocess execution with correct arguments and error handling
  • Integration tests covering argument validation, env var requirements, approval/rejection output
  • All 18 tests pass

Implements a universal Python script to run prompt templates against
the auggie coding agent. Resolves template paths, substitutes
environment variables (DRAFT_REPO_DIR, DRAFT_BRANCH,
DRAFT_BASE_BRANCH, DRAFT_SPEC_FILE), validates auggie auth, and
handles output verdicts (approval if no issues found, rejection if
FOUND_ISSUES present). Includes comprehensive test coverage for all
functionality. Will serve as a reviewer in the review-implementation
step of config.yaml.
…_DIR

- Replace `"FOUND_ISSUES" in stdout` guard with `stdout.strip()` — review
  contract treats any non-empty output as rejection, not just sentinel
- Require only `DRAFT_REPO_DIR` up front; collect remaining vars from env
  as optional substitutions — templates may use only a subset of vars
- Update approval test to return `""` instead of `"NO_ISSUES"` to match
  the real approval signal
- Update missing-var test to pop `DRAFT_REPO_DIR`, the only mandatory var
…ie PATH

- Delete scripts/review.sh — review issue: old bash script was not removed
  when run_agent.py was introduced as its replacement
- Add scripts/review.md with prompt extracted from review.sh — review issue:
  run_agent.py requires a template file but the prompt was never migrated out
  of the deleted script
- Convert ${VAR} bash syntax to {VAR} brace syntax in review.md — required by
  run_agent.py's fill_template substitution logic
- Remove FOUND_ISSUES sentinel contract from review.md output rules — review
  issue: run_agent.py forwards all non-empty stdout, no sentinel filtering
- Add shutil.which("auggie") guard before subprocess.run — review issue:
  missing PATH check would surface as opaque FileNotFoundError traceback
The test now mocks shutil.which alongside subprocess.run to
simulate auggie being available, fixing CI failures when auggie
is not installed in the test environment.
@vm-mishchenko vm-mishchenko marked this pull request as ready for review May 15, 2026 05:31
@vm-mishchenko vm-mishchenko merged commit 8b46097 into main May 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant