Thread transfer impact
⚠️ The latest CI run did not produce a thread transfer result for 7483af8.
This comment will update automatically after the next completed run.
Automatic load balancing and the manual machine switch both decide one thing: which machine an unsent draft runs on. That state, its effect, and the in-flight switch refs took about 180 lines of ChatView.
chat/useDraftEnvironmentRouting.ts now holds them. It also owns the useLoadBalancedEnvironment, useProjects and useScratchProject reads that only this flow used. ChatView gets back the auto label, the switch and auto callbacks, the busy flag, and the pending-switch reader that onSend checks.
This layer moves code only and doesn't change render boundaries.
| previous layer | this layer | |
|---|---|---|
| ChatView.tsx lines | 7,533 | 7,372 |
Tests: vp test run src/reactCompilerCoverage.test.ts for ChatView and every new file (0 bailouts), tsc-rs --noEmit for apps/web, and oxlint on the changed files.
🤖 Generated with Claude Code
Review completed
Added 1 commit
⚠️ The latest CI run did not produce a thread transfer result for 7483af8.
This comment will update automatically after the next completed run.
Verdict: Approved at 7483af8
Macroscope's review found this PR approvable — This PR extracts ChatView’s existing automatic and manual draft-environment routing into a dedicated hook without changing the routing logic or rendered integration points. The diff is localized to that refactor and does not alter product defaults or introduce sensitive configuration changes.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review. 🎉
4b4f545e-d962-4da9-9184-694208686d63Reviewing files that changed from the base of the PR and between 08ca07f2b1229c4de2131e514c73b38577e9f3eb and 7483af891cd7a34bc9f3c661a49d3af59b42574b.
apps/web/src/components/ChatView.tsxapps/web/src/components/chat/useDraftEnvironmentRouting.tsLimit details: You’ve used all 10 included reviews currently available.
ChatView now uses useDraftEnvironmentRouting for draft environment routing. The hook handles automatic environment selection, load-balancing status, and guarded manual switching.
Changes: Draft environment routing
| Layer / File(s) | Summary |
|---|---|
Hook contract and ChatView integration apps/web/src/components/chat/useDraftEnvironmentRouting.ts, apps/web/src/components/ChatView.tsx | The new hook accepts draft, project, environment, provider, and send-state inputs. ChatView replaces its inline routing logic with the hook and removes unused imports and values. |
Automatic environment selection apps/web/src/components/chat/useDraftEnvironmentRouting.ts | Automatic routing filters environments by connection, weight, thread-context compatibility, and provider status. Attachments prevent automatic routing and trigger a warning. The hook updates the draft and exposes balancing status. |
Guarded manual environment switching apps/web/src/components/chat/useDraftEnvironmentRouting.ts | Manual switching applies existing projects or opens a scratch project. Draft and project scope, send state, and superseding requests guard retargeting and busy-state cleanup. |
Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Refactor
Suggested reviewers: t3dotgg, maria-rcks
7483aThis refactor moves draft machine routing into its own hook without a stated behavior change. No concrete merge-blocking risk was found.
Failed Failed checks: 1 warning
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | Warning | The description explains the refactor and lists specific verification commands and results. It does not provide the required Scope and approval information, and it does not clearly state the problem, … | Add the Problem section with the affected behavior and context. Add the Scope and approval section with the triaged issue or explicit maintainer approval, or explain why an exemption applies. Add before/after screenshots if this change affe… |
| Check name | Status | Explanation |
|---|---|---|
| Title check | Passed | The title clearly and concisely identifies the main refactor: moving ChatView draft machine routing into useDraftEnvironmentRouting. |
| Linked Issues check | Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | Passed | Check skipped because no linked issues were found for this pull request. |
Explanation
The description explains the refactor and lists specific verification commands and results. It does not provide the required Scope and approval information, and it does not clearly state the problem, expected behavior, or UI verification evidence.
Resolution
Add the Problem section with the affected behavior and context. Add the Scope and approval section with the triaged issue or explicit maintainer approval, or explain why an exemption applies. Add before/after screenshots if this change affects the UI, or state why screenshots are not applicable.
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.