Skip to main content

Module runner

Module runner 

Source
Expand description

Task runner — executes tasks using AI agents.

Replaces run_task.sh with pure Rust. The runner:

  1. Sets up a git worktree for isolation
  2. Builds context (project instructions, comments)
  3. Renders prompts and spawns the agent in tmux
  4. Waits for completion, collects and classifies the response
  5. Handles errors (reroute on limits, fallback agents)
  6. Auto-commits, pushes, and creates PRs
  7. Updates status labels and posts result comments

Submodules handle the heavy lifting:

  • task_init — guard checks, worktree setup, and invocation building
  • session — tmux session lifecycle and output collection
  • response_handler — success path: commit, push, PR, token storage
  • fallback — error classification and recovery strategies

Re-exports§

pub use response::WeightSignal;

Modules§

agent
Agent command building + tmux invocation.
context
Context building for task execution.
fallback
Error recovery and fallback strategies.
ndjson
Renders agent NDJSON as a Claude Code style transcript for orch stream, orch task watch and session export. Each agent’s runner turns its own lines into StreamEvents
response
Response collection + error classification.
response_handler
Success-path response handler — commit, push, PR, token storage.
sandbox
The OS sandbox around a task or review agent, on unless workflow.sandbox is false. The policy and why it is shaped this way are in docs/plans/2026-10-28-agent-sandboxes.md
session
Agent session management — spawn, wait for completion, collect output.
task_init
Task initialization — guard checks, worktree setup, and invocation building.
template

Structs§

RunAudit
Fully materialized task-run audit data.
RunExecution
Result returned by run() so callers can persist the audit trail.
TaskRunner
Task runner configuration.

Functions§

parse_session_output
Tries parse_success_output first when stdout is non-empty. If that succeeds, returns success regardless of exit code. If it fails and exit_code != 0, checks for "terminal_reason":"completed" or cost-telemetry-only stdout ("costUSD":) before falling back to classify_error, so valid sessions that exit 1 produce InvalidResponse (soft error, re-route) instead of a garbled Unknown/Auth error (hard failure with spurious cooldown)