You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Orchestrator never lands a finished worker's work: thread_merge #600
Workers finish, get archived, and their work is never merged. Measured on the live store (2026-08-20): 195 orchWorker threads, 190 finished ones still holding an unmerged worktree (0 unarchived — thread archiving works fine, the work is what never lands). At the ~709 MB median worktree that is over 100 GB of stranded commits.
Root cause
The orchestrator had no way to merge. mergeWorktree was reachable only from the renderer (git:mergeWorktree IPC / Git tab); the coder-threads MCP surface exposed fork/send/status but nothing to land a branch. The server instructions even told the lead to "merge a worker's branch when its work lands" — with no tool to do it.
Second defect found while fixing: mergeWorktree always squashed into project.path. A lead running in its own worktree (the normal case) would have had its workers' code squashed onto main, not onto the lead's branch — invisible to the lead and landed on main without review.
Fix
mergeWorktree({ intoPath }) — optional merge target checkout, defaults to project.path so the Git tab is unchanged. mergeInto now takes the target path instead of the project.
New MCP tool thread_merge({ threadId, projectId, workerThreadId }): squash-merges the worker's branch into the caller's working tree, commits, then removes the worker's worktree and branch. Guards: same project, must be a worker the caller forked, refuses while the worker is running (removing a live worker's cwd), reports "nothing to merge" for worktree:false workers. Conflicts reuse the existing replay-in-the-worktree path, so the lead can thread_send the worker to resolve and retry.
Worker-finished wake-up notice now names the branch and tells the lead to call thread_merge.
Server instructions updated: a crew you never merge produced nothing.
Activity
currentbits commentedon Aug 20, 2026
Landed as 11efa5d on coder/when-we-have-workers-and-they-are-done-t-ea550e.