Skip to content

Add lightweight orchestrator CLI with supervisor/worker subprocess flows#298

Open
mmprotest wants to merge 2 commits into
mainfrom
mmprotest/add-orchestrator-command-to-villani-code
Open

Add lightweight orchestrator CLI with supervisor/worker subprocess flows#298
mmprotest wants to merge 2 commits into
mainfrom
mmprotest/add-orchestrator-command-to-villani-code

Conversation

@mmprotest

Copy link
Copy Markdown
Owner

Motivation

  • Provide a dead-simple, deterministic orchestrator for multi-step repo work that reuses the existing CLI runner as subprocesses and keeps orchestration logic outside model output parsing.
  • Keep the design minimal: supervisor + worker roles only, up to 3 subtasks, up to 1 retry per worker, and deterministic verification outside the model.

Description

  • Added a new top-level CLI command orchestrate that invokes villani_code.orchestrator.run_orchestrator(...) and prints a concise final summary.
  • Extended run in villani_code/cli.py with hidden machine-only flags --role, --result-json-path, and --parent-mission-id, and made run emit a strict JSON artifact to the provided --result-json-path when present while preserving normal UX.
  • Implemented orchestrator modules: villani_code/orchestrator.py (controller + subprocess launcher), villani_code/orchestrator_models.py (typed dataclasses and state persistence), villani_code/orchestrator_roles.py (supervisor/worker prompt builders), villani_code/orchestrator_git.py (minimal git worktree/merge/diff helpers), and villani_code/orchestrator_verify.py (deterministic worker and final verification heuristics).
  • Kept subprocess approach: the orchestrator runs child agents via python -m villani_code.cli run ... (see run_villani_subprocess) and consumes the strict JSON artifact at --result-json-path instead of parsing human stdout.
  • Updated villani_code/subagent_runtime.py to include supervisor and worker role presets with simple allowed-tool constraints.
  • Added focused tests under tests/ that mock subprocess/git interactions to validate direct/split supervisor behavior, invalid supervisor artifacts, retry/blocked/timeout flows, merge/final-verification failure handling, and CLI machine-artifact emission.

Testing

  • Ran the new unit tests with: pytest -q tests/test_orchestrator.py tests/test_cli_orchestrator_flags.py and all tests passed (12 passed).
  • Tests mock subprocess and git operations to avoid live model calls and real worktrees while exercising orchestrator logic and state persistence under .villani_code/missions/<mission_id>/orchestrator/.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant