The best way to control Claude Code, Codex and more from any computer or phone
fix(server): selected-file commits stop when the index reset fails (#28275)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Victor Vogel committed
Nov 1, 2026 at 16:01 UTC
cf5e6d3f0cbb41334b6d7c27e37f1e8817775e95
2 files changed
+26
-3
apps/server/src/vcs/GitVcsDriverCore.test.ts
+25
@@ -5089,6 +5089,31 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
5089
}),
5090
);
5091
5092
+ it.effect("stops a selected-file commit when another process holds the index lock", () =>
5093
+ Effect.gen(function* () {
5094
+ const cwd = yield* makeTmpDir();
5095
+ yield* initRepoWithCommit(cwd);
5096
+ const head = yield* git(cwd, ["rev-parse", "HEAD"]);
5097
+ yield* writeTextFile(cwd, "a.txt", "a\n");
5098
+ yield* writeTextFile(cwd, "staged.txt", "staged\n");
5099
+ yield* git(cwd, ["add", "staged.txt"]);
5100
+ const lockPath = (yield* Path.Path).join(cwd, ".git", "index.lock");
5101
+ yield* (yield* FileSystem.FileSystem).writeFileString(lockPath, "");
5102
+ const { driver } = yield* makeDriverReleasingLock(
5103
+ (args) => args.includes("reset"),
5104
+ lockPath,
5105
+ );
5106
+
5107
+ const error = yield* driver
5108
+ .commit(cwd, "Add a", "", { stage: { filePaths: ["a.txt"] } })
5109
+ .pipe(Effect.flip);
5110
+
5111
+ assert.equal(error.operation, "GitVcsDriver.commit.reset");
5112
+ assert.equal(yield* git(cwd, ["rev-parse", "HEAD"]), head);
5113
+ assert.equal(yield* git(cwd, ["diff", "--cached", "--name-only"]), "staged.txt");
5114
+ }),
5115
+ );
5116
+
5117
it.effect.each([
5118
{ location: "root", ref: "refs/heads/MERGE_HEAD" },
5119
{ location: "nested", ref: "refs/heads/MERGE_HEAD" },
apps/server/src/vcs/GitVcsDriverCore.ts
+1
-3
@@ -2450,9 +2450,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2450
"Cannot commit selected files during a merge. Commit all files to finish the merge.",
2451
});
2452
}
2453
- yield* runGit("GitVcsDriver.commit.reset", cwd, ["reset"]).pipe(
2454
- Effect.catchTags({ GitCommandError: () => Effect.void }),
2455
- );
2453
+ yield* runGit("GitVcsDriver.commit.reset", cwd, ["reset", "--quiet"]);
2454
}
2455
yield* runGit(
2456
"GitVcsDriver.commit.addSelected",