Skip to main content

Module foreman_loop

Module foreman_loop 

Source
Expand description

Foreman delegation: verified parallel coding inside a coder session.

Composition of the two systems, each keeping its own boundary:

  • Foreman (car-multi patterns/foreman, #274) decomposes the intent, farms subtasks to an external CLI in per-subtask worktrees, and gates each patch plus the integrated union (AST containment + build/test + policy). Its repo root is the coder session’s worktree — clean at HEAD when delegation starts — so subtask worktrees and the staging tree never see the user’s checkout.
  • The coder applies the gate-accepted union into its session worktree and then evaluates the outcome contract itself. Foreman’s gate is an inner filter; the contract stays the outer trust boundary, exactly as with the single-session external engine.

Fallback ladder (driven by super::rpc): foreman declining (prefer_single_session, invalid plan, nothing accepted, integration rejected) → single-session external CLI → native loop. A red contract after foreman applied work falls to the native loop too — which then repairs on top of foreman’s changes rather than starting over.

When the daemon’s MCP listener is bound, its URL is threaded into car_multi::FarmOutConfig::mcp_endpoint so the farmed-out CLI workers’ CAR-namespace tool calls (memory_*, verify, skill_*) route back through car-server’s policy + memgine — gated and audited. The workers’ own built-in tools (Edit, Bash) stay ungoverned (the residual upstream stage-4b limitation), contained by the per-worktree gate and the outer contract.

Cancellation is honored between stages (plan / farm / integrate); an in-flight farm-out cannot be killed mid-stage yet (same limitation as the single-session external engine).

Structs§

ForemanRun
A foreman run, and what of it actually reached the session worktree.

Enums§

ForemanFallback
Why foreman declined, so the caller can fall down the ladder. Not an error: every variant has a working next step.

Functions§

run_foreman_loop
Run foreman delegation to a contract-evaluated outcome, or decline with a fallback the caller can act on.