@devries-cameron20 / t3code Mirror · read-only / commits / 52c62087b3
Fork 0

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, 11:00 UTC

fix(server): a pushed commit no longer reports failure when the final git status read fails (#32705)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Victor committed Nov 15, 2026 at 00:34 UTC 52c62087b35dae14369fdef59e24e64310d7105e
2 files changed +62 -10
apps/server/src/git/GitManager.test.ts
+50
@@ -3648,6 +3648,56 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
3648 }),
3649 );
3650
3651 + it.effect("finishes a pushed commit when the final status read fails", () =>
3652 + Effect.gen(function* () {
3653 + const repoDir = yield* makeTempDir("t3code-git-manager-");
3654 + yield* initRepo(repoDir);
3655 + yield* runGit(repoDir, ["checkout", "-b", "feature/status-after-push"]);
3656 + const remoteDir = yield* createBareRemote();
3657 + yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]);
3658 + NodeFS.writeFileSync(NodePath.join(repoDir, "change.txt"), "change\n");
3659 + const gate = {
3660 + matches: (args: ReadonlyArray<string>) => args[0] === "push",
3661 + reached: yield* Deferred.make<void>(),
3662 + release: yield* Deferred.make<void>(),
3663 + };
3664 + const events: GitActionProgressEvent[] = [];
3665 + const { manager } = yield* makeManager({ gitSpawnGate: gate });
3666 +
3667 + const action = yield* Effect.forkChild(
3668 + runStackedAction(
3669 + manager,
3670 + { cwd: repoDir, action: "commit_push", commitMessage: "Status after push" },
3671 + {
3672 + progressReporter: {
3673 + publish: (event) =>
3674 + Effect.sync(() => {
3675 + events.push(event);
3676 + }),
3677 + },
3678 + },
3679 + ),
3680 + );
3681 + yield* Deferred.await(gate.reached);
3682 + NodeFS.writeFileSync(NodePath.join(repoDir, ".git", "index.lock"), "");
3683 + yield* Deferred.succeed(gate.release, undefined);
3684 + const result = yield* Fiber.join(action);
3685 +
3686 + expect(result.push.status).toBe("pushed");
3687 + expect(result.toast.cta).toEqual({ kind: "none" });
3688 + expect(events.at(-1)?.kind).toBe("action_finished");
3689 + expect(
3690 + (yield* runGit(remoteDir, [
3691 + "--git-dir=.",
3692 + "log",
3693 + "-1",
3694 + "--pretty=%s",
3695 + "feature/status-after-push",
3696 + ])).stdout.trim(),
3697 + ).toBe("Status after push");
3698 + }),
3699 + );
3700 +
3701 it.effect("hands the branch base to the host when a failed first push is retried", () =>
3702 Effect.gen(function* () {
3703 const repoDir = yield* makeTempDir("t3code-git-manager-");
apps/server/src/git/GitManager.ts
+12 -10
@@ -2061,16 +2061,17 @@ export const make = Effect.gen(function* () {
2061 hasUpstream: boolean;
2062 } | null = null;
2063
2064 - if (result.action !== "commit") {
2065 - const finalStatus = yield* gitCore.statusDetails(cwd);
2066 - if (finalStatus.branch) {
2067 - finalBranchContext = {
2068 - branch: finalStatus.branch,
2069 - upstreamRef: finalStatus.upstreamRef,
2070 - hasUpstream: finalStatus.hasUpstream,
2071 - };
2072 - currentBranchIsDefault = finalStatus.isDefaultBranch;
2073 - }
2064 + const finalStatus =
2065 + result.action === "commit"
2066 + ? null
2067 + : yield* gitCore.statusDetails(cwd).pipe(Effect.orElseSucceed(() => null));
2068 + if (finalStatus?.branch) {
2069 + finalBranchContext = {
2070 + branch: finalStatus.branch,
2071 + upstreamRef: finalStatus.upstreamRef,
2072 + hasUpstream: finalStatus.hasUpstream,
2073 + };
2074 + currentBranchIsDefault = finalStatus.isDefaultBranch;
2075 }
2076
2077 const explicitResultPr =
@@ -2122,6 +2123,7 @@ export const make = Effect.gen(function* () {
2123 }
2124 : (result.action === "push" || result.action === "commit_push") &&
2125 result.push.status === "pushed" &&
2126 + finalStatus !== null &&
2127 !currentBranchIsDefault
2128 ? {
2129 kind: "run_action" as const,