The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 19:15 UTC
fix(server): status polling no longer locks the git index (#14718)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ahalekelly committed
Oct 5, 2026 at 21:12 UTC
447046b589140a50a4a782453133da83ff77e85e
1 file changed
+9
-4
apps/server/src/vcs/GitVcsDriverCore.ts
+9
-4
@@ -931,6 +931,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
931
cwd: commandInput.cwd,
932
env: {
933
...process.env,
934
+ // Status polling runs beside the user's own git commands; without this,
935
+ // `git status` takes index.lock to save its refreshed index.
936
+ GIT_OPTIONAL_LOCKS: "0",
937
...input.env,
938
...trace2Monitor.env,
939
},
@@ -1875,10 +1878,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1878
const statusCacheKey = repositoryPaths?.gitCommonDir;
1879
const [numstatStdout, defaultBranch, hasPrimaryRemote] = yield* Effect.all(
1880
[
1881
+ // Plumbing, because porcelain `git diff` rewrites the index even with
1882
+ // GIT_OPTIONAL_LOCKS=0. -M keeps porcelain's rename detection.
1883
executeGitWithStableDiagnostics(
1884
"GitVcsDriver.statusDetails.numstat",
1885
cwd,
1881
- ["diff", "HEAD", "--numstat", "--"],
1886
+ ["diff-index", "-M", "--numstat", "HEAD", "--"],
1887
{ allowNonZeroExit: true },
1888
).pipe(
1889
Effect.flatMap((result) => {
@@ -1887,7 +1892,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1892
return Effect.map(
1893
Effect.all([
1894
runGitStdout("GitVcsDriver.statusDetails.numstat.unborn", cwd, [
1890
- "diff",
1895
+ "diff-files",
1896
"--numstat",
1897
]),
1898
runGitStdout("GitVcsDriver.statusDetails.numstat.unborn.staged", cwd, [
@@ -1920,9 +1925,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1925
...gitCommandContext({
1926
operation: "GitVcsDriver.statusDetails.numstat",
1927
cwd,
1923
- args: ["diff", "HEAD", "--numstat", "--"],
1928
+ args: ["diff-index", "-M", "--numstat", "HEAD", "--"],
1929
}),
1925
- detail: "git diff HEAD --numstat failed.",
1930
+ detail: "git diff-index HEAD --numstat failed.",
1931
exitCode: result.exitCode,
1932
stdoutLength: result.stdout.length,
1933
stderrLength: result.stderr.length,