Skip to content

feat: serve published file previews from the workspace agent over tailnet - #31282

Draft
DanielleMaywood wants to merge 1 commit into
mainfrom
feat/agents-open-preview-agent
Draft

DanielleMaywood wants to merge 1 commit into
mainfrom
feat/agents-open-preview-agent

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

The workspace agent can publish an absolute .html file, or a directory containing index.html, and serve it from the existing agent API (AgentHTTPAPIServerPort, 4) under /api/v0/previews/{id}/. Publishing returns the path's preview ID, a random eight-hex-digit value; publishing a path again keeps its ID and serves its current contents. Adds AgentConn.OpenPreview to the workspace SDK.

Files are served through os.Root: each path component is Lstated, opened as its own root and compared with SameFile, so symlinks, hard-linked files and FIFOs are never served, nor are names inside a published directory that start with a dot (after any leading format characters such as U+200C, which HFS+ ignores), and a directory swapped mid-request cannot escape the published root. Only the current directory stays open during a lookup, so deep paths use a constant number of handles. Responses are no-store and nosniff. Publications and their IDs last until the agent restarts, capped at 64. Path previews work on Linux, macOS and Windows. Requested names containing \, : or ~ are rejected on every platform, because Windows reads them as a path separator, an alternate data stream, or a short name such as HIDDEN~1 for .hidden. On Windows the published directory is opened from its parent so it can still be renamed or deleted, and hard links are detected from the open file handle. OpenPreview returns the canonical path it serves.

Decision log
  • Agent API instead of per-preview loopback ports. An earlier iteration served each preview on 127.0.0.1:<random port>. Those ports were reachable by every workspace process and inherited numeric port shares, so a public share on a reused port could expose published files. The agent API is only reachable over tailnet and sits in the reserved range below AgentMinimumListeningPort.
  • Agent API (port 4) instead of a dedicated port 5 listener. Verified through the real coderd app proxy against a real agent that .., %2e%2e, %2f and backslash variants stay inside /api/v0/previews/{id}/ and return 404: neither the proxy nor chi resolves dot segments, so preview requests cannot reach other agent API routes. The chat and tool-call middleware are no-ops without their headers, which coderd drops from preview requests (feat: route preview app hostnames to agent previews #31283), and the preview handler extends its own write deadline per request.
  • The agent assigns a random ID per resolved path, so symlinks to one file share its ID. It is the only process holding the publications, so it can redraw an ID that's already taken, with any number of coderd replicas. IDs are eight hex digits because preview hostnames read four- or five-digit numbers as ports. Previews do not survive agent restarts: a link from before a restart returns 404 instead of showing another path with the old origin's storage (a new ID matches a stale one with probability about 64/2³²). Random IDs also keep a page from guessing its neighbours' hostnames. Guessing an ID gains nothing beyond that: it only serves an already published path, to principals that already hold application_connect on the workspace.
  • Rejections are logged, not returned. Symlink, hard-link and I/O failures add their reason to the agent's request log line; the response stays a bare 404, or 500 for I/O errors, so pages can't probe which files exist.
  • 64 publications, no unpublish. Each publication holds one directory handle, and the cap bounds a looping model. Republishing a path does not take a new slot.
  • Hard links are rejected because another link to the same file may sit outside the preview. A same-user process could still copy a file in, so this guards against accidents, not a determined process.
  • A file publishes only that file; a directory publishes that directory (never its parent). Directories require index.html and there are no listings.
  • Republishing a rebuilt output directory replaces the pinned root, so rm -rf dist && build followed by open_preview serves the new tree. Requests that are opening a file hold a read lock, so the old root is not closed under them.
  • Kept the strict symlink/FIFO/TOCTOU handling from security review; os.Root alone would still serve in-root symlinks such as index.html -> .env.

Stack (proof of concept for the embedded previews RFC, review bottom-up):

  1. feat: serve published file previews from the workspace agent over tailnet #31282 Agent file previews over tailnet ← this PR
  2. feat: route preview app hostnames to agent previews #31283 Preview app hostname routing
  3. feat(coderd): add open_preview chat tool #31284 open_preview chat tool
  4. feat: add chat previews endpoint #31285 Chat previews endpoint
  5. feat(site): add a Preview tab for open_preview #31286 Preview tab UI
  6. docs(docs/coder-agents): document embedded previews #31287 Docs
  7. feat: open coder_app tabs from open_preview #31484 Open coder_app tabs

🤖 This PR was written by Coder Agents on behalf of @DanielleMaywood.

@ibetitsmike ibetitsmike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Adversarial security review — stack summary (#31282 → #31287) + agent-server findings

This is the roll-up for the whole stack; each PR also has its own review with PR-local findings. Line numbers refer to the stack head 678b80103 (feat/agents-open-preview-docs).

Method. 8 independent reviewers (one per PR + two whole-stack reviewers with different attacker focus), then 3 independent voters assigned severity, then every finding voted ≥P2 was re-reproduced from scratch by a separate validator against a real coderd + in-process agent + Postgres. Severity = voter majority. P3/nit items below were not independently re-validated and should be read as unverified single-reviewer observations.


S1 — P1 (contested: 2 voters P1, 1 voter + both validators P2) — validated

A prompt-injected model can choose both the content and the moment the dashboard renders it, on the wildcard app domain with the owner's ambient application_connect cookie; the one containment added by the stack (deny preview-- origins in CORS) covers only path mode, only response reads, and only cors_behavior=simple.

Chain (all hops verified):

  • open_preview result → site/src/pages/AgentsPage/components/ChatConversation/useChatToolInvalidations.ts:173 (effect, no gesture) → AgentChatPageView.tsx:427 showSingletonTab("preview") → RightPanel/PreviewPanel.tsx:174 <WorkspaceIframe src> → site/src/modules/apps/WorkspaceAppFrame.tsx:166: no sandbox, allow="clipboard-read; clipboard-write", loading="eager". This is the only effect-driven tab activation in the Agents UI; every other activation is an onClick.
  • The frame runs on <slug>--<agent>--<ws>--<owner>.<wildcard> and carries coder_subdomain_app_session_token_<hash> (coderd/workspaceapps/proxy.go:277 Domain=.<wildcard suffix>, SameSite=Lax, strict not selectable — codersdk/deployment.go:3665). That key is application_connect-scoped (coderd/workspaceapps.go:103-118), so the blast radius is every owner-level app and port in every workspace of the owner (code-server etc.), not the dashboard API.
  • Port mode escapes the mitigation. open_preview(port) (coderd/x/chatd/chattool/openpreview.go:52, the mode the tool description recommends first) yields an ordinary <port>--… origin. WorkspaceAppCors (coderd/httpmw/cors.go:126) only denies preview-- origins and otherwise allows any same-username origin with AllowCredentials: true (cors.go:140). Validator transcript (fresh test, real proxy, two workspaces of the same user):
    GET victim--agent--w2--testuser  Origin: http://34979--agent--w1--testuser.<wildcard>
      -> 200  ACAO: http://34979--agent--w1--testuser.<wildcard>   ACAC: true
    GET victim--agent--w2--testuser  Origin: http://preview--0123456789abcdef--agent--w1--testuser.<wildcard>
      -> 200  (no ACAO / ACAC)   <- request still delivered to upstream
    
    Port-mode "previews" also go through the port-share branch (request.go:357-400): with a public share the LLM-authored page is served unauthenticated (validated: 303 → 200 after POST /workspaces/{w1}/port-share). This contradicts "Previews are always owner-only; port shares do not apply" in #31283.
  • CORS does not stop requests, only reads. A simple POST (form content-type) from a preview--… Origin carrying only the subdomain cookie was token-issued and delivered to a sibling app with its body (validator: UPSTREAM RECEIVED: POST /do Origin="https://preview--…" Cookie="" body="action=delete&csrf_case=0"). grep Origin|Sec-Fetch|Referer coderd/workspaceapps/*.go → no request-origin gating anywhere. The #31283 PR body / cors.go:124 comment ("cannot make credentialed requests") is therefore inaccurate.
  • cors_behavior=passthru skips the check entirely (proxy.go:406); validated: a reflecting upstream's ACAO: http://preview--… + ACAC: true reach the browser unchanged.
  • Validator calibration: browser preflights are uncredentialed and ResolveRequest runs before CORS, so non-simple cross-origin requests fail at the auth redirect; the readable primitive is simple GET/HEAD/POST with credentials: "include" — still a credentialed cross-workspace read of any GET-able page/file of a sibling app.
  • Browser-side behaviours (top-navigation after a click in the frame, clipboard write, popups, cookie tossing onto .<wildcard>) follow from the missing sandbox and are UNVERIFIED (no browser in the harness).

Why it is new vs. main: the unsandboxed app iframe, the domain-wide app cookie and the same-username CORS allowance all pre-exist; on main the model would need to social-engineer a click on a port tab. The stack makes it zero-click, brands the pane "Preview", and ships a mitigation that doesn't cover the recommended mode.

Suggested fixes (split across PRs; details in each PR review): (1) #31286 — do not auto-src a fresh preview; require a click; render previews in a dedicated frame with sandbox="allow-scripts allow-same-origin allow-forms" (no top-nav/popups), no clipboard allow, referrerpolicy="no-referrer"; only mount while visible. (2) #31284/#31283 — make the trust decision follow content provenance, not hostname shape: either drop port mode or give port-mode previews a preview---class origin (e.g. preview--p<port>--…) so appurl.PreviewID covers both modes and forces AppSharingLevelOwner. (3) #31283 — move the preview-origin rule out of WorkspaceAppCors into an unconditional step in determineCORSBehavior (strip ACAO/ACAC for preview origins in passthru too) and consider a hard 403 in HandleSubdomain when Origin parses as a preview host ≠ request host; fix the wording.


S2 — P2 (unanimous) — validated

Anyone who can read the chat and holds application_connect on the workspace — the site owner role by default — renders the victim's LLM-authored page in their own browser with their own app cookie.

  • Catalog is gated on chat ActionRead only (coderd/database/dbauthz/dbauthz.go:3739); preview fetch is gated on ActionApplicationConnect (coderd/workspaceapps/db.go:370), not on OwnerID == actor. The UI builds the URL from workspace.owner_name (the victim) and never compares viewer to chat.owner_id (AgentChatPageView.tsx:408-434, PreviewPanel.tsx:63-77, Tool.tsx OpenPreviewRenderer).

  • Validator matrix (fresh end-to-end test, victim = plain member):

    principal GET /chats/{id}/previews preview--<id>--main--<ws>--<victim>/
    victim 200 200, file body (proxied to agent :5)
    site owner 200 200, victim's file body
    org admin 200 (title + absolute path leak) coderd 404 page
    same-org member / chat-ACL read sharee 404 / 200 coderd 404 page
    unauthenticated — 303 login

    --disable-owner-workspace-access fully closes the site-owner path. Viewing another user's chat is a supported flow (isOtherUserReadOnly banner; Workspaces page "Agent" badge → /agents/<chatId>).

  • Impact is the S1 primitive turned against an admin (no confidentiality gain — the site owner already has SSH). Fix: #31286 only build/iframe the URL when the viewer is the chat owner and never auto-open for a non-owner; #31285 defence-in-depth: return [] (or 403) from getChatPreviews when actor != chat.owner_id; #31283 optionally make preview authz literally Workspace.OwnerID == roles.ID.


Verified negatives (so nobody re-spends effort)

  • Catalog poisoning is unreachable: no user API writes role='tool' parts; MCP tools are <server>__<tool> + tagged mcp_server_config_id; built-in open_preview shadows dynamic tools; IsPreviewID is anchored.
  • Hostname parsing: 104,868-hostname corpus diff vs the pre-PR parser → zero meaning changes; coder_app slugs can't contain --; 0005/00004 leading-zero ports still hit the reserved-port 400; signed token bound to slug/agent/prefix; path/terminal access can't reach port 5; traversal variants (.., %2e%2e, //, \, ;) all 404 at the agent; Coder cookies stripped before proxying.
  • os.Root + Lstat + SameFile holds against symlink/FIFO/TOCTOU (checked against Go 1.26.9 os/root_unix.go); go test -race clean; lock ordering is cycle-free.
  • Port 4/5 are reachable by exactly the population that can already use /api/v0/files (ActionSSH), so publication itself is not an escalation.

#31282-specific findings (agent preview server) — unverified (single reviewer; not independently re-validated)

P3

  • fd per path component, no depth cap — agent/agentpreview/preview.go:241 keeps one *os.Root fd per component until openFile returns. Reviewer test: a 2,000-deep request peaked at ~2,009 fds; at ulimit -n 1024 unrelated os.Open calls in the agent process hit EMFILE during the request (no leak afterwards). Request line allows ~500k components. Fix: close the parent after verifying the child, cap component count (e.g. 64).
  • open() / Close() hold api.mu while waiting on rootMu.Lock() — preview.go:100-127, api.go:45. A pending republish of preview A blocks GET on unrelated preview B (reviewer-tested). Fix: swap the root outside api.mu.
  • No unpublish/TTL; 16-slot cap per agent lifetime (preview.go:21). 16 open_preview(path) calls lock out previews for all chats on that agent until restart; file-mode previews pin the parent dir fd (e.g. $HOME) for the daemon lifetime.
  • Preview ID is an unsalted sha256("<isDir>:<canonical>")[:8] (preview.go:71) — validated: /home/coder/project/dist → dc5e6154dd7948f4 offline and from two independent agent instances. Combined with application_connect-only principals (constructible via a premium custom org role workspace:{read,application_connect}; validated they are refused at /coordinate but get 200 on the published index.html/config.json), the URL is guessable. Voted P3 because that principal already reaches owner-level coder_apps (code-server → file read) through the same authorizeRequest branch. Still worth salting per agent process (the catalog stores path so the model can republish).

nit

  • Hardlinks inside the published tree are served (reviewer: hardlink to ~/.ssh/id_rsa → 200). PR text "symlinks, dot paths and FIFOs are never served" should not be read as "links"; a same-UID process could cp anyway.
  • Served HTML carries no Referrer-Policy/CSP; handleOpen returns raw OS error strings in Detail; WriteTimeout: time.Minute is absolute (assets slower than 60s truncate); stale catalog after agent restart shows a bare 404 page not found inside the frame.

@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch 6 times, most recently from fdb11aa to fbfcc95 Compare October 29, 2026 09:57

@ibetitsmike ibetitsmike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Follow-up (re-checked at 2c52e96)

Most of the agent-side items from the earlier review are addressed here (one fd at a time in openFile, root swap outside api.mu, Nlink > 1 rejection, cap 64) — thanks.

One item is worth revisiting because it now composes with a new vector: preview IDs are still an unsalted sha256("<isDir>:<canonical>")[:8] (agent/agentpreview/preview.go:80). Besides the earlier guessability point (P3), a stable origin is what lets a service worker registered by an agent-authored page survive daemon restarts and observe the next app-auth handoff on that origin (details on #31283). Salting per agent process — e.g. sha256(processSecret || key)[:8] — makes the origin rotate on restart; the catalog already stores path, so the model can republish and the UI can re-key. If stable URLs are a hard requirement, pair it with worker-src 'none' on preview responses and a single-use, host-bound smuggling payload instead.

@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

@codex review

🤖 Posted by Coder Agents on behalf of @DanielleMaywood.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T14:28:10.021121Z dbef10d Manual request
ℹ️ About Codex in GitHub

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

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

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: f92c4a3751

ℹ️ About Codex in GitHub

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

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DanielleMaywood DanielleMaywood left a comment

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.

This review was performed by ai-review, an automated review bot.

1 inline finding.

Coverage
Coverage: 10 of 11 files reviewed, 1 generated; 35 rules.
Candidates: 360 found, 331 outside changed lines, 0 already discussed, 29 evaluated.
Findings: 1 (1 sites, 0 pre-existing sites), 0 over budget, 0 failed.
Model: deepseek/deepseek-v4.1-flash; 28 questions, 25 answered, 3 abstained (truncated 3), 22 cached; 0 uncalibrated findings held back; 4402 input and 7621 output tokens.

Comment thread agent/previews_test.go Resolved
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch 8 times, most recently from 9854951 to cc4d20b Compare November 1, 2026 23:34
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch from bc7408d to 57dfcfb Compare November 5, 2026 12:05
@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.

Re-review of 57dfcfb. All 8 findings from the previous review are fixed and verified, including random preview IDs and the HFS+ dot-name check. This round adds 2 P3, 2 P4 and 1 Nit: the new request-log reason covers only the last path component, and two of the new behaviors (random IDs across restarts, the .html-only rule) have no test that fails if they regress.

The directory-swap SameFile branch in openFile is still untested and needs explicit acceptance by a human. The two out-of-scope items from the first review (chat and tool-call headers on preview requests for #31283, and the open_preview tool description for #31284) still need a ticket or explicit acceptance by a human.

🤖 This review was automatically generated with Coder Agents.

Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch from 57dfcfb to 1c0b3d4 Compare November 5, 2026 14:46
@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

Responses to the items in the round 2 review body:

  • Untested directory-swap SameFile branch in openFile: accepted by @DanielleMaywood as untested. It rejects a directory replaced with a symlink between Lstat and the open. A test would need either a timing race, which would flake, or a hook that exists only for tests.
  • Chat and tool-call headers on preview requests (feat: route preview app hostnames to agent previews #31283): handled. coderd/workspaceapps/proxy.go removes CoderChatIDHeader, CoderToolCallIDHeader, and CoderAncestorChatIDsHeader from preview requests before proxying them, and proxy_test.go covers it.
  • open_preview tool description (feat(coderd): add open_preview chat tool #31284): handled. The description says a file publishes only that file, and to publish the directory to include CSS, JavaScript, images, or other pages.

🤖 Posted by Coder Agents on behalf of @DanielleMaywood.

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

Re-review of 1c0b3d4. All 5 findings from the previous review are fixed and verified, including a symlinked parent directory now logging its reason. This round adds 3 P4 and 1 Nit, all about the reason that reaches the agent's log: one rejection rule still logs "file does not exist", no test checks which error is returned, and publish still discards the cause.

The directory-swap SameFile branch in openFile is still untested and needs explicit acceptance by a human. The two out-of-scope items from the first review (chat and tool-call headers on preview requests for #31283, and the open_preview tool description for #31284) still need a ticket or explicit acceptance by a human.

🤖 This review was automatically generated with Coder Agents.

Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch from 1c0b3d4 to 6541ef4 Compare November 5, 2026 15:17
@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.

Re-review of 6541ef4. All 4 findings from the previous review are fixed and verified. This round adds 5 P4 findings: two rejection branches whose errNotServed return no test checks, one name check that still logs "file does not exist", publish error text that lists rules publish never applies, and an untested write deadline.

Rounds 2 to 5 have each fixed the cited branch of the same problem (which reason a refused request logs, and whether a test pins it) and the next round has found a sibling. One pass that lists every return in openServed and openFile, picks its error, and adds an ErrorIs assertion for each would likely close the class.

The directory-swap SameFile branch in openFile is still untested and needs explicit acceptance by a human. The two out-of-scope items from the first review (chat and tool-call headers on preview requests for #31283, and the open_preview tool description for #31284) still need a ticket or explicit acceptance by a human.

🤖 This review was automatically generated with Coder Agents.

Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch from 6541ef4 to 2d9f1f6 Compare November 5, 2026 16:53
@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

The CRF-52 to CRF-55 fixes are in 2d9f1f6, and CRF-56 is not being changed; each is answered in its thread. @DanielleMaywood accepts the untested SameFile directory-swap branch in openFile (agent/agentpreview/preview.go:245-248) without a ticket. She also accepts, without a ticket, that the open_preview tool description for #31284 does not mention CDN or other-origin limits. The other out-of-scope item, chat and tool-call headers on preview requests, is handled in #31283: the proxy removes Coder-Chat-Id, Coder-Tool-Call-Id and Coder-Ancestor-Chat-Ids from file-preview requests (coderd/workspaceapps/proxy.go, covered by the FilePreviewDropsChatHeaders row).

🤖 Posted by Coder Agents on behalf of @DanielleMaywood.

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

Re-review of 2d9f1f6. CRF-52 to CRF-55 are fixed and verified, and the panel accepts the reasons for not testing the write deadline. This round adds 3 P4 findings, all in the same area as the last four rounds: a file preview's refusal still logs "file does not exist", the errNotServed rewording reverted the earlier fix for a regular-file parent, and the errNameNotServed text omits invalid UTF-8.

This is the third round in a row where the fix covered the cited lines and the next pass found a sibling. One way to close it: make every refusal a value of one unexported type, check it in handleServe with errors.As instead of listing sentinels (a new refusal then cannot become a 500 by omission), and add an ErrorIs/ErrorAs assertion for each return in openServed and openFile.

The directory-swap SameFile branch in openFile is still untested and needs explicit acceptance by a human. The two out-of-scope items from the first review (chat and tool-call headers on preview requests for #31283, and the open_preview tool description for #31284) still need a ticket or explicit acceptance by a human.

🤖 This review was automatically generated with Coder Agents.

Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
Comment thread agent/agentpreview/preview.go Resolved
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch from 2d9f1f6 to 5537640 Compare November 6, 2026 00:46
@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

On the review body:

  • One refusal type checked with errors.As: not adopting it. None of the recent findings were a refusal that became a 500 because the handler missed a sentinel, which is the only thing the type prevents; they were message accuracy. The sentinels now state their rule instead of listing cases, so each is true at every return.
  • SameFile branch untested: accepted, as answered last round.
  • Chat and tool-call headers on preview requests: handled in feat: route preview app hostnames to agent previews #31283. coderd/workspaceapps/proxy.go deletes Coder-Chat-Id, Coder-Tool-Call-Id and Coder-Ancestor-Chat-Ids before proxying, covered by the FilePreviewDropsChatHeaders row in proxy_test.go.
  • open_preview tool description: answered in earlier rounds; nothing new to change.

🤖 Posted by Coder Agents on behalf of @DanielleMaywood.

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

Re-review of 5537640. The regular-file parent and the invalid UTF-8 message are fixed and verified, and Netero accepts the reason for keeping "file does not exist" for other names in a file preview, since a file preview contains only one name. No in-scope findings remain open.

Three items still need a human decision because the author cannot accept them on the project's behalf: the directory-swap SameFile branch in openFile has no test (it needs a race or a test hook); chat and tool-call headers on preview requests must be stripped by #31283; and the open_preview tool description in #31284 must tell the model to publish a directory or a self-contained file. Each needs a ticket or explicit acceptance.

🤖 This review was automatically generated with Coder Agents.

@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch from 5537640 to f85cc0d Compare November 6, 2026 09:37
@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

@DanielleMaywood accepts the untested directory-swap SameFile branch in openFile and the open_preview tool description item without a ticket. The chat and tool-call headers item is not a gap: #31283 strips them before proxying.

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

Re-review of f85cc0d, a rebase onto bf47fc6. The PR diff is identical to 5537640, the six base commits touch none of the packages this PR uses, and the preview tests pass on the new head. No findings.

The three items left for a human decision are settled: the untested directory-swap SameFile branch and the open_preview tool description are accepted without a ticket, and #31283 removes Coder-Chat-Id, Coder-Tool-Call-Id and Coder-Ancestor-Chat-Ids from file-preview requests (coderd/workspaceapps/proxy.go:825-827, FilePreviewDropsChatHeaders in proxy_test.go).

🤖 This review was automatically generated with Coder Agents.

@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch from f85cc0d to 8088000 Compare November 9, 2026 12:52
@DanielleMaywood
DanielleMaywood temporarily deployed to main November 9, 2026 12:52 — with GitHub Actions Inactive
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch from 8088000 to e59b454 Compare November 10, 2026 13:56
@DanielleMaywood
DanielleMaywood temporarily deployed to main November 10, 2026 13:56 — with GitHub Actions Inactive
@linear-code

linear-code Bot commented Nov 11, 2026

Copy link
Copy Markdown

CODAGT-301

…lnet

Add the agentpreview package. POST /api/v0/previews publishes an absolute
HTML file or a directory containing index.html and returns its preview ID.
Publishing a path again keeps its ID and serves the path's current
contents. IDs count up from 1 and last until the agent restarts. The agent
API serves each preview under /api/v0/previews/{id}/. Files are opened
through os.Root with per-component Lstat and SameFile checks, so symlinks,
hidden paths and FIFOs are never served.

Add AgentConn.OpenPreview to the workspace SDK.
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-open-preview-agent branch from e59b454 to 02b9591 Compare November 16, 2026 13:01
@DanielleMaywood
DanielleMaywood temporarily deployed to main November 16, 2026 13:01 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
main — 02b9591e Deployed Nov 16, 2026 by DanielleMaywood via cla #257897
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.

2 participants