refactor(web): resuming an interrupted run lives in its own hook#23087

merged1
main
refactor/split3-send-resume
opened2d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 2d ago

useComposerSend was moved verbatim out of ChatView in #23062. It is still one ~1,900-line hook that takes an 82-field input object. This stack splits it along its send paths, and each piece reads what it needs.

This layer moves resuming an interrupted run (and releasing held queued runs) into useComposerResume. ChatView calls that hook directly. Resume shares the per-route send lock with the other send paths through draftSendState, as before. useComposerSend no longer takes resumableRunId, hasHeldQueuedRuns, interactionMode or scrollToEnd.

beforeafter
useComposerSend.ts lines1,9161,823
useComposerSend input fields8278
useComposerResume input fields—19

Render boundaries are unchanged: these are hooks inside ChatView, so render counts are unchanged and were not measured.

Tested in this worktree's dev server (isolated .t3, throwaway git repo as the project) with the whole stack applied: plain send from a draft (new thread), send with an image, queued follow-up and Ctrl+Enter steer during a running turn, resume of a stopped run, plan refinement and "Implement in a new thread" (legacy plan mode on), and a two-model start (two threads, two worktrees). All replies arrived and nothing errored. Also ran apps/web typecheck, lint on changed files (only the pre-existing prefer-set-has warning in useComposerSend.ts remains) and the React Compiler coverage test for changed files (0 bailouts).

🤖 Generated with Claude Code

Checks

All checks passed

Added 1 commit

  • refactor(web): resuming an interrupted run lives in its own hook9c7a742
Synced from GitHub

Approvability

Verdict: Approved at 9c7a742

Macroscope's review found this PR approvable — This PR extracts existing resume behavior from useComposerSend into a dedicated hook without changing the commands, guards, state coordination, or UI wiring. The remaining changes are limited to moving dependencies and handlers between the two hooks.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

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: 2d3c2fb0-2626-449d-a636-4b55d458da24
📥 Commits

Reviewing files that changed from the base of the PR and between 322d08dbd46eecf4446d33d85f9fd7ff08d60f1b and 9c7a742e1f18ec3fb7be07b6099e20ea01c7a8d3.

📒 Files selected for processing: 3
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/chat/useComposerResume.ts
  • apps/web/src/components/chat/useComposerSend.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📝 Walkthrough

Resume handling moved from useComposerSend to a dedicated useComposerResume hook. ChatView invokes the new hook separately and keeps send and plan-implementation behavior in useComposerSend.

Changes: Composer resume flow

Layer / File(s)Summary
Separate resume handling from sending
apps/web/src/components/chat/useComposerResume.ts, apps/web/src/components/chat/useComposerSend.ts
The new hook handles guarded interrupted-run continuation and queued-run release. useComposerSend no longer accepts resume inputs or maintains resume state and behavior.
Connect the resume hook in ChatView
apps/web/src/components/ChatView.tsx
ChatView invokes useComposerResume with thread and runtime inputs. It no longer passes resume inputs or scrolling to useComposerSend.

Priority: ⬇️ Low

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

Change: Refactor

Possibly related issues

  • pingdotgg/t3code#22851 — This change moves interrupted-run resumption and queued-run release into useComposerResume. It does not change normal Send dispatch or continuation text.
  • pingdotgg/t3code#14169 — This change updates the client-side interrupted-run resume path used by the recovery action. It does not add the missing reset timestamp.
Merge Risk: ⚪ Minimal · up to 9c7a7

This refactor moves resuming interrupted runs and releasing queued runs into their own hook without changing behavior. No concrete risk was identified, so it looks ready to merge after the normal checks.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description clearly explains the problem, change, and verification, but it does not follow the required template headings and does not provide the required triaged issue or explicit maintainer app…Add the Problem, Change, Scope and approval, and Verification sections. Include a link to the triaged issue or approval discussion with the maintainer approval comment, or explain why this focused refactor qualifies for an exemption.
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly identifies the main change: moving interrupted-run resumption into its own hook.
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.
Full details: Description check

Explanation

The description clearly explains the problem, change, and verification, but it does not follow the required template headings and does not provide the required triaged issue or explicit maintainer approval for scope.

Resolution

Add the Problem, Change, Scope and approval, and Verification sections. Include a link to the triaged issue or approval discussion with the maintainer approval comment, or explain why this focused refactor qualifies for an exemption.

✨ 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.