Repository navigation
Description
What happens
Git-tab Merge looks like it landed. The nightly / origin/main still does not have the work. Repeat for the next worktree. It feels like the #760 CI inspect refusal coming back.
What actually happens
defaultBranch() is git branch --show-current in the project checkout (electron/worktrees.js). It only falls back to origin/HEAD / main when that checkout is detached. checkoutForMerge then follows that name into whichever worktree currently holds it.
So:
- If
~/code/coderis on a feature branch (e.g. a Merge refuses with 'Could not inspect the diff for CI workflow files' on ordinary merges #760 fix branch), every Merge worktree commit lands there. Measured: eightMerge worktree coder/...commits oncoder/merge-ci-inspect-refused-false-positive-760after Merge refuses with 'Could not inspect the diff for CI workflow files' on ordinary merges #760, whileorigin/mainonly has the six that were later PR'd as Land six worktrees: picker, status pulse, cursor MCP, kimi spend, code wiki #766. - If a nightly/release worktree holds a stale local
main(today:~/code/coder-release-buildat 3148708, 10 ahead / 2 behindorigin/main), a detached project checkout followsmaininto that tree. Still notorigin/main.
#760 fixed the false CI-inspect block. After that fix, stacked merges succeed and still miss origin/main. Sign-off cannot help; the target is wrong.
#187 asked for an explicit base-branch picker and assumed merge was already hardwired to the repo default. It is not.
Fix direction
- Git-tab Merge (no
intoPath) should target the repo default (origin/HEAD→main), not whatever the project checkout happens to have checked out. - If that branch lives in another worktree, follow it there (existing
checkoutForMerge), but refuse or warn when thatmainhas diverged fromorigin/main. intoPath(orchestrator → lead worktree) stays an explicit override.- Do not treat this as a Blast-radius guard: agent diffs touching CI/workflow files require explicit human sign-off #510 CI sign-off.
Test
Project checkout on a feature branch, worker worktree with a unique file, mergeWorktree without intoPath → file is on main, feature branch HEAD unchanged.
Activity
currentbits commentedon Aug 29, 2026
Implementing on a clean
origin/mainbranch (coder/merge-targets-origin-head-770) so this does not remelt #766 or #772.Approach:
intoPath) usesrepoDefaultBranch(origin/HEAD→ local main/master), thencheckoutForMergeonly stays put when that named branch is already checked out.origin/<default>(ahead-only is allowed).intoPathstill usesdefaultBranchof that checkout.defaultBranch()itself stays "this checkout" for setup/PR/conflict.currentbits commentedon Aug 29, 2026
Landed from Solenta thread "Merge worktree lands on the project checkout branch, not ori". Closed on merge.
Merge origin/main into local main so Git-tab Merge is not behind (#770).