You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run a batch of related sub-issues as a sequential stacked PR chain — each PR building on the previous. When upstream PRs change (review feedback, CI fixes), downstream tasks automatically rebase and re-run.
autopilot chain --epic 52 # fetch sub-issues of #52, run as stacked chain
autopilot chain --issues 51,52,53 # explicit issue list, run as stacked chain
Motivation
Today, autopilot-loop handles one task at a time. For larger features that decompose into multiple sub-tasks, users must manually:
Run each sub-task sequentially, waiting for completion
Manually set PR base branches for stacking
Manually rebase downstream PRs when upstream changes
Type out issue numbers instead of referencing an epic
This is exactly the kind of repetitive coordination that should be automated.
Architecture: Sequential Stacked Chain with Branch Checkout
V1 uses standard git checkout for branch switching, not git worktrees.
We evaluated git worktrees extensively. While they provide workspace isolation (agent and user don't share the same working tree), they have a critical practical problem: every worktree is a full copy of the working tree (minus .git). For large repos with expensive dependency bootstrapping (Rails apps needing bundle install, Node projects needing npm install, etc.), each worktree requires a full re-bootstrap of dependencies. This can take 10+ minutes per worktree, making chains impractical.
Branch checkout keeps installed dependencies in place — git checkout <branch> swaps source files but leaves node_modules/, vendor/, .venv/, and other gitignored dependency directories untouched. Zero bootstrap overhead between tasks.
Trade-off: The repo's working directory is occupied while the agent runs (same as today — no regression). Worktrees remain a future optimization option for repos where dependency bootstrapping isn't a concern.
Flow
autopilot chain --epic 52
Fetch sub-issues via GraphQL (issue.subIssues connection)
Create tasks for each sub-issue in order, with dependency chain:
Task 1: base_branch = default branch, checkout new branch
Use git worktrees for parallel task isolation #28 — Git worktrees for task isolation — enables parallel execution and workspace isolation. Deferred because dependency bootstrapping in large repos makes worktrees impractical for V1. Revisit when worktree-aware dependency sharing (symlinks, hardlinks, or shared caches) is solved.
GitHub sub-issues are GraphQL-only (issue.subIssues). The codebase already uses GraphQL extensively (review threads, comment resolution). Graceful handling when the feature isn't available — bail early: "Issue #52 has no sub-issues. Use autopilot chain --issues 51,52,53 instead."
2. Sub-Issue Ordering
GitHub returns sub-issues in the order they were added. V1 uses this order as the dependency chain. Users who want different ordering use --issues with explicit numbers.
3. Cascade After Human Review
The primary cascade scenario: human reviewer gives feedback on PR #1, user restarts task 1, it pushes new commits. The cascade engine detects the change and propagates downstream. This must work reliably — it's the core value of stacking.
4. Rebase Conflicts
When downstream rebases onto updated upstream, conflicts are possible. The agent gets a conflict resolution prompt. If it can't resolve after 2 attempts, the task pauses for manual attention.
Verification Scenarios
autopilot chain --epic 52 with 3 sub-issues → 3 stacked PRs created sequentially
autopilot chain --issues 51,52,53 → same result from explicit issue list
--epic with no sub-issues → clear error message, bail
Summary
Run a batch of related sub-issues as a sequential stacked PR chain — each PR building on the previous. When upstream PRs change (review feedback, CI fixes), downstream tasks automatically rebase and re-run.
Motivation
Today, autopilot-loop handles one task at a time. For larger features that decompose into multiple sub-tasks, users must manually:
This is exactly the kind of repetitive coordination that should be automated.
Architecture: Sequential Stacked Chain with Branch Checkout
V1 uses standard
git checkoutfor branch switching, not git worktrees.We evaluated git worktrees extensively. While they provide workspace isolation (agent and user don't share the same working tree), they have a critical practical problem: every worktree is a full copy of the working tree (minus
.git). For large repos with expensive dependency bootstrapping (Rails apps needingbundle install, Node projects needingnpm install, etc.), each worktree requires a full re-bootstrap of dependencies. This can take 10+ minutes per worktree, making chains impractical.Branch checkout keeps installed dependencies in place —
git checkout <branch>swaps source files but leavesnode_modules/,vendor/,.venv/, and other gitignored dependency directories untouched. Zero bootstrap overhead between tasks.Trade-off: The repo's working directory is occupied while the agent runs (same as today — no regression). Worktrees remain a future optimization option for repos where dependency bootstrapping isn't a concern.
Flow
issue.subIssuesconnection)base_branch = default branch, checkout new branchbase_branch = task_1_branch,parent_task_id = task_1_idbase_branch = task_2_branch,parent_task_id = task_2_idArchitecture Diagram
What This Builds On (v0.3.0)
The current codebase (schema v8) already has:
CIOrchestratorfor CI fix loopsretry_counts_json) andpre_fix_shatrackingSub-Issues (Essential for V1)
Ordered by dependency:
parent_task_id,epic_id,base_branch,upstream_shacolumns (no dependencies, do first)base_branchsupport for stacked PRs (PR targeting, diff context,get_default_branch())autopilot chaincommand (CLI entry point,--epicwith GraphQL sub-issue fetching,--issuesfallback, sequential runner)Deferred (Future Enhancements)
autopilot statusworks for V1.Hard Problems
1. Sub-Issues API
GitHub sub-issues are GraphQL-only (
issue.subIssues). The codebase already uses GraphQL extensively (review threads, comment resolution). Graceful handling when the feature isn't available — bail early: "Issue #52 has no sub-issues. Useautopilot chain --issues 51,52,53instead."2. Sub-Issue Ordering
GitHub returns sub-issues in the order they were added. V1 uses this order as the dependency chain. Users who want different ordering use
--issueswith explicit numbers.3. Cascade After Human Review
The primary cascade scenario: human reviewer gives feedback on PR #1, user restarts task 1, it pushes new commits. The cascade engine detects the change and propagates downstream. This must work reliably — it's the core value of stacking.
4. Rebase Conflicts
When downstream rebases onto updated upstream, conflicts are possible. The agent gets a conflict resolution prompt. If it can't resolve after 2 attempts, the task pauses for manual attention.
Verification Scenarios
autopilot chain --epic 52with 3 sub-issues → 3 stacked PRs created sequentiallyautopilot chain --issues 51,52,53→ same result from explicit issue list--epicwith no sub-issues → clear error message, bailautopilot statusshows all chain tasks with their statesDifferentiation from Agent Orchestrator (Composio)
Agent Orchestrator is a general-purpose agent fleet manager (agent-agnostic, runtime-agnostic, parallel-first). autopilot-loop differentiates by:
--issueor--epicreads GitHub issues directly