Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: parallel IDD via git worktree isolation (#167) - #168

Merged
kiki830621 merged 2 commits into
mainfrom
idd/167-worktree-isolation
May 31, 2026
Merged

kiki830621 merged 2 commits into
mainfrom
idd/167-worktree-isolation

Conversation

@kiki830621

Copy link
Copy Markdown
Member

Refs #167

Summary

Parallel IDD via git worktree isolation (multi-window / Case B). A git worktree isolates the working tree, branch HEAD, and repo-relative .claude/.idd/ staging simultaneously, riding the existing --cwd plumbing — so N Claude Code windows can each run a full IDD pipeline on N issues without colliding.

Convergence = N independent branches → N PRs (no merge-back); work that must land as one clustered PR stays on the existing sequential /idd-all-chain. Case A (within-window agent teams, merge-back orchestration) is explicitly deferred to a future change.

Implements Spectra change idd-worktree-isolation (proposal / design / spec / tasks under openspec/changes/).

What's in it

  • scripts/idd-worktree.shcreate / cleanup / list; exit codes 0–5; stdout = worktree-path-only (feeds --cwd); strict-numeric N (blocks path injection); anchors on the main worktree so it's correct from any linked worktree.
  • scripts/tests/idd-worktree/test.sh — 34 assertions (throwaway-repo fixtures).
  • references/worktree-isolation.md — the convention contract + deferred-Case-A boundary.
  • idd-implement Phase 0.5 — slug-agnostic idd/<N>-* worktree-branch acceptance (composes a helper-created worktree end-to-end).
  • idd-close Step 6.7 — best-effort terminal worktree GC (never blocks close).
  • cross-repo-cwd.md cross-ref; CHANGELOG + plugin.json 2.74.0 → 2.75.0 (minor, additive).

Verify

6-AI ensemble (5 Claude reviewers + Codex gpt-5.5 xhigh) on 1f34fcc0 hard-blocking; 2 P2 + 4 minor → all fixed in-PR at 114f384. Codex (cross-model) caught the main-worktree-anchoring bug the 5 same-family reviewers missed. Tests 34 GREEN, spectra validate clean.

Checklist

  • Diagnose (Complexity = Spectra)
  • Discuss → Propose → Apply
  • Implement (2 commits)
  • Verify (6-AI, findings fixed in-PR + regression-tested)
  • Post-merge: run /idd-close #167, then /spectra-archive idd-worktree-isolation

Do NOT add a GitHub auto-close trailer — IDD requires a manual close after merge (checklist gate + closing summary). Worktree GC runs automatically during the close.

Add idd-worktree.sh helper (create/cleanup/list) + a worktree-isolation
convention so multiple IDD pipelines run concurrently (multi-window /
Case B) without working-tree / branch / staging collision, riding the
existing --cwd plumbing. A git worktree isolates working-tree, branch,
and repo-relative .claude/.idd/ staging simultaneously.

Convergence = N branches -> N PRs (no merge-back); single-cluster-PR work
stays on sequential /idd-all-chain. Case A (within-window agent teams,
merge-back) explicitly deferred to a future change.

- scripts/idd-worktree.sh + 30-assertion fixture test suite
- references/worktree-isolation.md (convention + lifecycle + convergence)
- idd-implement Phase 0.5: slug-agnostic idd/<N>-* worktree-branch acceptance
- idd-close: best-effort terminal worktree GC (never blocks close)
- cross-repo-cwd.md cross-ref; CHANGELOG + plugin.json 2.74.0 -> 2.75.0
- Spectra change idd-worktree-isolation (proposal/design/spec/tasks)

Refs #167
Two P2 correctness gaps surfaced by the verify ensemble (Codex caught the
first; logic reviewer cross-confirmed the second):

- Helper now anchors repo-root on the MAIN worktree (first `git worktree
  list` entry) instead of `rev-parse --show-toplevel`, so create/cleanup/
  list are correct even when invoked from inside a linked worktree — fixes
  idd-close GC silently no-op'ing under --cwd. idd-close also passes
  --repo-root explicitly (defense in depth).
- create refuses a canonical `.claude/worktrees/idd-<N>/` path registered
  on a wrong branch (exit 4) instead of misleading exit 0.

Plus lower-severity hardening: ensure_gitignore refuses symlinked .gitignore
(security LOW); design.md rationale no longer over-claims that N-PRs
"deletes that entire problem" (DA — same-file parallel edits still conflict
at 2nd PR merge; spec SHALL was already honest); spec gitignore wording
aligned to the line-presence guard; idd-implement note clarifies the
acceptance clause is intentionally not --cwd-gated.

Tests: 30 -> 34 assertions (+wrong-branch refusal, +cleanup-from-linked-
worktree). All GREEN. spectra validate clean.

Refs #167
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