Repository navigation
fix(server): threads from the pre-v2 multi-repo fork reach every repository again - #341
Merged
LoganRupe merged 1 commit intoOct 12, 2026
Conversation
…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
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.
What Changed
On startup, the server repairs threads imported from the pre-v2 multi-repo fork. A thread qualifies when its
worktrees_jsonlists more than one worktree, all in one per-thread folder under the worktrees directory, and its v2 worktree path still equals the importedworktree_path. For each one:<container>.t3-isolated-run.json, listing each repository's folder and source checkout, unless one already existsthread.metadata.updatewith the container as the worktree path, guarded byexpectedWorktreePath, so the orchestrator handles the cwd change like any other worktree moveThe 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 withoutworktrees_jsonreturn 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-workspacethe fork generated in the container is a regular file, so deletion keeps it along with the folder.UI Changes
None.