From f7535bb36caa9b71a7fb75a8f42fbbb67e337c18 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 13 Apr 2026 12:04:56 -0700 Subject: [PATCH] Prevent live thread branches from regressing to temp worktree names (#1995) Co-authored-by: codex --- .../web/src/components/GitActionsControl.logic.test.ts | 9 +++++++++ apps/web/src/components/GitActionsControl.logic.ts | 1 - packages/client-runtime/src/gitActions.ts | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/GitActionsControl.logic.test.ts b/apps/web/src/components/GitActionsControl.logic.test.ts index 267cbec180..c6a50b82c2 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 c5323dcfd2..96663172f4 100644 --- a/apps/web/src/components/GitActionsControl.logic.ts +++ b/apps/web/src/components/GitActionsControl.logic.ts @@ -12,5 +12,4 @@ export { resolveQuickAction, resolveThreadBranchUpdate, } from "@t3tools/client-runtime"; - export { resolveAutoFeatureBranchName } from "@t3tools/shared/git"; diff --git a/packages/client-runtime/src/gitActions.ts b/packages/client-runtime/src/gitActions.ts index 97bd22557e..e6f3a15000 100644 --- a/packages/client-runtime/src/gitActions.ts +++ b/packages/client-runtime/src/gitActions.ts @@ -4,6 +4,7 @@ import type { GitStackedAction, GitStatusResult, } from "@t3tools/contracts"; +import { isTemporaryWorktreeBranch } from "@t3tools/shared/git"; export type GitActionIconName = "commit" | "push" | "pr"; @@ -424,6 +425,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, };