Skip to content

fix(sdd): allow parallel dispatch with worktree isolation - #1534

Closed
xuefei-wang wants to merge 1 commit into
obra:mainfrom
xuefei-wang:parallel-dispatch-worktree-isolation
Closed

xuefei-wang wants to merge 1 commit into
obra:mainfrom
xuefei-wang:parallel-dispatch-worktree-isolation

Conversation

@xuefei-wang

@xuefei-wang xuefei-wang commented May 13, 2026 •

Copy link
Copy Markdown

Problem

The Red Flag entry:

Dispatch multiple implementation subagents in parallel (conflicts)

is too broad. Staged-index conflicts only happen when subagents share the same git worktree and touch overlapping files. File-independent tasks dispatched with isolation: "worktree" each get their own git worktree — no index conflict is possible.

As written, the rule steers controllers away from the correct high-speed pattern even when it would be perfectly safe.

Changes

1. Narrow the Red Flag (line 242)

Before:

- Dispatch multiple implementation subagents in parallel (conflicts)

After:

- Dispatch multiple implementation subagents in parallel **when they touch overlapping files or share sequential dependencies** — for file-independent tasks, use `isolation: "worktree"` and dispatch in parallel instead (that's the preferred approach for speed)

2. Add Parallel dispatch guidance (after the Continuous execution paragraph)

New paragraph:

Parallel dispatch: Before starting, scan the plan and identify groups of tasks that are file-independent (no shared files, no sequential dependency). Dispatch those groups in parallel using isolation: "worktree" — each subagent gets its own git worktree, eliminating staged-index conflicts. Spec and quality reviewers for independent tasks can also be dispatched in parallel (they are read-only). Only run tasks sequentially when a later task depends on an earlier task's output or when they touch overlapping files. Parallel dispatch with worktree isolation is faster and equally safe when tasks don't share state.

Why this is safe

isolation: "worktree" (the Agent tool parameter in Claude Code) provisions a fresh git worktree per subagent. Each worktree has its own index and working tree — there is no shared staging area to conflict over. The only case where parallel dispatch causes problems is when two subagents write to the same files in the same worktree, which this guidance explicitly carves out.

The blanket 'never dispatch subagents in parallel' rule was too broad.
Staged-index conflicts only occur when subagents touch overlapping files
or have sequential dependencies — file-independent tasks can be safely
dispatched in parallel using `isolation: "worktree"`, which gives each
subagent its own git worktree.

Two changes:
1. Red Flag narrowed: prohibit parallel dispatch only for overlapping-file
   or sequentially-dependent tasks; explicitly recommend worktree isolation
   for file-independent tasks.
2. New 'Parallel dispatch' paragraph added alongside 'Continuous execution':
   guides the controller to scan for file-independent task groups and
   dispatch them in parallel with worktree isolation before starting.
@obra obra added documentation Improvements or additions to documentation subagents Retired: use skill:subagent-driven-development / skill:dispatching-parallel-agents worktrees Retired: use skill:using-git-worktrees needs-rebase-to-dev-branch PR targets main but should target dev labels May 23, 2026
@obra obra added the skill:subagent-driven-development The subagent-driven-development skill label Sep 20, 2026
@obra

obra commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Hi @xuefei-wang! I'm Claude, helping @obra triage. This duplicates #1213 (parallel SDD dispatch with worktrees); SDD stays serial by design for now. Changes to skill wording shape agent behavior, so they need eval evidence (see "Skill Changes Require Evaluation" in CLAUDE.md). Closing it isn't a judgment about you or your work; we're clearing out PRs against main (new work lands on dev) that aren't going in as they stand. Thanks for the contribution!

— Claude (Opus 5.5, claude-opus-5-5), Claude Code 2.1.283, session 49301b31-b716-41b8-a316-80b8461e0de9

@obra obra closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation needs-rebase-to-dev-branch PR targets main but should target dev skill:subagent-driven-development The subagent-driven-development skill subagents Retired: use skill:subagent-driven-development / skill:dispatching-parallel-agents worktrees Retired: use skill:using-git-worktrees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants