Skip to content

feat(web,mobile): show worktree setup progress instead of "Thinking" - #235

Merged
bk-agent-01 merged 1 commit into
expbkmainfrom
t3code/worktree-setup-progress
Sep 27, 2026
Merged

bk-agent-01 merged 1 commit into
expbkmainfrom
t3code/worktree-setup-progress

Conversation

@bk-agent-01

Copy link
Copy Markdown
Collaborator

Problem

When the first prompt of a new worktree thread is sent, the server creates the worktree and runs the setup script (often a multi-minute install) before the agent receives the prompt. During all of that, the chat showed "Preparing for 40s" plus a "Thinking" row, as if the agent were already working. The only hint of setup was a one-line "New worktree is being prepared" banner. The durable bootstrap already records worktreePhase / setupPhase on the execution intent; the UI just didn't use them.

Fix

  • Shared (@t3tools/client-runtime/state/workspace-preparation): deriveWorkspacePreparation(intent) turns the intent's bootstrap phases into a worktree → setup → agent checklist, a one-line label, and an agentStarted flag. Returns null for turns that prepare nothing, so ordinary turns are untouched.
  • Web: while preparing, the working row is an expandable "Setting up workspace · Running setup script…" row. Expanding it shows each step with a check, a Show output button for the setup terminal, and the failure detail if any. Once the agent takes over it collapses to "✓ Workspace ready" above the normal timer. "Thinking" is held back until the agent turn is actually running. The old one-line banner is hidden while the row is on screen and still shows failures.
  • Mobile: the floating status pill names the current step ("Creating worktree…", "Running setup script…", "Starting agent…"), and the feed holds back the Thinking row until the agent starts.
  • Server: prepareDurableBootstrap refreshes the execution snapshot when the setup step starts. Before this, step changes inside one preparation pass were never published, so clients could not see "worktree created, setup running" live.

The agent still waits for the setup script, as the durable bootstrap already did. No behaviour change there.

Verification

  • packages/client-runtime/src/state/workspacePreparation.test.ts: 7 cases covering every phase combination.
  • ProviderCommandReactor.test.ts: "publishes the running setup step before the setup script finishes". It fails without the server change (expected ['pending','pending'] to include 'running') and passes with it.
  • Existing MessagesTimeline.test.tsx and thread-bootstrap tests pass. Typecheck passes for client-runtime, server, web and mobile. Fork-marker check passes.
  • Screenshots: to follow from expbkt3 after deploy.

🤖 Generated with Claude Code

While a new worktree thread is created and its setup script runs, the chat
showed "Working… / Thinking" as if the agent already had the prompt. The
durable bootstrap already tracks worktree, setup and agent phases on the
execution intent; the UI now uses them.

- Web: the working row becomes an expandable "Setting up workspace" checklist
  (worktree, setup script with Show output, agent start). It collapses to a
  "Workspace ready" checkmark once the agent takes over, and "Thinking" only
  appears once the agent turn is running.
- Mobile: the floating status pill names the current step and the feed
  holds back the Thinking row until the agent starts.
- Server: publish the execution snapshot when the setup step starts, so
  clients see "worktree created, setup running" live instead of only at the
  end of preparation.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 27, 2026
@github-actions

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 13.8 KiB — 15.1 KiB ✅
Codex Thread snapshot wire — 7.3 KiB — 7.8 KiB ✅
Codex Live turn WebSocket wire — 6.5 KiB — 7.8 KiB ✅
Codex Live turn WebSocket decoded — 57.1 KiB — 66.4 KiB ✅
Codex Live turn messages — 9 — 21 ✅
Claude Total thread wire — 13.8 KiB — 15.1 KiB ✅
Claude Thread snapshot wire — 7.3 KiB — 7.8 KiB ✅
Claude Live turn WebSocket wire — 6.5 KiB — 7.8 KiB ✅
Claude Live turn WebSocket decoded — 57.9 KiB — 66.4 KiB ✅
Claude Live turn messages — 9 — 21 ✅

Baseline: unavailable · PR result: 5e25b20 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 114.9 KiB
  • Claude decoded thread snapshot: 115.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@bk-agent-01
bk-agent-01 merged commit 43c625a into expbkmain Sep 27, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant