refactor(web): the composer send reads its own settings and draft instead of taking them from ChatView#23095

merged1
refactor/split3-send-multimodel
refactor/split3-send-inputs
opened3d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 3d ago

Fourth layer of splitting useComposerSend.

The send now reads its own state instead of taking it from ChatView:

  • Client settings hydration comes from useClientSettingsHydrated.
  • planModeEnabled comes from useEnvironmentSettings with a selector.
  • At send time it reads the environment presentation atom (the source of ChatView's environmentById/serverConfig) for worktree-bootstrap support, attachment-upload support and a stranded thread's machine label.
  • It reads the composer draft store for non-prompt content and referenced thread contexts.

Decision logic moves to composerSend.logic.ts with tests: referenced thread contexts, the load-balancing toast copy, why a multiple-model send is blocked, and what to say when a send over pending approvals did not go out.

beforeafter
useComposerSend.ts lines1,3771,383
useComposerSend input fields7669

Across the stack, useComposerSend.ts goes from 1,916 to 1,383 lines and from 82 to 69 input fields. The resume, plan and multiple-model paths now live in their own hooks (167, 402 and 293 lines). The plain single-thread dispatch stays inside onSend, because it shares nearly every value its validation computes. Pulling it out would only swap the input object for an equally large argument object.

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). Ran vp test run src/components/chat/composerSend.logic.test.ts (14 tests).

🤖 Generated with Claude Code

Checks

All checks passed

Added 1 commit

  • refactor(web): the composer send reads its own settings, configs, and draft instead of taking them from ChatViewf6f27d6
Synced from GitHub

Approvability

Verdict: Approved at f6f27d6

Macroscope's review found this PR approvable — This is a focused web refactor that lets the composer-send hook read the same settings, environment presentation, and draft state directly, while extracting and testing unchanged decision logic. The affected runtime paths remain bounded to existing send behavior, with no schema, deployment, default, or static-analysis 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: d30ea05c-b48b-4061-8c69-a94d1661353b
📥 Commits

Reviewing files that changed from the base of the PR and between 70d001c0c38d5e2eaf823da1e55d66b35777684b and f6f27d6ba1e15350293c4be0ad3f3ae8996acc61.

📒 Files selected for processing: 4
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/chat/composerSend.logic.test.ts
  • apps/web/src/components/chat/composerSend.logic.ts
  • apps/web/src/components/chat/useComposerSend.ts
💤 Files with no reviewable changes: 1
  • apps/web/src/components/ChatView.tsx

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

📝 Walkthrough

The composer send hook now derives settings and environment capabilities from live state. It also uses centralized logic for attached-thread filtering, send warnings, multiple-model eligibility, and approval redirect notices.

Changes: Composer Send State and Validation

Layer / File(s)Summary
Composer send decision helpers
apps/web/src/components/chat/composerSend.logic.ts, apps/web/src/components/chat/composerSend.logic.test.ts
Added helpers for filtering attached thread contexts, generating load-balancing warnings, checking multiple-model send eligibility, and creating approval redirect notices. Tests cover these helpers’ outcomes.
Live composer state and input wiring
apps/web/src/components/chat/useComposerSend.ts, apps/web/src/components/ChatView.tsx
The hook reads plan-mode, settings hydration, and environment presentation data through hooks. ChatView and the hook input no longer pass the removed cached configuration and derived composer fields. Usage-limit handling, target resolution, thread ownership labels, and attachment capability checks use current state.
Send checks and approval notices
apps/web/src/components/chat/useComposerSend.ts
The hook delegates load-balancing warnings, multiple-model validation, and approval redirect notices to the new helpers.

Priority: ⬇️ Low

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

Change: Refactor

Possibly related issues

  • pingdotgg/t3code#22957: The pull request changes approval-pending send notices, but does not address the issue’s stale server turn items.
Merge Risk: ⚪ Minimal · up to f6f27

The composer send refactor preserves the inspected send behavior and appears ready to merge after normal checks.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description provides detailed change and verification information, but it does not include a clear ## Problem section or the required ## Scope and approval information.Add a ## Problem section that states the underlying problem, expected behavior, and reproduction context. Add a ## Scope and approval section with the related issue or explicit maintainer approval, or explain why this focused change qua…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main change: moving composer settings and draft reads into useComposerSend.
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

Resolution

Add a ## Problem section that states the underlying problem, expected behavior, and reproduction context. Add a ## Scope and approval section with the related issue or explicit maintainer approval, or explain why this focused change 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.