Skip to content

feat(site/src): open open_preview results in the right panel - #32441

Open
DanielleMaywood wants to merge 1 commit into
open-preview/toolfrom
open-preview/ui
Open

DanielleMaywood wants to merge 1 commit into
open-preview/toolfrom
open-preview/ui

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

A preview opens only when its owner clicks, because the user decides by the title the agent chose. It opens only in the chat's right panel, because the preview host lets only the dashboard frame it.

The tab asks coderd for the address instead of building a hostname, and signs in only when the preview host asks, so the server's rules decide where a preview loads and reopening it creates no API key. Opening the same result again only focuses its tab, so the preview keeps its state; a newer result reloads it to show what the agent just opened.

Implementation details

Renders open_preview results in the Agents chat. For the workspace owner, the result has an Open preview button. Anyone else sees why they can't open it: only the workspace owner can, or the preview belongs to a different workspace. Nothing opens until the owner clicks.

The preview tab asks coderd for the preview's address and loads it inside a srcdoc wrapper frame whose CSP allows only that preview's origin, with the sandbox the server returns. The UI never builds a preview hostname. If the preview host has no session, it tells the dashboard, which signs in once and reloads the frame, so reopening or reloading a preview does not create a new API key. Opening a newer result for the same preview renames its tab and reloads it; opening the same result again only focuses its tab, also after a page reload, so the preview keeps its state. The Open preview button stays visible when assistant steps are collapsed. Previews open only in the chat's right panel; opening a preview address directly shows an error page (#32439).

Results are parsed by shape, the title rule is checked again because the user decides by title, and the server enforces the slug and url_path rules. With the experiment disabled, the button is hidden and saved preview tabs are hidden until it is enabled again.

A manual pass in Safari 27.2 on macOS against an HTTPS deployment passed on an earlier version of this PR, before sign-in moved to on demand: file and port previews signed in and loaded inside the wrapper, every preview response carried the CSP, and the test page's fetch to the dashboard, top navigation and popup were all blocked. The on-demand sign-in was checked in Chromium and Firefox.

Stack (review bottom-up). Replaces the closed #31282 stack. Security review: coder/security-assessments#437.

  1. feat: serve published HTML previews from the workspace agent #32438 Agent file previews
  2. feat: serve agent previews on strict preview hosts #32439 Strict preview hosting and experiment
  3. feat: sign previews in from the dashboard with a host-bound token #32522 Preview sign-in
  4. feat(coderd): add the open_preview chat tool #32440 open_preview chat tool
  5. feat(site/src): open open_preview results in the right panel #32441 Agents UI, this PR
  6. docs: document open_preview previews #32442 Docs

🤖 Generated with Claude Code

@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-11-26 21:55 UTC by @DanielleMaywood
Spend: $107.30 / $100.00

Review history
  • R1 (2026-11-25): 12 reviewers, 5 Nit, 8 P3, 7 P4, COMMENT. Review
  • R2 (2026-11-25), 5 Nit, 8 P3, 7 P4, COMMENT. Review
  • R3 (2026-11-25), 5 Nit, 8 P3, 7 P4, COMMENT. Review
  • R4 (2026-11-25): 13 reviewers, 9 Nit, 12 P3, 13 P4, COMMENT. Review
  • R5 (2026-11-26): 12 reviewers, 9 Nit, 12 P3, 14 P4, COMMENT. Review
  • R6 (2026-11-26): 4 reviewers, 9 Nit, 12 P3, 15 P4, COMMENT. Review
  • R7 (2026-11-26): 4 reviewers, 9 Nit, 12 P3, 15 P4, COMMENT. Review
  • R8 (2026-11-26): 4 reviewers, 9 Nit, 12 P3, 15 P4, APPROVE. Review
  • R9 (2026-11-26): 4 reviewers, 9 Nit, 12 P3, 15 P4, COMMENT. Review
  • R10 (2026-11-26): 4 reviewers, 9 Nit, 12 P3, 15 P4, COMMENT. Review
  • R11 (2026-11-26): 4 reviewers, 9 Nit, 12 P3, 15 P4, COMMENT. Review
  • R12 (2026-11-26): 5 reviewers, 11 Nit, 12 P3, 17 P4, COMMENT. Review

deep-review v0.13.1 | Round 12 | 944be92..fa5d6ce

Last posted: Round 12, 40 findings (12 P3, 17 P4, 11 Nit), COMMENT. Review

Finding inventory

Finding inventory, PR #32441

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Author fixed (16f0f81) OpenPreviewTool.tsx:40 parseOpenPreviewResult never checks kind despite PR claim R1 Netero Yes
CRF-2 P3 Author fixed (16f0f81) OpenPreviewTool.tsx:20 Comment cites nonexistent CheckURLPath in previewhost.go R1 Netero Yes
CRF-3 P3 Author fixed (16f0f81) AgentChatPageView.tsx:696 No test covers the experiment gate on the Open preview button R1 Netero Yes
CRF-4 P4 Author fixed (16f0f81) OpenPreviewTool.tsx:31 Slug regex accepts ports 65536-99999 that the server rejects R1 Netero Yes
CRF-5 P4 Author contested; panel closed R4 (1/1 accept) rightPanelTabs.ts:169 getMatchingAgentOrFirst fallback never applies for preview tabs R1 Netero Yes
CRF-6 P3 Author fixed (16f0f81) AgentChatPageView.tsx:579 Re-opening an existing preview only activates the stale tab, no reload, old label R1 Nami P3, Hisoka P4 Yes
CRF-7 P3 Author fixed (16f0f81) OpenPreviewTool.tsx:75 Button shown to non-workspace-owners; sign-in always 404s for them R1 Melody Yes
CRF-8 P3 Author accepted R6 (operator decision for the experimental release, no ticket; panel 2/2 accept R5) OpenPreviewTool.tsx:90 Row with hidden button shows bare title and no reason R1 Leorio P3, Nami P4 Yes
CRF-9 P3 Author fixed (16f0f81) OpenPreviewTool.tsx:41 Client copies of slug/url_path rules enforce nothing server does not; drift hides button R1 Pariston, Bisky Yes
CRF-10 P3 Author fixed (d156c13, in #32438) rightPanelTabs.ts:165 Restored file preview tabs and old buttons 404 after agent restart with no hint R1 Hisoka Yes
CRF-11 P4 Author fixed (16f0f81) Tool.tsx:1170 MCP branch of OpenPreviewRenderer is unreachable; comment premise false R1 Mafuuu, Melody, Knov Yes
CRF-12 P4 Author fixed (16f0f81) PreviewFrame.tsx:52 Each reload/remount mints a new long-lived application_connect key R1 Pariston Yes
CRF-13 P4 Author fixed (16f0f81) OpenPreviewTool.tsx:78 workspaceId guard on the button is untested R1 Bisky Yes
CRF-14 P4 Author fixed (16f0f81, PR description) rightPanelTabs.ts:167 Experiment off hides saved preview tabs; description says dropped R1 Mafuuu Note, Hisoka Note Yes
CRF-15 P4 Author contested; panel closed R4 (1/1 accept) PreviewPanel.tsx:13 PreviewPanel vs PortPreviewPanel naming hides that both show ports R1 Gon P3 Yes
CRF-16 Nit Author contested; panel closed R6 (1/1 accept) OpenPreviewTool.tsx:16 Bare 80/2048 literals copy Go constants R1 Gon P3 Yes
CRF-17 Nit Author contested; panel closed R5 (1/1 accept) api.ts:4428 Doc comments restate symbol names or JSX (6 locations) R1 Gon P2 Yes
CRF-18 Nit Author contested; panel closed R4 (1/1 accept) rightPanelTabs.ts:74 Tab field slug should be previewSlug R1 Gon Yes
CRF-19 Nit Author fixed (16f0f81) PreviewFrame.tsx:37 signIn holds a response; name signInResponse R1 Gon Yes
CRF-20 Nit Author contested; panel closed R4 (1/1 accept) AgentChatPage.test.tsx:769 Test name omits that it clicks twice R1 Leorio Yes
CRF-21 Nit Dropped by orchestrator (site FE1 mandates Vitest/RTL for behavior and forbids play assertions) PreviewFrame.test.tsx:1 New standalone RTL test file for a component R1 Pariston, Bisky, Knov No
CRF-22 Nit Dropped by orchestrator (site FE1 forbids assertions in play functions) Tool.stories.tsx:3063 OpenPreviewCompleted story has no play function checking spy R1 Bisky No
CRF-23 Nit Dropped by orchestrator (each reload frames a new document; previews.ts doc defines frameId per frame) PreviewFrame.tsx:33 Rename frameId to signInAttemptId R1 Gon No
CRF-24 Note Note (body) PR description "the routing PR" is not in the stack list R1 Leorio P4 No
CRF-25 P2 Dropped by orchestrator (comment states the limit is the server's; CRF-2 rewrites this comment) OpenPreviewTool.tsx:21 "limits the path to 2048 bytes" restates line 26 R1 Gon No
CRF-26 P2 Dropped by orchestrator (exported component contract; caller needs button conditions without reading body) OpenPreviewTool.tsx:62 OpenPreviewTool doc lists conditions in the expression R1 Gon No
CRF-27 P2 Dropped by orchestrator ("in the right panel" names the destination, not in name or type) ChatWorkspaceContext.tsx:11 openPreview doc restates field name R1 Gon No
CRF-28 Note Dropped by orchestrator (cleared; no change requested) PreviewFrame.tsx:62 srcdoc wrapper runs as dashboard origin; escaping and CSP hold R1 Kurapika No
CRF-29 Note Dropped by orchestrator (cleared; no change requested) OpenPreviewTool.tsx:76 Button scoping and sign-in authorization verified R1 Kurapika No
CRF-30 Note Dropped by orchestrator (cleared; no change requested) OpenPreviewTool.tsx:37 Go/TS pairings walked and in agreement R1 Melody No
CRF-31 Note Dropped by orchestrator (cleared; no change requested) PreviewPanel.tsx:18 Preview tab states all handled with stories R1 Nami No
CRF-32 Note Dropped by orchestrator (cleared; no change requested) AgentChatPage.test.tsx:769 Page-level preview tests catch regressions (mutation verified) R1 Bisky No
CRF-33 Note Dropped by orchestrator (cleared; no change requested) Tool.tsx:1170 Comments state condition and consequence R1 Leorio No
CRF-34 Note Dropped by orchestrator (cleared; no change requested) PreviewFrame.tsx:84 Wrapper enforces origin invariant R1 Knov No
CRF-35 OOS Fixed in base 004cc93 (verified R9) coderd/x/chatd/chattool/openpreview.go:166 Tool returns success for workspace chat owner does not own R1 Melody No
CRF-36 OOS Out of scope (body) coderd/workspaceapps/preview.go:108 New app_connect key per sign-in, never revoked; expired token rejected despite session cookie R1 Pariston, Knov No
CRF-37 OOS Out of scope (body) agent/agentpreview/preview.go:69 File preview IDs only in agent memory R1 Hisoka No
CRF-38 OOS Out of scope (body) coderd/previews.go:69 Sign-in does not check the file preview is published R1 Hisoka No
CRF-39 OOS Out of scope (body) coderd/x/chatd/chattool/openpreview.go:138 checkURLPath limits bytes but error says characters R1 Gon No
CRF-40 P4 Author contested; panel closed R5 (1/1 accept) OpenPreviewTool.tsx:70 Agent mismatch shows "belongs to a different workspace" R4 Netero Yes
CRF-41 P3 Author accepted R7 (operator decision for the experimental release, no ticket; Melody accept R5, Pariston deferred to a human R6) AgentChatPageView.tsx:608 Embedded chat (VS Code) offers Open preview that cannot load or sign in R4 Melody, Pariston Yes
CRF-42 P3 Author fixed (4ac23c2) PreviewFrame.tsx:53 Reload preview does nothing after the address request fails R4 Nami, Mafuuu Yes
CRF-43 P3 Author fixed (5421940, in #32522) PreviewFrame.tsx:98 Second sign-in-needed message dropped; panel shows bare 401 page with no cause R4 Leorio Yes
CRF-44 P3 Author contested; panel closed R5 (1/1 accept) AgentChatPage.test.tsx:860 Experiment-off test waits for getWorkspace call, not render; passes vacuously under delay R4 Komugi Yes
CRF-45 P4 Author accepted R6 (operator decision for the experimental release, no ticket; panel 1/1 accept R5) PreviewFrame.tsx:60 Frame keyed only on reloadCount; cached region switch keeps old region's sign-in URL R4 Knov Yes
CRF-46 P4 Author fixed (4ac23c2) AgentChatPageView.tsx:306 Comment says a page load loads every preview; PreviewPanel loads lazily R4 Mafuuu P4, Leorio Nit Yes
CRF-47 P4 Author fixed (4ac23c2) PreviewFrame.tsx:111 Sign-in failure branch and Reload recovery untested R4 Bisky Yes
CRF-48 P4 Author fixed (4ac23c2) AgentChatPage.test.tsx:989 Page test's Reload part duplicates PreviewFrame.test.tsx R4 Bisky Yes
CRF-49 P4 Author fixed (4ac23c2) OpenPreviewTool.tsx:33 Comment names only sign-in as the validator; address request validates on every mount R4 Gon P3 Yes
CRF-50 Nit Author fixed (4ac23c2) AgentChatPage.test.tsx:849 toBeInTheDocument presence assertions (FE1) on getByTitle results R4 Bisky Yes
CRF-51 Nit Author contested; panel closed R5 (1/1 accept) AgentChatPage.test.tsx:846 Test comment restates the next two lines R4 Gon P2 Yes
CRF-52 Nit Author contested; panel closed R5 (1/1 accept) PreviewPanel.tsx:11 reloadCount names two different counters R4 Gon Yes
CRF-53 Nit Author contested; panel closed R5 (1/1 accept) PreviewFrame.tsx:121 frame holds a sign-in response next to frameRef (the iframe) R4 Gon Yes
CRF-54 Nit Dropped by orchestrator ("on request" reads as on demand; doc comment states when it signs in) PreviewFrame.tsx:82 Rename SignInOnRequestFrame R4 Gon No
CRF-55 Note Note (body) commit 16f0f81 message Commit body still says saved preview tabs are dropped R4 Leorio P4 No
CRF-56 Note Note (body) AgentChatPage.test.tsx:782 Two page tests took 5.5-5.7s on a cold cache (5s default timeout) R4 Bisky No
CRF-57 Note Note (body) PreviewFrame.tsx:35 Proxy auto-switch reloads an open preview and discards a pending sign-in R4 Komugi No
CRF-58 Note Dropped by orchestrator (cleared; no change requested) PreviewFrame.tsx:97 Wire pairings (message string, origin, source, types, routes) agree R4 Melody No
CRF-59 Note Dropped by orchestrator (cleared; fix verifications) PreviewFrame.tsx:93 CRF-12 and CRF-9 fixes verified R4 Pariston No
CRF-60 Note Dropped by orchestrator (cleared; mutation-verified) PreviewFrame.test.tsx:129 New sign-in and gate tests catch regressions R4 Bisky No
CRF-61 Note Dropped by orchestrator (cleared; no change requested) ChatWorkspaceContext.tsx:15 previewAccess union and region-free props rule out bad states R4 Knov No
CRF-62 OOS Out of scope (body) coderd/previews.go:44 Address endpoint reuses PreviewSignInRequest/Response types R4 Netero, Gon, Leorio No
CRF-63 OOS Out of scope (body) coderd/workspaceapps/preview.go:163 Signed-out page says "Reopen from Coder" and offers Back to site, blocked by frame-src R4 Leorio, Knov No
CRF-64 OOS Out of scope (body) coderd/workspaceapps/preview.go:172 Signed-out page posts to window.top with AccessURL origin R4 Melody, Pariston No
CRF-65 OOS Out of scope (body) coderd/workspaceapps/preview.go (session cookie) Preview session cookie not kept when preview host is cross-site with dashboard R4 Leorio No
CRF-66 P4 Author contested; panel closed R6 (1/1 accept) PreviewFrame.tsx:103 Sign-in-needed after a successful sign-in is dropped silently; test at :160-163 locks it in R5 Chopper P3 Yes
CRF-67 P4 Author accepted R8 (operator decision for the experimental release, no ticket; panel 1/1 accept R7) AgentChatPageView.tsx:608 previewAccess.open accepts any workspace/agent; only OpenPreviewTool repeats the match check R6 Meruem Yes
CRF-68 Note Note (body) AgentChatPageView.tsx:577 "Same preview" identity predicate is inline in the view; only page tests cover it R6 Meruem No
CRF-69 P4 Open AgentChatPageView.tsx:589 No test covers reopening a persisted preview tab without toolCallId; mutation focusing such tabs passes 56/56 R12 Netero Yes
CRF-70 P4 Open AgentChatPageView.tsx:305 previewReloadCounts comment says it counts reopenings; same-result reopen no longer increments it R12 Razor Yes
CRF-71 Nit Open AgentChatPageView.tsx:586 Comment and description say "a newer result"; code reloads for any different result, including an older one R12 Razor (Netero noted) Yes
CRF-72 Nit Open AgentChatPage.test.tsx:858 Focus-only reopen assertions sit inside the rename-and-reload test, so their failure reports under the opposite title R12 Bisky Yes
CRF-73 OOS Out of scope (body) messageParsing.ts:441 Results match calls by tool call ID chat-wide; fantasy OpenAI fallback tool-call-<index> can repeat across steps, so an earlier row renders a later result R12 Razor No

Contested and acknowledged

CRF-5 (P4, rightPanelTabs.ts:169) - getMatchingAgentOrFirst fallback never applies for preview tabs

  • Finding: Netero: preview tabs use getMatchingAgentOrFirst, whose first-agent fallback cannot trigger because isUserRightPanelTab rejects empty agentName; proposed a plain find by name at both call sites for readability.
  • Author defense (R3, PRRC_kwDOGkVX1s8AAAABGD80DQ): "Declined: behavior is the same because preview tabs always carry an agent name; cheap to revisit."
  • Status: contested, awaiting panel (Netero) check-in.
  • Panel closure (R4, 1/1): Netero, the agent that raised it (reused R1 agent), traced both tab creation paths (isUserRightPanelTab rejects ""; new tabs only via previewAccess.open, which requires workspaceAgent, and OpenPreviewTool requires preview.agentName === agentName) and accepted: readability cost only, no failure mode.

CRF-16 (Nit, OpenPreviewTool.tsx:16) - Bare 80/2048 literals copy Go constants

  • Finding: Gon: 80 and 2048 copy Go constants as bare literals; proposed named constants citing the Go names.
  • Author defense (R3, PRRC_kwDOGkVX1s8AAAABGD83rg): the 2048 copy was removed in 16f0f81 because sign-in now checks url_path; the title limit 80 stays inline in its only check.
  • Status: contested, awaiting panel (Gon) check-in.
  • Panel re-raise (R4): Gon (reused R1 agent) verified 2048 is gone and held for 80: if maxPreviewTitleLength is raised, results with longer titles render as a bare title with no button and no reason, and nothing on the TS line points to the Go constant.

CRF-15 (P4, PreviewPanel.tsx:13) - PreviewPanel vs PortPreviewPanel naming hides that both show ports

  • Finding: Gon: PreviewPanel (kind: "preview") also shows port previews next to the existing PortPreviewPanel (kind: "port"); proposed naming the new panel and kind after the tool (AgentPreviewPanel, kind: "agent_preview").
  • Author defense (R4, PRRC_kwDOGkVX1s8AAAABGEFFNw): kind: "port" and PortPreviewPanel exist on main for the port forwarding panel, so preview names what this tab shows (an open_preview result) without colliding, and the PreviewPanel doc says it shows a port or file preview that the agent opened with open_preview.
  • Status: contested, awaiting Gon check-in.
  • Panel closure (R4, 1/1): Gon, the agent that raised it (reused R1 agent), accepted: cost is navigation time only; the UserTabPanel switch maps kind: "preview" to PreviewPanel in one place and the doc says it shows port and file previews.

CRF-18 (Nit, rightPanelTabs.ts:74) - Tab field slug should be previewSlug

  • Finding: Gon: the tab field slug renames the API's preview_slug and reads as an app slug in a module that also stores workspace app tabs.
  • Author defense (R4, PRRC_kwDOGkVX1s8AAAABGEFGOw): slug sits on the preview tab variant only, next to kind: "preview", so TypeScript narrows it before any read and it cannot be confused with an app tab's fields; renaming touches every preview tab test for no behavior change.
  • Status: contested, awaiting Gon check-in.
  • Panel closure (R4, 1/1): Gon (reused R1 agent) accepted: every read narrows to kind: "preview" first and workspace app tabs have no slug field (they store appId).

CRF-20 (Nit, AgentChatPage.test.tsx:769) - Test name omits that it clicks twice

  • Finding: Leorio: the name "opens a result's tab from its row once" does not say the test clicks twice.
  • Author defense (R4, PRRC_kwDOGkVX1s8AAAABGEFHKA): the name says the result opens its tab once, which is the asserted behavior; the two clicks are setup; the suggested name describes the same assertion in more words.
  • Status: contested, awaiting Leorio check-in.
  • Panel closure (R4, 1/1): Leorio (reused R1 agent) accepted: the name states the asserted behavior and is not false; the body is 20 lines.

CRF-8 (P3, OpenPreviewTool.tsx:90) - Row with hidden button shows bare title and no reason

  • Finding: Nami, Leorio: when previewAccess is unset (experiment off, or a stopped workspace with no agent in the latest build) the row shows only the title, no button and no reason; asked for an unavailableReason for those cases.
  • Author response: Acknowledged (R5, PRRC_kwDOGkVX1s8AAAABGH7hbA): hiding previews completely while the experiment is off is the chosen behavior; agrees a stopped owner workspace shows no button and no reason, and leaves it because the button appears once the workspace has an agent again.
  • Status: awaiting R5 check-in by the raising persona.
  • Panel (R5): Gon (reused R1 agent) re-raises: the reply explains why the copy exists, not how someone raising maxPreviewTitleLength finds it; one clause on the line 8 comment fixes it.
  • Panel (R5): Nami (reused R4 agent) and Leorio (reused R1 agent) accept: the experiment-off case matches the chosen design, and a stopped owner workspace regains the button when the agent connects. Recorded as Author accepted.

CRF-41 (P3, AgentChatPageView.tsx:608) - Embedded chat (VS Code) offers Open preview that cannot load or sign in

  • Finding: Melody, Pariston: previewAccess ignores isEmbedded; preview CSP frame-ancestors and the signed-out page's window.top.postMessage both assume the dashboard is top-level; asked for an unavailableReason when embedded.
  • Author response: Acknowledged (R5, PRRC_kwDOGkVX1s8AAAABGH7WUg): agrees an embedded preview is unlikely to load; previews in this experiment target the dashboard and the embedded case was not reproduced, so the embedded chat is left unchanged.
  • Status: awaiting R5 check-in by the raising persona.
  • Panel (R5): Melody (reused R4 agent) accepts. Pariston (reused R4 agent) re-raises with new evidence: a Playwright Chromium reproduction (/tmp/pariston-embed/repro.mjs, three origins, PR wrapper markup, server sandbox and CSP) shows the preview frame refused and no sign-in message when the dashboard is framed. The author's stated reason (not reproduced) no longer holds. Stays open.

CRF-45 (P4, PreviewFrame.tsx:60) - Frame keyed only on reloadCount; cached region switch keeps old region's sign-in URL

  • Finding: Knov: SignInOnRequestFrame keeps signInMutation.data across an address change when the new region's address is cached; asked to key on the address too.
  • Author response: Acknowledged (R5, PRRC_kwDOGkVX1s8AAAABGH7Ztw): reproduces at component level, but the Agents page has no region control and latency auto-select runs once, so a switch back to a cached region within a mount needs a proxy health change.
  • Status: awaiting R5 check-in by the raising persona.
  • Panel (R5): Knov (reused R4 agent) accepts: /agents renders outside DashboardLayout, so no ProxyMenu/setProxy caller; regions query has infinite staleTime. Recorded as Author accepted.

CRF-16 (Nit, OpenPreviewTool.tsx:16) - Bare 80 literal copies a Go constant

  • Finding: Gon re-raised R4: if maxPreviewTitleLength is raised, longer titles lose the button with no reason; asked for a comment naming the Go constant.
  • Author response: Contested (R5, PRRC_kwDOGkVX1s8AAAABGH7izA): the title check is deliberately a client copy since the user decides by title, and the limit only changes together with the tool, so drift needs a Go change first.
  • Status: awaiting R5 check-in by the raising persona.

CRF-17 (Nit, api.ts:4428) - Doc comments restate symbol names (3 of 6 locations unchanged)

  • Finding: Gon re-raised R4: UserTabPanel.tsx:21, rightPanelTabs.ts:78, chatEntities.ts:240 unchanged.
  • Author response: Contested (R5, PRRC_kwDOGkVX1s8AAAABGH7kLw): these are one-line docs on exported symbols, which the repository requires, and each one is accurate.
  • Status: awaiting R5 check-in by the raising persona.
  • Panel (R5, 1/1): Gon accepts: AGENTS.md requires docs on exported symbols, and all three are exported.

CRF-40 (P4, OpenPreviewTool.tsx:70) - Agent mismatch shows 'belongs to a different workspace'

  • Finding: Netero: one message for workspace and agent mismatch; asked for an agent-specific reason.
  • Author response: Contested (R5, PRRC_kwDOGkVX1s8AAAABGH7X_Q): the tool takes the agent name from the chat's own workspace agent, so a same-workspace mismatch needs a rebuild that renames the agent; one reason keeps the row short.
  • Status: awaiting R5 check-in by the raising persona.
  • Panel (R5, 1/1): Netero (reused R1 agent) accepts: the tool sets AgentName from the chat's own agent, so the mismatch needs a rename rebuild; the user can ask the agent to open it again.

CRF-44 (P3, AgentChatPage.test.tsx:860) - Experiment-off test waits for getWorkspace call, not render

  • Finding: Komugi: test passes with the gate removed when getWorkspace resolves 150 ms late; asked to wait on rendered workspace state.
  • Author response: Contested (R5, PRRC_kwDOGkVX1s8AAAABGH7gDA): removing the gate fails the test with the suite's mocks; agrees it waits for the request, but the workspace mock resolves immediately in every case.
  • Status: awaiting R5 check-in by the raising persona.
  • Panel (R5, 1/1): Komugi (reused R4 agent) accepts: with the gate removed, 42 of 42 runs (incl. single-core taskset -c 0) found the button and failed; mockResolvedValue fixes the order. The test would go vacuous only if the mock later adds a delay.

CRF-51 (Nit, AgentChatPage.test.tsx:846) - Test comment restates the next two lines

  • Finding: Gon: delete // Opening the same result again reloads it too.
  • Author response: Contested (R5, PRRC_kwDOGkVX1s8AAAABGH7bMA): the comment marks where the test moves from the newer result to reopening the same one, which the click alone does not say.
  • Status: awaiting R5 check-in by the raising persona.
  • Panel (R5, 1/1): Gon accepts: the comment marks the switch to reopening the same result.

CRF-52 (Nit, PreviewPanel.tsx:11) - reloadCount names two counters

  • Finding: Gon: chat-level counter counts reopenings, PreviewFrame's counts Reload clicks; asked to rename the chat-level chain reopenCount.
  • Author response: Contested (R5, PRRC_kwDOGkVX1s8AAAABGH7cvQ): both are React keys that reload the preview when they change, so one name fits both; the prop doc states what changing it does.
  • Status: awaiting R5 check-in by the raising persona.
  • Panel (R5, 1/1): Gon accepts: no code reads either count as a number; both are keys.

CRF-53 (Nit, PreviewFrame.tsx:121) - frame holds a sign-in response next to frameRef

  • Finding: Gon: one name for two things; asked for target.
  • Author response: Contested (R5, PRRC_kwDOGkVX1s8AAAABGH7eaw): frame is the target the iframe loads (URL, origin, sandbox) and is used only in the next three lines.
  • Status: awaiting R5 check-in by the raising persona.
  • Panel (R5, 1/1): Gon accepts: used only in three attributes of one element; type visible at the declaration.

CRF-41 R6 response

  • Author response (R6, PRRC_kwDOGkVX1s8AAAABGJBK_w): the reproduction runs a copy of the markup and CSP on static pages rather than Coder itself, and the embedded chat was already decided out of scope for this PR.
  • Status: awaiting Pariston R6 check-in (Melody accepted R5).
  • Panel (R6): Pariston (reused R4 agent) does not re-raise for lack of new evidence; the R6 defense does not answer the reproduction (it used the server CSP and sandbox strings and the PR wrapper markup) or the scope point (the diff adds the button the embedded route shows). Stays acknowledged with no fix and no ticket; a human decides.

CRF-16 R6 response

  • Author response (R6, PRRC_kwDOGkVX1s8AAAABGJBMpw): the title check is deliberately a client copy because the user decides by title, and the limit only changes together with the tool, so no cross-reference is added.
  • Status: awaiting Gon R6 check-in.
  • Panel closure (R6, 1/1): Gon (reused R1 agent) accepts with no new evidence; notes both sides still lack a cross-reference after three declines.

CRF-66 (P4, PreviewFrame.tsx:103) - Sign-in-needed after a successful sign-in is dropped silently

  • Finding: Chopper: after this mount's sign-in succeeds, a second coder-preview-sign-in-needed is dropped and the panel stays on the host's 401 page; asked for an in-panel error when the message arrives after signInMutation.isSuccess, and for the test at PreviewFrame.test.tsx:160-163 to expect it.
  • Author response (R6, PRRC_kwDOGkVX1s8AAAABGJBJVw): one sign-in per mount is deliberate because script in the preview can post the same message; the only known way a host loses the new session (a cross-site region) is now refused before the frame loads; for an expired session the host page's advice to reopen is right, because Reload remounts the frame and signs in again.
  • Status: awaiting Chopper R6 check-in.
  • Panel closure (R6, 1/1): Chopper (reused R5 agent) accepts: the R5 example (Secure cookie over HTTP) also breaks the dashboard session cookie (HTTPCookieConfig.Apply), cross-site regions are refused before the frame loads, and an expired session recovers through Reload.

CRF-8, CRF-45 R6

  • Author accepted (R6, PRRC_kwDOGkVX1s8AAAABGJBOOA and PRRC_kwDOGkVX1s8AAAABGJBP3g): "Confirmed for the experimental release (operator decision, no ticket)". This is the human acceptance the R5 review asked for.

CRF-41 R7

  • Author accepted (R7, PRRC_kwDOGkVX1s8AAAABGKBAeg): "Confirmed for the experimental release (operator decision, no ticket): previews target the dashboard, and we accept that the embedded chat shows a button whose preview does not load there." This is the human decision the R6 review asked for.

CRF-67 (P4, AgentChatPageView.tsx:608) - previewAccess.open accepts any workspace/agent; only OpenPreviewTool repeats the match check

  • Finding: Meruem: openPreviewTab does not check workspaceId/agentName, while validateUserRightPanelTabs drops tabs that fail them; a second caller that skips the check persists hidden tabs and selects an ID the tab list omits. Proposed making previewAccess a function of the preview that checks ownership, workspace and agent in one place, and removing agentName from the context.
  • Author response (R7, PRRC_kwDOGkVX1s8AAAABGKA6Ag): agrees a future caller could skip the check; today the tool row is the only caller and checks workspace and agent before opening, so the check stays where the reason text is shown.
  • Status: acknowledged, no fix, no ticket; awaiting Meruem R7 check-in.
  • Panel (R7, 1/1): Meruem (reused R6 agent) accepts: OpenPreviewTool.tsx:66-71 is the only non-test reader of previewAccess and replaces open with the reason before any click; the hazard needs a second caller. No ticket, so the review asks for the operator decision wording used for CRF-8, CRF-41 and CRF-45.

CRF-67 R8

  • Author accepted (R8, PRRC_kwDOGkVX1s8AAAABGKKAkg): "Confirmed for the experimental release (operator decision, no ticket): the workspace and agent match check stays in OpenPreviewTool, the only reader of previewAccess."

Law analysis

R1: not run. Effective additions 979 (threshold 1000). Head de09426.
R4: ran. Effective +1371 -8 (516 production). Head 16f0f81. Verdict: Don't split. Enforcement: Advisory. Asks reviewers to give PreviewFrame.tsx (postMessage origin/source check, srcdoc CSP, single sign-in per mount) dedicated attention.

Round log

Round 1

Full panel (round 1). Netero first pass: 3 P3, 2 P4, no P0, panel proceeded. Law not run (979 effective additions). Panel: ging-ts, ging-react, nami, kurapika, melody (domain specialists), pariston, mafuuu (core), bisky, hisoka, gon, leorio (pool), knov (wildcard). 12 reviewers, multi-domain security-sensitive target 9-12.
Cross-check: CRF-6 merges Nami P3 and Hisoka P4 label mismatch (same code path, same fix). CRF-8 merges Leorio P3 and Nami P4 at the higher severity. CRF-9 contradicts CRF-1/CRF-4 (remove copy vs tighten copy); comment states both options. CRF-7 adds a case to CRF-8.
Downgrades and drops (keep-argument first):

  • CRF-15 P3 to P4. Keep: two panels show ports, only one named for ports. Reason: reader-navigation cost only; the doc comment distinguishes them.
  • CRF-16 P3 to Nit. Keep: drift silently hides the button. Reason: the drift consequence is CRF-9's; naming the literal does not prevent drift; this is a magic-number convention.
  • CRF-17 P2 to Nit, combined. Keep: AGENTS.md requires substantive comments and 9 of 21 restate. Reason: no behavior or comprehension harm; convention violation. CRF-25/26/27 dropped, each comment carries information the code does not.
  • CRF-21/22. Keep: root AGENTS.md says no standalone RTL component tests. Reason: site/AGENTS.md and FRONTEND_PATTERNS.md FE1, scoped to site/, require Vitest/RTL for behavior and forbid play assertions.
  • CRF-23. Keep: value changes per reload. Reason: each reload frames a new document; name matches the documented per-frame meaning.
  • CRF-24 P4 to Note (body). Keep: reviewers cannot locate the routing behavior. Reason: PR text, no file line; posted as a body process note.
  • CRF-14 Note raised to P4 because it asks for a change.
    Verified: mcpclient prefixing (mcpclient.go:1229), postPreviewSignIn owner check (previews.go:64), createAppConnectKey per request, agent in-memory preview map, NewPreviewID per path, ParsePreviewSlug uint16, getMatchingAgentOrFirst fallback, persistence of unfiltered tabs (AgentChatPageView.tsx:319). Leorio's CRF-20 line 131 was a blank line; used Bisky's :769 for the same test.
    8 P3, 7 P4, 5 Nit posted. Reviewed against e37889b..de09426.
    Post-post correction: CRF-3's posted fix asks for a Vitest assertion that no Open preview button renders. FE1 forbids presence assertions in Vitest (shown/hidden goes to a story screenshot). Next round: when verifying CRF-3, accept an FE1-compliant fix (a story with openPreviewEnabled: false showing the row, or a non-visual assertion such as no signInToPreview call and no persisted tab) and say so in the reply. Base AGENTS.md (e37889b:AGENTS.md:82) no longer has the "no standalone RTL test files" line, which confirms the CRF-21/22 drops.

Round 2 update

BLOCKED. 6 of 20 findings silent (CRF-5, CRF-10, CRF-15, CRF-16, CRF-18, CRF-20): no code change, no reply. 14 claimed fixed in 16f0f81, unverified by the panel. No review. Reviewed against 18fa1d5..16f0f81 (rebased; prior head de09426).

Round 3 update

BLOCKED. Head unchanged (16f0f81). Author replied on all six R2-silent threads. CRF-10 claimed fixed in d156c13 (#32438, in base; agent 404 page now says the agent restarted); CRF-5 and CRF-16 contested with reasons. CRF-15, CRF-18, CRF-20 each got the identical reply "Declined: naming preference.", which the churn-guard rules classify as silent (copy-pasted reply, no finding-specific reasoning). No PR description or top-level comment gives naming rationale (checked). Orchestrator has no override; advisor concurred. The R2 sign-in rewrite (postMessage-driven on-demand sign-in) is still unreviewed by any panel. Reviewed against 18fa1d5..16f0f81.

Round 4 update

PROCEED (churn guard). CRF-15, CRF-18, CRF-20 now contested with finding-specific reasons (R4 replies). CRF-5, CRF-16 contested since R3. Head unchanged since R2 (16f0f81); this is the first panel round on it. Restructure round: PreviewFrame rewritten for on-demand sign-in (postMessage coder-preview-sign-in-needed), new getPreviewAddress API, PR description states the new sign-in design. Inventory validation: dropped/OOS rows re-checked against 16f0f81; none reopened (CRF-36 key-per-sign-in is reduced by on-demand sign-in, stays OOS).
Panel (restructure round, full panel): domain ging-ts, ging-react, nami, kurapika, melody; core pariston, mafuuu; pool bisky, hisoka, komugi; wildcard knov (random draw). Dispute check-ins on reused R1 agents: netero (CRF-5), gon (CRF-15/16/18), leorio (CRF-20); they do not count toward the size target. Law ran (Don't split, Advisory).
Fix verification: CRF-1, 2, 4 (Netero), CRF-3 gate mutation-verified (Netero, Bisky) but its test is timing-dependent (CRF-44, posted on the CRF-3 thread), CRF-6 (Nami, Hisoka), CRF-7 (Melody), CRF-9 (Pariston, Bisky), CRF-10 (Hisoka, in d156c13), CRF-11 (Mafuuu, Knov), CRF-12 (Pariston), CRF-13 (Bisky), CRF-14 (Mafuuu, Hisoka), CRF-19 (Gon). CRF-8 re-raised (Nami, Leorio: stopped workspace and experiment off still show a bare title). CRF-17 re-raised (Gon: 3 of 6 locations unchanged; R2 status was set from the churn guard alone).
Downgrades (keep-argument first): CRF-49 P3 to P4. Keep: the comment is the stated reason the client checks were removed. Reason: the comment is incomplete, not false (sign-in does check in full); no behavior depends on it. CRF-51 P2 to Nit. Keep: AGENTS.md comment rule. Reason: convention only, as with CRF-17 in R1. CRF-46 merges Mafuuu P4 and Leorio Nit at P4. CRF-54 dropped. Keep: the request prop makes the name ambiguous. Reason: the doc comment states when it signs in.
Verified by orchestrator: previewhost.go:120 frame-ancestors 'self' <dashboardOrigin>; preview.go:172 window.top.postMessage; AgentChatPageView.tsx:608 previewAccess ignores isEmbedded; ChatTopBar hides the panel toggle when embedded; experiment-off test waits on API.getWorkspace being called (AgentChatPage.test.tsx:861).
10 new posted (4 P3, 6 P4) plus 4 Nit; 3 re-raises (CRF-8 P3, CRF-16 Nit, CRF-17 Nit). 4 contested closed (CRF-5, 15, 18, 20). Reviewed against 18fa1d5..16f0f81.

Round 5 update

PROCEED (churn guard: 7 addressed, 3 acknowledged, 7 contested, 0 silent). Head 4ac23c2 (rebased onto 631c66e). Fix round: 5 files changed since R4 (PreviewFrame.tsx, PreviewFrame.test.tsx, OpenPreviewTool.tsx, AgentChatPageView.tsx, AgentChatPage.test.tsx), no files added, no exported signature change, +49 effective additions. Law not re-run (+49 since R4 Law). Inventory validation: dropped/OOS rows unchanged by the new diff; CRF-65 (cross-site cookie) is now refused server-side per 5421940, still OOS.
Panel (fix round): personas with contested or acknowledged findings or open findings in changed code (gon, komugi, nami, mafuuu, knov, bisky, leorio, melody, pariston), domain specialists for changed .ts/.tsx (ging-ts, ging-react), wildcard chopper (random). All except chopper were their previous agents (dispute check-in). Netero ran first (no findings; CRF-40 closed).
Fix verification: CRF-42 (Nami, Mafuuu, Bisky mutation), CRF-43 (Leorio: cross-site cause refused server-side in 5421940), CRF-46 (Mafuuu, Leorio), CRF-47, CRF-48, CRF-50 (Bisky mutation), CRF-49 (Gon, Leorio, Netero).
CRF-66 (Chopper P3 to P4). Keep: a silent drop leaves the user on a 401 page whose instruction repeats the failure, and each retry mints a key. Reason: the known trigger (cross-site cookie) is now refused before any frame loads (CRF-43), and Chopper's example (Secure cookie over plain HTTP) would also reject the dashboard's own session cookie, so no reachable trigger is identified; the in-PR change is defensive messaging. Not merged into CRF-43 because Leorio, its raiser, verified that fix.
Posted: 1 new (CRF-66 P4), re-raises CRF-41 (P3) and CRF-16 (Nit). Human decision needed: CRF-8 and CRF-45 accepted by the author without a ticket. Reviewed against 631c66e..4ac23c2.

Round 6 update

PROCEED (churn guard: 0 addressed, 1 acknowledged, 2 contested, 0 silent). Head 79c6491 is a rebase of 4ac23c2 onto 9ec965f; git range-diff reports the PR commit identical. CRF-8 and CRF-45 accepted as an operator decision. Fix round with no code change: dispute check-ins only (Gon CRF-16, Chopper CRF-66, Pariston CRF-41) plus a wildcard; Netero re-run because the head SHA changed.
Panel: gon, chopper, pariston (reused agents, dispute check-ins), wildcard meruem (random). Netero: no findings (rebase only; base change is Go-only and keeps response shapes and the message string).
Posted: CRF-67 (P4). Closed: CRF-16, CRF-66. CRF-41 needs a human decision. Reviewed against 9ec965f..79c6491.

Round 7 update

PROCEED (churn guard: 2 acknowledged, 0 silent). Head 9db4ea5 is a rebase of 79c6491 onto a1249bd; git range-diff reports the PR commit identical; the base change is 7 lines in coderd/previews.go. CRF-41 accepted as an operator decision. Fix round: Meruem check-in on CRF-67, plus core (pariston, mafuuu) to reach 3, plus a wildcard; Netero re-run because the head SHA changed.
Panel: meruem (dispute check-in, reused), pariston, mafuuu (core, reused), wildcard chopper (random, reused). All no findings. Netero: no findings; base change is comment-only in coderd/previews.go.
No new findings. All in-scope findings are fixed, closed by the panel, or accepted; CRF-67 awaits the operator's confirmation. Reviewed against a1249bd..9db4ea5.

Round 8 update

PROCEED (churn guard: no open findings). Head c626616 is a rebase of 9db4ea5 onto 9a116a6; git range-diff reports the PR commit identical; the base change is comment-only (coderd/previews.go, previewhost.go). CRF-67 accepted as an operator decision. Fix round with no disputes: 3-reviewer minimum filled with mafuuu (core) and kurapika, hisoka (pool; last saw the code at R4, before the R5 reload changes), plus a wildcard. Netero re-run because the head SHA changed.

Panel: mafuuu (core), kurapika, hisoka (pool), wildcard chopper (random); all reused agents; all no findings. Netero: no findings. No open in-scope findings remain. Event APPROVE. The out-of-scope rows (CRF-35 to CRF-39, CRF-62 to CRF-65) still need tickets or human acceptance. Reviewed against 9a116a6..c626616.

Round 9 update

PROCEED (churn guard: no open findings). Head 71bab52 is a rebase of c626616 onto 004cc93; git range-diff reports the PR commit identical; the base change is tests (coderd/previews_test.go, agent/agentpreview/preview_test.go) and coderd/x/chatd/ARCHITECTURE.md only. Fix round with no disputes: 3-reviewer minimum filled with bisky, melody, nami (pool and domain; last saw the code at R5), plus a wildcard. Netero re-run because the head SHA changed.

Panel: bisky, melody, nami (pool and domain), wildcard meruem (random); all reused agents; all no findings. Netero: no findings. Melody showed the base now returns an error result for a workspace the chat owner does not own (coderd/x/chatd/chattool/openpreview.go, owner check before the port branch), so CRF-35 is fixed in base. CRF-64 still applies. Event COMMENT, so that R8's APPROVE stays the only bot approval. Reviewed against 004cc93..71bab52.

Round 10 update

PROCEED (churn guard: no open findings). Head b1c1ead is a rebase of 71bab52 onto 0be9a55; git range-diff reports the PR commit identical. The base change since R9 is tests, coderd/x/chatd/ARCHITECTURE.md, and one runtime change: previewHostingFor in coderd/previews.go now reads the workspace proxy with the caller's context instead of dbauthz.AsSystemRestricted, and treats a missing row or an authorization error (httpapi.Is404Error) as an unknown region. The UI calls the endpoints that use it. Fix round with no disputes: 3-reviewer minimum filled with pariston, hisoka, ging-ts (pool; security and server-contract angle for the base change), plus a wildcard. Netero re-run because the head SHA changed.

Panel: pariston, hisoka, ging-ts (pool), wildcard zoro (random, new agent); all no findings. Netero: no findings. Netero, Pariston, Hisoka and Zoro each showed that the previewHostingFor change leaves the dashboard's responses unchanged: the member role grants site-wide workspace_proxy read (coderd/rbac/roles.go), so only a scoped token without that permission now gets the existing 400, which PreviewFrame renders with Reload. Event COMMENT, so that R8's APPROVE stays the only bot approval. Reviewed against 0be9a55..b1c1ead.

Round 11 update

PROCEED (churn guard: no open findings). Head ddafde3 is a rebase of b1c1ead onto 9a81592; git range-diff reports the PR commit identical. The base change since R10: previewHostingFor in coderd/previews.go reads the workspace proxy with dbauthz.AsSystemRestricted again and treats only sql.ErrNoRows as an unknown region (reverting the R10 base change, so scoped tokens can use proxy regions); codersdk.PreviewSignInRequest.RegionID is omitzero instead of omitempty; tests and coderd/x/chatd/ARCHITECTURE.md. The generated TS type keeps region_id?: string. Fix round with no disputes: 3-reviewer minimum filled with kurapika, komugi, leorio (pool), plus a wildcard. Netero re-run because the head SHA changed.

Panel: kurapika, komugi, leorio (pool), wildcard knov (random); all reused agents; all no findings. Netero: no findings. Netero, Komugi, Leorio and Knov each showed that omitzero affects only Go encoding (the UI omits an undefined region_id, coderd decodes it to uuid.Nil, the primary) and that the AsSystemRestricted lookup returns the same row for a dashboard session; an unknown proxy ID still gets the 400, and other read errors now get a 500, both rendered by PreviewFrame's ErrorAlert. Event COMMENT, so that R8's APPROVE stays the only bot approval. Reviewed against 9a81592..ddafde3.

Round 12 update

PROCEED (churn guard: no open findings). Head fa5d6ce, rebased onto 944be92; the PR commit changed for the first time since R5. git range-diff 9a815921aa..ddafde30ad 944be92567..HEAD shows: preview tabs store a toolCallId (persisted, validated in isUserRightPanelTab); openPreviewTab only focuses an existing tab when the result's tool call ID matches, and a newer result still renames and reloads it; Tool and MessageBlocks pass toolCallId; open_preview joins UNCOLLAPSIBLE_TOOLS in workingBlockGrouping.ts; new page tests for focus-only reopen across a remount and for the button with collapsed assistant steps. The description states the new behavior. This partly reverses the CRF-6 fix (reopen reloaded every time). Base change since R11: comment in coderd/previews.go and one tool description sentence in openpreview.go (Vite server.allowedHosts). Panel: nami, hisoka (CRF-6 reporters), ging-react (React state and memoized Tool props), bisky (tests), plus a wildcard. Netero re-run because the head SHA changed.

Panel: nami, hisoka, ging-react, bisky (reused agents), wildcard razor (random, new agent). Netero: CRF-69 (P4). Nami, Hisoka, Bisky, Razor and Netero each traced openPreviewTab and found CRF-6 still met (different ID reloads; legacy tabs without an ID reload on first click; a result without an ID never focus-only). Bisky mutation-verified the new tests. New: CRF-69, CRF-70 (P4), CRF-71, CRF-72 (Nit; Bisky raised CRF-72 as P4, downgraded because the test still fails on regression and only its title misleads), CRF-73 (OOS, fantasy fallback ID confirmed at providers/openai/language_model.go:423). Event COMMENT. Reviewed against 944be92..fa5d6ce.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds the Agents UI for open_preview results: a tool row with an Open preview button, and a right-panel tab that signs in and frames the preview in a CSP wrapper. 8 P3, 7 P4, 5 Nit.

The PR description says "see the routing PR", and no PR in the stack list is the routing PR. Name its number.

Out of scope (needs a ticket or explicit acceptance by a human):

  • coderd/x/chatd/chattool/openpreview.go:166: the tool returns success for a workspace the chat owner does not own. Sign-in rejects that workspace, so the model tells the user a preview is ready that cannot open.
  • coderd/workspaceapps/preview.go:108, coderd/workspaceapps.go:146: each sign-in creates an application_connect API key with session lifetime that is never revoked, and an expired sign-in token is rejected even when the request has a valid preview session cookie. Every frame reload adds a key.
  • agent/agentpreview/preview.go:69: file preview IDs exist only in agent memory, so preview links and tabs return 404 after an agent restart until open_preview runs again.
  • coderd/previews.go:69: sign-in issues a token for a file preview slug without checking that the agent has published that ID, so the failure appears inside the frame instead of as a sign-in error.
  • coderd/x/chatd/chattool/openpreview.go:138: checkURLPath limits the path in bytes but its error says "characters", so a model with a long non-ASCII path cannot tell why it failed.

🤖 This review was automatically generated with Coder Agents.

export const parseOpenPreviewResult = (
result: unknown,
): NewPreviewTab | undefined => {
const rec = asRecord(result);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 [CRF-1] parseOpenPreviewResult never reads kind, so the PR description's "parsed strictly by kind" does not hold. (Netero)

A result with no kind, or with kind: "port" and a file slug such as preview--0123abcd, gets an Open preview button. Check that kind is "port" or "file" and matches the slug form, or remove the claim from the description.

🤖

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified in 16f0f81d16: the description now says results are parsed by shape, which matches the parser.

🤖

);
};

// Mirrors CheckURLPath in coderd/workspaceapps/previewhost/previewhost.go,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 [CRF-2] CheckURLPath in coderd/workspaceapps/previewhost/previewhost.go does not exist. The rule this code mirrors is checkURLPath in coderd/x/chatd/chattool/openpreview.go:129. (Netero)

A reader who follows this reference to keep the two checks in sync finds nothing to compare. Point the comment at checkURLPath.

🤖

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified fixed in 16f0f81d16: the comment and the client url_path check are gone.

🤖

buildId: chat.build_id,
agentId: chat.agent_id,
agentName: workspaceAgent?.name,
openPreview: openPreviewEnabled ? openPreviewTab : undefined,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 [CRF-3] No test fails if the Open preview button shows with the open-preview experiment off. (Netero)

Changing this line to openPreview: openPreviewTab, left Tool.test.tsx, AgentChatPage.test.tsx and rightPanelTabs.test.ts passing (60 of 60), because every page test returns ["open-preview"] from /api/v2/experiments. Add a case to the open_preview results block that returns [] and asserts that no Open preview button renders.

🤖

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 [CRF-44] "offers no preview while the experiment is off" waits for API.getWorkspace to be called, not for its response to render, so it checks the gate only when the workspace render finishes first. (Komugi)

The button can only appear after the workspace renders, because previewAccess is undefined while workspace is unset. With !openPreviewEnabled || removed, the test fails with the current mock but passes when getWorkspace resolves 150 ms after the call. Before looking for buttons, wait for something rendered from the loaded workspace, or resolve a deferred getWorkspace and wait until the query succeeds.

🤖

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: removing the experiment check from previewAccess fails this test with the mocks the suite uses, so it guards the gate today; you are right that it waits for the workspace request rather than its render, but the workspace mock resolves immediately in every case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defense holds: with the gate removed, 42 of 42 runs (including on a single core) found the button and failed. Closed.

🤖


const isPreviewSlug = (value: unknown): value is string =>
typeof value === "string" &&
/^preview--([0-9a-f]{8}|[1-9][0-9]{0,4})$/.test(value);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4 [CRF-4] The port branch [1-9][0-9]{0,4} accepts preview--65536 through preview--99999, which appurl.ParsePreviewSlug rejects with strconv.ParseUint(target, 10, 16). (Netero)

Such a result shows a button whose sign-in returns 400. Match the server's range, or remove this copy (see the comment on the duplicated server rules).

🤖

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified fixed in 16f0f81d16: the parser checks only the preview-- prefix.

🤖

return (
openPreviewEnabled &&
tab.workspaceId === workspace.id &&
getMatchingAgentOrFirst(workspace, tab.agentName) !== undefined

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4 [CRF-5] getMatchingAgentOrFirst falls back to the first agent only for an empty name, and isUserRightPanelTab already rejects preview tabs with an empty agentName, so here and in UserTabPanel.tsx:77 the call only finds an agent by name. (Netero)

A reader has to trace back to isUserRightPanelTab to confirm that a preview tab cannot fall back to an unrelated agent. Use getWorkspaceAgents(workspace).find((agent) => agent.name === tab.agentName) at both call sites.

🤖

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: behavior is the same because preview tabs always carry an agent name; cheap to revisit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defense holds: both ways a preview tab gets an agent name keep it non-empty. Closed.

🤖

}
const runes = [...value].length;
return (
runes >= 1 && runes <= 80 && !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(value)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-16] 80 here and 2048 on line 26 are bare copies of maxPreviewTitleLength and maxURLPathLength in coderd/x/chatd/chattool/openpreview.go. (Gon)

Declare them as named constants, each with a comment that names the Go constant it mirrors.

🤖

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: the 2048 copy is gone in 16f0f81 because sign-in now checks url_path, and the title limit 80 stays inline in its only check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2048 copy is gone. The 80 remains: if maxPreviewTitleLength in coderd/x/chatd/chattool/openpreview.go is raised, results with longer titles render as a bare title with no button and no reason, and nothing on this line points to the Go constant. Adding "The limit of 80 mirrors maxPreviewTitleLength in coderd/x/chatd/chattool/openpreview.go." to the comment above isPreviewTitle is enough. (Gon)

🤖

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: the title check is deliberately a client copy, since the user decides by title, and the limit only changes together with the tool, so a drift would need a Go change first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still open as a Nit. The reply explains why the client keeps a copy, but not how someone who raises maxPreviewTitleLength in coderd/x/chatd/chattool/openpreview.go finds it: neither side names the other, and results with longer titles would then lose the button with no reason. One clause on the existing comment above isPreviewTitle fixes it: "The limit of 80 mirrors maxPreviewTitleLength in coderd/x/chatd/chattool/openpreview.go." (Gon)

🤖

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: the title check is deliberately a client copy because the user decides by title, and the limit only changes together with the tool, so we are not adding the cross-reference here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted. Neither side names the other, so whether that is acceptable is now the author's call. Closed. (Gon)

🤖

Comment thread site/src/api/api.ts Outdated
};

/**
* Signs the caller in to a preview. The returned URL carries a short-lived

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-17] Several new doc comments open with a sentence that restates the symbol name or the JSX, and AGENTS.md requires comments to be "substantive and concise". (Gon)

Here, keep only "The returned URL carries a short-lived sign-in token." The same applies to previews.ts:5 ("Signs in to a preview for one frame"), PreviewFrame.tsx:24 ("under a header with the preview's host and a reload button"), UserTabPanel.tsx:21 (the list of kinds repeats the exhaustive switch), rightPanelTabs.ts:78, and chatEntities.ts:240.

🤖

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three of the six locations are unchanged: UserTabPanel.tsx:21 (the list of kinds), rightPanelTabs.ts:78 ("A preview tab before it has an ID."), and chatEntities.ts:240. (Gon)

🤖

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: these are one-line docs on exported symbols, which the repository requires, and each one is accurate.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defense holds: AGENTS.md requires docs on exported symbols, and all three are exported. Closed.

🤖

label: string;
workspaceId: string;
agentName: string;
slug: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-18] The tab field slug renames the API's preview_slug, and in a module that also stores workspace app tabs, a bare slug reads as an app slug. (Gon)

Name it previewSlug.

🤖

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: naming preference.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: slug sits on the preview tab variant only, next to kind: "preview", so TypeScript narrows it before any read and it cannot be confused with an app tab's fields; renaming it touches every preview tab test for no behavior change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defense holds: every read narrows to kind: "preview" first, and workspace app tabs store appId, not slug. Closed.

🤖

const signInQuery = useQuery(
previewSignIn({ ...preview, region_id: proxy.proxy?.id }, frameId),
);
const signIn = signInQuery.data;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-19] signIn holds a PreviewSignInResponse, but it reads as a function at signIn && ... and wrapperHTML(signIn, title). (Gon)

Name it signInResponse.

🤖

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified fixed in 16f0f81d16.

🤖

return { user: userEvent.setup(), signIn };
};

it("opens a result's tab from its row once", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-20] The test name "opens a result's tab from its row once" does not say that the test clicks twice. (Leorio)

For example: "clicking Open preview twice opens one tab and focuses it".

🤖

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: naming preference.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declined: the test name says the result opens its tab once, which is the asserted behavior, and the body's two clicks are the setup; the suggested name describes the same assertion in more words.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defense holds: the name states the asserted behavior. Closed.

🤖

@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This head is a rebase of b1c1ead with the same PR diff. No new findings. The earlier approval still applies, so this review is a comment rather than another approval.

Neither base change alters what this UI sends or receives. RegionID moving from omitempty to omitzero affects only Go encoding: PreviewFrame omits region_id when no proxy is selected, coderd decodes that to uuid.Nil, and the generated type is still region_id?: string. previewHostingFor reading the proxy with AsSystemRestricted again returns the same row a dashboard session could already read, and an unknown proxy ID still gets the 400 that PreviewFrame shows with Reload.

The out-of-scope server items from earlier reviews (sign-in types reused by the address endpoint, the signed-out page's action and window.top target, key lifetime) are not part of this PR and still need tickets or explicit acceptance.

🤖 This review was automatically generated with Coder Agents.

@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@DanielleMaywood
DanielleMaywood marked this pull request as ready for review November 26, 2026 22:05
@DanielleMaywood
DanielleMaywood requested a review from a team as a code owner November 26, 2026 22:05
@DanielleMaywood DanielleMaywood removed the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Nov 26, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T22:09:49.894336Z fa5d6ce Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This round reviews the tool call ID change: opening the same result again only focuses its tab, a different result renames and reloads it, and open_preview stays out of collapsed steps. New findings: 2 P4, 2 Nit.

CRF-6 still holds. Every path the panel traced shows the result the user clicked: a different tool call ID reloads, a tab saved before this change has no ID and reloads on its first click, and a result without an ID never takes the focus-only branch. The new tests fail when the toolCallId match, the stored ID, the Tool and MessageBlocks props, or the UNCOLLAPSIBLE_TOOLS entry is removed.

Out of scope: messageParsing.ts matches results to calls by tool call ID across the whole chat, and fantasy's OpenAI provider fills a missing ID with tool-call-<index> (providers/openai/language_model.go:423), which can repeat across steps. With such IDs an earlier row already renders a later result, and this PR's focus-only check would treat the two results as one. The out-of-scope server items from earlier reviews (sign-in types reused by the address endpoint, the signed-out page's action and window.top target, key lifetime) still need tickets or explicit acceptance.

🤖 This review was automatically generated with Coder Agents.

// A newer result renames the tab and reloads its frame, so the tab
// shows what the agent just opened.
if (
preview.toolCallId !== undefined &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4 [CRF-69] No test covers clicking Open preview for a preview tab saved without toolCallId, which every tab persisted before this change is. (Netero)

The code handles it: undefined never equals the clicked ID, so the tab is renamed, reloaded and given the ID. But changing this condition to also focus tabs with no toolCallId leaves such a tab on its older label and frame, and AgentChatPage.test.tsx and rightPanelTabs.test.ts still pass (56 of 56). Add a case to the open_preview results block that seeds savePersistedRightPanelTabs with a preview tab with no toolCallId and an older label, clicks the matching result, and asserts the label and toolCallId change and the frame is replaced.

🤖

SingletonRightPanelTabId[]
>(() => getPersistedVisibleSingletonTabs(agentId));
const [pendingTabId, setPendingTabId] = useState<string | null>(null);
// Counts how often each preview tab was opened again, so its frame

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4 [CRF-70] This comment says the count tracks how often a tab "was opened again", but opening the same result again now returns at line 592 without changing it. (Razor)

A reader who trusts the comment expects every Open preview click to remount the frame. Say that the count changes when the tab is opened from a different open_preview result.

🤖

);
if (existingTab) {
// The same result only focuses its tab, keeping the frame's state.
// A newer result renames the tab and reloads its frame, so the tab

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-71] "A newer result" is narrower than the code: any result with a different toolCallId renames and reloads the tab, including an older row clicked after a newer one. (Razor)

The PR description says "newer" too. Write "a different result" in both.

🤖

expect(newerFrame).not.toBe(firstFrame);
expect(firstFrame).not.toBeInTheDocument();

// Opening the same result again only focuses it, keeping the frame,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit [CRF-72] These focus-only assertions sit at the end of "renames an open preview's tab and reloads it for a newer result", so when the focus-only branch breaks, the failure reports under a title that says the opposite. (Bisky)

Deleting the toolCallId match at AgentChatPageView.tsx:589 fails this test under the rename-and-reload title. Move lines 858 to 870 into their own test, for example "only focuses a preview's tab when the same result is opened again, also after a remount", seeded with one previewExchange.

🤖

@DanielleMaywood
DanielleMaywood force-pushed the open-preview/ui branch 2 times, most recently from 86b336e to 8a343fa Compare December 2, 2026 12:21
@DanielleMaywood
DanielleMaywood force-pushed the open-preview/ui branch 2 times, most recently from 5b9af8f to 46b5b5b Compare December 2, 2026 13:43
@DanielleMaywood
DanielleMaywood force-pushed the open-preview/ui branch 2 times, most recently from ef292da to f72869c Compare December 2, 2026 15:18
@DanielleMaywood
DanielleMaywood force-pushed the open-preview/ui branch 2 times, most recently from 24b5433 to 5394bc1 Compare December 2, 2026 15:56
Renders open_preview results in the Agents chat with an Open preview
button. The preview tab loads the preview's address in a srcdoc wrapper
frame whose CSP allows only that preview's origin. When the preview's
signed-out page posts coder-preview-sign-in-needed, the tab signs in
through the dashboard endpoint, at most once per mount, and loads the
returned URL. With the experiment off, the button is hidden and saved
preview tabs are dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant