Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preserve worktree setup after a failed hook and restart #48259

OpenUtkarshUsername(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/48259/headopened View on GitHub

Showing 3 changed files with 91 additions and 70 deletions (loading 1).

x
0 of 3 viewed, 3 left
88 additions and 69 deletionsapps/server/src/orchestration-v2/ProviderTurnStartService.test.tsModified
View file
@@ -529,82 +529,101 @@
});
​
-effectIt.effect("hands a checkout left by a failed recreate to the next restore for setup", () => {
- const worktreePath = `${managedWorktreesDir}/project/feature-restore`;
- let checkedOut = false;
- const pendingSetupMarkers = new Set<string>();
- const createWorktree = vi.fn(() => {
- checkedOut = true;
- return Effect.fail(
- new GitCommandError({
- operation: "GitVcsDriver.createWorktree",
- command: "git worktree add",
- cwd: "/tmp/provider-turn-start-project",
- detail: "git worktree add failed: the post-checkout hook failed",
- }),
- );
- });
- return Effect.gen(function* () {
- const { restore, pendingSetup, setupDone } = yield* ThreadWorktreeRestore;
+effectIt.live.each([
+ { retry: "after a server restart", markerWriteFails: false },
+ { retry: "in the same process when the marker write fails", markerWriteFails: true },
+])("runs setup for a checkout left by a failed hook $retry", ({ markerWriteFails }) =>
+ Effect.gen(function* () {
+ const fileSystem = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const config = yield* ServerConfig.ServerConfig;
+ const driver = yield* GitVcsDriver.GitVcsDriver;