@@ -83,6 +83,7 @@ import {
8383 shouldRecedeSidebarThread ,
8484 resolveWorkingStartedAt ,
8585 useRetainedValue ,
86+ withoutRemovedCheckout ,
8687 useSidebarRowSubscriptionLease ,
8788} from "../Sidebar.logic" ;
8889import { resolveLocalCheckoutBranchMismatch } from "../BranchToolbar.logic" ;
@@ -629,6 +630,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
629630 JSON . stringify ( [ thread . environmentId , gitCwd ] ) ,
630631 gitStatus . data ,
631632 ) ;
633+ const checkoutThread = withoutRemovedCheckout ( thread , visibleGitStatus ) ;
632634 const pr = linkedPullRequestStatus ?. pr ?? null ;
633635 const supportsMultiplePullRequests = useSupportsMultiplePullRequests ( thread . environmentId ) ;
634636 const currentLinkedPr = supportsMultiplePullRequests
@@ -710,9 +712,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
710712 const isWokeStatus = topStatus ?. icon === "woke" ;
711713
712714 const branchMismatch = resolveLocalCheckoutBranchMismatch ( {
713- effectiveEnvMode : thread . worktreePath === null ? "local" : "worktree" ,
714- activeWorktreePath : thread . worktreePath ,
715- activeThreadBranch : thread . branch ,
715+ effectiveEnvMode : checkoutThread . worktreePath === null ? "local" : "worktree" ,
716+ activeWorktreePath : checkoutThread . worktreePath ,
717+ activeThreadBranch : checkoutThread . branch ,
716718 currentGitBranch : visibleGitStatus ?. refName ?? null ,
717719 } ) ;
718720 const prStatus = prStatusIndicator ( pr , linkedPullRequestStatus ?. sourceControlProvider ) ;
@@ -730,11 +732,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
730732 : thread . modelSelection . model ;
731733
732734 const isRemote = thread . environmentId !== props . currentEnvironmentId ;
733- const showsScratchMachine = ! thread . branch && props . scratchMachineLabel !== null ;
735+ const showsScratchMachine = ! checkoutThread . branch && props . scratchMachineLabel !== null ;
734736
735737 const detailsTooltip = (
736738 < SidebarThreadTooltip
737- thread = { thread }
739+ thread = { checkoutThread }
738740 project = { props . project }
739741 projectDisplayName = { props . projectDisplayName }
740742 environmentLabel = { props . environmentLabel }
@@ -1451,11 +1453,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
14511453 ) : null }
14521454 </ div >
14531455 < div className = "mt-0.5 flex min-w-0 items-center gap-1.5 text-secondary-label text-xs" >
1454- { thread . branch ? (
1456+ { checkoutThread . branch ? (
14551457 < >
1456- < ThreadWorktreeIndicator thread = { thread } />
1458+ < ThreadWorktreeIndicator thread = { checkoutThread } />
14571459 < span className = "flex min-w-0 flex-1 text-muted-foreground/40 redesign:text-inherit" >
1458- < MiddleTruncate value = { thread . branch } showTitle = { false } />
1460+ < MiddleTruncate value = { checkoutThread . branch } showTitle = { false } />
14591461 </ span >
14601462 </ >
14611463 ) : showsScratchMachine ? (
@@ -1563,10 +1565,11 @@ export const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props
15631565 JSON . stringify ( [ thread . environmentId , gitCwd ] ) ,
15641566 gitStatus . data ,
15651567 ) ;
1568+ const checkoutThread = withoutRemovedCheckout ( thread , visibleGitStatus ) ;
15661569 const branchMismatch = resolveLocalCheckoutBranchMismatch ( {
1567- effectiveEnvMode : thread . worktreePath === null ? "local" : "worktree" ,
1568- activeWorktreePath : thread . worktreePath ,
1569- activeThreadBranch : thread . branch ,
1570+ effectiveEnvMode : checkoutThread . worktreePath === null ? "local" : "worktree" ,
1571+ activeWorktreePath : checkoutThread . worktreePath ,
1572+ activeThreadBranch : checkoutThread . branch ,
15701573 currentGitBranch : visibleGitStatus ?. refName ?? null ,
15711574 } ) ;
15721575 const modelInstanceId = thread . runtime ?. providerInstanceId ?? thread . modelSelection . instanceId ;
@@ -1679,7 +1682,7 @@ export const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props
16791682 </ span >
16801683 </ TooltipTrigger >
16811684 < SidebarThreadTooltip
1682- thread = { thread }
1685+ thread = { checkoutThread }
16831686 project = { props . project }
16841687 projectDisplayName = { props . projectDisplayName }
16851688 environmentLabel = { props . environmentLabel }
0 commit comments