feat(server): persist the worktree setup send and progress on the thread #11852
Merged
juliusmarmingemerged 11 commits into
main fromrefs/pull/11852/head·merged by juliusmarminge View on GitHubShowing 29 changed files with 24 additions and 1 deletion (loading 26).
x
18 additions and 1 deletion+18-1apps/mobile/src/features/threads/ThreadRouteScreen.tsxModifiedView file
@@ -782,9 +782,26 @@
+ // 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 &&
🟡 Medium threads/ThreadRouteScreen.tsx:791
A normal non-worktree first turn is shown as “Setting up worktree…” after reload while it is starting, and the composer is blocked until startup completes. session.status === "starting" is also set for pending thread.turn.start, so it is not a unique bootstrap signal; derive preparingWorktree only from the worktree-setup activity.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/mobile/src/features/threads/ThreadRouteScreen.tsx around line 791:
A normal non-worktree first turn is shown as “Setting up worktree…” after reload while it is starting, and the composer is blocked until startup completes. `session.status === "starting"` is also set for pending `thread.turn.start`, so it is not a unique bootstrap signal; derive `preparingWorktree` only from the `worktree-setup` activity.
Fixed in f3096e608b: preparingWorktree now derives only from the running worktree-setup record, on mobile and on web (web's awaitingBootstrapTurn had the same ambiguity).
+ 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],
+ );
- return null;
+ return awaitingBootstrapTurn ? { kind: "preparing", preparingWorktree: true } : null;