Skip to content

fix(server): threads from the pre-v2 multi-repo fork reach every repository again - #341

Merged
LoganRupe merged 1 commit into
multi-repo-workspacesfrom
bug/multi-repo/fork-thread-worktrees
Oct 12, 2026
Merged

LoganRupe merged 1 commit into
multi-repo-workspacesfrom
bug/multi-repo/fork-thread-worktrees

Conversation

@LoganRupe

@LoganRupe LoganRupe commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

What Changed

On startup, the server repairs threads imported from the pre-v2 multi-repo fork. A thread qualifies when its worktrees_json lists more than one worktree, all in one per-thread folder under the worktrees directory, and its v2 worktree path still equals the imported worktree_path. For each one:

  • write <container>.t3-isolated-run.json, listing each repository's folder and source checkout, unless one already exists
  • dispatch thread.metadata.update with the container as the worktree path, guarded by expectedWorktreePath, so the orchestrator handles the cwd change like any other worktree move

The repair is apps/server/src/orchestration-v2/legacy/repairMultiRepoForkWorktrees.ts. It runs once the v2 recovery phase finishes. A repaired thread no longer matches the query, so later boots skip it. A thread the user moved after the upgrade is left alone. Databases without worktrees_json return immediately.

compare.mp4

Why

Closes #340. The v2 import copies worktree_path, which on the fork named only the first repository's worktree. Those threads came across as single-repo threads. The fork's <thread>/<repo> layout already matches v2's container, so the layout file plus a path change is enough.

Repairing at the ledger step would miss databases that already upgraded. nauvoo's is one: 10 affected threads, 7 of them not deleted, and the query selects exactly those 7 on a read-only open of statev2.sqlite.

The layout file also lets thread deletion remove these worktrees. The test covers that with real git worktrees in the fork's layout. One leftover: the .code-workspace the fork generated in the container is a regular file, so deletion keeps it along with the folder.

UI Changes

None.

…sitory again

The v2 import copied worktree_path, which on the fork named only the first
repository's worktree, so isolated multi-repo threads came across as
single-repo threads. At startup, write the isolated-run layout file beside
each fork container and move the thread's worktree path up to the container
when it still holds the imported value.

Fork-only; not intended for upstream.

Closes #340
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Oct 12, 2026
@LoganRupe
LoganRupe merged commit 635fe0f into multi-repo-workspaces Oct 12, 2026
7 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants