The best way to control Claude Code, Codex and more from any computer or phone
fix(server): git hooks keep the user's locale (#27778)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 2, 2026 at 18:51 UTC
acd2db9c5e16417218458bf088e929c05cfaf27c
4 files changed
+41
-6
apps/server/src/sourceControl/SourceControlRepositoryService.ts
+2
-1
@@ -79,7 +79,8 @@ const CLONE_ENV = {
79
// Force piped progress immediately; refuse credential prompts that would hang without a tty.
80
GIT_PROGRESS_DELAY: "0",
81
GIT_TERMINAL_PROMPT: "0",
82
- LC_ALL: "C",
82
+ // English progress without overriding LC_CTYPE, which a global post-checkout hook inherits.
83
+ LANGUAGE: "C",
84
} satisfies NodeJS.ProcessEnv;
85
86
function mapRepositoryError(operation: string, provider: SourceControlProviderKind) {
apps/server/src/triage/TriageService.ts
+2
-1
@@ -23,7 +23,8 @@ const T3CODE_REPOSITORY_URL = "https://github.com/pingdotgg/t3code";
23
const GIT_ENV = {
24
GIT_TERMINAL_PROMPT: "0",
25
GIT_ASKPASS: "",
26
- LC_ALL: "C",
26
+ // English messages without overriding LC_CTYPE, which a global post-checkout hook inherits.
27
+ LANGUAGE: "C",
28
} satisfies NodeJS.ProcessEnv;
29
30
/** Starts in-app triage sessions: the same files `t3 triage` writes, plus a source clone. */
apps/server/src/vcs/GitVcsDriverCore.test.ts
+34
-2
@@ -1439,7 +1439,7 @@ it.effect.each([
1439
return yield* Effect.die("expected Git command");
1440
if (command.args[0] !== "fetch") return makeNonRepositoryHandle();
1441
assert.deepEqual(command.args, ["fetch", "--quiet", "--", "origin"]);
1442
- assert.equal(command.options.env?.LC_ALL, "C");
1442
+ assert.equal(command.options.env?.LANGUAGE, "C");
1443
assert.equal(command.options.env?.GIT_TERMINAL_PROMPT, "0");
1444
yield* Ref.update(attempts, (count) => count + 1);
1445
return ChildProcessSpawner.makeHandle({
@@ -1863,7 +1863,7 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
1863
command.args[0] === "branch" ||
1864
command.args[0] === "checkout")
1865
) {
1866
- locales.push(command.options.env?.LC_ALL);
1866
+ locales.push(command.options.env?.LANGUAGE);
1867
}
1868
return delegate.spawn(command);
1869
});
@@ -4282,6 +4282,38 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
4282
}
4283
}),
4284
);
4285
+
4286
+ // regression: #27749 hooks inherited the driver's forced LC_ALL=C
4287
+ it.effect("runs post-checkout hooks under the server's own locale", () =>
4288
+ Effect.gen(function* () {
4289
+ const cwd = yield* makeTmpDir();
4290
+ const { initialBranch } = yield* initRepoWithCommit(cwd);
4291
+ const fs = yield* FileSystem.FileSystem;
4292
+ const path = yield* Path.Path;
4293
+ const driver = yield* GitVcsDriver.GitVcsDriver;
4294
+ const serverLocale = process.env.LC_ALL ?? "unset";
4295
+ const seenLocale = path.join(yield* makeTmpDir("git-hook-locale-"), "lc-all");
4296
+ yield* writeTextFile(
4297
+ cwd,
4298
+ "hooks/post-checkout",
4299
+ `#!/bin/sh\necho "\${LC_ALL-unset}" > '${seenLocale}'\n[ "\${LC_ALL-unset}" = '${serverLocale}' ]\n`,
4300
+ );
4301
+ yield* fs.chmod(path.join(cwd, "hooks/post-checkout"), 0o755);
4302
+ yield* git(cwd, ["config", "core.hooksPath", path.join(cwd, "hooks")]);
4303
+ const worktreePath = path.join(yield* makeTmpDir("git-worktrees-"), "locale");
4304
+
4305
+ const result = yield* driver
4306
+ .createWorktree({ cwd, path: worktreePath, refName: initialBranch, newRefName: "locale" })
4307
+ .pipe(Effect.result);
4308
+
4309
+ assert.equal(
4310
+ (yield* fs.readFileString(seenLocale)).trim(),
4311
+ serverLocale,
4312
+ "post-checkout hook should see the server's LC_ALL",
4313
+ );
4314
+ assert.isTrue(Result.isSuccess(result), "worktree creation failed in the hook");
4315
+ }),
4316
+ );
4317
it.effect.each(["commit", "short-commit", "tag", "revision"] as const)(
4318
"creates a worktree from a %s without recording it as a PR base",
4319
(kind) =>
apps/server/src/vcs/GitVcsDriverCore.ts
+3
-2
@@ -1186,7 +1186,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1186
...options,
1187
env: {
1188
...options.env,
1189
- LC_ALL: "C",
1189
+ // English diagnostics without overriding LC_CTYPE, which hooks inherit.
1190
+ LANGUAGE: "C",
1191
},
1192
});
1193
@@ -4303,7 +4304,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
4304
timeoutMs: null,
4305
...(onSubmoduleLine
4306
? {
4306
- env: { LC_ALL: "C" },
4307
+ env: { LANGUAGE: "C" },
4308
progress: { onStdoutLine: onSubmoduleLine, onStderrLine: onSubmoduleLine },
4309
}
4310
: {}),