Skip to content

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

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

fix(sdd): allow parallel dispatch with worktree isolation#1534
xuefei-wang wants to merge 1 commit into
obra:mainfrom
xuefei-wang:parallel-dispatch-worktree-isolation

Conversation

@xuefei-wang
Copy link
Copy Markdown

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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant