@devries-cameron20 / t3code-1 / commits / c28c6acaf8
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): a rejected non-fast-forward push explains itself under a translated Git (#35386)

Julius Marminge committed Nov 12, 2026 at 23:42 UTC c28c6acaf8b00e239cce059097c9ec22acd9d89b
2 files changed +55 -4
apps/server/src/vcs/GitVcsDriverCore.test.ts
+49
@@ -2189,6 +2189,55 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2189 }),
2190 );
2191
2192 + it.effect("explains a non-fast-forward push from a host with a translated Git", () =>
2193 + Effect.gen(function* () {
2194 + const cwd = yield* makeTmpDir();
2195 + const { initialBranch } = yield* initRepoWithCommit(cwd);
2196 + const remote = yield* makeTmpDir("git-remote-");
2197 + const other = yield* makeTmpDir("git-other-");
2198 + yield* git(remote, ["init", "--bare"]);
2199 + yield* git(cwd, ["remote", "add", "origin", remote]);
2200 + yield* git(cwd, ["push", "--set-upstream", "origin", initialBranch]);
2201 + yield* git(other, ["clone", "--branch", initialBranch, remote, "."]);
2202 + yield* git(other, [
2203 + "-c",
2204 + "user.email=t@t",
2205 + "-c",
2206 + "user.name=T",
2207 + "commit",
2208 + "--allow-empty",
2209 + "-m",
2210 + "remote",
2211 + ]);
2212 + yield* git(other, ["push", "origin", initialBranch]);
2213 + yield* git(cwd, ["commit", "--allow-empty", "-m", "local"]);
2214 + const locales: Array<CommandLine.Word | undefined> = [];
2215 + const delegate = yield* ChildProcessSpawner.ChildProcessSpawner;
2216 + const spawner = ChildProcessSpawner.make((command) => {
2217 + if (ChildProcess.isStandardCommand(command) && command.args.includes("push")) {
2218 + locales.push(command.options.env?.LANGUAGE);
2219 + }
2220 + return delegate.spawn(command);
2221 + });
2222 + const driver = yield* makeGitVcsDriverCore().pipe(
2223 + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
2224 + Effect.provide(layerServerConfig),
2225 + );
2226 + const hostEnv = yield* HostProcess.Environment;
2227 +
2228 + const error = yield* driver
2229 + .pushCurrentBranch(cwd, null)
2230 + .pipe(
2231 + Effect.provideService(HostProcess.Environment, { ...hostEnv, LANGUAGE: "de" }),
2232 + Effect.flip,
2233 + );
2234 +
2235 + assert.equal(error.reason, "push_rejected_non_fast_forward");
2236 + assert.isNotEmpty(locales);
2237 + for (const locale of locales) assert.equal(locale, "C");
2238 + }),
2239 + );
2240 +
2241 it.effect("lets a slow remote branch checkout finish without blocking config writes", () =>
2242 Effect.gen(function* () {
2243 const cwd = yield* makeTmpDir();
apps/server/src/vcs/GitVcsDriverCore.ts
+6 -4
@@ -2912,7 +2912,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2912 const requestedRemoteName = options?.remoteName?.trim() || null;
2913 if (requestedRemoteName) {
2914 const publishBranch = yield* resolvePublishBranchName(cwd, branch);
2915 - yield* runGit(
2915 + yield* executeGitWithStableDiagnostics(
2916 "GitVcsDriver.pushCurrentBranch.pushWithRequestedRemote",
2917 cwd,
2918 ["push", "--", requestedRemoteName, `HEAD:refs/heads/${publishBranch}`],
@@ -3006,7 +3006,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
3006 });
3007 }
3008 }
3009 - yield* runGit(
3009 + yield* executeGitWithStableDiagnostics(
3010 upstream
3011 ? "GitVcsDriver.pushCurrentBranch.pushOwnBranch"
3012 : "GitVcsDriver.pushCurrentBranch.pushWithUpstream",
@@ -3023,7 +3023,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
3023 }
3024
3025 if (destination?.upstream) {
3026 - yield* runGit(
3026 + yield* executeGitWithStableDiagnostics(
3027 "GitVcsDriver.pushCurrentBranch.pushUpstream",
3028 cwd,
3029 ["push", "--", destination.remoteName, `HEAD:refs/heads/${destination.branchName}`],
@@ -3037,7 +3037,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
3037 };
3038 }
3039
3040 - yield* runGit("GitVcsDriver.pushCurrentBranch.push", cwd, ["push"], { timeoutMs: null });
3040 + yield* executeGitWithStableDiagnostics("GitVcsDriver.pushCurrentBranch.push", cwd, ["push"], {
3041 + timeoutMs: null,
3042 + });
3043 return {
3044 status: "pushed" as const,
3045 branch,