Repository navigation
Serve subagent worktrees from one auto session, with a reviewer pool - #33
Merged
Merged
Conversation
pair start --serve-worktrees lets subagents in their own git worktrees run review loops through the session's owner, enrolled on first validated contact, with one FIFO and up to --reviewers N rounds at once. Approved by Codex in thread 2026-11-06T09-43-24-681Z-399fea, after the design brainstorms 1887a1, 33039d and 86f267. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Y3kg5hjT2zSZM9qUEEinM
pair start --serve-worktrees lets a subagent working in its own git worktree of the repository run its own review loop through the session's reviewer. The author's environment carries PAIR_AUTO_OWNER, so a subagent's pair send reaches the session's socket. Its first request enrolls the worktree after full validation (same repository, listed worktree, no manual registration, its socket claimed). Rounds from every worktree share one FIFO, and --reviewers N runs up to N at once. Identity (path, inode, resolved git dir) is re-checked at request, launch, every heartbeat while running, completion and retry; a removed or replaced worktree fails alone and its reviewer is stopped. Failures, sessions and settings are per worktree and thread, pair reviewer --thread works from a served worktree, and nothing is written there: the reviewer rules come with the prompt and instruction refresh is skipped. A request without a root (an older CLI) means the session's own worktree. Spec: docs/specs/serve-worktrees.md; reviewed by Codex in thread 2026-11-06T13-15-24-578Z-2dd5eb. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Y3kg5hjT2zSZM9qUEEinM
A served subagent worktree doesn't need pair's instruction files: its session passes the rules to its agents. pair status there now says so instead of advising pair init, which would write files into the subagent's PR. Found in the live check, which otherwise confirmed enrollment, two reviewers running at once, and the child's status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Y3kg5hjT2zSZM9qUEEinM
The guardian stops the whole session after 5s without a heartbeat, and a synchronous git with a 10s timeout could block the owner that long. Identity checks (request, launch, every heartbeat, completion, retry) now read the worktree's .git pointer from the filesystem; enrollment records git's --absolute-git-dir, requires the pointer to match it, and runs its git commands asynchronously. A test delays enrollment's git by 7s while a sibling review runs: the author and the sibling survive. Reviewed by Codex in thread 2026-11-06T13-54-12-248Z-b4be19. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Y3kg5hjT2zSZM9qUEEinM
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An auto author can now delegate separate PRs to subagents in their own git worktrees, and each subagent runs its own review loop through the session's reviewer. Up to N reviews run at once.
How it works
--serve-worktrees, behavior is unchanged from 0.8.1.PAIR_AUTO_OWNER, which subagents inherit, so a subagent'spair sendreaches the session's socket, the only one a Claude author's sandbox allows.git worktree list;pair startandpair resetout);--reviewers N(1–8, default 1) runs up to N at once.pair reviewer --thread currentworks from a served worktree, andpair statusthere names the serving session. The root's resume record never changes from a subagent.pair initadvice are skipped there.Review
docs/specs/serve-worktrees.md, approved in thread 399fea after 3 medium fixes.--absolute-git-dir).Tests
npm test: 129 pass, 10 of them new:.gitreplaced while running;Live check (real Claude author, Codex reviewer)
.claude/worktrees/agent-…) were enrolled and reviewed in their own worktrees.--reviewers 2, status showedrunning 2: two worktrees, two threads, two reviewer pids.pair statusin a subagent worktree named the serving session. It also advisedpair init, which would write files there; fixed in d76d4e1.git statuswas captured. No-writes is covered by the scoped test.main(d4d856e), not the session's branch.No release until the set is merged (planned as 0.9.0).
🤖 Generated with Claude Code
https://claude.ai/code/session_012Y3kg5hjT2zSZM9qUEEinM