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, skills, 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.
agents
Per-agent runner trait, error types, and agent registry.
context
Context building for task execution.
cow
Copy-on-write task worktrees cloned from a per-project template by the git-cow crate, see docs/content/cow-worktrees.md
diff
direct
One-shot agent invocation without tmux.
fallback
Error recovery and fallback strategies.
git_ops
Git operations — auto-commit, push, PR creation.
response
Response collection + error classification.
response_handler
Success-path response handler — commit, push, PR, token storage.
session
Agent session management — spawn, wait for completion, collect output.
task_init
Task initialization — guard checks, worktree setup, and invocation building.
worktree
Git worktree management for task execution.

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)