Skip to content

allow resolve-and-merge follow-ups to adopt a live /claim worktree - #6244

Merged
atomantic merged 1 commit into
mainfrom
cos/task-mtn7zy9c/agent-d9041d7d
Sep 4, 2026
Merged

allow resolve-and-merge follow-ups to adopt a live /claim worktree#6244
atomantic merged 1 commit into
mainfrom
cos/task-mtn7zy9c/agent-d9041d7d

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • A manual "resolve and merge" trigger on a PR whose branch was still checked out in a /do:next claim worktree (data/cos/worktrees/claim-*) retried git worktree add against it for 5 cooldown cycles, then blocked the agent permanently.
  • The existing allowLiveClaim carve-out (already used by branchReconcile's dispatch side) never got a chance to apply, because findAdoptableWorktreeForBranch's requireAgentId root gate rejected the claim-shaped directory name one check earlier.
  • Fixed the root-gate check in worktreeOwnershipReason to let a claim-shaped id through when the caller opts in, and threaded allowLiveClaim from findAdoptableWorktreeForBranch through agentWorkspacePrep's review-loop and PR-remediation follow-up paths (via the shared isNonCommittingCoordinatorTask predicate), so these tasks now take over the branch's existing worktree and land the merge instead of stalling on it.

Test plan

  • Added unit coverage in worktreeOwnership.test.js for the root-gate carve-out (claim id admitted with allowLiveClaim, non-claim/non-agent id still rejected).
  • Added coverage in worktreeManager.test.js for findAdoptableWorktreeForBranch adopting a claim worktree with allowLiveClaim: true.
  • Added coverage in agentWorkspacePrep.test.js for both review-loop and PR-remediation follow-ups opting in, and a plain resume task NOT opting in.
  • Full server suite (cd server && NODE_ENV=test npx vitest run) and full client suite pass locally.
  • agy local review pass: clean, no findings.

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.
@atomantic
atomantic merged commit 6d5d551 into main Sep 4, 2026
7 checks passed
@atomantic
atomantic deleted the cos/task-mtn7zy9c/agent-d9041d7d branch September 4, 2026 17:49
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