From c1a7e53fe6decd7dffe15337d82704b044278f8f Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 13 Apr 2026 11:27:09 -0700 Subject: [PATCH] Prevent semantic thread branches from regressing - Keep live thread branches stable when git status reports a temporary worktree branch - Use the shared temporary worktree branch helper in web logic - Add regression test for semantic branch renames Co-authored-by: codex --- .../web/src/components/GitActionsControl.logic.test.ts | 9 +++++++++ apps/web/src/components/GitActionsControl.logic.ts | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/apps/web/src/components/GitActionsControl.logic.test.ts b/apps/web/src/components/GitActionsControl.logic.test.ts index 267cbec180d..c6a50b82c27 100644 --- a/apps/web/src/components/GitActionsControl.logic.test.ts +++ b/apps/web/src/components/GitActionsControl.logic.test.ts @@ -1020,6 +1020,15 @@ describe("resolveLiveThreadBranchUpdate", () => { assert.equal(update, null); }); + + it("does not regress a semantic thread branch back to a temporary worktree branch", () => { + const update = resolveLiveThreadBranchUpdate({ + threadBranch: "t3code/github-query-rate-limit", + gitStatus: status({ branch: "t3code/bda76797" }), + }); + + assert.equal(update, null); + }); }); describe("resolveAutoFeatureBranchName", () => { diff --git a/apps/web/src/components/GitActionsControl.logic.ts b/apps/web/src/components/GitActionsControl.logic.ts index b4b0b98b0b1..e4e611fb87c 100644 --- a/apps/web/src/components/GitActionsControl.logic.ts +++ b/apps/web/src/components/GitActionsControl.logic.ts @@ -3,6 +3,7 @@ import type { GitStackedAction, GitStatusResult, } from "@t3tools/contracts"; +import { isTemporaryWorktreeBranch } from "@t3tools/shared/git"; export type GitActionIconName = "commit" | "push" | "pr"; @@ -354,6 +355,15 @@ export function resolveLiveThreadBranchUpdate(input: { return null; } + if ( + input.threadBranch !== null && + input.gitStatus.branch !== null && + !isTemporaryWorktreeBranch(input.threadBranch) && + isTemporaryWorktreeBranch(input.gitStatus.branch) + ) { + return null; + } + return { branch: input.gitStatus.branch, };