refactor(web): ChatView's model, mode, and workspace choices live in useComposerSelection#23069

merged2
refactor/split2-chatview-project-banners
refactor/split2-chatview-composer-selection
opened4d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 4d ago

Provider/model selection, runtime and interaction mode changes, env mode and start-from-origin changes, and the model-disabled reason move into chat/useComposerSelection.ts, which selects its own draft-store setters. Verbatim move.

BeforeAfter
ChatView.tsx lines4,4154,271

Tests: tsc-rs --noEmit for apps/web, oxlint on the changed files, vp test run src/components/ChatView.logic.test.ts, and the React Compiler coverage test for every changed file (0 bailouts). ChatView stays in the coverage test's slow set.

Part of the ChatView split (7,258 → 3,975 lines across the stack).

Opus 5.5, Claude Code.

🤖 Generated with Claude Code

Checks

All checks passed
Synced from GitHub

Approvability

Verdict: Approved at d7052be

Macroscope's review found this PR approvable — This refactor moves ChatView’s existing composer-selection logic into a dedicated hook while preserving its handlers, guards, state updates, navigation, and focus behavior. It introduces no new user-facing capability, schema change, product-default change, or static-analysis override.

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: 0476c458-7865-42f8-b30b-7f77bbda69c4
📥 Commits

Reviewing files that changed from the base of the PR and between 9a9e4191fa567f0279d7fa108911d7900a9a04e5 and d7052be1584ef4c21e11eed75ae43ddced5989f3.

📒 Files selected for processing: 1
  • apps/web/src/components/ChatView.tsx

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

📝 Walkthrough

ChatView now delegates composer selection behavior to useComposerSelection. The hook manages runtime and interaction modes, provider and model selection, environment mode, start-from-origin updates, and related focus and navigation behavior.

Changes: Composer selection

Layer / File(s)Summary
Mode handlers and hook wiring
apps/web/src/components/chat/useComposerSelection.ts, apps/web/src/components/ChatView.tsx
The hook defines its input contract and runtime and interaction handlers. ChatView supplies state and dependencies to the hook and uses its returned handlers.
Provider and model selection
apps/web/src/components/chat/useComposerSelection.ts, apps/web/src/components/ChatView.tsx
The hook handles provider and model selection, including restrictions and model-disable reasoning. ChatView removes the corresponding inline logic and imports.
Environment and origin updates
apps/web/src/components/chat/useComposerSelection.ts, apps/web/src/components/ChatView.tsx
The hook handles environment-mode and start-from-origin updates and returns the selection handlers and model-disable resolver.

Priority: ⬇️ Low

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

Change: Refactor

Possibly related issues

  • pingdotgg/t3code#22748: The hook includes provider and model selection checks for active sessions, but the supplied context says it does not address MCP or server-side session detachment.
  • pingdotgg/t3code#22957: The PR extracts runtime-mode change handling, but it does not change server-side terminalization of approval-pending items.

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to d7052

This is a behavior-preserving move of composer selection logic into a hook. Review found no regression risk, so it is ready to merge after the normal checks.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description explains the code change and lists focused verification commands, but it does not provide the required Problem section or Scope and approval information. It also does not explicitly st…Add Problem and Scope and approval sections. Describe the underlying problem or refactoring goal, link the relevant issue or maintainer approval, or explain why this focused refactor qualifies for an exemption. State why screenshots are not…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely identifies the main refactor: moving ChatView model, mode, and workspace selection logic into useComposerSelection.
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 code change and lists focused verification commands, but it does not provide the required Problem section or Scope and approval information. It also does not explicitly state whether UI evidence is unnecessary because behavior remains unchanged.

Resolution

Add Problem and Scope and approval sections. Describe the underlying problem or refactoring goal, link the relevant issue or maintainer approval, or explain why this focused refactor qualifies for an exemption. State why screenshots are not applicable if the UI behavior is unchanged.

✨ 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

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

Comment @coderabbitai help to get the list of available commands.

Added 2 commits

  • refactor(web): ChatView's model, mode, and workspace choices live in useComposerSelection09bb6e6
  • fix(web): keep ChatView's ProviderInstanceId import that idle compaction now usesd7052be
Synced from GitHub

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for d7052be.

This comment will update automatically after the next completed run.