Skip to content
Source
Sign inSign up
pingdotgg/t3code

refactor(web): move worktree setup progress out of ChatView #20316

Mergedjuliusmarmingemerged 1 commit intochatview-split/panel-surfaces fromrefs/pull/20316/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Part of the ChatView split so the React Compiler can compile it.

useWorktreeSetup now owns:

  • the setup snapshot subscription
  • the snapshot it holds while the server briefly reports null during its grace period
  • whether setup is holding the composer
  • the retryable preparation runs
  • cancel, retry and open-terminal

onSend records the thread it is setting up by calling begin(). "Work locally" uses cancel(), which resolves to whether the server actually cancelled.

Behavior should match. To make the hook compile, the held snapshot (and its reset when switching routes) and the retryable-run set are now updated during render instead of in effects or useMemo. The ordering is the same as before: when the route changes, the held snapshot ends up null.

The hook goes on the compile-required lint list (#20292). ChatView.logic tests pass (128).

Stack progress

LayerChatView linesChatView component bodyCompiler on ChatViewFiles held to strict compiler lint
main11,66010,007crashes (internal error)0
#20161 pending approvals and questions hook11,2229,624crashes (internal error)0
#20164 terminal drawer and panel file10,6149,624crashes (internal error)0
#20289 one terminal open/close hook10,4669,481crashes (internal error)0
#20292 compile-required lint list10,4669,481crashes (internal error)2
#20294 pending hook compiles10,4669,481crashes (internal error)3
#20296 /usage-limits panel hook10,3979,416crashes (internal error)4
#20304 queued-message editing hook10,1729,200crashes (internal error)5
#20308 linked pull request hook10,0789,106crashes (internal error)6
#20309 proactive panel hook9,9508,984crashes (internal error)7
#20312 agent-opened previews hook9,8558,890crashes (internal error)8
#20315 right panel close hook9,7438,779crashes (internal error)9
→ #20316 worktree setup hook9,6608,695crashes (internal error)10
#20321 two onSend phases split out9,6608,613crashes (internal error)10
#20340 compiler no longer crashes on ChatView9,6478,599skips (32 reasons)10
#20379 ChatView compiles9,6168,469compiles11
#20380 re-render fixes from profiling9,6618,514compiles11
#20392 provider pushes keep identity9,6288,481compiles11
#20393 keyboard shortcuts command map9,3408,265compiles13
#20396 Sidebar compiles, no manual memos9,3408,265compiles14
#20397 ChatComposer compiles9,3408,265compiles14
#20401 project script editing hook9,1108,049compiles15
#20402 MessagesTimeline compiles9,1108,049compiles16
#20418 ChatView strict: no memos, no sync effects8,9017,855compiles17

Measured with the native React Compiler (oxc-transform-react) on each layer's ChatView.tsx. "Crashes" means it hit an internal codegen error and left ChatView uncompiled; "skips" means it reported reasons it could not compile it. Strict files must compile with no bailouts, no manual memoization and no effect-rule violations; lint and reactCompiledFiles.test.ts enforce it.

🤖 Generated with Claude Code (Claude Opus 5.5)


Devin Review
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. juliusmarminge added labelsmacroscope-review

    3. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

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

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—4.9 KiB—6.8 KiB✅
      CodexThread snapshot wire—3.8 KiB—4.9 KiB✅
      CodexLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      CodexLive turn WebSocket decoded—20.8 KiB—29.3 KiB✅
      CodexLive turn messages—1—8✅
      ClaudeTotal thread wire—5.0 KiB—6.8 KiB✅
      ClaudeThread snapshot wire—3.8 KiB—4.9 KiB✅
      ClaudeLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      ClaudeLive turn WebSocket decoded—21.2 KiB—29.3 KiB✅
      ClaudeLive turn messages—1—8✅

      Baseline: unavailable · PR result: e2182f9 · 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: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

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

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 8edf05e

      Macroscope's review found this PR approvable — This is a contained web refactor that extracts existing worktree setup state and actions into a compiler-compatible hook without changing APIs, defaults, or user-facing capabilities. The Vite update only enforces compilation of the new hook.

      No code changes detected at e2182f9. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Important

      Review skipped

      Review was skipped as selected files did not have any reviewable changes.

      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Team
      • Run ID: a1b07f12-ae65-43f4-aa8f-5eaf50e6daf6
      📥 Commits

      Reviewing files that changed from the base of the PR and between 8edf05e2b4dba4eb7bfa2047db25038b83168c4a and e2182f92bc413091695457b947c09c6e7c34bb8d.

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Team
      • Run ID: 1ba540a8-2fea-4760-900e-f33a6f91f1c9
      📥 Commits

      Reviewing files that changed from the base of the PR and between 42f615114ea6db1303a6390ba55a1a367f729fd7 and 8edf05e2b4dba4eb7bfa2047db25038b83168c4a.

      📒 Files selected for processing: 2
      • apps/web/src/components/ChatView.tsx
      • vite.config.ts

      Limit details: You’ve used all 10 included reviews currently available.

      📝 Walkthrough

      Worktree setup state and actions move from ChatView into useWorktreeSetup. ChatView uses the hook to manage setup progress, send blocking, retries, cancellation, and terminal access.

      Changes: Worktree setup handling

      Layer / File(s)Summary
      Track setup state
      apps/web/src/components/chat/useWorktreeSetup.ts
      The hook subscribes to relevant setup state, retains the latest snapshot for the route, and resolves visible progress from snapshots and run context.
      Apply setup rules and actions
      apps/web/src/components/chat/useWorktreeSetup.ts
      The hook computes send blocking and retryable run IDs. It exposes actions to track setup, cancel or retry it, and open the setup terminal for the active thread.
      Connect setup handling to ChatView
      apps/web/src/components/ChatView.tsx, vite.config.ts
      ChatView uses the hook for setup state and actions. “Work locally” schedules a draft resend only when cancellation succeeds. The React Compiler lint configuration includes the hook.

      Priority: ⬇️ Low

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Refactor

      Pre-merge checks: Passed 3 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Description checkWarningThe description explains the refactor and reports test results, but it does not use the required Problem, Change, Scope and approval, and Verification sections. It also does not provide the required i…Update the description with the required sections. Add the problem and expected behavior, explain the change under Change, provide the triaged issue or explicit maintainer approval under Scope and approval, and document focused verification…
      Passed Passed checks: 3 passed
      Check nameStatusExplanation
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe title clearly and concisely describes the main change: moving worktree setup progress management out of ChatView.
      Full details: Description check

      Explanation

      The description explains the refactor and reports test results, but it does not use the required Problem, Change, Scope and approval, and Verification sections. It also does not provide the required issue or maintainer approval link and lacks detailed verification evidence.

      Resolution

      Update the description with the required sections. Add the problem and expected behavior, explain the change under Change, provide the triaged issue or explicit maintainer approval under Scope and approval, and document focused verification with observed results and any checks not run. Include UI evidence if applicable.

      ✨ Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    6. juliusmarminge merged thisd3de2c1

    7. juliusmarminge closed this

Sign in to join this conversation.