The best way to control Claude Code, Codex and more from any computer or phone
fix(server): checkpoints no longer expire a split index the repo still uses (#17074)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sheehan Munim committed
Oct 18, 2026 at 15:33 UTC
d37bce55f2d0b46e63f0517a223f2d965263500c
2 files changed
+28
-1
apps/server/src/vcs/GitVcsDriver.test.ts
+21
@@ -163,6 +163,27 @@ it.effect("checkpoint capture skips untracked nested repositories without a comm
163
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
164
);
165
166
+it.effect("checkpoint capture keeps the shared index a split index still uses", () =>
167
+ Effect.gen(function* () {
168
+ const fileSystem = yield* FileSystem.FileSystem;
169
+ const path = yield* Path.Path;
170
+ const driver = yield* GitVcsDriver.makeVcsDriverShape();
171
+ const cwd = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-checkpoint-split-" });
172
+ const { git, checkpointRef } = yield* makeCheckpointFixture(driver, cwd);
173
+ yield* git(["config", "core.splitIndex", "true"]);
174
+ yield* git(["config", "splitIndex.sharedIndexExpire", "now"]);
175
+ yield* git(["update-index", "--split-index"]);
176
+ yield* fileSystem.writeFileString(path.join(cwd, "untracked.txt"), "new\n");
177
+
178
+ yield* driver.checkpoints.captureCheckpoint({ cwd, checkpointRef });
179
+
180
+ assert.strictEqual((yield* git(["show", `${checkpointRef}:untracked.txt`])).stdout, "new\n");
181
+ // The real index points at a sharedindex.* file. Reading it fails if the capture expired it.
182
+ assert.strictEqual((yield* git(["ls-files", "--cached"])).stdout, "file.txt\n");
183
+ assert.strictEqual((yield* git(["diff", "--cached", "--name-only"])).stdout, "file.txt\n");
184
+ }).pipe(Effect.scoped, Effect.provide(layerGitContract)),
185
+);
186
+
187
it.effect("checkpoint recovery discovers nested HEAD independently of inherited GIT_DIR", () =>
188
Effect.gen(function* () {
189
const fs = yield* FileSystem.FileSystem;
apps/server/src/vcs/GitVcsDriver.ts
+7
-1
@@ -793,11 +793,17 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
793
const checkpoints: VcsDriver.VcsCheckpointOps = {
794
captureCheckpoint: Effect.fn("GitVcsDriver.checkpoints.captureCheckpoint")(function* (input) {
795
const operation = VcsProcess.CHECKPOINT_CAPTURE_OPERATION;
796
+ // core.splitIndex governs every index Git writes, so an unguarded write to the
797
+ // scratch index can expire the sharedindex.* the real .git/index still uses.
798
const indexConfig = [
799
"-c",
800
"core.fsmonitor=false",
801
"-c",
802
"sparse.expectFilesOutsideOfPatterns=false",
803
+ "-c",
804
+ "core.splitIndex=false",
805
+ "-c",
806
+ "splitIndex.sharedIndexExpire=never",
807
];
808
const gitCommonDir = yield* resolveGitCommonDir(input.cwd);
809
const indexId = yield* crypto.randomUUIDv4().pipe(Effect.orDie);
@@ -933,7 +939,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
939
cwd: input.cwd,
940
args: sparseCheckout
941
? [...indexConfig, "-c", "index.sparse=true", "read-tree", "--reset", "HEAD"]
936
- : ["read-tree", "HEAD"],
942
+ : [...indexConfig, "read-tree", "HEAD"],
943
env: commitEnv,
944
});
945
}