Repository navigation
feat: add workspace file upload agent API - #27078
Conversation
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
ba6b5a7 to
b3afdea
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
b3afdea to
fb509f9
Compare
|
@codex review |
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb509f9635
ℹ️ 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".
fb509f9 to
c6b45ec
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Overall LGTM. I'm adding agent comments for issues found during manual and automated review and uat. Nothing is blocking imo, but most of these should be easy to rip through with an agent. The improved heuristics around mime types is nice to have (e.g. reject say 1+mb of text but not images), but that one feels like a follow-up.
The inline comments are spread across the stack at the relevant code; each says roughly how big the fix is. Everything is non-blocking; all five PRs are approved. The links and the inline comments were generated by Coder Agents from the panel review and UAT; the paragraph at the top was written by Scott. |
jscottmiller
left a comment
There was a problem hiding this comment.
Approved. See the summary comment on #27078 and the non-blocking inline follow-ups across the stack.
Approval posted by Coder Agents on Scott's behalf.
jscottmiller
left a comment
There was a problem hiding this comment.
Re-approved after the fix commits. Verified the addressed threads against the code (agent atomic publish, workspace status, normalized references, logging/metric, first-message fallback title, reasoning-effort override, Vitest coverage, archive-409 navigation) and ran the affected Go and Vitest suites; the remaining notes are acceptable as is. The three open follow-up threads are resolved as agreed follow-ups.
Approval posted by Coder Agents on Scott's behalf.

What
Adds a dedicated workspace-agent endpoint,
POST /api/v0/upload-chat-file, that streams a request body into the chat's upload directory~/.coder/chats/<chat-id>/files/<name>, plus the SDK plumbing to call it:coderd/x/chatfiles: upload-name sanitization (SanitizeWorkspaceUploadName), collision suffixes (compound extensions such as.tar.gzstay intact:archive_2.tar.gz), and the shared~/.coder/chats/<id>/filespath layout.agent/agentfiles: the HTTP handler. On Linux/macOS the directory chain is opened withopenat(O_NOFOLLOW), so symlinked path components are rejected. The body streams into a hidden.<name>.upload-<random>temp file and is published under its final name only when complete, vialinkatover the_2,_3, ... collision sequence, so existing files are never overwritten and a half-written file is never visible under its final name. Filesystems without hard links fall back to an exclusive placeholder plusrenameat. Other platforms use an afero-based fallback with the same semantics. Stale temp files older than an hour are swept before each upload, and failures are logged with a structured warning.codersdk/workspacesdk:AgentConn.UploadChatFile+ regeneratedagentconnmock.Why
Coder Agents chat can attach images/text/PDF to prompts, but arbitrary files (zips, datasets, binaries) have nowhere to land where the agent's tools can act on them. This is the agent-side foundation; the coderd route that fronts it is stacked on top.
Design notes:
CODER_AGENT_BLOCK_FILE_TRANSFER. That flag targets SSH-transport file tools (scp/rsync/sftp). Chat uploads are an agent API capability likewrite-fileandedit-files, which already bypass the flag; the interaction is documented in the FAQ.How tested
go test ./agent/agentfiles ./coderd/x/chatfiles ./codersdk/workspacesdk(unit + umask/symlink/collision integration tests).Part of CODAGT-211. Stack: agent API (this PR) -> coderd endpoint -> UI.