@devries-cameron20 / t3code-1 / commits / 2c3779762b
Fork 0

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

fix(server): commits no longer land on a branch switched in mid-action (#24473)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>

Victor Vogel committed Oct 29, 2026 at 12:43 UTC 2c3779762b5ae58c3ef4ae69bc9cb0b97ff74783
2 files changed +15 -16
apps/server/src/git/GitManager.test.ts
+11 -10
@@ -3906,7 +3906,7 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
3906 return { repoDir, manager, providerCalls, firstCommit, pullHead };
3907 });
3908
3909 - it.effect.each(["switch", "create-and-switch", "feature-branch"] as const)(
3909 + it.effect.each(["switch", "create-and-switch", "feature-branch", "commit"] as const)(
3910 "local PR checkout excludes a concurrent %s from a nested project with an alternate root",
3911 (operation) =>
3912 Effect.gen(function* () {
@@ -3956,7 +3956,7 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
3956 ...manager,
3957 runStackedAction: (input, options) =>
3958 Effect.sync(() => {
3959 - events.push("feature-branch");
3959 + events.push(input.featureBranch ? "feature-branch" : "commit");
3960 NodeFS.writeFileSync(
3961 NodePath.join(repoDir, "second-client.txt"),
3962 "second client\n",
@@ -3993,9 +3993,9 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
3993 })
3994 : workflows[1]!.runStackedAction({
3995 cwd: nestedCwd,
3996 - actionId: "second-client-feature-branch",
3996 + actionId: `second-client-${operation}`,
3997 action: "commit",
3998 - featureBranch: true,
3998 + featureBranch: operation === "feature-branch",
3999 commitMessage: "Second client commit",
4000 }),
4001 { startImmediately: true },
@@ -4008,15 +4008,16 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
4008 expect(events).toEqual([operation]);
4009 expect(prepared).toMatchObject({ branch: "feature/pr-safe", isOnPullRequestHead: true });
4010 expect((yield* runGit(repoDir, ["rev-parse", "main"])).stdout.trim()).toBe(mainCommit);
4011 - expect((yield* runGit(repoDir, ["rev-parse", "feature/pr-safe"])).stdout.trim()).toBe(
4012 - pullHead,
4013 - );
4011 + const pullBranch = operation === "commit" ? "feature/pr-safe^" : "feature/pr-safe";
4012 + expect((yield* runGit(repoDir, ["rev-parse", pullBranch])).stdout.trim()).toBe(pullHead);
4013 expect((yield* runGit(repoDir, ["branch", "--show-current"])).stdout.trim()).toBe(
4014 operation === "switch"
4015 ? "main"
4017 - : "branch" in switched
4018 - ? switched.branch.name
4019 - : "second-client",
4016 + : operation === "commit"
4017 + ? "feature/pr-safe"
4018 + : "branch" in switched
4019 + ? switched.branch.name
4020 + : "second-client",
4021 );
4022 if ("commit" in switched) {
4023 expect(switched.commit.status).toBe("created");
apps/server/src/git/GitWorkflowService.ts
+4 -6
@@ -377,12 +377,10 @@ export const make = Effect.gen(function* () {
377 runStackedAction: Effect.fn("GitWorkflowService.runStackedAction")(function (input, options) {
378 return ensureGit("GitWorkflowService.runStackedAction", input.cwd).pipe(
379 Effect.flatMap((handle) =>
380 - input.featureBranch
381 - ? withCheckoutLease(
382 - handle.repository.rootPath,
383 - gitManager.runStackedAction(input, options),
384 - )
385 - : gitManager.runStackedAction(input, options),
380 + withCheckoutLease(
381 + handle.repository.rootPath,
382 + gitManager.runStackedAction(input, options),
383 + ),
384 ),
385 );
386 }),