Skip to main content

Module worktree

Module worktree 

Source
Expand description

Git worktree lifecycle for isolated phase runs.

Each batty work <phase> run gets a dedicated branch/worktree: <phase-slug>-run-<NNN>. The executor runs in that worktree. Cleanup is merge-aware:

  • merged runs are removed (worktree + branch)
  • rejected/failed/unmerged runs are retained for inspection

Structs§

AgentWorktree
PhaseWorktree

Enums§

CleanupDecision
RunOutcome

Functions§

branch_fully_merged
Check if all commits on branch since diverging from base are already present on base (e.g., via cherry-pick).
git_current_branch
Get the current branch name for a repository/worktree path.
prepare_agent_worktrees
Prepare (or reuse) one worktree per parallel agent slot for a phase.
prepare_phase_worktree
Create an isolated git worktree for a phase run.
reset_worktree_to_base
Reset a worktree to point at its base branch. Used to clean up after a cherry-pick merge has made the task branch redundant.
resolve_phase_worktree
Resolve the phase worktree for a run.
sync_phase_board_to_worktree
Sync the phase board from the source tree into the worktree.