Skip to content

Add minimal orchestrate mode with isolated scout/patch workspaces#308

Open
mmprotest wants to merge 3 commits into
mainfrom
mmprotest/implement-orchestrate-function-for-villani-code
Open

Add minimal orchestrate mode with isolated scout/patch workspaces#308
mmprotest wants to merge 3 commits into
mainfrom
mmprotest/implement-orchestrate-function-for-villani-code

Conversation

@mmprotest

Copy link
Copy Markdown
Owner

Motivation

  • Provide a small, deterministic outer loop to run multiple constrained Villani worker invocations in isolated worktrees to improve long-horizon task performance while avoiding a full multi-agent/chat redesign.
  • Enforce that the orchestrator owns state, verification, scoring, and merge decisions and that workers perform only bounded, isolated repo work.

Description

  • Add a new villani_code.orchestrate package implementing a simple round loop (DISCOVERPLANEXECUTEVERIFYMERGE) with compact orchestration state saved to artifacts/orchestrate/<run_id>/state.json, and emit per-round artifacts plus final_report.json and summary.md (files: orchestrator.py, state.py, prompts.py, worker.py, worktree.py, verify.py, merge.py, __init__.py).
  • Wire a new CLI command villani-code orchestrate "<task>" with the requested flags and passthrough for --provider/--model/--base-url/--api-key, and defaults: --workers=3, --scout-workers=3, --patch-workers=2, --rounds=3, --worker-timeout=300, --keep-worktrees and optional --verify-command. (villani_code/cli.py).
  • Implement isolated workspaces via WorkspaceManager that prefers git worktree and falls back to copying a temp repo, enforces dirty-checks for scouts, and supports cleanup honoring --keep-worktrees (worktree.py).
  • Implement a forgiving worker adapter and parser that runs the normal villani_code runner for workers, extracts a WORKER_REPORT_JSON block when present, and builds a resilient fallback report when parsing fails or a worker times out (worker.py, prompts.py).
  • Add verification detection and execution helpers that reuse the existing benchmark verifier where possible, and a conservative candidate scoring and guarded-merge flow that only applies changes to the original repo after verification passes (verify.py, merge.py, orchestrator.py).

Testing

  • Added unit and integration-like tests: tests/test_orchestrate_state.py, tests/test_orchestrate_worker.py, tests/test_orchestrate_merge.py, tests/test_orchestrate_worktree.py, and tests/test_orchestrate_integration.py to cover state serialization, report parsing, scoring, worktree cleanup, and artifact generation.
  • Ran: pytest -q tests/test_orchestrate_state.py tests/test_orchestrate_worker.py tests/test_orchestrate_merge.py tests/test_orchestrate_worktree.py tests/test_orchestrate_integration.py tests/test_init_cli.py tests/test_cli_debug_flags.py, which passed (10 passed, 3 warnings).

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