mirror of
https://github.com/coder/coder.git
synced 2026-11-25 14:28:37 +08:00
5dde49dffbd02a0adbdefabecedb247cfc8cf5da
2983
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5dde49dffb |
feat: add chat workspace file upload endpoint (#27079)
## What
Adds `POST /api/v2/chats/{chat}/workspace-files`, which streams the
request body to the chat's bound workspace agent and returns the final
path/name/size, plus the `workspace-file-reference` message part type
that carries the uploaded file's metadata through chat messages:
- `coderd/exp_chats.go`: owner-only middleware (chat RBAC update +
reject archived), workspace exec authorization (403/409 like the
existing chat exec paths), agent selection (prefer the chat's bound
agent, else deterministic `agentselect.FindChatAgent`, without
persisting a binding), 30s dial timeout, chat/ancestor tracking headers
on the agent connection, and agent error passthrough (agent HTTP status
preserved, 502 with a generic detail for transport failures; the real
error is logged). Deleted and non-running workspaces get a specific 409
("Workspace is stopped. Start the workspace before uploading files.")
before agent lookup. Each failed upload logs one structured warning, and
`coderd_chat_workspace_upload_total{status}` counts outcomes. The route
shares the files rate limit and documents its 429.
- Input validation: client-supplied `workspace-file-reference` parts
must point inside `/.coder/chats/<chat-id>/files/` with a matching
basename, non-negative size, and a `workspace_file_workspace_id` equal
to the chat's currently bound workspace (the upload response echoes it
as `workspace_id`). References uploaded before a workspace rebind are
rejected instead of silently sending the agent an unreadable path. The
file name must already be in sanitized form
(`SanitizeWorkspaceUploadName(name) == name`), and the cleaned path and
base media type are what gets persisted; message edits share the same
validation. Parts are rejected on chat creation (no chat ID exists yet).
- `coderd/x/chatd/chatprompt`: references render into the prompt as text
only, `[workspace file: <name> (<size>) at <path>]`; file bytes never
reach the LLM. Title derivation (`TitleText`) uses the bare file name,
so fallback titles carry no internal marker.
- `codersdk`: part-type constants/fields,
`ChatMessageWorkspaceFileReference` builder, and
`Client.UploadChatWorkspaceFile` (RFC 5987 filename in
`Content-Disposition`).
No DB migration: parts persist as JSON in `chat_messages.content`.
## Why
Bridges chat and the workspace filesystem for CODAGT-211: users drop a
file in chat, the bytes land where the agent's tools can operate on
them, and the model learns the path from the reference part.
## How tested
- `go test ./coderd -run 'WorkspaceFile|ChatInput|UploadChat'` including
an integration test that runs a real in-memory agent, uploads through
the coderd route, verifies bytes on disk, and exercises collision
suffixes.
- `go test ./codersdk ./coderd/x/chatd/...`, `make gen`
(swagger/types/docs), `make lint`.
- Rebased onto main 2026-09-21: the chat API moved from
`/api/experimental` to `/api/v2`, so the route is registered in
`coderd/chat_routes.go` and the SDK method lives on `codersdk.Client`.
## Follow-ups
- The files rate limit counts requests, not bytes or concurrency;
whether this route should use a per-user concurrency cap instead, and
whether the new-chat page should keep partial successes on a 429, is
still open
([CODAGT-1171](https://linear.app/codercom/issue/CODAGT-1171)).
Part of CODAGT-211. Stack: agent API -> coderd endpoint (this PR) -> UI.
> This PR was authored by Mux (AI) working on Mike's behalf.
|
||
|
|
b55f721f24 |
fix: apply user-supplied AWS Bedrock API keys instead of dropping them (#28724)
## Bug
Under `/agents/settings/api-keys`, a personal API key saved for a
Bedrock provider never took effect. AI Gateway forwarded the saved
value, but the Bedrock interceptors re-signed every request with the
deployment's AWS credentials (SigV4), overwriting the `Authorization`
header. The key was silently dropped, so users were unknowingly still
billed to the administrator's AWS account with no way to bring their own
credentials.
## Fix
Apply the user's Bedrock key instead of discarding it. AWS Bedrock API
keys are bearer tokens (`Authorization: Bearer <key>`), so when a
personal key is present AI Gateway now sends it as a bearer token and
skips SigV4 signing. This covers every Bedrock route:
- **InvokeModel** (`/v1/messages`): applies the same wire transform as
the signed path (`/model/{model}/invoke[-with-response-stream]`,
`anthropic_version`, `anthropic-beta` → body, `model`/`stream`
stripping) but sets a bearer `Authorization` header instead of signing.
- **Mantle** (`/v1/messages`, `/v1/responses`, `/v1/chat/completions`):
passthrough with a bearer `Authorization` header instead of signing.
The bearer paths resolve no deployment AWS credentials, so BYOK works
even where the deployment has none. Requests without a personal key keep
the existing SigV4 behavior.
This also reverts the earlier interim guard that hid the key field and
rejected Bedrock key upserts: the field is shown again and the API
accepts the keys, because they now work.
<details>
<summary>Implementation notes</summary>
**Gateway (`aibridge`)**
- `messages.newMessagesService` detects BYOK on a Bedrock interception
and routes it through bearer-token option builders instead of the SigV4
path.
- `withBedrockInvokeModelBYOKOptions` /
`bedrockInvokeModelBearerMiddleware` reimplement the Anthropic SDK's
`bedrock.WithConfig` wire transform without signing, because that helper
couples the transform with SigV4 and would resolve deployment
credentials a BYOK request must not depend on.
- `bedrocksig.BearerMiddleware` is shared by the Messages, Responses,
and chat-completions interceptors for the Mantle passthrough; each
installs it in place of `SignMiddleware` when the credential is BYOK.
- Streaming decoding is unchanged: the Bedrock event-stream decoder is
registered by the SDK package's `init` and selected by response
content-type, independent of `bedrock.WithConfig`.
**coderd / SDK / frontend / docs**
- Removed the interim guard and `supports_user_api_key` capability flag;
restored the API-key field for Bedrock providers.
- Docs describe the Bedrock personal key as an AWS Bedrock API key
forwarded as a bearer token for every model family Bedrock serves.
**Tests**
- Unit: bearer middleware transform + auth for InvokeModel; shared
bearer middleware; option-builder validation.
- Integration: end-to-end through the bridge for InvokeModel, Mantle
Messages, Mantle Responses, and Mantle chat completions, asserting
`Authorization: Bearer <key>`, no `X-Amz-*` headers, correct upstream
path/model, no `X-Api-Key` leak, and that InvokeModel streaming decodes
real AWS binary event-stream frames.
- coderd: Bedrock key upserts succeed.
</details>
Closes
[CODAGT-699](https://linear.app/codercom/issue/CODAGT-699/bedrock-provider-settings-for-byok-only-expose-one-api-key).
---
*This PR was generated by Coder Agents on behalf of @f0ssel.*
|
||
|
|
282365b23a | feat: report clicks on the workspace build debug action to telemetry (#29853) | ||
|
|
aa87166c2f | docs: fix step order and values.yaml in Azure App Gateway guide (#29927) | ||
|
|
4b3c2b3ca3 |
docs: remove the User spend page from AI Gateway docs (#29844)
## Description Remove the **User spend** page from the AI Gateway and spend management docs, since the page is hidden from the sidebar and marked experimental for this release. The removed content is commented out with a TODO so it can be restored once the page leaves experimental. Related to [internal Slack thread](https://codercom.slack.com/archives/C04M9CNGHGF/p1790190171687059?thread_ts=1790190121.005749&cid=C04M9CNGHGF). ## Changes - Comment out the **User spend** page in the dashboard visibility table and spend details lists in `cost-controls.md` and `spend-management.md`. > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
46ccaf3764 |
chore: mark organization AI spend users endpoint as experimental (#29842)
## Description
Move `GET /organizations/{organization}/ai/spend/users` under
`/api/experimental` so the per-user spend report is not part of the
stable API for this release. The endpoint behavior is unchanged.
Related to [internal Slack
thread](https://codercom.slack.com/archives/C04M9CNGHGF/p1790190171687059?thread_ts=1790190121.005749&cid=C04M9CNGHGF).
## Changes
- Register the route on the experimental handler and mark it
`@x-apidocgen {"skip": true}`, which removes it from the generated API
reference.
- Move the Go SDK method to `ExperimentalClient` and the frontend method
to `API.experimental`.
- Drop the docs link to the removed API reference section. The link is
commented out with a TODO so it can be restored later.
User-facing docs for the **User spend** page are updated upstack in
#29844.
> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
|
||
|
|
9afdea4808 |
docs(docs): document RPM install on RHEL-family Linux (#29295)
## Summary Coder ships `.rpm` assets with every release and `install.sh` routes the RHEL family to `install_rpm()`, but no public page said so. The only page that named RHEL was the uninstall page. This adds an RPM install page for the control plane. New page `docs/install/server/rpm.md`: - Supported distribution matrix for RHEL 8/9/10, Rocky, AlmaLinux, CentOS Stream, Amazon Linux, Fedora, and openSUSE, with the `ID`/`ID_LIKE` detection that makes derivatives work. - Install tabs for the install script, `dnf install`, and `rpm -U`. - What the package lays down: `/usr/bin/coder`, `/etc/coder.d/coder.env`, `coder.service`, `coder-workspace-proxy.service`, and the unprivileged `coder` user. - Configure-then-start ordering, because `coder.service` carries `ConditionFileNotEmpty=/etc/coder.d/coder.env` and won't start against an empty config. - SELinux caveat for Docker/Podman inside workspaces on RHEL nodes, linking the existing guidance instead of duplicating it. - Iron Bank UBI9-minimal pointer for hardened environments, scoped correctly as a container image rather than an RPM path. Supporting edits: manifest entry under "3. Install the control plane" between OpenShift and Cloud Providers, a row in the platform table on `install/server/index.md`, and a pointer from `install/cli.md`. ## Placement The page sits at `docs/install/server/rpm.md`, as a sibling of Docker, Kubernetes, Rancher, and OpenShift, rather than under community install methods: RPMs are officially built and shipped, not an unofficial method. It is a control-plane deployment page, not CLI download content, so it is out of scope for the CLI-retirement work. ## Verification Claims on the page were checked against real RHEL-family images, not just the install script: | Check | Method | Result | |-------|--------|--------| | `ID` and `ID_LIKE` per distribution | `docker run <image> sh -c '. /etc/os-release; ...'` across UBI 8/9/10, Rocky 9, Alma 9/10, CentOS Stream 9/10, Amazon Linux 2/2023, Fedora, openSUSE Leap and Tumbleweed | Every RHEL-family image lists `fedora` in `ID_LIKE`; both openSUSE variants list `opensuse`. Matches the `distro()` branch in `install.sh` | | `dnf install ./coder_*.rpm` | Rocky Linux 9 container | Installs cleanly | | Package contents | `rpm -ql coder` | `/usr/bin/coder`, `/etc/coder.d/coder.env`, `coder.service`, `coder-workspace-proxy.service` | | Service account and start condition | Installed unit file | Runs as `coder:coder`; `ConditionFileNotEmpty=/etc/coder.d/coder.env` | | Architectures | `.github/workflows/release.yaml` | `amd64`, `armv7`, `arm64` | Not verified: `systemctl enable --now coder` against a live database, since the containers used for verification have no init system. The `systemctl is-active` output on the page is standard systemd output, flagged here for the reviewer. Lint: `make lint/markdown`, `make lint/emdash`, and `make lint/prose` all clean on the changed files; `pnpm run format-docs` applied. <details> <summary>Implementation plan and decision log</summary> ### Style guide application The first revision of this page was drafted from sibling install pages rather than from the style guide, and was rewritten against [`docs/.style/content-guidelines.md`](https://github.com/coder/coder/blob/main/docs/.style/content-guidelines.md) and the prose style guide. What changed: one sentence per source line, declared audience and outcome in the opening paragraph, numbered procedures with one instruction per step and conditions stated first, `refer to` instead of `see`, `sh` fences instead of `shell`, H3 tab headings, non-breaking space between number and unit, and `Learn more` instead of `Next steps`. ### Decisions - **No version numbers or FIPS certification claims for Iron Bank.** The tags in `scripts/ironbank/hardening_manifest.yaml` are stale (`0.15.3`); documenting them would re-create the drift. The page links the registry and names the UBI9-minimal base only. - **Iron Bank framed as a container path.** It is a container image, so the page routes readers to Kubernetes/OpenShift rather than implying it is an alternative to the RPM. - **Dropped an unverified SELinux claim.** An earlier draft asserted that the control plane runs under enforcing mode with no policy changes. That was not tested, so it is gone. The section now covers only the workspace container-runtime case, which links to existing verified guidance. - **`ID_LIKE` values kept out of the table.** They vary by version (RHEL 8/9 report `fedora`, RHEL 10 reports `centos fedora`), so the table lists `ID` and the prose states the invariant the install script actually matches on. - **Minimal edit to `install/cli.md`.** That file is slated for deletion in the Install restructure, so it gets a pointer and nothing more. ### Rebase onto the install spine restructure The install spine restructure landed on `main` while this PR was open and removed the install-method tabs on `install/index.md` that the first revision pointed from. The branch was rebased and squashed onto it: the page moved from `docs/install/rpm.md` to `docs/install/server/rpm.md`, every relative link was repointed at the new locations (`../plan/sizing/index.md`, `../prepare/airgap.md`, `../operate/upgrade.md`, `../operate/uninstall.md`, `./kubernetes/index.md`), the install script snippet picked up the standardized `curl -fsSL` flags, and discovery moved from the removed `install/index.md` tabs to the platform table on `install/server/index.md`. The prose is otherwise unchanged. ### Follow-ups tracked elsewhere The install spine has no other bare-host or Linux-package option under platforms; every other entry is a container platform or a cloud VM. Open question recorded on the IA proposal: whether this generalizes to a single "Linux host (system packages)" page covering `.deb` and `.apk` too. </details> --- Linear: [DOCS-886](https://linear.app/codercom/issue/DOCS-886/document-support-for-running-coder-on-red-hat-linux) 🤖 Generated with Coder Agents on behalf of @nickvigilante. |
||
|
|
702b13112d | feat: add Debug with Coder Agents action for failed workspace builds (#29811) | ||
|
|
f64ccfb836 |
feat: add experimental inline MCP servers (#29546)
Closes CODAGT-1131 Fifth PR in the inline MCP servers stack, on top of #29520. A chat owner can now declare MCP servers by URL and headers on their own chat, and chatd connects to them every turn alongside the org-configured ones. They go in a new `inline_mcp_servers` field on `POST /api/v2/chats` and `POST /api/v2/chats/{chat}/messages`, which replaces the whole set (omit to keep, `[]` to remove). Root chats only. `GET /api/v2/chats/{chat}` returns them, with the URL blanked for non-owners and header values never returned. Subagents only get servers marked `allow_in_subagents`, a root chat in explore mode gets none, and a root chat in plan mode gets all of them. URLs must be `https`, or `http` to an IP literal in `CODER_MCP_ALLOWED_PRIVATE_CIDRS`. Header values have no minimum length, so anything under the redactor's 8 byte floor from #29518 is accepted but not redacted, which the docs call out. Every cap is exported from `codersdk`. It's behind the `chat-inline-mcp-servers` experiment, and the `--disable-chat-caller-supplied-tools` kill switch from #29466 covers it too. With either off, declaring servers gets a 403 and existing chats stop connecting to theirs, but `[]` still works so a client can detach. Load failures show up in the chat debug panel as failed connections, as do org servers with an invalid config. Docs are hand-written in `mcp-servers.md`. |
||
|
|
1c974608b1 |
feat: rotate, decrypt, and delete encrypted chat_mcp_servers headers (#29520)
Relates to #25381 `chat_mcp_servers.headers_key_id` has a foreign key to `dbcrypt_keys(active_key_digest)`, but `dbcrypt rotate`, `decrypt` and `delete` didn't know about the table. `rotate` finishes by revoking every old key, so an encrypted header row would fail that revoke with an FK violation, which is the same class of bug as #25381. This PR adds `chat_mcp_servers` to all three commands. `rotate` re-encrypts under the new key (and encrypts plaintext rows with no key ID, like `gitsshkeys`), `decrypt` writes the plaintext back and clears the key ID, and `delete` removes the encrypted rows outright, like `user_secrets`, since a server without its headers can't authenticate anyway. Rows with `{}` headers are never encrypted, so they're left alone. The org-level `mcp_server_configs` gap is still tracked at #25381. I've stacked this on the `mcpclient` PR, though it only depends on the `chat_mcp_servers` table PR, as `gh stack` is linear. Part of CODAGT-1131 |
||
|
|
c1af0793e5 |
feat: add caller-supplied tools kill switch for chats (#29466)
This is the first PR in a stack that adds experimental support for attaching MCP servers to a chat when it's created, and then deprecates `unsafe_dynamic_tools` in favour of them. Both are "caller-supplied tools", i.e. tools the client hands to coderd at chat creation rather than tools an admin has configured, so we want a single switch admins can use to turn all of them off. This PR adds that switch: `--disable-chat-caller-supplied-tools` (`CODER_DISABLE_CHAT_CALLER_SUPPLIED_TOOLS`). It follows the existing `disable-*` deployment flag pattern (`--disable-chat-sharing` etc.), so there's no new API route and it's independent of any experiment. When set, `POST /api/v2/chats` returns a `403` if the request includes `unsafe_dynamic_tools`, and chats that already have dynamic tools run without them; a call to one gets a tool error result and the model just continues. Later in the stack, chat-attached MCP servers are gated behind the same flag. It's unset by default, so nothing changes unless you opt in. Part of CODAGT-1131 |
||
|
|
2de1f8b111 |
feat: link promoted chat messages to their queue entry (#29859)
Signed-off-by: Thomas Kosiewski <tk@coder.com> |
||
|
|
7c74fa3548 |
feat: add workspace file upload agent API (#27078)
## 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.gz` stay intact: `archive_2.tar.gz`), and the shared `~/.coder/chats/<id>/files` path layout. - `agent/agentfiles`: the HTTP handler. On Linux/macOS the directory chain is opened with `openat(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, via `linkat` over 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 plus `renameat`. 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` + regenerated `agentconnmock`. ## 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: - There is deliberately no size cap; the resource profile matches existing SSH/WebSocket proxying, and client cancellation aborts the stream (a failed write removes the temp file, so no partial files remain). Because the agent HTTP server uses fixed 20 s read/write timeouts, the handler pushes both deadlines forward on every received chunk, so a slow upload only fails after a 20 s stall. If the connection does not support deadline changes, the agent logs one warning per request. - This endpoint is not gated by `CODER_AGENT_BLOCK_FILE_TRANSFER`. That flag targets SSH-transport file tools (scp/rsync/sftp). Chat uploads are an agent API capability like `write-file` and `edit-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). - UAT on a dogfood-style deployment (2026-09-21): uploads longer than 20 s went from 502 to 201 once the workspace agent was restarted on this build; a coderd restart alone keeps the old agent running, so the per-chunk deadline extension needs the agent rolled (older agents get the 409 "Restart the workspace" from #27079). Part of CODAGT-211. Stack: agent API (this PR) -> coderd endpoint -> UI. > This PR was authored by Mux (AI) working on Mike's behalf. |
||
|
|
37295547b8 | feat: add default model picker to Coder Agents settings (#29470) | ||
|
|
5393f9d5f4 |
feat: stream advisor reasoning in tool cards (#29742)
Show the advisor’s live reasoning under **Thinking**, separately from **Advice**, in one tool card with the original question and title. Keep nested reasoning out of the parent assistant’s reasoning and saved chat history. Clear both live channels on retry and remove transient reasoning when the call finishes. Cover streaming, retry, error, and interrupted-output behavior with regression tests, and regenerate the SDK and API schemas. This also changes a shared seam for every tool, not only the advisor: live output for a tool call that is already saved now completes that call's card, and the separate live-row card for it is removed. Remote UAT passed on `a39bbe4c21`: deterministic provider tests covered streamed reasoning, retry, errors, and refresh; a real-provider run confirmed advice streaming and card association. The real model did not emit reasoning. The intermittent, unattributed React console warning is tracked in #29741. <details> <summary>Remote UAT evidence (deterministic provider)</summary>  Streaming, completion, and refresh: https://github.com/user-attachments/assets/dd1f3a24-a365-40c8-a1d9-b78cd17ef4c5 </details> --- <details> <summary>📋 Implementation Plan</summary> # Plan: Stream advisor reasoning in Coder Agents ## Goal and delivery boundary Show nested advisor reasoning as live **Thinking** in its advisor tool card. Keep it separate from live **Advice**, normal parent-assistant reasoning, and the final persisted advisor result. Deliver one focused PR: optional SDK field, nested publisher, transient frontend state, existing card rendering, generated API artifacts, and regression tests. Do not add provider features, persistence, new stream event types, UI redesigns, or unrelated cleanup. The implementation already exists and has been reconciled with current main. The implement-flow implementation phase is an acceptance audit, not a rewrite. Preserve correct behavior and current architecture. Change only demonstrated gaps. A no-op implementation result is valid; do not manufacture an empty commit. ## Current integration points 1. `codersdk/chats.go`: add optional `ReasoningDelta string` with `json:"reasoning_delta,omitempty" variants:"tool-result?"`. Preserve it in `StripInternal` alongside other live fields. Register the same NUL-encoding policy as `ResultDelta` in `chatprompt` so the SDK field coverage and round-trip tests remain complete. Regenerate SDK types and API documentation with `make gen`. 2. `coderd/x/chatd/chatadvisor/runner.go`: route assistant text and reasoning through separate optional callbacks on `RunAdvisorOptions`. Install the publisher if either callback exists. Preserve empty-delta and role guards. Use current `GenerateAssistant` and `chatretry.Retry`. Rename the reset callback to `OnLiveOutputReset` because it clears advice and reasoning. Keep `extractAdvisorText` text-only and existing budget/refund behavior. 3. `coderd/x/chatd/chatadvisor/tool.go`: use the current context-injected `MessagePartPublisherFromContext`; do not reintroduce the old ToolOptions publishing callbacks or chatd.go wiring. Preserve the missing-publisher error and the nonempty tool-call-ID guard. Publish reasoning as role `tool`, part type `tool-result`, tool name `advisor`, matching `tool_call_id`, and `reasoning_delta`. Use existing `result_reset` to reset both live channels on retry. 4. `site/src/pages/AgentsPage/components/ChatConversation/streamState.ts` and `types.ts`: retain a single transient reasoning string. Append deltas exactly as plain text, never JSON-parse or trim them during accumulation. Reasoning makes the tool streaming. An empty `result_delta` must not swallow a nonempty `reasoning_delta`. Reset removes the entry. A final result or `is_error` clears reasoning and streaming state. Pass reasoning through `buildStreamTools` into `MergedTool`. 5. `MessageBlocks.tsx` and `ChatElements/tools/Tool.tsx`: forward reasoning at both current Tool instantiation paths and through AdvisorRenderer. Do not restore the old ConversationTimeline rendering implementation. 6. `AdvisorTool.tsx`: use current `ToolCall.Root`, `ScrollArea`, `Response`, and semantic theme tokens. Display Thinking only when running and trimmed reasoning is nonempty. Display live advice separately when present. Keep completed advice, empty/loading, limit, and error behavior unchanged. Reasoning-only running cards must not show the empty-advice fallback. Do not restore removed MUI dependencies. 7. `messageParsing.ts`, `streamState.ts`, and `ChatPageContent.tsx`: associate live tool results with matching durable tool calls. Preserve the invocation's question, intent, and metadata. A durable final result remains authoritative, including explicit null results. Remove only the overlaid result and its block from the separate live row; keep unrelated results and live call/result pairs unchanged. This closes the durable-call/live-result split found during integration testing. ## Acceptance criteria 1. Nested reasoning reaches the dedicated runner callback and the client as tool-scoped live output for the same advisor call as advice. 2. Advisor reasoning is not parent assistant reasoning, final advice, input to the parent's continuation, or persisted chat history. 3. Retry clears stale reasoning and advice before fresh output. Final success and bare error clear transient reasoning. 4. Raw whitespace and JSON-looking reasoning survive concatenation unchanged. Empty advice deltas do not hide reasoning. 5. Reasoning-only and reasoning-plus-advice states render in exactly one existing advisor card per invocation, retaining its question and intent title when the call is already durable. Completed cards never display transient thinking, even if handed a stale prop. Other tool and normal assistant reasoning behavior is unchanged. 6. Generated artifacts match source. Final candidate passes relevant Go tests, frontend tests, stories, typecheck, lint, and pre-commit checks, or has explicit verified blockers. Old evidence is not final-candidate evidence. ## Phases and quality gates 1. Reconcile existing work onto current main while retaining a recovery snapshot. Remove obsolete workarounds, not current upstream behavior. Gate: no conflicts, focused diff, preserved original work. 2. Audit regressions at the existing runner, tool publisher, parent-chat stream, and frontend state boundaries. Add one missing behavior at a time. Reproduce failures before fixes. Gate: failing tests demonstrate the defect and pass after the smallest fix. 3. Simplify only within this feature. Use one reasoning string and existing publishers/components. Gate: tests remain green, generated diff is scoped, FE1 through FE10 pass. 4. Commit the candidate with repository hooks enabled, then run the packaged implement-flow audit, validation, remote UAT, and polish stages. Gate: readyForPr and verified remote evidence for the exact final candidate. If polish changes HEAD, refresh the UAT evidence for that SHA. 5. Create a reviewable PR and complete green CI plus bounded Codex review on its exact head. Get one fresh independent readiness recommendation. Gate: no unresolved review threads, required evidence recorded, and a justified readiness decision. Do not merge. ## Regression coverage - Runner: reasoning and advice callbacks remain separate; final advice and usage count stay correct. Retain existing retry/refund tests. - Tool: all reasoning/advice events carry role tool, type tool-result, advisor name, and the invocation ID. Without an ID, emit no live output. Retry emits stale reasoning/advice, reset, then fresh reasoning/advice. - Chatd: extend `TestAdvisorHappyPath_RootChat` with deterministic `openai-compat` reasoning chunks. Hold the nested response until the live subscriber captures expected reasoning and advice. Observe the complete relevant event set, assert no parent-assistant reasoning, and check continuation and persisted content contain no advisor reasoning. Extend only the test fixture needed to emit `reasoning_content`; do not change production adapters. - Frontend: extend streamState tests for exact accumulation, whitespace, JSON-looking text, reasoning-only streaming, empty advice delta, reset, final result, and bare error. - Durable/live integration: replay a durable assistant tool call followed by live reasoning and advice results. Assert the durable card receives both channels and the live row no longer owns the same result or block. Preserve unrelated IDs and live calls. Clear the overlay on reset; prefer durable final results, including null. Cover the complete display path with a real-store ChatPageContent story. - Visual stories: running reasoning-only, running reasoning-plus-advice, and completed with stale reasoning. Keep existing limit/error stories. Stories set up visual states without assertions, following current FE1. ## Validation Run targeted checks while iterating, then the broader gates: ```sh umask 022 go test ./coderd/x/chatd/chatadvisor ./coderd/x/chatd ./codersdk -run 'Advisor|ChatMessagePart|ChatStream' -count=1 pnpm -C site exec vitest run --project=unit src/pages/AgentsPage/components/ChatConversation/streamState.test.ts pnpm -C site exec vitest run --project=storybook src/pages/AgentsPage/components/ChatElements/tools/AdvisorTool.stories.tsx make gen make fmt make test RUN='Advisor|ChatMessagePart|ChatStream' pnpm -C site lint:types pnpm -C site check pnpm -C site lint make lint make pre-commit ``` Keep native exit codes and logs. Do not hide a failed check, bypass hooks, or fix unrelated baseline problems in this PR. Stage intentional generated/formatting changes before pre-commit's clean-diff checks. Report exact blockers and risks. ## Remote dogfood UAT Use the coder-agents-uat skill and an independent critical Coder Agent, not a local-only substitute. Push only the named feature branch. Test its exact SHA in an isolated workspace/deployment without changing shared model credentials or configuration. Use an isolated user, chat, and model config. Setup: 1. Read the branch diff and UAT scope. Record the branch and SHA. 2. Start Coder with the repository-supported `./scripts/develop.sh --port-offset` (or `CODER_DEV_PORT_OFFSET=true`). Do not replace it with a manual server launch. Record effective API/UI URLs and wait for readiness. 3. Prefer a deterministic mock OpenAI-compatible provider that emits advisor reasoning and advice separately, and a retry after stale output. Use only isolated configuration. Never print or capture secrets. 4. Start a named agent-browser session. Attempt `agent-browser skills get core`; record the installed version/fallback if unavailable. Record video before the scenario, then install any stream capture since recording may recreate browser context. Scenario: 1. Create a normal advisor-enabled root chat. Do not use Plan Mode: current product behavior excludes the advisor there. 2. Capture the initial state. Prompt the parent to call advisor. 3. While the tool is running, capture reasoning-only and reasoning-plus-advice states. Verify exactly one advisor card per tool-call ID, with its original question and intent title. Verify Thinking and Advice stay separate inside that card and the parent thinking area does not receive nested reasoning. 4. Capture the relevant WebSocket event set. Verify role tool, type tool-result, advisor name, matching tool-call ID, and reasoning_delta. An advisor-filtered subset is insufficient to prove absence of parent reasoning. 5. Let the advisor finish. Verify final advice remains, Thinking disappears, and refresh does not restore transient reasoning. 6. Exercise retry with the deterministic provider if feasible. Verify stale reasoning/advice clears before fresh output. If not exercised, record the omission and remaining test evidence; do not claim it was dogfooded. 7. Capture console errors before and after. Inspect the screenshots and semantic video frames, not only successful media decoding. Required evidence: exact tested SHA; remote chat URL; setup command and effective URLs; non-secret provider/model names; before/thinking/thinking-plus-advice/completed screenshots; a short streaming video; complete relevant stream evidence; refresh and retry observations; console results; explicit omissions; and owned-resource cleanup receipts. Keep evidence under `.mux-uat/round-<n>/`, excluded from source commits. When publishing evidence to GitHub, use native `gh --attach`, not cookie-based uploads or gh-image. Cleanup: stop only owned develop/provider processes and named browser sessions. Do not use unscoped process sweeps, shared database resets, or `agent-browser close --all`. </details> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `coder:openai/gpt-6-astra` • Thinking: `xhigh`_ --------- Signed-off-by: Thomas Kosiewski <tk@coder.com> |
||
|
|
b70702d50d |
docs: split OAuth2 provider page (#29778)
Split the OAuth2 provider documentation into seven focused pages. - Update navigation and inbound links, preserving compatibility anchors for moved headings. - Correct `DELETE /oauth2/tokens` documentation: it revokes only the calling user's tokens and codes, not every user's for the application. - Clarify client authentication and app creation, mention PKCE, and update callback UI references. - Remove contributor-only instructions and the feature-specific example from feature-stage docs; restore release and upgrade guidance in `security.md`. - Standardize formatting and verify internal anchors. Markdown and em-dash linting pass. Refs PLAT-659. |
||
|
|
3d30e201b5 |
docs: move contributor guides out of the published docs into the repo (#29751)
## Merge order Merge first; then republish the docs; then coder/coder.com#1100 (the redirects). ## Summary The nine pages under `docs/about/contributing/` are for people working in this repository, not for Coder users or administrators, so they leave the published documentation. The repository becomes their canonical home. Until now the root `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md` were two-line stubs that only linked to the docs site, so contributors on GitHub were bounced out to read them. A companion PR in `coder/coder.com` adds redirects from every retired `/docs/about/contributing/*` URL to the new GitHub location. It must merge only after this PR has merged and the docs have republished. ## Changes | Old path | New path | | -- | -- | | `docs/about/contributing/CONTRIBUTING.md` | `CONTRIBUTING.md` (replaces the stub) | | `docs/about/contributing/CODE_OF_CONDUCT.md` | `CODE_OF_CONDUCT.md` (replaces the stub) | | `docs/about/contributing/SECURITY.md` | deleted; the root `SECURITY.md` already holds the policy | | `docs/about/contributing/AI_CONTRIBUTING.md` | `contributing/AI_CONTRIBUTING.md` | | `docs/about/contributing/backend.md` | `contributing/backend.md` | | `docs/about/contributing/frontend.md` | `contributing/frontend.md` | | `docs/about/contributing/modules.md` | `contributing/modules.md` | | `docs/about/contributing/templates.md` | `contributing/templates.md` | | `docs/about/contributing/documentation.md` | `contributing/documentation.md` (see note below) | For every moved file: the docs front matter is stripped and its `title` becomes the H1, relative links are rewritten for the new depth (`../../../foo` becomes `./foo` at the root and `../foo` under `contributing/`; the two links into `docs/admin/` become `../docs/admin/...`), and the docs-only `<div class="tabs">` wrapper in `CONTRIBUTING.md` is removed. `CONTRIBUTING.md` gains a short intro that links the code of conduct, the security policy and the area guides, since GitHub only auto-surfaces the root files. `docs/manifest.json` loses the About → Contributing group and `docs/images/icons/contributing.svg`, which only that group used. Inbound references updated: - `README.md`: contribution guide link now points at `CONTRIBUTING.md` on GitHub. - `docs/tutorials/example-guide.md` and `docs/install/releases/feature-stages.md`: link to `contributing/documentation.md` on GitHub, since a docs page cannot link to a repo-only file. - `docs/.style/style-guide/README.md`: the "Relationship to" section names the new location. - `scripts/docshtmlcheck/main.go`: both the package comment and the user-facing error string name `contributing/documentation.md`. - `scripts/docshtmlcheck/README.md`: relative link to the new location. - `coderd/database/migrations/migrate_test.go`: `t.Log` link now points at `contributing/backend.md#database-fixtures-for-testing-migrations`. - `.github/pull_request_template.md`: AI contribution guidelines link. - `.github/workflows/contrib.yaml`: commit-message guidelines link in the PR title check. - `.github/workflows/test-docs-preview-mapper.sh`: the mapper test case that used `docs/about/contributing/CONTRIBUTING.md` now uses `docs/admin/security/audit-logs.md`. - `.claude/docs/{ARCHITECTURE,PR_STYLE_GUIDE,WORKFLOWS,DOCS_STYLE_GUIDE}.md`: links to `CONTRIBUTING.md`. `git grep about/contributing` is empty after this change. `CODEOWNERS` had no entry for the old paths. Note on `documentation.md`: it is docs-authoring guidance and is parked in `contributing/` for now. Folding it into `docs/.style/` is tracked separately and is deliberately not attempted here. ## Testing - `go run ./scripts/docshtmlcheck` over `docs/`, and again over `contributing/`, `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md`: clean. - `go vet ./scripts/docshtmlcheck/...` and `go test ./scripts/docshtmlcheck/...`: 47 tests pass. - `go vet ./coderd/database/migrations/...`: clean. `go test` for that package fails to link on this machine (`tailscale.com/tstime/mono: invalid reference to runtime.nanotime1`) identically on unmodified `main`, so it is a local toolchain issue and not exercised here; the change is a string in a `t.Log`. - `pnpm check-docs` (markdownlint-cli2 and markdown-table-formatter over `docs/`, `.claude/docs/`, root `*.md`): 495 files, 0 errors. The same two tools over `contributing/*.md`: 0 errors. - Every relative link in the eight moved files resolves to an existing path (scripted check). - `bash .github/workflows/test-docs-preview-mapper.sh`: the changed `assert_maps_to` case passes; the six `resolve_ref`/`pages_for_image` failures it reports are identical on unmodified `main` on macOS. Linear: [DOCS-975](https://linear.app/codercom/issue/DOCS-975) --- 🤖 Built with AI assistance. |
||
|
|
d7b6528d7e |
docs: cap the config reference TOC and drop the Dangerous emoji (#29857)
## Merge order Standalone; no dependency on the other DOCS-977 PR (task-list checkboxes). ## Summary Tracy and Ian flagged the mixed checkbox/emoji styling in the docs (Slack thread linked from DOCS-977), including the `⚠️ Dangerous` heading that `scripts/configdocgen` generates from `codersdk.DeploymentValues`. The generated configuration reference also has around 130 `h3` headings, which makes its "On this page" list unreadable. This PR changes only the generator, `scripts/configdocgen`, and regenerates `docs/admin/setup/configuration-reference.md` from it. ## Design or Fix - Emit `toc_depth: 2` frontmatter at the top of the generated page, before the `<!-- DO NOT EDIT -->` comment. docs-engine's sync (`packages/docs-build/src/sync.ts`) reads a page's own frontmatter before stripping it, so this caps the on-page TOC at h2 without any docs-engine change. - Strip any leading emoji or symbol from generated section headings (`stripLeadingSymbol`), so the Dangerous heading reads "Dangerous" instead of "⚠️ Dangerous". `sectionRank`'s "Dangerous last" ordering still keys off the raw serpent group name, so ordering is unaffected. - Render a GitHub `[!CAUTION]` alert directly under the Dangerous heading, using the group's own codersdk description when it has one, otherwise a short fallback ("These options can break your deployment or weaken its security..."). The `⚠️ Dangerous` group name in `codersdk/deployment.go` is unchanged, because the CLI and other output use it. ## Testing - `go test ./scripts/configdocgen/...` — 45 passed (7 new/updated cases: `TestStripLeadingSymbol`, `TestRenderDangerousWithDescription`, and updated `TestRenderPipeline` assertions for the stripped heading, the Caution alert, and its position between the heading and the first option). - `go vet ./scripts/configdocgen/...` and `gofmt -l scripts/configdocgen/*.go` — clean. - `make docs/admin/setup/configuration-reference.md` — regenerated the page (never hand-edited); this also runs `markdownlint-cli2 --fix` and `markdown-table-formatter` as part of the make target, both clean. - `go run ./scripts/docshtmlcheck` — clean. - Verified with a small Node script against docs-engine's built `parseFrontmatter`/`extractTitle` (from `packages/docs-transforms/dist/transform.js`, at the commit that introduced `toc_depth` support) that a page shaped like the regenerated one — `toc_depth: 2` frontmatter followed by the `<!-- DO NOT EDIT -->` comment and then the `# Configuration reference` H1 — parses `toc_depth: 2` and the title correctly. ## QA Confirmed via the docs-engine sync parser directly (see Testing) that `toc_depth: 2` is picked up correctly from this file shape. I did not spin up docs-engine's dev server against this worktree: my local docs-engine checkout is behind `origin/main` by several commits including the one that added `toc_depth` support, so a faithful local preview would first need a docs-engine rebuild against `origin/main`. Given the direct parser verification above already confirms the mechanism, I judged the full dev-server rebuild too heavy for the marginal confidence gained and skipped it. Expected rendering, based on the diff and docs-engine's documented `toc_depth` behavior: - The "On this page" TOC lists only h2 sections (General, Dangerous, and the rest), not the ~130 option h3s. - The Dangerous section renders as a plain "Dangerous" heading, followed immediately by a Caution callout, with no emoji. ## Upstream No. This is Coder product documentation generation (`codersdk`-driven), not a Fumadocs engine change. Linear: [DOCS-977](https://linear.app/codercom/issue/DOCS-977/docs-replace-emoji-checkboxes-and-emoji-headings-with-one-icon-style) --- 🤖 Built with AI assistance. |
||
|
|
99a3425333 |
fix: advertise install.sh with curl -fsSL everywhere (#29801)
## Summary The install one-liner is advertised as `curl -L` in most docs pages, the README, and the CLI's default version-mismatch hint, while `install.sh` itself and the deployment-local hint use `curl -fsSL`. Without `-f`, curl writes an HTTP error body to stdout, and the one-liner pipes that error page into `sh`. This PR standardizes every `install.sh` invocation on `-fsSL` so a failed download fails closed. ## Changes - Docs: `install/cli.md`, `install/operate/upgrade.md` (twice), `get-started/index.md`, `start/local-deploy.md`, `install/operate/provisioners/index.md`, `admin/templates/managing-templates/change-management.md` (twice), `user-guides/workspace-access/zed.md`, and `README.md`. - CLI: `defaultUpgradeMessage` in `cli/root.go` now prints `curl -fsSL`, matching the deployment-local branch in the same function. - `codersdk/deployment.go`: the `--cli-upgrade-message` description now says `curl -fsSL`; the server help goldens, `server-config.yaml.golden`, `docs/reference/cli/server.md`, and `docs/admin/setup/configuration-reference.md` are regenerated to match. - `install.sh`: the "To run" header comment now matches the script's own usage text. - Style guide: a new "Commands that pipe a download into a shell" rule in `docs/.style/style-guide/formatting.md`, and the tabs example uses `-fsSL`. The coder.com download page already builds its command from `-fsSL` in coder/coder.com#1093, and coder.com `main` has no other `install.sh` one-liners outside test fixtures, so no coder.com change is needed. DatoCMS content and a release verification page are not in this PR. `main` since moved the upgrade and provisioner pages under `docs/install/operate/` and removed the install one-liner from `docs/install/index.md` in #29304, so that page no longer appears in this diff. ## Testing - `TZ=UTC go test ./cli -run='Test(CommandHelp|ServerYAML|ErrorExamples|.*Golden)' -update` and `go test ./enterprise/cli -run=TestEnterpriseCommandHelp -update` pass and produce the committed golden diffs. - `go test ./cli -run 'Test.*Version|TestWrapTransport'` passes, including `Test_wrapTransportWithVersionCheck`. - `go run ./scripts/configdocgen` output contains the new `curl -fsSL` description. - `markdownlint-cli2` on the edited style guide page reports 0 errors. - `git grep` finds no remaining `curl -L …install.sh` outside the style guide's **Don't** example. - After merging `main`: `make pre-commit` passes, and `make test`, `make test-js`, and `make site/out/index.html` pass. Linear: https://linear.app/codercom/issue/DOCS-964/standardize-installsh-curl-flags-on-fssl-across-docs-codercom-and-the --- 🤖 Built with AI assistance. |
||
|
|
d5a6047879 |
docs: restructure Install into the five phase deployment spine (#29304)
Restructures the Install section into the five-phase deployment spine, so the reading order matches the order a deployment actually happens: **plan, prepare, install, validate, operate.** Today the first thing a reader sees is a shell command, and architecture and sizing sit downstream in Administration, after the point where they would have been useful. Resolves [DOCS-869](https://linear.app/codercom/issue/DOCS-869). Part of [DOCS-685](https://linear.app/codercom/issue/DOCS-685) and [DOCS-738](https://linear.app/codercom/issue/DOCS-738). > [!IMPORTANT] > **Stacked on [#28960](https://github.com/coder/coder/pull/28960)** (DOCS-871, terminology). Base is that branch, not `main`. Retarget to `main` after it merges. > > **Paired with coder/coder.com [#1077](https://github.com/coder/coder.com/pull/1077)**, which must merge **first**. Without it, every inbound link to a moved page 404s in the gap. ## Deliberately mechanical No prose changes. The only edits inside moved pages are relative link and image path repairs, so the diff reads as renames. That is the point: this is the highest link-breakage change in the project, and it should be reviewable as such. The prose work is [DOCS-868](https://linear.app/codercom/issue/DOCS-868) (phase overview, architecture rewrite, sizing split, actor table) and [DOCS-872](https://linear.app/codercom/issue/DOCS-872) (new pages). ## The new spine ```text Install and deploy Coder /install ├── Coder CLI [unchanged, retired by DOCS-870] ├── 1. Plan your deployment │ ├── Architecture and components [from admin/infrastructure] │ └── Coder Validated Architecture [from admin/infrastructure] │ └── 1k / 2k / 3k / 10k users ├── 2. Prepare prerequisites │ ├── Licensing [from admin/licensing] │ ├── Air-gapped deployments [from install/airgap] │ └── Mirror images and registries [from install/registry-mirror-artifactory] ├── 3. Install the control plane │ ├── Docker / Kubernetes / Rancher / OpenShift │ ├── Cloud marketplace and VM images │ └── Unofficial install methods ├── 4. Validate your deployment │ └── Scale testing [from admin/infrastructure] │ ├── Scale test utility │ └── Scaling best practices └── 5. Operate and maintain ├── External provisioners [from admin/provisioners] ├── Upgrading (+ best practices, ESR guides) └── Uninstall ``` Leaving Install: release channels become `reference/releases`, feature stages become `reference/feature-stages`. `docs/admin/infrastructure/` is gone entirely, which is what DOCS-738 recommended. ## Numbers - 31 pages moved, all as `git mv` renames. - 1 page deleted: `admin/infrastructure/index.md`, whose content was a one-line section blurb. - 5 new placeholder index pages, one per phase, each a sentence of orientation plus `<children></children>`. The nav schema requires a path on every entry, so a phase cannot exist without one. - 265 relative links and asset paths repaired across 57 files. - `docs/manifest.json` restructured. Entry count goes 460 to 464: plus 5 stubs, minus the deleted Infrastructure entry. ## Reviewer attention, please **The redirects PR repairs 19 existing redirects, not just adds new ones.** This was the surprise. `redirects.json` already had entries whose *destinations* pointed at pages this PR moves, so they would have started redirecting to 404s. Examples: `/docs/architecture/architecture`, `/docs/admin/architectures`, `/docs/scaling/scale-testing`, `/docs/licensing`, `/docs/enterprise`, `/docs/install/offline`, `/docs/platforms`, `/docs/install/1-click`, `/docs/admin/upgrade`, `/docs/install/cloud/ec2`, and both `feature-stages` aliases. All 19 are fixed in the paired PR. **This PR touches `scripts/`, so it is not docs-only.** Two release tools write to paths that moved and would have broken silently at release time: - `scripts/update-release-calendar.sh`: `DOCS_FILE` now points at `docs/reference/releases.md`. - `scripts/releaser/docs.go`: `releasesFile`, and also `kubernetesFile` and `rancherFile`, which pointed at `docs/install/kubernetes.md` and `docs/install/rancher.md`. <details> <summary>Deliberate scope decisions</summary> - **Self-managed vs cloud grouping is flattened.** The reconciled IA nested platform pages under a "Self-managed platforms" parent. That would need two more placeholder index pages for groups with no content yet, so the platform pages sit directly under Phase 3 and the grouping lands with the DOCS-868 prose. - **Release-notes URLs left alone.** `scripts/releaser/release.go` and `scripts/release/generate_release_notes.sh` embed `https://coder.com/docs/install/releases` and `/docs/install/upgrade` in release-note templates. The redirects cover them, and changing the strings would require updating Go test fixtures in `scripts/release/main_internal_test.go`. Better as its own change. - **In-product doc links left alone.** Several `site/src` pages link to `coder.com/docs/admin/provisioners` and similar. Those are absolute URLs, so the redirects cover them. Updating them is a frontend change that would pull frontend review into a docs restructure. - **`admin/security/audit-logs.md` line 237** is hand-written prose below the generated table, and its `../licensing/index.md` link had to move with the licensing page. Verified `make gen` does not revert it. - **`reference/feature-stages.md`** has generated blocks whose relative links changed depth with the move. The generator named in its own marker comment (`scripts/release/docs_update_feature_stages.sh`) no longer exists in the repo, so those links were repaired by hand and the file is effectively hand-maintained. Worth its own issue. - **`install/cli.md` keeps its nav slot** here. DOCS-870 retires it. </details> ## Verification | Check | Result | |---|---| | Broken relative link scan | 0 in `install/`, `admin/`, `reference/`. 21 remain, all pre-existing illustrative examples in `docs/.style/style-guide/**` and one malformed URL in `docs/README.md` | | `make gen` | clean, manifest not clobbered, phase structure intact | | `make lint/markdown` | pass, 508 files, 0 errors | | `make lint/emdash` | pass | | `make lint/docs-html` | pass | | `make lint/prose` | pass, 1 intentional demo error, no new findings | | `make pre-commit` | pass, including `lint/go`, `lint/ts`, `lint/shellcheck`, and a slim build | | Manifest audit | every path resolves to a file on disk; entry-by-entry diff shows only the expected moves | Generated with Coder Agents on behalf of @nickvigilante. <details> <summary>CI note: doc-check failure is infrastructure, not this PR</summary> `Analyze PR for Documentation Updates Needed` fails before it reviews anything: the Coder account behind `agents-chat-action` returns `User is not active (status = "suspended")`. It isn't a required check. `check-docs` (linkspector) and every other check pass on `58ed9e3e4b`. _CI note added by Coder Agents on behalf of @nickvigilante._ </details> |
||
|
|
eb893f536d | docs: move section page to index.md (#29858) | ||
|
|
6f22956063 | docs(docs): label MCP Server page early access (#29864) | ||
|
|
442b08fee5 |
docs: drop duplicated 'the the' in scaletest flag help and OIDC docs (#29107)
Two doubled-word typos: - `cli/exp_scaletest.go`: the `--connect-url` flag description shown by `coder exp scaletest --help` read "inside **the the** workspace over WireGuard" - `docs/admin/users/oidc-auth/index.md`: "as **the the** username" Docs/help text only. |
||
|
|
c95a87cea7 |
feat: warn before narrowing a self-registered OAuth2 app's scope allowlist (#29777)
- Warn rather than block when admins narrow a self-registered OAuth2 app's scope allowlist. Clients requesting all advertised scopes may receive `invalid_scope` on new authorizations; existing tokens retain their scopes. - Expose `dynamically_registered` in API responses and display registration type on the app page. - Show no warning for widening or clearing allowlists, or for admin-created apps. - Update scope and `invalid_scope` troubleshooting docs and remove the outdated note that the UI cannot set allowlists. Closes PLAT-664. |
||
|
|
4def4b480a |
docs(docs/ai-coder/agents/platform-controls): rename sandboxing guide to network isolation (#29847)
Renames the guide added in #29698 from "Sandboxing" to "Network isolation" in both places it appears: the `docs/manifest.json` entry and the `agent-isolation.md` heading. > Generated by Coder Agents on behalf of @bpmct. |
||
|
|
bacb4fc6ed |
feat: expose per-app session counts (#29351)
Track individual applications across deployment statistics, Prometheus, telemetry, and the dashboard instead of exposing only fixed family totals. Preserve existing fields and gauges so current consumers can migrate without breaking. - Add per-app counts with normalized identifiers and registry-backed display names, families, and bundled icons. Unrecognized apps retain their identifiers. - Limit each statistics report to 64 distinct app names, combining excess names into an explicit overflow bucket. - Group dashboard connections by family, including an Other category, with alphabetical per-app tooltips and distinct loading and empty states. - Export app-keyed Prometheus counts separately from current family metadata, allowing queries to enrich historical counts without rewriting stored samples. - Document family queries with unknown fallback, deployment isolation, and replica handling, alongside collection behavior and migration guidance. - Include per-app counts in telemetry, update API schemas and documentation, and add regression coverage across collection, metrics, and dashboard behavior. Closes #27411 |
||
|
|
0c98308ca9 | feat: default the CLI workspace search to the user filter (#29753) | ||
|
|
f97e825109 |
chore(docs): update root docs/images screenshots (#29768)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. Replaces five screenshots in the `docs/images` root with 1792px (2x) captures of the current dashboard. The old images date from 2022 to 2023 (#3153, #3990, #4029, #6332, #9613) and predate the current workspace page, template page, New workspace form, and User Settings layouts. Same approach as #29693. Image-only change; no docs text or paths were modified. `external-apps.png` on the same Web IDEs page is left for a separate update. | File | Used by | Old | New | |---|---|---|---| | `delete-template.png` | `admin/templates/managing-templates/index.md` | <img width="400" alt="delete-template (old)" src="https://raw.githubusercontent.com/coder/coder/22a6d3496d101c240dc48fcaf93d8d4b8e45412d/docs/images/delete-template.png" /> | <img width="400" alt="delete-template (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-root-images-refresh/docs/images/delete-template.png" /> | | `file-browser.png` | `user-guides/workspace-access/filebrowser.md`, `admin/templates/extending-templates/web-ides.md` | <img width="400" alt="file-browser (old)" src="https://raw.githubusercontent.com/coder/coder/22a6d3496d101c240dc48fcaf93d8d4b8e45412d/docs/images/file-browser.png" /> | <img width="400" alt="file-browser (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-root-images-refresh/docs/images/file-browser.png" /> | | `ide-row.png` | `user-guides/workspace-access/web-ides.md` | <img width="400" alt="ide-row (old)" src="https://raw.githubusercontent.com/coder/coder/22a6d3496d101c240dc48fcaf93d8d4b8e45412d/docs/images/ide-row.png" /> | <img width="400" alt="ide-row (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-root-images-refresh/docs/images/ide-row.png" /> | | `parameters.png` | `admin/templates/extending-templates/parameters.md` | <img width="400" alt="parameters (old)" src="https://raw.githubusercontent.com/coder/coder/22a6d3496d101c240dc48fcaf93d8d4b8e45412d/docs/images/parameters.png" /> | <img width="400" alt="parameters (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-root-images-refresh/docs/images/parameters.png" /> | | `ssh-keys.png` | `admin/security/secrets.md` | <img width="400" alt="ssh-keys (old)" src="https://raw.githubusercontent.com/coder/coder/22a6d3496d101c240dc48fcaf93d8d4b8e45412d/docs/images/ssh-keys.png" /> | <img width="400" alt="ssh-keys (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-root-images-refresh/docs/images/ssh-keys.png" /> | <details> <summary>Verification</summary> - Committed bytes match the images supplied for this change (SHA256 `dbafc8db…`, `d92de0bc…`, `0a0c41ef…`, `6705c466…`, `194d73f0…`). All are RGBA PNGs, 1792x1024 except `ide-row.png` at 1792x512. - Each image is still referenced only from the pages listed above (`rg` over `docs/`); no orphaned or renamed paths. - Each capture matches its surrounding prose: the template page dropdown with `Delete...` for "select the dropdown in the right-hand corner of the page"; the File Browser app listing a workspace directory; the agent card app row for the Web IDEs intro; the New workspace form with an immutable `Region` parameter for the Parameters intro; and User Settings > SSH keys for "Users can view their public key in their account settings". - Fixture data only (`admin`, `lime-tern-45`, `poised_green55`, `copper-swan-44`); no deployment URLs. The SSH key shown is a public key from a local dev deployment. </details> |
||
|
|
528dd3cc44 |
feat: edit an OAuth2 app's redirect URIs as an ordered list (#29603)
Completes PLAT-619, following #29440 and #29502. - Replace the OAuth2 app’s single callback field with an editable `redirect_uris` list supporting 1–32 entries, with the first labeled “Default callback.” - Show a `+N` badge for additional redirect URIs in the applications table. - Remove `omitempty` from request `redirect_uris` so explicit empty lists reach the server. - Add tests and stories for adding, editing, removing, and requiring at least one URI. |
||
|
|
7555486351 |
docs(docs/ai-coder/agents/platform-controls): add agent isolation sandboxing guide (#29698)
Ports the sandboxing guide from coder-private's `prototype-agent-isolation-build-1` branch. Adds `docs/ai-coder/agents/platform-controls/agent-isolation.md` and registers it in `docs/manifest.json` under Platform Controls, tagged early access. 🤖 Generated with [Coder Agents](https://coder.com/docs/ai-coder/agents) |
||
|
|
07c24d6021 |
docs: document OpenCode custom models through Bedrock Mantle (#29734)
Document OpenCode custom model IDs through an AI Gateway Bedrock Mantle provider. Explain Coder token authentication, model aliases, optional default/small-model selection, and SDK selection for Responses, Chat Completions, and Anthropic Messages. <details> <summary>Configuration context and verification</summary> Based on a working Astra configuration supplied and live-tested by @dannykopping. Keep Astra as a concrete example while using vendor-neutral provider naming and instructions. Use `coder.example.com` and `bedrock-provider-name` as placeholders and omit unrelated MCP configuration. Readers must substitute an available model ID and select the matching SDK package. Gateway routes and model routing were checked against the implementation, and OpenCode settings against its documentation/schema. Local Markdown/table checks, Vale, JSON parsing, and repository lightweight pre-commit checks passed. The agent did not repeat the live AWS request; OpenCode is not installed in this workspace. </details> Generated by Coder Agents on behalf of @dannykopping. |
||
|
|
22a6d3496d |
chore(docs): update kube-region-picker.png (#29693)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. Replaces `kube-region-picker.png` with a 1792px (2x) capture of the current New workspace form, showing the immutable `Cluster` parameter (US Central / Europe West) from the doc's own `coder_parameter` example. The old image was added with the original additional-clusters docs (#7019, April 2023) and predates the current form. Image-only change; no docs text or paths were modified. Referenced once, from `docs/admin/integrations/multiple-kube-clusters.md`. | Old | New | |---|---| | <img width="448" alt="kube-region-picker (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/integrations/kube-region-picker.png" /> | <img width="448" alt="kube-region-picker (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-kube-region-picker/docs/images/admin/integrations/kube-region-picker.png" /> | <details> <summary>Verification</summary> - Committed bytes match the image supplied for this change (SHA256 `81601e0e5a0e…`), 1792x1024 PNG (2x the earlier 896x512 preview). - Parameter display name, `mutable = false` (Immutable badge), option names, and emoji icons match the `kube_context` parameter block in `multiple-kube-clusters.md`. - Fixture data only (`my-workspace`, `beige-ermine-42`); no real users or deployment URLs. </details> |
||
|
|
9079fc41ec |
chore(docs): update logstream-kube.png (#29694)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. Replaces `logstream-kube.png` with a 1792px (2x) capture of the current workspace page, showing `coder-logstream-kube` pod events (pod created and scheduled, image pulled, container started, node low on memory, container stopped) streamed into the agent's All Logs tab. The old image was a 2222x1049 screenshot of the previous workspace page layout. Image-only change; no docs text or paths were modified. Referenced once, from `docs/admin/monitoring/logs.md` under "Kubernetes Event Logs". | Old | New | |---|---| | <img width="448" alt="logstream-kube (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/monitoring/logstream-kube.png" /> | <img width="448" alt="logstream-kube (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-logstream-kube/docs/images/admin/monitoring/logstream-kube.png" /> | <details> <summary>Verification</summary> - Committed bytes match the image supplied for this change (SHA256 `73a5a52e0f0d…`), 1792x1024 PNG (2x the earlier 896x512 preview). - Log content matches the doc's description of the feature: events "such as a node being out of resources" streamed to the Coder UI. - Fixture data only (`TestUser` / `demo`, `hello-world` container); no real users or deployment URLs. </details> |
||
|
|
8c736839e6 |
chore(docs): update appearance images (#29695)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. Replaces the five screenshots in `docs/admin/setup/appearance.md` with 1792px (2x) captures of the current UI: the Appearance branding form, the Announcement Banners settings table, two stacked announcement banners over the dashboard, a "SECRET" classification banner, and the user dropdown with support links. The old images dated from before the current admin settings layout. `multiple-banners.PNG` is renamed to `multiple-banners.png` to match its siblings and the markdown reference is updated accordingly; the other four paths are unchanged. | Old | New | |---|---| | <img width="448" alt="application-name-logo-url (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/setup/appearance/application-name-logo-url.png" /> | <img width="448" alt="application-name-logo-url (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-appearance-images/docs/images/admin/setup/appearance/application-name-logo-url.png" /> | | <img width="448" alt="announcement_banner_settings (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/setup/appearance/announcement_banner_settings.png" /> | <img width="448" alt="announcement_banner_settings (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-appearance-images/docs/images/admin/setup/appearance/announcement_banner_settings.png" /> | | <img width="448" alt="multiple-banners (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/setup/appearance/multiple-banners.PNG" /> | <img width="448" alt="multiple-banners (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-appearance-images/docs/images/admin/setup/appearance/multiple-banners.png" /> | | <img width="448" alt="service-banner-secret (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/setup/appearance/service-banner-secret.png" /> | <img width="448" alt="service-banner-secret (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-appearance-images/docs/images/admin/setup/appearance/service-banner-secret.png" /> | | <img width="448" alt="support-links (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/setup/appearance/support-links.png" /> | <img width="448" alt="support-links (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-appearance-images/docs/images/admin/setup/appearance/support-links.png" /> | <details> <summary>Verification</summary> - Committed bytes match the images supplied for this change (all 1792px wide PNGs, 2x the earlier 896px previews). - `rg multiple-banners` confirms `appearance.md:37` was the only reference to the renamed file. - Fixture data only (`TestUser` / `test@coder.com`, application name `Foobar`); no real users or deployment URLs. </details> |
||
|
|
9771e3d6cf |
chore(docs): update prebuilds and preset images (#29696)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. Replaces three screenshots under `docs/images/admin/templates/extend-templates/` with 1792px (2x) captures of the current UI: the Workspaces list filtered by `owner:prebuilds`, the inbox notification for a prebuilt workspace claim that triggered a resource replacement, and the Preset dropdown on the New workspace form. The old images dated from the original prebuilds (#17580) and presets (#16612) docs in 2025. Image-only change; no docs text or paths were modified. Referenced once each, from `docs/admin/templates/extending-templates/prebuilt-workspaces.md` (two images) and `docs/admin/templates/extending-templates/parameters.md` under "Workspace presets". | Old | New | |---|---| | <img width="448" alt="prebuilt-workspaces (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/templates/extend-templates/prebuilt/prebuilt-workspaces.png" /> | <img width="448" alt="prebuilt-workspaces (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-prebuilds-preset-images/docs/images/admin/templates/extend-templates/prebuilt/prebuilt-workspaces.png" /> | | <img width="448" alt="replacement-notification (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/templates/extend-templates/prebuilt/replacement-notification.png" /> | <img width="448" alt="replacement-notification (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-prebuilds-preset-images/docs/images/admin/templates/extend-templates/prebuilt/replacement-notification.png" /> | | <img width="448" alt="template-preset-dropdown (old)" src="https://raw.githubusercontent.com/coder/coder/47d3e1c52b144664e72544b733b3b5a2f9e68876/docs/images/admin/templates/extend-templates/template-preset-dropdown.png" /> | <img width="448" alt="template-preset-dropdown (new)" src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-prebuilds-preset-images/docs/images/admin/templates/extend-templates/template-preset-dropdown.png" /> | <details> <summary>Verification</summary> - Committed bytes match the images supplied for this change (all 1792px wide PNGs, 2x the earlier 896px previews). - The prebuilds list shows the `owner:prebuilds` search term that the doc's caption calls out; the notification wording matches the `TemplateWorkspaceResourceReplaced` template (`000324_resource_replacements_notification.up.sql`). - Fixture data only (`prebuilds` owner, `blue-locust-51`, `admin`); no real users or deployment URLs. </details> |
||
|
|
395e8032dc |
fix: reject client_secret in the OAuth2 token and revocation URL (#29508)
Reject non-empty `client_secret` query parameters on token and revocation endpoints with `400 invalid_request`, enforcing OAuth 2.1 §2.4.1 (D6-04). - **Breaking:** Send secrets in the request body or `Authorization` header, and rotate any previously sent in URLs. Rejections consume nothing, so clients can retry without reauthorization. - Empty query secrets count as absent, but token requests also supplying a body secret still fail duplicate-parameter validation. Authorize ignores query secrets and logs a warning without the value. - Sanitize and cap revocation parse errors, correctly report repeated token parameters, and update tests and API docs. Refusal logs include the app ID, never the secret. - Other query parameters (`client_id`, `refresh_token`, `code`, and revocation tokens) remain accepted; body-only credential parsing is tracked in PLAT-660. No migration or new error codes. Refs PLAT-602. |
||
|
|
fc707a15d1 |
fix: rate limit the OAuth2 endpoints (#29510)
Apply the login rate limit to OAuth2 authorization, token, revocation, registration, client configuration, and discovery endpoints, closing the brute-force protection gap (D6-01) and bounding database work. - Limit requests per IP without a Coder session and per user otherwise. - Use independent, fixed-key endpoint buckets to prevent path-based bypasses; unmatched routes consume no budget. - Return HTTP 429 with `temporarily_unavailable` and a `message` matching `error_description` for dashboard/SDK compatibility. - Preserve `X-Coder-Bypass-Ratelimit` and `--dangerous-disable-rate-limits`. - Add documentation and tests for route coverage, variable paths, and endpoint/user isolation. No migrations or new configuration. Refs PLAT-624 |
||
|
|
83bef8a12d | fix: consolidate pg and nats pubsub metrics generation into one (#26843) | ||
|
|
8a3352079e |
docs(docs/.style/style-guide): update word choice rule counts (#29758)
- main fails lint and the Go test jobs on the style claims check. - #28960 added a documentation-only rule to the word choice page. - #29299 added a check that the README table matches the rules. - They merged 19 seconds apart, so neither ran against the other. - This updates the word choice row and the total row. - The style claims check and its test pass. |
||
|
|
ccffab23a0 |
feat: fail CI when the style guide claims enforcement it doesn't have (#29299)
## Summary PR 1 corrected 9 annotations that claimed enforcement the config doesn't provide. This adds the check that keeps them correct, because the same drift will recur: annotations are prose, `.vale.ini` is config, and nothing tied them together. `scripts/styleclaims` reconciles three sources and fails `make lint`. It also runs in `lint-light`, so the fast pre-commit hook covers docs-only changes: the checker's inputs all live under `docs/.style/`, and leaving it out would let this drift land through the hook that docs changes actually use. It is the only `lint-light` entry that compiles Go, which costs one small build on first run and nothing after. What it reports: 1. `.vale.ini` plus `docs/.style/styles/Coder/`, which is the truth. 2. The per-rule annotations in the style guide subpages. 3. The two coverage tables on the style guide landing page. ### What it reports | Finding | Example it would have caught | |---|---| | A `Coder.*` rule cited as active with no rule file | `Coder.FirstPersonSingular`, `Coder.FirstPersonPlural` | | A third-party rule cited as active while `BasedOnStyles = Coder` | the 8 `Google.*` citations | | A rule file that no section cites as active | a rule landing without the section the per-rule PR pattern requires | | Checks-table severity, scope, or membership drift | a rule re-scoped in `.vale.ini` without updating the table | | Coverage-count drift | the per-section and total rows | ### Also in this PR - One annotation reworded so each planned citation is marked individually (`Google.Gender` and `Google.GenderBias`). A trailing `(both planned)` covering several citations isn't machine-readable, and the checker depends on that precision. - The annotation format documented in `scripts/styleclaims/README.md`, with the per-rule PR pattern in `docs/.style/README.md` pointing at it. - `make lint/prose` prints a coverage pointer after running, so the advisory result doesn't read as a pass. ## Verification - `go test ./scripts/styleclaims/` covers the parser and each finding class, including the mixed `scripts/check_emdash.sh` plus `Coder.EmDash` (planned) annotation and the "rule mentioned but not claimed" case that `Google.Passive` represents. - `go run ./scripts/styleclaims` is clean on the branch. - Regression check: reverting `Coder.FirstPersonSingular` to its pre-PR-1 wording reproduces 3 findings (the false claim plus the 2 count rows). Restoring it returns to clean. - `golangci-lint run scripts/styleclaims/...` reports 0 issues; `gofmt` clean. - `make lint/markdown`, `make lint/emdash` clean. <details> <summary>Design notes</summary> ### Why Go, not bash `scripts/` is mostly bash, but this parses Markdown tables and multi-line annotations, which bash does badly. `scripts/docshtmlcheck` sets the precedent for a Go checker invoked from a lint target, so this follows its layout: `main.go`, `main_test.go`, `README.md`, and a `go run ./scripts/...` target. ### Why not generate the tables Considered and rejected. Generation and checking need the same parse, so once the checker exists the table's correctness is guaranteed either way. Generation would only save a one-row edit in a PR that already edits the guide by doctrine, at the cost of a generated block inside prose contributors are invited to edit. The checker also catches a case generation can't: a rule enabled in `.vale.ini` with no style guide section at all. ### Parsing tradeoff The checker reads prose annotations, so it depends on their format staying regular: start with a recognized keyword, and mark each planned citation individually. That regularity is enforced by the checker itself, which is the point, but it does mean an author who invents a new annotation phrasing gets a failure rather than silent acceptance. If that proves annoying in practice, the fallback is a small YAML manifest of rule status that both the tables and the checker read. I'd rather not add that until the prose form actually hurts. ### Scope validation Scope cells are checked against `.vale.ini` section globs: every glob that sets a rule to `YES` must appear in the cell, and a rule with no `NO` toggle must claim `docs/**`. That's how the `OneSentencePerLine` row stays honest about running on contributor docs only. </details> --- Linear: [DOCS-887](https://linear.app/codercom/issue/DOCS-887/make-clear-that-vale-passing-is-not-style-guide-conformance) 🤖 Generated with Coder Agents on behalf of @nickvigilante. |
||
|
|
5e41baf73c |
docs: normalize control plane, coderd, and coder server terminology (#28960)
Normalizes the three overlapping names for the thing that serves the Coder API and dashboard. This is step 1 of the Install/Deploy and Administration refactor ([DOCS-685](https://linear.app/codercom/issue/DOCS-685), [DOCS-738](https://linear.app/codercom/issue/DOCS-738)) and lands first because every later page depends on settled terminology. Resolves [DOCS-871](https://linear.app/codercom/issue/DOCS-871). ## The rule | Term | Means | Use when | |---|---|---| | control plane | The component that serves the Coder API and dashboard, brokers connections, and coordinates provisioners | Default in prose, diagrams, planning, sizing, security | | `coderd` | The process that implements it | Architecture internals, metrics, logs, flags, troubleshooting | | `coder server` | The literal CLI command | Only when the reader will type it | Retired: "the Coder server" as a name for the component, and "a service" as a standalone description of it. ## What changed - **`docs/.style/style-guide/word-choice.md`**: new "Naming Coder's components" rule, with do/don't examples. Also fixes a "Do" example on that page that itself used "the Coder server". - **`docs/reference/glossary.md`**: rewrote `coderd` and Control plane, added a `coder server` entry. The existing Control plane entry defined it as "the collective term for `coderd`, its provisioners, and its database", which made it indistinguishable from the Deployment entry two sections later. Control plane is now the component; Deployment remains the whole installation. - **65 pages** across `docs/admin`, `docs/install`, `docs/get-started`, `docs/tutorials`, `docs/user-guides`, `docs/ai-coder`, and `docs/about`: roughly 154 component-sense "Coder server" usages, 21 bare "the server" usages meaning the control plane, 3 "a service" descriptions, and 43 unbackticked `coderd` mentions in prose. - One real bug caught in passing: `docs/tutorials/best-practices/security-best-practices.md` documented `coderd server --disable-path-apps`, which is not a command. Now `coder server`. Generated files were not touched: `configuration-reference.md`, `prometheus.md`, `audit-logs.md`, `reference/cli/*`, `reference/api/*`, and the generated blocks inside `feature-stages.md`. Those still contain the retired term and need generator-side changes; see the deferred list below. ## Reviewer attention, please **Anchor changes.** 11 headings were renamed, so their fragments change. No in-repo link targets any of them (the one internal link that did was updated), but external deep links from tickets or blog posts would break, and fragments cannot be fixed with a redirect. Happy to revert any of these if you would rather they ride along with the page moves in [DOCS-869](https://linear.app/codercom/issue/DOCS-869), which changes those URLs anyway. <details> <summary>Renamed headings and their old fragments</summary> | File | Old fragment | New heading | |---|---|---| | `admin/networking/index.md` | `#coder-server` | `## Control plane` | | `install/index.md` | `#starting-the-coder-server` | `## Starting the control plane` | | `install/uninstall.md` | `#the-coder-server-binary-and-cli` | `## The Coder binary and CLI` | | `install/registry-mirror-artifactory.md` | `#step-5-configure-coder-server-or-provisioners` | `## Step 5: Configure the control plane or provisioners` | | `install/cloud/compute-engine.md` | `#configuring-coder-server` | `## Configuring the control plane` | | `get-started/index.md` | `#cant-start-coder-server-address-already-in-use` | ``### Can't start `coder server`: Address already in use`` | | `tutorials/external-database.md` | `#coder-server-fails-startup-with-...` | ``### `coder server` fails startup with ...`` | | `tutorials/faqs.md` | `#how-do-i-change-the-access-url-for-my-coder-server` | `## How do I change the access URL for my control plane?` | | `tutorials/best-practices/security-best-practices.md` | `#coder-server` | `## Control plane` | | `tutorials/best-practices/security-best-practices.md` | `#server-logs-and-audit-logs` | `### Control plane logs and audit logs` | | `tutorials/best-practices/scale-coder.md` | `#coder-server`, `#how-to-capture-coder-server-metrics-with-prometheus` | `## Control plane`, `### How to capture control plane metrics with Prometheus` | </details> **One deliberate deviation from the issue.** DOCS-871 proposed reserving "sub-agent" for the Coder Agents sense and using "devcontainer agent" for the workspace sense. I did not make that change. The glossary already disambiguates with "Sub-agent (Coder Agents)" and "Sub-agent (dev containers)", and "devcontainer agent" would violate the existing dev container spelling rule in the same style guide, which requires "dev container" as two lowercase words. The current split reads correctly and costs no churn. Happy to revisit if you disagree. <details> <summary>Deferred, with reasons</summary> - **Generated content still says "Coder server".** `reference/cli/*` comes from Go command help text, `configuration-reference.md` from `configdocgen`, and `reference/api/*` from Swagger annotations. Fixing those means changing Go source, which belongs in its own PR so a docs review does not turn into a backend review. - **`validated-architectures/index.md` "also known as `coderd`"** is fixed here, but the page's larger problem is that it holds four documents in one file. That split is [DOCS-868](https://linear.app/codercom/issue/DOCS-868). - **"server flag" phrasing** in `admin/users/idp-sync.md` and `admin/users/oidc-auth/index.md` means `coder server` flags. Left alone; rewording those sentences is a copy edit, not a substitution. - **Metric and UI labels** such as "Dashboard-to-server latency" in `admin/networking/index.md`. Renaming risks diverging from what the dashboard shows. - **Pre-existing `Coder.GerundHeading` warnings** on headings this PR touches, and a "from from" typo in `scale-coder.md`. Out of scope for a terminology pass. - **Peer-sense "server"** in NAT traversal prose, where "client or server" describes the connection roles rather than the control plane. Needs restructuring, not substitution. </details> ## Verification | Check | Result | |---|---| | `make lint/emdash` | pass | | `make lint/markdown` | pass, 504 files, 0 errors | | `make lint/docs-html` | pass | | `make lint/prose` | pass, findings identical to the `main` baseline (1 intentional demo error, 145 warnings, 1 suggestion; only Vale's file ordering and one line-number shift in `glossary.md` differ) | | `make gen` | clean, no drift | | `make fmt/markdown` | applied | No redirects needed: no page moved or was renamed in this PR. <details> <summary>Merged main, 2026-09-14</summary> One conflict, in `docs/ai-coder/ai-gateway/providers.md`. Both hunks were text this PR had edited and `main` had since deleted in #29053, which removed env-based AI provider configuration: - The deprecated provider seeding note, which held a `coderd` backtick fix, is gone. Took `main`. - The failure-mode table lost its env-drift row. Took `main`'s two rows and reapplied the `coderd` logs wording. `main` also landed new prose carrying the retired terms, so the pass was extended to cover it: - `docs/admin/integrations/oauth2-provider.md`: two "the server log(s)" in the scope-enforcement sections added by #29144 are now "the `coderd` log(s)"; "a `scope` the server will not grant" is now "the control plane". - `docs/reference/cli/index.md` gained "the server" from #29104, and stays deferred as generated content. The new `docs/ai-coder/agent-relay/claude-code.md` needed no change, and no page `main` added links to a heading this PR renamed. </details> <details> <summary>Decision log for the wider refactor</summary> Agreed with @nickvigilante before implementation, recorded on DOCS-685 and in the Notion outline: 1. Feature stages and release channels move to Reference; ESR upgrade guides move under Operate. No new top-level Releases section. 2. `data-retention.md` moves to Administration > Security; `chat-lifecycle-hooks.md` moves into the Coder Agents docs. `admin/setup/` therefore survives as "Deployment configuration" and `configdocgen` is not touched. 3. Prepare is advisory, not a gate, framed as "don't know where to start? Start here", with lead times and owners per item. 4. One actor table, on the Install overview, spanning all five phases, noting that one person can be several actors and several people can be one actor. 5. The quickstart stays independent and is mentioned once, on the Install overview. The proposed `server/single-machine` page is dropped. 6. Coder Validated Architecture keeps its name in nav, defined in-page, with a glossary entry. 7. PR 3 is split: moves only, then prose, so the riskiest change reads as a pure rename diff. 8. For every PR that moves a page, the coder.com `redirects.json` change merges first. 9. There is no Download section and no CLI page in docs. Per-OS CLI steps live on coder.com/download and the Install overview links to it. </details> Generated with Coder Agents on behalf of @nickvigilante. |
||
|
|
9fd0131d04 |
feat: accept redirect_uris on the OAuth2 app admin API and deprecate callback_url (#29502)
- Add `redirect_uris` to admin OAuth2 app responses and create/update requests. - Deprecate `callback_url` while preserving compatibility; it maps to the first redirect URI. - Reject empty `redirect_uris` lists instead of silently ignoring them. - Update fixtures, tests, and docs. Part of PLAT-619. Builds on #29440; admin UI support follows in #29603. |
||
|
|
6dd2e95692 |
docs: describe organization roles and correct the roles permission claims (#29303)
## Summary The roles reference documented deployment-wide roles only. Organization-scoped roles were named in passing on three other pages but defined nowhere, and two statements on the page contradicted the RBAC code. Closes [DOCS-891](https://linear.app/codercom/issue/DOCS-891/organization-scoped-roles-are-defined-only-in-code-not-in-the-docs) ## Problem `coderd/rbac/roles.go` and `coderd/rbac/rolestore/rolestore.go` define eight organization-scoped roles. `docs/` defined none of them. Searching `docs/` for `organization-auditor`, `organization-user-admin`, `organization-service-account`, and `organization-workspace-creation-ban` returns nothing, and `organization-admin` appears only inside an IdP sync JSON example. That produced three concrete defects: - **Dead-end cross-reference.** The AI Gateway group budget prerequisite named the Organization Admin and Organization User Admin roles and linked to a page that defines neither. - **Incorrect Member claim.** The page said all users hold an implicit Member role "that may use personal workspaces." The site `member` role grants no workspace permissions, and `OrgMemberPermissions` grants none either. Workspace access comes from `organization-workspace-access`, which organizations attach through their default member roles. - **Unqualified Owner row.** The table asserts Owner can execute and use all workspaces. `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` removes SSH and application access from the role, and the flag was documented only in the generated CLI and configuration references. ## Fix Adds an Organization roles section to the roles page covering the six assignable organization roles, where to assign them, and the implicit membership role the dashboard doesn't display. It also records that Organization Admin excludes SSH, application, and terminal access to other members' workspaces, which is the least discoverable part of the model. Corrects the Member and Owner statements, retargets the group budget prerequisite at the new section, notes that the Disabled workspace sharing policy overrides the sharing permission of any role an organization member holds, and fixes the built-in roles and custom roles glossary entries. The deployment roles table is deliberately untouched. [ENG-873](https://linear.app/codercom/issue/ENG-873/autogenerate-roles-documentation) replaces it with a generated table, so correcting the Auditor row or adding an organization matrix by hand now would be churn. The new section is prose a generator won't emit, so the two changes compose. <details> <summary>Verification and scope notes</summary> **Claims verified against source, not assumed:** | Claim | Source | |---|---| | Six assignable organization roles and their display names | `builtInRoles` in `coderd/rbac/roles.go` | | Organization Admin lacks `ssh` and `application_connect` | `orgAdmin` role, `slice.Omit(ResourceWorkspace.AvailableActions(), ...)` | | Member role grants no workspace permissions | `memberRole.User` excludes `ResourceWorkspace` with no add-back | | Workspace access comes from the default member roles | `DefaultOrgMemberRoles()` and `orgWorkspaceAccessMemberPerms()` | | `organization-member` and `organization-service-account` have no display name, so the dashboard never shows them | `systemRoles` in `rolestore.go`, `DisplayName: ""` | | Disabled sharing overrides other roles | org-level negative `workspace:share` permission in `OrgMemberPermissions` | | Roles are assigned on the organization Members page | `Edit roles` action in `OrganizationMembersTable.tsx` | | Flag, environment variable, and YAML names | `codersdk/deployment.go` | **Scoped out deliberately:** - The Disabled-sharing note says "any role held by a member of that organization" rather than naming Owner. The negation rides on the organization membership role, so it doesn't reach an Owner who isn't a member of that organization. - Pre-existing gerund headings on the touched pages (`Creating custom roles`, `Getting Started`, `Sharing your Workspace`, `Using a shared workspace`, `Accessing workspace apps in shared workspaces`) are left alone to keep the diff scoped. Vale reports them as warnings on `main` today. - `## Custom Roles` is retitled to sentence case. The GitHub anchor slug is unchanged, so inbound links still resolve. **Checks run:** `make fmt/markdown`, `make lint/markdown`, `make lint/emdash`, and `vale` on the four changed files. Vale reports zero findings from the new text. Every link added or changed was resolved to its file and heading anchor. **Also worth knowing:** three en dashes in the workspace sharing policy list are replaced with colons. `scripts/check_emdash.sh` only scans changed files, so they survived on `main` and would have failed this PR's CI once the surrounding lines were touched. </details> --- Opened by Coder Agents on behalf of @nickvigilante. |
||
|
|
25a6bf56c9 |
docs: state what the style guide tooling actually checks (#29298)
## Summary The style guide documents 77 rules. Tooling checks 8 of them, one of which doesn't run on published pages, and Vale runs advisory so no finding fails a build. Nothing said so, and several annotations said the opposite. This corrects the false claims and states the coverage where authors and agents actually read. ### The false claims Nine annotations read as active enforcement with no `(planned)` marker: - `Google.Gender`, `Google.GenderBias`, `Google.Headings`, `Google.HeadingPunctuation`, `Google.OxfordComma`, `Google.Quotes`, `Google.Exclamation`, `Google.Ranges`. The repo-root `.vale.ini` sets `BasedOnStyles = Coder`, and the doctrine in `docs/.style/README.md` deliberately excludes third-party rules. - `Coder.FirstPersonSingular` and `Coder.FirstPersonPlural`. No YAML exists for either in the rule package. All are now marked planned, matching the 17 annotations that already were. ### What changed | File | Change | |---|---| | `docs/.style/style-guide/README.md` | New "What the tooling checks, and what it doesn't" section: per-rule table with tool, severity, and scope, per-section coverage counts, and the enumeration and classification rules that reproduce them | | `docs/.style/style-guide/capitalization-and-punctuation.md`, `voice-and-tone.md`, `accessibility-and-inclusion.md` | Mark the 9 false enforcement claims planned | | `docs/.style/style-guide/audience-and-scope.md` | Give each rule its own enforcement footer, so the page's 6 rules stop counting as 1 | | `docs/.style/style-guide/word-choice.md` | Say that `Coder.BrandNames` covers `HashiCorp` casing only, and give the What's next? sub-rule its own footer | | `docs/about/contributing/documentation.md` | Drop "to enforce prose style"; state that Vale covers a subset and a clean run isn't conformance | | `AGENTS.md`, `.claude/docs/DOCS_STYLE_GUIDE.md`, `.claude/skills/write-docs/SKILL.md` | Same statement for agents; split the skill checklist item so applying the guide and passing linters are separate gates | ## Why An agent (me) wrote a new install page, ran `make lint/prose` and markdownlint clean, and shipped a draft that violated one-sentence-per-line, the "refer to" rule, `sh` fence tags, H3 tab headings, and the Learn more heading. None of those are enforced. The single checklist item that bundled "style guide applied with it open" with "Vale passes" made the substitution easy to miss. <details> <summary>Verification and method</summary> ### Empirical probe A scratch file violating 12 documented rules (gerund heading, trailing heading punctuation, first person singular and plural, `Click`, `Github`, `Hashicorp`, `VSCode`, Oxford comma, US quotation, numeric range, exclamation point, one-sentence-per-line, `Simply`, navigational `See`, `Next steps`) produced exactly 3 findings: `Coder.GerundHeading`, `Coder.SelectClick`, `Coder.BrandNames`. ### Counts One rule section is one heading with an enforcement footer (`*Enforced by ...*`, `*Documentation-only ...*`, `*Adapted from ASD-STE100 ...*`). Sections are classified against `.vale.ini` and `docs/.style/styles/Coder/` by an ordered test: a stated **Documentation-only** wins, then a check that runs today, then planned. 77 total: 8 tool-checked, 25 planned, 44 documentation-only. PR 2 in this stack adds a script that reconciles those three sources in CI so the table and the annotations can't drift from the config again. ### Two findings recorded but not fixed here - `Coder.BrandNames` ships at `error` but swaps only `Hashicorp` and `HASHICORP`, though the table it's cited under lists 8 brands. `Github` and `VSCode` pass clean. The footer now says so; widening the rule is tracked in DOCS-889. - `Coder.OneSentencePerLine` is set to `NO` repo-wide and re-enabled only for `docs/.style/*.md` and `docs/.style/styles/Coder/*.md`. Rollout tracked in DOCS-888. ### Note for the reviewer `make lint/prose` over `docs/` currently reports a backlog of `Coder.GerundHeading` warnings, plus the intentional `Coder.Demo*` findings in the annotation demo. That backlog is the advisory channel working as designed and is out of scope here, but it's the concrete evidence behind the new sentence about findings accumulating rather than blocking. Worth a separate cleanup decision: fix the headings, or re-scope the rule. </details> --- Linear: [DOCS-887](https://linear.app/codercom/issue/DOCS-887/make-clear-that-vale-passing-is-not-style-guide-conformance) PR 2 of this stack adds the CI guard that keeps these claims true. 🤖 Generated with Coder Agents on behalf of @nickvigilante. |
||
|
|
b9e3de8403 |
fix: make redirect_uris the source of truth for OAuth2 redirect URIs (#29440)
Fix OAuth2 callback edits retaining stale redirect URIs - Make `redirect_uris` the sole source of truth, with the first entry as primary and `callback_url` retained as a synchronized, deprecated copy. - Backfill existing apps and unify all writers. Callback-only admin updates now replace the previous primary while preserving alternate URIs. - Share redirect URI validation, reject fragments, and add limits of 32 URIs and 2048 bytes per URI. - Add regression coverage for migration, callback edits, validation, and rejection of removed URIs during authorization and token exchange. One data migration; no schema or request/response shape changes. Admin API and UI list editing follow separately. Rollout: Drain old replicas before upgrading; callback edits handled by old code are not reflected on new replicas. Refs PLAT-619. |
||
|
|
c2f2c1708e |
feat: route and link the User spend page for its viewers (#28964)
Routes `/ai/settings/spend` to the spend page and opens it to its
viewers: a **User spend** entry in the AI settings sidebar, the **AI**
entry in the Admin settings menu, and the AI settings index redirect all
admit anyone who can read some organization's group members
(`canViewAISpend`, the same `group_member:read` check the endpoint
applies), so Owners, Auditors, Template Admins, User Admins, and
organization admins reach it the way organization MCP sharers already
do. Documents the page in the AI Gateway cost controls and spend
management guides.
## Why
This is the PR that makes the feature reachable; the spend page remains
unreachable until this merges. It also carries the head branch and
delivery record of the original single PR.
## What to scrutinize
- `canViewAISpend` is a pure entitlement-and-organization predicate.
Each of its three callers owns its query and loading/error behavior. The
Navbar and index redirect skip that query for viewers with site-wide AI
settings permissions. This repeats the short query wiring rather than
introducing a shared hook.
- `AISettingsSidebarView` keeps User spend as a direct navigation entry.
- The index redirect checks spend access last, after every existing
destination.
## Rework note
Rewritten in place on 2026-09-20 as the ninth layer of a nine-PR stack;
the head branch name predates the split. The original description and
the UAT delivery record through round 13 (PASS on
`e830cbf9937d17a0693909bd027cc142393ceef3`) are preserved in the first
comment below. That verdict applies to the pre-split head, not to this
rewritten commit.
## Validation
`pnpm test src/modules/management/AISettingsSidebar.test.tsx
src/modules/dashboard/DashboardLayout.test.tsx
src/pages/AISettingsPage/AISettingsIndexRedirect.test.tsx`, Storybook
`AISettingsSidebarView` (`SpendVisible`, `UserSpendActive`), repository
pre-commit (includes markdown lint for the docs).
## Delivery record
Composed head `d899228f798` passed format, check, full frontend lint,
125 targeted unit tests, and 86 story tests. Every layer passed
integration checks and the commit hooks. Pre-push hooks were skipped as
requested.
The eight-role frontend audit covered `2cb8fb35b12..1adb58ecbd6`.
Findings were fixed before publication: the picker stays mounted after
the initial retention load; its skeleton uses utility classes; vacuous
test loops and the unnecessary predicate comment were removed; and the
entitlement fixture was simplified. RO3 query-wiring duplication is
intentionally retained to keep the access check a pure function, as
requested.
| Audit role | Task | Disposition |
|---|---|---|
| Simplicity and frontend contract | `fff065b7b7` | No findings |
| Reuse | `30b7fde9ac` | RO3 nit accepted above |
| Accessibility | `3bfd41ce80` | SA1 and SA6 fixed |
| Comments | `4eacb22ea8` | CD2, CD3, CD5 fixed |
| Tests | `1b03411670` | Test coverage corrected; literal-model API
regressions pass |
| Types | `7ef176f55d` | Fixture cleanup and picker regression fixes
integrated |
| React | `4d259f8821` | No findings |
| Data flow | `2a897df255` | No findings |
The follow-up fixes were validated by the implementing agents and the
composed-tip checks, not a new independent review of this exact head. No
further Codex or human re-review was requested because the review budget
is exhausted. Live UAT has not been rerun on this head; round 14
exercised `926d489db6c` and remained BLOCKED on the spend-only
entitlement cycle. Round 15 was halted after shared-deployment contact.
No UAT pass is claimed for the current stack.
## Stack context
PR 9 of 9. The stack adds a **User spend** page under **Admin settings**
> **AI** > **User spend**: total and per-user AI Gateway spend for one
organization over a reporting period, read from `GET
/api/v2/organizations/{organization}/ai/spend/users` (#29129, merged).
It is #28964 split into one-concern PRs. Historical UAT covers earlier
heads only; live UAT has not been rerun after these review fixes. Bottom
to top: DateRangePicker limits, shared dimension badge, API client
method, spend table, page view, page container, reporting period,
dimension filters, route and navigation (#28964).
> Xum prepared this PR on behalf of @ibetitsmike.
|
||
|
|
80eee58d1d |
feat: add the organization AI spend client method and report fixture (#29627)
Adds `API.getOrganizationAISpendUsers(organizationId, params)` for `GET
/api/v2/organizations/{organization}/ai/spend/users` (period, provider,
model, client filters plus `limit`/`offset`), the
`MockOrganizationAISpendReport` fixture, and a shared
`codersdk.MaxAISpendPeriodDays` constant that the enterprise export
handler now reads and that `make gen` emits into `typesGenerated.ts`.
The model-list endpoint also accepts a literal `model` prefix. The
backend escapes SQL LIKE characters, while `q` keeps its existing search
syntax. Supplying both nonempty parameters returns 400. The filter menu
adopts this parameter in #29632.
## Why
The frontend caps custom ranges at the same 31-day limit the server
enforces; one SDK constant keeps the two from drifting. The fixture is
what every later test and story renders. Literal model identifiers
should not require search-language quoting or SQL escaping in the
frontend.
## What to scrutinize
- `enterprise/coderd/aibridge.go`: `maxAISpendExportPeriod` is now
derived from the SDK constant, same value as before.
- `MockOrganizationAISpendUser` is not exported yet; the table PR
exports it for its stories (knip fails on exports without a consumer).
## Generated files
`site/src/api/typesGenerated.ts`, `coderd/apidoc/docs.go`,
`coderd/apidoc/swagger.json`, and `docs/reference/api/aigateway.md` via
`make gen`.
## Validation
`pnpm test src/api/api.test.ts -t getOrganizationAISpendUsers` (new
case), `go test ./enterprise/coderd/ -run TestAIBridgeListModels
-count=1 -v`, repository pre-commit including `make gen` with no drift.
Model tests cover literal punctuation, prefix matching, existing `q`
behavior, and conflicting parameters.
## Delivery record
Published head `8d9a4faa0aa` passed per-layer integration checks and
commit hooks. The composed head `d899228f798` passed format, check, full
frontend lint, 125 unit tests, and 86 story tests. Pre-push hooks were
skipped as requested. See #28964 for audit findings, their disposition,
and historical UAT limits. No exact-head live UAT or new independent
re-review is claimed.
## Stack context
PR 3 of 9. The stack adds a **User spend** page under **Admin settings**
> **AI** > **User spend**: total and per-user AI Gateway spend for one
organization over a reporting period, read from `GET
/api/v2/organizations/{organization}/ai/spend/users` (#29129, merged).
It is #28964 split into one-concern PRs. Historical UAT covers earlier
heads only; live UAT has not been rerun after these review fixes. Bottom
to top: DateRangePicker limits, shared dimension badge, API client
method, spend table, page view, page container, reporting period,
dimension filters, route and navigation (#28964).
> Xum prepared this PR on behalf of @ibetitsmike.
|
||
|
|
60cc826f2b | feat: sign forwarded MCP identity headers (#29669) | ||
|
|
af0ef00f91 |
feat: add owner_id to CreateChatRequest to create chats for another user (#29581)
Owners and owner-level service accounts can now start a Coder Agents
chat on behalf of another user by setting `owner_id` on `POST
/api/v2/chats`. The field is optional and defaults to the caller, so
existing clients are unaffected. A delegated owner must be an active,
non-system member of the requested organization; anything else returns
400 `Chat owner must be an active member of the organization.` once the
caller has passed the authorization gates below.
A chat runs entirely with its owner's credentials (synthetic API key,
workspace access, OIDC and provider tokens), so creating one for someone
else is acting as that user. On top of org-scoped `chat:create` for the
owner, the caller must hold the authority to create API keys for that
user, which is what the token endpoint demands to mint their session.
Org admins therefore cannot use it; site owners and owner-role service
accounts can. For the same reason the workspace binding, model config,
and MCP server IDs are validated as the owner rather than the caller,
and the owner must themselves hold `chat:create` (organization service
accounts do not). The initial user message is attributed to the caller
through `chatd.CreateOptions.CreatedBy`.
An earlier revision of this PR exposed the same behavior as `POST
/api/v2/users/{user}/chats`; that route and
`codersdk.Client.CreateUserChat` were removed in `62a8be3dd32` in favor
of the request field. An explicit zero `owner_id` is rejected with 400
rather than silently defaulting to the caller. Coverage lives in
`TestPostChats_OwnerID`.
<details>
<summary>Review record (path-based revision, gates unchanged)</summary>
- Two-axis code review (Standards, Spec) plus a simplicity audit ran as
Xum sub-agents on `1f3189898f0`. The Spec axis found the workspace
binding was authorized as the caller, fixed in `363d45281d8` with
red-green coverage in `WorkspaceNotAccessibleToOwner`. The additional
API-key gate and the `CreatedBy` attribution go beyond the workspaces
pattern and were kept deliberately for the reasons above.
- Codex review on `363d45281d8`: one P2, suspended, dormant, or system
users could be targeted and would get a chat that can never run because
AI Bridge refuses to authorize them. Fixed in `c065437e359` with
`OwnerSuspended` (red on the old head); thread replied to and resolved.
- Codex review on `c065437e359`: one P2, an explicit or
personal-override model config the caller can read but the owner cannot
was accepted and chatd would silently fall back to the default model at
run time. Fixed in `aa88b608182` by resolving the model config and MCP
server IDs under the owner's context, with
`ModelConfigNotAccessibleToOwner` (red on the old head); thread replied
to and resolved.
- Codex review on `aa88b608182`: one P2, an organization service account
(which deliberately holds no chat permissions) could be targeted because
the chat permission check ran as the caller. Fixed in `a6fe8075c30` by
also requiring the owner subject to hold `chat:create`, with
`OwnerWithoutChatPermission` (red on the old head); thread replied to
and resolved.
- Codex review on `a6fe8075c30`: one P2, the active/non-system check was
skipped when the caller could not read the owner's user object. Fixed in
`0dd8bb4dd44` by moving the check behind the authorization gates with a
system-restricted lookup; thread replied to and resolved. In
`62a8be3dd32` that lookup became a single `OrganizationMembers` query,
which also covers membership and excludes system and deleted users.
- Codex review on `62a8be3dd32` (the `owner_id` revision): two P2s. An
explicit zero `owner_id` was treated as omitted and created the chat for
the caller; fixed in `f54b4f33d36` with a 400 and `OwnerIDNil` (red on
the old head). Creation and the read-back still ran as the caller while
the preflight ran as the owner; fixed in the same commit by passing
`ownerCtx` to `CreateChat`, `GetChatByID`, title generation, and the
file-metadata fetch. That second scenario is unreachable today (only the
built-in `owner` role holds `api_key:create` for others, and site-wide
custom roles are refused by both the API and dbauthz), so it has no
dedicated red test. Both threads replied to and resolved.
</details>
<details>
<summary>Remote UAT record (path-based revision)</summary>
Remote UAT on dogfood (chat `d7442df3-693f-4403-805f-2de52f7bdbed`, Xum
sub-agent as critical runner) tested head `21ed6b389cc`, the last
path-based revision. Licensed dev server, real Haiku 4.5 model, 77
logged API requests, 23 inspected screenshots. Endorsed verdict:
**PASS**. Site owner creates a chat for member X: X sees it, gets real
answers to the admin prompt and to follow-ups, and state survives reload
and mid-response refresh. The creating admin gets `403 Only the chat
owner may send messages.` and a read-only view; an unrelated member gets
404. Org admin, member, user-admin, and template-admin callers get 403;
owner-role service account 201. Suspended, dormant, and service-account
targets 400; owner-inaccessible workspace, model config, or MCP server
400; 300 KiB body 413. The `owner_id` revision changes only how the
owner is supplied and the non-member response (400 instead of 404); the
authorization and eligibility gates it exercised are unchanged and
covered by `TestPostChats_OwnerID`.
Non-blocking findings for the author's judgment, none of them
regressions of this PR:
1. X's UI shows no author on the admin-written first message and offers
X "Edit" on it; `created_by` carries the admin but the frontend does not
surface it.
2. A site owner who is not a member of the organization can still create
a chat for its members (201), while a self-owned `POST /chats` returns
403 for the same organization; same asymmetry as `postUserWorkspaces`.
3. The creating admin can archive, rename, and interrupt X's chat
although it cannot message it (pre-existing chat authz).
4. Owner-inaccessible model config or MCP server is reported as "not
found or disabled" with no hint that the owner, not the caller, lacks
access.
5. Dormant (never logged in) targets are refused because AI Bridge
rejects non-active users; a new hire cannot be given a chat until first
login.
6. The endpoint docs list only 201 and 413.
</details>
> Xum (an AI agent) acted on behalf of @ibetitsmike for this PR.
|
||
|
|
988520477e |
feat!: remove the experimental chat API mounts after the transition window (#29548)
Remove the `/api/experimental` duplicates of the promoted chat API. #28496 double-mounted the chat, organization chat and MCP server, member model-override, AI provider key, and MCP OAuth2 disconnect routes under both prefixes for the one-release compatibility window decided in CODAGT-921; that window closed with v2.37.0, so these routes now answer only on `/api/v2`. The change also deletes what existed only for the dual mount: the `chatAPIPrefix` plumbing, the shared cross-prefix files rate limiter (`RateLimitByAPICompatibilityEndpoint`), the 410 tombstones for the legacy `chats/providers` and `chats/user-provider-configs` collections with their `ExperimentalClient` SDK methods, and the `/providers` and `/user-provider-configs` 404 reservations on `/api/v2`. Signed chat file download URLs now point at `/api/v2`. Routes that were never promoted stay on `/api/experimental`: the experiment-gated `chats/config/advisor` and `chats/config/computer-use-provider`, `chats/{chat}/stream/desktop`, `chats/{chat}/debug/runs`, and the MCP OAuth2 callback, whose path is pinned as a registered redirect URI with external providers. The frontend already calls `/api/v2` for every promoted route, so only `typesGenerated.ts` changes. Because the experimental mount no longer reserves the removed collection segments, requests such as `GET /api/experimental/chats/models` now fall into the `{chat}` wildcard and return 400 instead of 404; the experimental prefix carries no stability guarantee and the compatibility window is over, so no new reservations were added. `coderd/x/chatd/ARCHITECTURE.md` now describes the single `/api/v2` mount and the remaining experimental routes, and its endpoint headings use the `/api/v2` paths. Closes CODAGT-922 (https://linear.app/codercom/issue/CODAGT-922/remove-experimental-chats-api-paths-after-transition-window). Refs #28496. ## Delivery record - Remote dogfood UAT (Coder Agents chat https://dogfood.cdr.dev/agents/c016b549-201a-4eca-a50f-3c0b7c339db6): verdict PASS on b008976a4dfba3524b220ca846ea3c3492e9cc9c. The branch was since rebased onto main (which had a duplicate migration 000596 until #29568) and gained one docs-only commit (`coderd/x/chatd/ARCHITECTURE.md` only); the current head |