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 21, 23:30 UTC
fix(server): timed-out git commands that ignore SIGTERM no longer stall other git work (#26601)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 11, 2026 at 08:52 UTC
429c0ac2d369fe27e21d697813950756ba260371
3 files changed
+41
-7
apps/server/src/vcs/GitVcsDriver.ts
-1
@@ -54,7 +54,6 @@ export interface ExecuteGitInput {
54
readonly env?: NodeJS.ProcessEnv;
55
readonly allowNonZeroExit?: boolean;
56
readonly timeoutMs?: number | null;
57
- readonly forceKillAfterMs?: number;
57
readonly maxOutputBytes?: number;
58
readonly appendTruncationMarker?: boolean;
59
/** With appendTruncationMarker, line callbacks continue beyond the buffer cap for progress-only consumers. */
apps/server/src/vcs/GitVcsDriverCore.test.ts
+39
@@ -1804,6 +1804,45 @@ describe("rejected git refs", () => {
1804
});
1805
1806
it.layer(layerTest)("GitVcsDriver core integration", (it) => {
1807
+ // regression: #26577 a timed-out git that outlives its timeout holds a process permit
1808
+ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
1809
+ "kills a timed-out git command that ignores SIGTERM",
1810
+ () =>
1811
+ Effect.gen(function* () {
1812
+ const cwd = yield* makeTmpDir();
1813
+ yield* initRepoWithCommit(cwd);
1814
+ const pathService = yield* Path.Path;
1815
+ const fileSystem = yield* FileSystem.FileSystem;
1816
+ const markerPath = pathService.join(yield* makeTmpDir(), "outlived-timeout");
1817
+ const driver = yield* GitVcsDriver.GitVcsDriver;
1818
+ const trapped = yield* Deferred.make<void>();
1819
+
1820
+ const command = yield* driver
1821
+ .execute({
1822
+ operation: "GitVcsDriver.test.ignoresSigterm",
1823
+ cwd,
1824
+ args: [
1825
+ "-c",
1826
+ `alias.hang=!trap '' TERM; echo trapped; sleep 3; touch '${markerPath}'`,
1827
+ "hang",
1828
+ ],
1829
+ progress: {
1830
+ onStdoutLine: (line) =>
1831
+ line === "trapped" ? Deferred.succeed(trapped, undefined) : Effect.void,
1832
+ },
1833
+ })
1834
+ .pipe(Effect.forkChild);
1835
+ yield* Deferred.await(trapped);
1836
+ // The driver's timeout ends a command the same way: by interrupting it.
1837
+ yield* Fiber.interrupt(command);
1838
+
1839
+ assert.isFalse(
1840
+ yield* fileSystem.exists(markerPath),
1841
+ "the timed-out git command kept running until it finished on its own",
1842
+ );
1843
+ }),
1844
+ );
1845
+
1846
it.effect("keeps large change sets available for status and commit preparation", () =>
1847
Effect.gen(function* () {
1848
const cwd = yield* makeTmpDir();
apps/server/src/vcs/GitVcsDriverCore.ts
+2
-6
@@ -189,7 +189,6 @@ interface GitRefsSnapshot {
189
interface ExecuteGitOptions {
190
stdin?: string | undefined;
191
timeoutMs?: number | null | undefined;
192
- forceKillAfterMs?: number | undefined;
192
allowNonZeroExit?: boolean | undefined;
193
fallbackErrorDetail?: string | undefined;
194
env?: NodeJS.ProcessEnv | undefined;
@@ -995,7 +994,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
994
ChildProcess.make(executable, commandInput.args, {
995
cwd: commandInput.cwd,
996
env: spawnEnv,
998
- forceKillAfter: input.forceKillAfterMs,
997
+ // SIGTERM first lets git remove its lock files; SIGKILL ends one that ignores it.
998
+ forceKillAfter: "1 second",
999
...(runsGitWithoutConsole(hostPlatform, executable, commandInput.args)
1000
? { detached: true, windowsHide: true }
1001
: {}),
@@ -1164,9 +1164,6 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1164
...(options.env !== undefined ? { env: options.env } : {}),
1165
allowNonZeroExit: true,
1166
...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
1167
- ...(options.forceKillAfterMs !== undefined
1168
- ? { forceKillAfterMs: options.forceKillAfterMs }
1169
- : {}),
1167
...(options.maxOutputBytes !== undefined ? { maxOutputBytes: options.maxOutputBytes } : {}),
1168
...(options.appendTruncationMarker !== undefined
1169
? { appendTruncationMarker: options.appendTruncationMarker }
@@ -1381,7 +1378,6 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1378
env: STATUS_UPSTREAM_REFRESH_ENV,
1379
fallbackErrorDetail: "Background Git fetch exited with a non-zero status.",
1380
timeoutMs: Duration.toMillis(STATUS_UPSTREAM_FETCH_TIMEOUT),
1384
- forceKillAfterMs: 1_000,
1381
}).pipe(
1382
Effect.asVoid,
1383
Effect.tap(() =>