Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): persist the worktree setup send and progress on the thread #11852

Mergedjuliusmarmingemerged 11 commits intomain fromrefs/pull/11852/headmerged by juliusmarminge View on GitHub

Showing 29 changed files with 24 additions and 1 deletion (loading 26).

x
0 of 29 viewed, 29 left
18 additions and 1 deletionapps/mobile/src/features/threads/ThreadRouteScreen.tsxModified
View file
@@ -782,9 +782,26 @@
}),
}, [navigation, routeThreadIdentity, selectedThreadCreation, selectedThreadProject]);
+ // A worktree bootstrap records a running setup on the thread before its
+ // turn, so a thread opened from another device (or after a restart) shows
+ // the same preparing state the sending client does. A starting session is
+ // not enough on its own: an ordinary first turn projects one too.
+ const awaitingBootstrapTurn = useMemo(
+ () =>
+ selectedThreadDetail !== null &&
+ selectedThreadDetail.latestTurn === null &&
+ selectedThreadDetail.activities.some(
+ (activity) =>
+ activity.kind === "worktree-setup" &&
+ typeof activity.payload === "object" &&
+ activity.payload !== null &&
+ (activity.payload as { phase?: unknown }).phase === "running",
+ ),
+ [selectedThreadDetail],
+ );
const creationState = ((): ThreadDetailScreenProps["creationState"] => {
if (selectedThreadCreation === null) {
- return null;
+ return awaitingBootstrapTurn ? { kind: "preparing", preparingWorktree: true } : null;
if (selectedThreadCreation.outcome?.kind === "failed") {
return {