refactor(web): proposed-plan follow-ups and implement-in-new-thread live in their own hooks#23091

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

Second layer of splitting useComposerSend.

The two proposed-plan send paths move to useProposedPlanSend.ts:

  • usePlanFollowUpSend handles refining a plan, or implementing it on this thread. useComposerSend calls it from the plan branch of onSend.
  • useImplementPlanInNewThread is called by ChatView directly. It owns the create/delete thread commands and navigate, so useComposerSend drops those, plus defaultRuntimeMode and onImplementPlanInNewThread.
beforeafter
useComposerSend.ts lines1,8231,553
useComposerSend input fields7877

Render boundaries are unchanged.

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): proposed-plan follow-ups and implement-in-new-thread live in their own hooks9927f9e
Synced from GitHub

Approvability

Verdict: Approved at 9927f9e

Macroscope's review found this PR approvable — This PR extracts existing proposed-plan send flows into dedicated hooks while preserving their guards, orchestration, navigation, cleanup, and error behavior. The remaining changes are wiring and input cleanup, with no product-default or static-analysis configuration changes.

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: d1e5d5e0-fd28-4c14-9dda-0ff38e4064ac
📥 Commits

Reviewing files that changed from the base of the PR and between 9c7a742e1f18ec3fb7be07b6099e20ea01c7a8d3 and 9927f9e40537f202f9d8ca68f1f415a5b123bc86.

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

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

📝 Walkthrough

The pull request moves proposed-plan follow-up sending and new-thread implementation into dedicated hooks. ChatView now supplies the new-thread callback, and useComposerSend returns only onSend.

Changes: Proposed-plan sending

Layer / File(s)Summary
Plan follow-up submission
apps/web/src/components/chat/useProposedPlanSend.ts, apps/web/src/components/chat/useComposerSend.ts
usePlanFollowUpSend validates and submits follow-ups, persists thread settings, and handles optimistic messages and failures. useComposerSend wires the hook and delegates plan follow-up submission to it.
New-thread plan implementation
apps/web/src/components/chat/useProposedPlanSend.ts, apps/web/src/components/ChatView.tsx, apps/web/src/components/chat/useComposerSend.ts
useImplementPlanInNewThread creates and starts an implementation thread, waits for server startup, and navigates to the thread. On failure, it deletes the thread and displays an error toast. ChatView passes the callback to the composer.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to 9927f

This is a behavior-preserving refactor that splits proposed-plan sending into its own hooks. The supplied context shows no concrete regression. The author reports testing the affected send paths and passing the typecheck.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description explains the implementation and provides detailed verification results. It does not include a distinct Problem section or the required issue, discussion, maintainer approval, or exempt…Add a Problem section with the expected behavior and motivation. Add a link to the triaged issue or maintainer approval with the approval comment. If no prior issue or discussion applies, explain why this focused refactor qualifies for an e…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main change: moving proposed-plan follow-up and new-thread implementation logic into separate hooks.
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 explains the implementation and provides detailed verification results. It does not include a distinct Problem section or the required issue, discussion, maintainer approval, or exemption rationale under Scope and approval.

Resolution

Add a Problem section with the expected behavior and motivation. Add a link to the triaged issue or maintainer approval with the approval comment. If no prior issue or discussion applies, 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.