fix: keep worktree setup visible after leaving and reopening the thread #11836
Mergedt3dotgg(GitHub profile, opens in a new tab)merged 4 commits into
main fromrefs/pull/11836/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/web/src/components/ChatView.tsx lines 3502 to 3510Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -3493,3 +3493,16 @@34933493 const worktreeSetupOwnerKey = draftId ?? routeThreadKey;34943494 const worktreeSetupActive =34953495 worktreeSetupRef !== null && worktreeSetupRef.ownerKey === worktreeSetupOwnerKey;3496+ // A thread reopened mid-setup has no dispatch ref: this view remounted.3497+ // The server projects a starting session before any message or turn exists3498+ // for exactly that window, so follow the setup stream from the thread's own3499+ // state until the agent's turn lands.3500+ const resumedWorktreeSetupRef =3501+ !worktreeSetupActive &&3502+ isServerThread &&3503+ activeThreadRef !== null &&3504+ activeThreadShell?.session?.status === "starting" &&3505+ activeThreadShell.latestTurn === null &&3506+ activeThreadShell.latestUserMessageAt === null3507+ ? activeThreadRef3508+ : null;apps/web/src/components/ChatView.tsx lines 9336 to 9338OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -9313,4 +9333,6 @@93139333 ? "Sending feedback"93149334 : threadDetailLoading93159335 ? "Messages loading"9316- : projectCloneSendBlockReason9336+ : worktreeSetup?.phase === "running"9337+ ? "Preparing worktree"9338+ : projectCloneSendBlockReason
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/ChatView.tsx lines 3514 to 3514OutdatedResolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -3494,2 +3494,21 @@34943494 const worktreeSetupActive =34953495 worktreeSetupRef !== null && worktreeSetupRef.ownerKey === worktreeSetupOwnerKey;3496+ // A thread reopened mid-setup has no dispatch ref: this view remounted.3497+ // The server projects a starting session before any message or turn exists3498+ // for exactly that window, so follow the setup stream from the thread's own3499+ // state. The ref is adopted below so the card then follows the same3500+ // lifecycle as the original send, including an async setup script that3501+ // keeps running after the agent's turn lands.3502+ const resumedWorktreeSetupRef =3503+ !worktreeSetupActive &&3504+ isServerThread &&3505+ activeThreadRef !== null &&3506+ activeThreadShell?.session?.status === "starting" &&3507+ activeThreadShell.latestTurn === null &&3508+ activeThreadShell.latestUserMessageAt === null3509+ ? activeThreadRef3510+ : null;3511+ useEffect(() => {3512+ if (!resumedWorktreeSetupRef) return;3513+ setWorktreeSetupRef(3514+ (current) => current ?? { ...resumedWorktreeSetupRef, ownerKey: worktreeSetupOwnerKey },
- apps/web/src/components/ChatView.tsx line 3514OutdatedResolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -3494,2 +3494,21 @@34943494 const worktreeSetupActive =34953495 worktreeSetupRef !== null && worktreeSetupRef.ownerKey === worktreeSetupOwnerKey;3496+ // A thread reopened mid-setup has no dispatch ref: this view remounted.3497+ // The server projects a starting session before any message or turn exists3498+ // for exactly that window, so follow the setup stream from the thread's own3499+ // state. The ref is adopted below so the card then follows the same3500+ // lifecycle as the original send, including an async setup script that3501+ // keeps running after the agent's turn lands.3502+ const resumedWorktreeSetupRef =3503+ !worktreeSetupActive &&3504+ isServerThread &&3505+ activeThreadRef !== null &&3506+ activeThreadShell?.session?.status === "starting" &&3507+ activeThreadShell.latestTurn === null &&3508+ activeThreadShell.latestUserMessageAt === null3509+ ? activeThreadRef3510+ : null;3511+ useEffect(() => {3512+ if (!resumedWorktreeSetupRef) return;3513+ setWorktreeSetupRef(3514+ (current) => current ?? { ...resumedWorktreeSetupRef, ownerKey: worktreeSetupOwnerKey },
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed