fix(server): recreate missing worktree on bootstrap - #197
Merged
Conversation
patroza
enabled auto-merge
July 30, 2026 08:09
Owner
Author
|
Fixed CI: switched path existence check from |
When a thread already has worktreePath/branch but the directory was removed (disk GC or manual cleanup), re-run git worktree add at the same path for the existing branch and re-run setup instead of assuming the tree is still on disk.
node:fs/promises trips effect(nodeBuiltinImport) in the server typecheck gate. Match the rest of the codebase with FileSystem.exists.
The replay-reuse test used a non-existent worktree path; after exists() checks that path no longer short-circuited prepareWorktree and hit an unmocked fetchRemote. Create a real temp dir for reuse, and add a missing-path recreate case.
patroza
force-pushed
the
fix/recreate-missing-worktree
branch
from
July 30, 2026 08:52
d0e566c to
cdde25d
Compare
patroza
disabled auto-merge
July 30, 2026 09:18
patroza
added a commit
that referenced
this pull request
Jul 30, 2026
* fix(server): recreate missing worktree on bootstrap When a thread already has worktreePath/branch but the directory was removed (disk GC or manual cleanup), re-run git worktree add at the same path for the existing branch and re-run setup instead of assuming the tree is still on disk. * fix(server): use Effect FileSystem for worktree path check node:fs/promises trips effect(nodeBuiltinImport) in the server typecheck gate. Match the rest of the codebase with FileSystem.exists. * test(server): fix bootstrap worktree reuse and cover recreate The replay-reuse test used a non-existent worktree path; after exists() checks that path no longer short-circuited prepareWorktree and hit an unmocked fetchRemote. Create a real temp dir for reuse, and add a missing-path recreate case. --------- Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza
added a commit
that referenced
this pull request
Jul 30, 2026
* fix(server): recreate missing worktree on bootstrap When a thread already has worktreePath/branch but the directory was removed (disk GC or manual cleanup), re-run git worktree add at the same path for the existing branch and re-run setup instead of assuming the tree is still on disk. * fix(server): use Effect FileSystem for worktree path check node:fs/promises trips effect(nodeBuiltinImport) in the server typecheck gate. Match the rest of the codebase with FileSystem.exists. * test(server): fix bootstrap worktree reuse and cover recreate The replay-reuse test used a non-existent worktree path; after exists() checks that path no longer short-circuited prepareWorktree and hit an unmocked fetchRemote. Create a real temp dir for reuse, and add a missing-path recreate case. --------- Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza
added a commit
that referenced
this pull request
Jul 31, 2026
* fix(server): recreate missing worktree on bootstrap When a thread already has worktreePath/branch but the directory was removed (disk GC or manual cleanup), re-run git worktree add at the same path for the existing branch and re-run setup instead of assuming the tree is still on disk. * fix(server): use Effect FileSystem for worktree path check node:fs/promises trips effect(nodeBuiltinImport) in the server typecheck gate. Match the rest of the codebase with FileSystem.exists. * test(server): fix bootstrap worktree reuse and cover recreate The replay-reuse test used a non-existent worktree path; after exists() checks that path no longer short-circuited prepareWorktree and hit an unmocked fetchRemote. Create a real temp dir for reuse, and add a missing-path recreate case. --------- Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
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.
Summary
worktreePathstill exists on disk.git worktree add <same-path> <branch>and re-run setup (post-checkout / pnpm).This pairs with worktree GC that strips reflinked
node_modulesand removes orphans: reactivating a cleaned thread should not require manualgit worktree add.Test plan
worktreePathrecorded but directory removed: bootstrap re-creates at the same path, setup runs, agent can start.