allow resolve-and-merge follow-ups to adopt a live /claim worktree - #6244
Merged
Conversation
A "resolve and merge" trigger on a PR whose branch was still checked out in a /do:next claim-* worktree retried git worktree add against it for 5 cooldown cycles and then blocked permanently, because findAdoptableWorktreeForBranch's requireAgentId root gate rejected the claim-shaped directory name before the existing allowLiveClaim carve-out (used by branchReconcile's dispatch side) ever got a chance to apply. Fix the root-gate check in worktreeOwnershipReason to let a claim-shaped id through when the caller opts in, and thread allowLiveClaim from findAdoptableWorktreeForBranch through agentWorkspacePrep's review-loop and PR-remediation follow-up paths (isNonCommittingCoordinatorTask), so these tasks take over the branch's existing worktree and land the merge instead of stalling on it.
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.
Summary
/do:nextclaim worktree (data/cos/worktrees/claim-*) retriedgit worktree addagainst it for 5 cooldown cycles, then blocked the agent permanently.allowLiveClaimcarve-out (already used bybranchReconcile's dispatch side) never got a chance to apply, becausefindAdoptableWorktreeForBranch'srequireAgentIdroot gate rejected the claim-shaped directory name one check earlier.worktreeOwnershipReasonto let a claim-shaped id through when the caller opts in, and threadedallowLiveClaimfromfindAdoptableWorktreeForBranchthroughagentWorkspacePrep's review-loop and PR-remediation follow-up paths (via the sharedisNonCommittingCoordinatorTaskpredicate), so these tasks now take over the branch's existing worktree and land the merge instead of stalling on it.Test plan
worktreeOwnership.test.jsfor the root-gate carve-out (claim id admitted withallowLiveClaim, non-claim/non-agent id still rejected).worktreeManager.test.jsforfindAdoptableWorktreeForBranchadopting a claim worktree withallowLiveClaim: true.agentWorkspacePrep.test.jsfor both review-loop and PR-remediation follow-ups opting in, and a plain resume task NOT opting in.cd server && NODE_ENV=test npx vitest run) and full client suite pass locally.agylocal review pass: clean, no findings.