Skip to content

refactor(web): move agent-opened browser and device surfacing out of ChatView - #20312

Merged
juliusmarminge merged 1 commit into
chatview-split/proactive-panelsfrom
chatview-split/preview-panel
Oct 17, 2026
Merged

juliusmarminge merged 1 commit into
chatview-split/proactive-panelsfrom
chatview-split/preview-panel

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Part of the ChatView split so the React Compiler can compile it.

useAgentOpenedPreviews now holds three effects, with the baseline refs they use:

  • show a device that an agent or another client opened
  • reveal a browser tab that an agent or another client opened
  • close a floating device once its session ends

The effect bodies are unchanged; only the inputs were renamed. The hook compiles and goes on the compile-required lint list (#20292). Preview mini-player and right-panel store tests pass (93).

Stack progress

Layer ChatView lines ChatView component body Compiler on ChatView Files held to strict compiler lint
main 11,660 10,007 crashes (internal error) 0
#20161 pending approvals and questions hook 11,222 9,624 crashes (internal error) 0
#20164 terminal drawer and panel file 10,614 9,624 crashes (internal error) 0
#20289 one terminal open/close hook 10,466 9,481 crashes (internal error) 0
#20292 compile-required lint list 10,466 9,481 crashes (internal error) 2
#20294 pending hook compiles 10,466 9,481 crashes (internal error) 3
#20296 /usage-limits panel hook 10,397 9,416 crashes (internal error) 4
#20304 queued-message editing hook 10,172 9,200 crashes (internal error) 5
#20308 linked pull request hook 10,078 9,106 crashes (internal error) 6
#20309 proactive panel hook 9,950 8,984 crashes (internal error) 7
→ #20312 agent-opened previews hook 9,855 8,890 crashes (internal error) 8
#20315 right panel close hook 9,743 8,779 crashes (internal error) 9
#20316 worktree setup hook 9,660 8,695 crashes (internal error) 10
#20321 two onSend phases split out 9,660 8,613 crashes (internal error) 10
#20340 compiler no longer crashes on ChatView 9,647 8,599 skips (32 reasons) 10
#20379 ChatView compiles 9,616 8,469 compiles 11
#20380 re-render fixes from profiling 9,661 8,514 compiles 11
#20392 provider pushes keep identity 9,628 8,481 compiles 11
#20393 keyboard shortcuts command map 9,340 8,265 compiles 13
#20396 Sidebar compiles, no manual memos 9,340 8,265 compiles 14
#20397 ChatComposer compiles 9,340 8,265 compiles 14
#20401 project script editing hook 9,110 8,049 compiles 15
#20402 MessagesTimeline compiles 9,110 8,049 compiles 16
#20418 ChatView strict: no memos, no sync effects 8,901 7,855 compiles 17

Measured with the native React Compiler (oxc-transform-react) on each layer's ChatView.tsx. "Crashes" means it hit an internal codegen error and left ChatView uncompiled; "skips" means it reported reasons it could not compile it. Strict files must compile with no bailouts, no manual memoization and no effect-rule violations; lint and reactCompiledFiles.test.ts enforce it.

🤖 Generated with Claude Code (Claude Opus 5.5)


Devin Review

@juliusmarminge
juliusmarminge added this pull request to stack #20165 October 16, 2026 16:36
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 16, 2026
@juliusmarminge
juliusmarminge marked this pull request as ready for review October 16, 2026 16:52
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 16, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 0fda0fb

Macroscope's review found this PR approvable — This is a contained refactor that extracts existing preview-surfacing effects from ChatView without changing product defaults or introducing a new runtime capability. The Vite update only places the extracted hook under React Compiler checks and does not suppress static analysis.

No code changes detected at 41c4e00. Prior analysis still applies.

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

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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: 5e0b2a00-5372-4165-8ef1-0395b694911c
📥 Commits

Reviewing files that changed from the base of the PR and between fd2501d and 0fda0fb.

📒 Files selected for processing: 2
  • apps/web/src/components/ChatView.tsx
  • vite.config.ts

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

📝 Walkthrough

ChatView delegates device-session and server-browser preview handling to useAgentOpenedPreviews. The hook tracks sessions and reveal requests, opens previews or panel surfaces under specified conditions, and closes device previews when their sessions end.

Changes: Agent-opened previews

Layer / File(s) Summary
Device-session preview routing
apps/web/src/components/preview/useAgentOpenedPreviews.ts
The hook tracks device sessions per thread after device state loads. New sessions open as floating previews when auto-show is enabled, or as device panel tabs when it is disabled and no matching tab exists. Sheet layouts skip this behavior.
Browser reveals and device-preview cleanup
apps/web/src/components/preview/useAgentOpenedPreviews.ts
Newly revealed server-browser tabs open as floating previews when auto-show is enabled or the request is forced. A forced request activates a matching panel surface. The hook closes the current device preview when loaded state no longer contains its session.
ChatView integration and lint coverage
apps/web/src/components/ChatView.tsx, vite.config.ts
ChatView calls the hook and removes its local preview selector and related effects. The React Compiler lint override includes the hook.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to 0fda0

This refactor moves agent-opened preview handling into a dedicated hook, and no actionable merge-blocking risk was identified.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description explains the implementation and reports test results, but it does not follow the required template. It omits the Problem and Scope and approval sections, and the Verification section l… Rewrite the description using the required headings: Problem, Change, Scope and approval, and Verification. Add the problem, expected behavior, reproduction or environment details, issue or maintainer approval reference, focused verificatio…
Passed Passed checks: 3 passed
Check name Status Explanation
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.
Title check Passed The title clearly and concisely describes the main change: moving agent-opened browser and device surfacing out of ChatView.
Full details: Description check

Explanation

The description explains the implementation and reports test results, but it does not follow the required template. It omits the Problem and Scope and approval sections, and the Verification section lacks focused checks with observed results and any untested items.

Resolution

Rewrite the description using the required headings: Problem, Change, Scope and approval, and Verification. Add the problem, expected behavior, reproduction or environment details, issue or maintainer approval reference, focused verification steps with observed results, and any checks that could not be performed. Include the model and harness used, if applicable.

  • Fix all pre-merge checks with AI
✨ 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.

@juliusmarminge
juliusmarminge force-pushed the chatview-split/preview-panel branch from fd2501d to 0fda0fb Compare October 16, 2026 17:03
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 16, 2026 17:03

Dismissing prior approval to re-evaluate 0fda0fb

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 5.0 KiB — 6.8 KiB ✅
Codex Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Codex Live turn WebSocket decoded — 20.9 KiB — 29.3 KiB ✅
Codex Live turn messages — 2 — 8 ✅
Claude Total thread wire — 5.0 KiB — 6.8 KiB ✅
Claude Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Claude Live turn WebSocket decoded — 21.2 KiB — 29.3 KiB ✅
Claude Live turn messages — 2 — 8 ✅

Baseline: unavailable · PR result: 41c4e00 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

…ChatView

useAgentOpenedPreviews holds the three effects that show a browser tab or
device an agent or another client opened, and close a floating device
once its session ends, with their baseline refs. The effect bodies are
unchanged. The hook compiles and joins the compile-required list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the chatview-split/preview-panel branch from 0fda0fb to 41c4e00 Compare October 17, 2026 00:11
@juliusmarminge
juliusmarminge merged commit a5539a6 into main Oct 17, 2026
57 of 77 checks passed
@juliusmarminge
juliusmarminge deleted the chatview-split/preview-panel branch October 17, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant