fix(server): recreate a thread's worktree before starting a turn (#7839)

This commit is contained in:
MacKinley Smith authored and GitHub committed 2026-08-24 03:48:33 -07:00
1 parent 17822fab70
commit 01fc7d228d
5 files changed
+124

No files matched your search

+4
View File
@@ -310,6 +310,10 @@ export class GitVcsDriver extends Context.Service<
readonly removeWorktree: (
input: VcsRemoveWorktreeInput,
) => Effect.Effect<void, GitCommandError>;
/** Drops worktree admin entries whose directory is already gone (`git worktree prune`). */
readonly pruneWorktrees: (input: {
readonly cwd: string;
}) => Effect.Effect<void, GitCommandError>;
readonly renameBranch: (
input: GitRenameBranchInput,
) => Effect.Effect<GitRenameBranchResult, GitCommandError>;
+10
View File
@@ -3017,6 +3017,15 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
});
});
const pruneWorktrees: GitVcsDriver.GitVcsDriver["Service"]["pruneWorktrees"] = Effect.fn(
"pruneWorktrees",
)(function* (input) {
yield* executeGit("GitVcsDriver.pruneWorktrees", input.cwd, ["worktree", "prune"], {
timeoutMs: 15_000,
fallbackErrorDetail: "git worktree prune failed",
});
});
const renameBranch: GitVcsDriver.GitVcsDriver["Service"]["renameBranch"] = Effect.fn(
"renameBranch",
)(function* (input) {
@@ -3222,6 +3231,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
withListRefsInvalidation(input.cwd, fetchRemoteTrackingBranch(input)),
setBranchUpstream: (input) => withListRefsInvalidation(input.cwd, setBranchUpstream(input)),
removeWorktree: (input) => withListRefsInvalidation(input.cwd, removeWorktree(input)),
pruneWorktrees: (input) => withListRefsInvalidation(input.cwd, pruneWorktrees(input)),
renameBranch: (input) => withListRefsInvalidation(input.cwd, renameBranch(input)),
createRef: (input) => withListRefsInvalidation(input.cwd, createRef(input)),
switchRef: (input) => withListRefsInvalidation(input.cwd, switchRef(input)),