Commit Graph
3375 Commits
Author SHA1 Message Date
Danielle MaywoodandClaude Opus 5.5 02567e9194 feat: serve agent previews on strict preview hosts (#32439)
Agent-written pages are untrusted, because a prompt-injected agent can
write any HTML. The security review (coder/security-assessments#437)
showed that serving them like ordinary apps lets them reach the user's
apps in every workspace. Previews therefore get their own strict host
mode instead of the app path: a sandboxing CSP, framing only by the
dashboard, no shared app cookie, and no top-level loads.

Preview hosts sit under the existing wildcard app hostname, so operators
need no new DNS or certificates. The experiment stays out of the safe
experiments, so `--experiments='*'` does not enable it, until we have
more experience running previews. That is a rollout choice, not a known
safety problem.

<details>
<summary>Implementation details</summary>

Adds the `open-preview` experiment, which is hidden from
`--experiments='*'` and must be named explicitly, and serves agent
previews on preview hosts under the existing wildcard app hostname in a
strict mode. A security review (coder/security-assessments#437) showed
that agent-written pages served like ordinary apps can reach the user's
apps in every workspace, so preview hosts are locked down:

- `preview--<id>--<agent>--<workspace>--<owner>` serves a file preview
from the agent API (port 4), and `preview--<port>--…` serves a port.
Both use the owner sharing level and ignore port shares. The port
forwarding display app only hides the dashboard's ports UI, so it does
not gate port previews, just as it does not gate port URLs. Connection
logs record file previews as `workspace_app` and port previews as
`port_forwarding`, under the `preview--` slug.
- `coderd/x/previewhost` decides how previews are hosted. Coderd and
workspace proxies build one `Hosting` at startup with
`previewhost.Strict`, and every preview host request goes through
`servePreview`. A later preview domain on another site would add a
second constructor. `Hosting.Sandbox`, `Hosting.URL` and
`PreviewID.Slug` are used by the sign-in (#32522) and tool (#32440) PRs.
`API.previewsUnavailable` and `previewhost.ErrHostPrefixCookieOff` have
no reader here beyond the startup log; the sign-in (#32522) and tool
(#32440) PRs read them.
- `Hosting.ApplyPolicy` adds the CSP (`sandbox`, `default-src 'self'`,
`form-action 'self'`, `frame-ancestors` the dashboard) and drops `Link`
headers, `Clear-Site-Data` and cookies with a `Domain` attribute. A
response writer applies it to every response coderd writes on a preview
host, including its own sign-in, error and 403 pages, at `WriteHeader`,
because Go's `ReverseProxy` clears response headers after a 1xx. The
writer drops 1xx responses other than 101. `ReverseProxy` writes a
WebSocket 101 to the hijacked connection instead, so the proxy also
applies the policy to every proxied response in `ModifyResponse`.
- Requests whose `Origin` is another preview host of the same server get
a 403, before CORS is applied.
- `DBTokenProvider.Issue` refuses previews unless the experiment is on,
`--host-prefix-cookie` is enabled, the request is a subdomain request,
and the caller owns the workspace. The host-prefix requirement keeps a
preview's script from replacing the user's Coder session cookie; without
it, coderd still starts and logs a warning.
- A preview without a session gets a 401 page that posts a
`coder-preview-sign-in-needed` message to the dashboard, which then
signs the user in once (see #32522).
- A top-level open of a preview host gets a 403 page that links to the
dashboard, so a preview never loads outside the dashboard's wrapper.
Browsers send no fetch metadata to a plain-HTTP host other than
localhost, so there the page says previews need an HTTPS access URL.
Service workers are refused.

</details>

**Stack** (review bottom-up). Replaces the closed #31282 stack. Security
review: coder/security-assessments#437.

1. #32438 Agent file previews
2. #32439 Strict preview hosting and experiment, this PR
3. #32522 Preview sign-in
4. #32440 open_preview chat tool
5. #32441 Agents UI
6. #32442 Docs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 10:42:54 +00:00
Sas Swart 8e569c9c2e refactor: share AI spend fields between organization spend types (#32663)
`UserOrganizationAISpend` and `OrganizationMemberAISpendStatus` now
share their effective group, budget and spend fields through a new
embedded `codersdk.AISpendBudgetStatus`, as suggested in
https://github.com/coder/coder/pull/32203#discussion_r4583554893. The
organization member AI spend handler now builds the budget with the
existing `aiBudgetLimitToSDK` helper instead of by hand.

The wire format does not change. Embedded struct fields serialize at the
top level of the JSON object, so both responses keep the same keys. In
the generated swagger, only the property descriptions change, because
the doc comments were merged to fit both types. `typesGenerated.ts` now
uses `extends AISpendBudgetStatus` with the same fields. The tests
change only because Go composite literals must name the embedded struct.

_Generated by Coder Agents on behalf of @SasSwart._
2026-12-03 08:56:42 +00:00
Lisa Fiander 8d3051a928 fix(scripts/releaser): derive ESR calendar statuses from esr_versions.txt (#32905)
The release calendar in `docs/reference/releases.md` still lists 2.29 as
an Extended Support Release after the v2.40.0 release, and lists 2.40 as
plain `Mainline` instead of `Mainline (ESR)`.

`releasetui` (`scripts/releaser/docs.go`) only moves rows along the
Mainline, Stable, Security Support, and Not Supported chain. It never
reads `scripts/release_channels/esr_versions.txt`, so rows marked
`Extended Support Release` never change, and new ESRs never get the
`(ESR)` suffix. #32843 updated that file to replace 2.29 with 2.40
before #32858 regenerated the calendar, but the calendar ignored the
change.

- `updateCalendar` now loads the active ESR set from `esr_versions.txt`,
the same file the backport workflow and
`scripts/update-release-calendar.sh` use, and re-derives the ESR
statuses on every run.
- Fixes the current calendar: 2.29 becomes `Not Supported` and 2.40
becomes `Mainline (ESR)`.
- Adds a regression test that replays the v2.40.0 release against the
calendar from before #32858.

Refs #32843, #32858

<details>
<summary>Implementation notes</summary>

- On each run, `updateCalendar` removes any ESR markers to get each
row's base status, applies the normal channel transitions, and then
re-applies the markers from `esr_versions.txt`. An active ESR shows
`Extended Support Release` once it leaves the standard channels and
`<Channel> (ESR)` while it is still in one. A retired ESR goes back to
`Not Supported`.
- ESR markers are applied before `trimOldestNotSupported`, so an active
ESR such as 2.34 is never trimmed. Retired ESRs are trimmed like any
other unsupported row.
- Patch releases also re-apply the markers, so the calendar corrects
itself after any change to `esr_versions.txt`.
- The broad `strings.Contains(r.Status, "Stable")` match for the old
`Stable + ESR` format is replaced with an exact match, because ESR
suffixes are now removed before the transitions run.
- The hand-edited calendar keeps 2.29 as a `Not Supported` row so
readers can see that it reached end of life. The next minor release
trims it automatically.

</details>

---

> [!NOTE]
> Generated by Coder Agents on behalf of @Lisa-Fiander.
2026-12-02 19:23:44 +00:00
Ethan 924e84d59a fix: gate chat instruction reads on deployment_config:read (#32928)
Closes WI-101

`GET /api/v2/chats/config/system-prompt` and `GET
/api/v2/chats/config/plan-mode-instructions` both checked
`deployment_config:update`, so a token that only needs to read them,
e.g. for a `terraform plan`, also had to be able to write them, along
with every other setting behind that permission. The check was `read`
when #23616 first added it, and was switched to `update` in that same PR
to match the gate on the settings form.

To fix, we'll check `deployment_config:read` on both, as the other
admin-only reads under `/chats/config` already do. The `PUT`s still need
`update`. Both settings are now gated on `read` in `dbauthz` as well.
Plan mode instructions already had a check there, which moves from
`update`. As chatd only holds `read`, it had been borrowing the system
identity for that read, and now reads them as itself. The system prompt
had none, as chat creation read it as the chat's creator, so chatd now
reads it itself too, like it does for organization instructions. As each
`PUT` reads the old value for its audit entry, both now answer 403 for a
token without `read`.

Auditor is the only built-in role with `read` but not `update`, so
auditors now get a read-only view of the deployment instructions on the
Instructions page. The sidebar link to that page is shown for `read`
too.

A token scoped to `deployment_config:update` without
`deployment_config:read` can no longer read or write either setting.
Tokens have only been able to request these scopes since #32653, which
isn't in a release yet.
2026-12-02 15:54:14 +00:00
Ehab Younes df0e1a4047 fix!: only apply connection settings from deployment SSH config options (#32921)
- Limit --ssh-config-options to an allow list of connection settings:
  timeouts, keepalives, connection sharing (ControlMaster,
  ControlPersist), algorithms, authentication methods and logging,
  matching the VS Code extension's list
- Make `coder server` drop other options, and options set more than once
  in different case, with a startup warning instead of refusing to start
- Apply the same filter in `coder config-ssh` to what the deployment
  serves and print a warning, so it behaves the same against older
  servers
- Keep rejecting values with line breaks or NUL characters; malformed
  option names are ignored along with the rest
- Make SSHConfigResponse.Validate reject options outside the list, so
  callers filter first

BREAKING CHANGE: options outside the list, such as ForwardAgent, User,
HostName or SetEnv, are no longer written to users' SSH configs. Users
who need them can pass `coder config-ssh --ssh-option`.

Closes CLIENT-1123
2026-12-02 15:11:16 +00:00
Ethan b4d485bdb6 fix: send max_completion_tokens to Azure OpenAI reasoning models (#31952)
Closes #31714
Closes WI-31

Azure OpenAI reasoning models reject `max_tokens`:

```
Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.
```

We pick between `max_tokens` and `max_completion_tokens` from the model
name, and that check only knew names up to `gpt-5`, so a `gpt-6-luna`
deployment failed on default settings. To fix, the fantasy bump
(coder/fantasy#86, coder/fantasy#87 and coder/fantasy#88) extends the
check to `gpt-6` through `gpt-9`. That bump is a full sync with
upstream, so it also brings the other chatd changes listed there, which
is why a few test expectations move here.

On Azure that name is the deployment name though, which doesn't have to
say what model it serves. So the model form now also shows the existing
Reasoning Model setting for Azure models, and we obey it. With it on, we
send `max_completion_tokens` and drop `temperature` and `top_p`,
whatever the deployment is called.

I confirmed against a real Azure `gpt-5.4` deployment that it rejects
`max_tokens` and accepts `max_completion_tokens`, but that test resource
has since gone, so I haven't run this exact change against Azure.

This only fixes the `max_tokens` error. Going by [Microsoft's
docs](https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/reasoning),
I think GPT-6 chats on Azure will then hit a second error, as on Chat
Completions those models only accept tools with the reasoning effort set
to `none`, or not at all. The OpenAI and Bedrock providers use the
Responses API, so they aren't affected. I can't reproduce that for the
same reason, so it's being tracked separately at
[CODAGT-1655](https://linear.app/codercom/issue/CODAGT-1655).
2026-12-02 20:37:20 +11:00
Jaayden Halko 4aef0f6fdd feat: add chat project summaries (#32026)
Adds project summaries and share counts on top of #32025. The sidebar's
pinned projects read the summaries; the Projects page reads the
summaries and the counts.

- **`GET /api/experimental/chats/projects/summaries`** returns one
`ChatProjectSummary` for every project in the existing project list (the
same set): `project_id`, `pinned`, `pin_order`, `own_chat_count`,
`own_unread_count`, `own_running`, `own_needs_attention`
(`requires_action`, `error` or `paused`) and `last_activity_at` (newest
`updated_at` among the caller's counted chats). Counts use only the
caller's own top-level, non-archived chats; unread uses the same rule as
`has_unread`. `pin_order` is the stored order from #32025: it sorts the
pinned projects, lowest first, and can have gaps. A summary does not
repeat the project: clients pair it with `GET /chats/projects` by ID.
- **Share counts on `ChatProject`:** every project response now carries
`member_count` (the owner plus the users the project is shared with
directly), `group_count` (shared groups, including Everyone) and
`shared_with_everyone`. They count exactly the users and groups `GET
.../projects/{project}/acl` lists: users outside the project's
organization and deleted groups are left out, through the same helper
the ACL endpoint uses. Group members are not expanded, so a list costs
two extra queries (memberships and groups) for any number of projects.
While chat sharing is disabled or the `chat-project-sharing` experiment
is off, every project reports 1 member, 0 groups.
- **Same numbers on both pages:** the project page heading already
showed "N members, M groups" from the ACL. It now uses a shared
formatter, `formatProjectMembers`, which the Projects page card (#32083)
also uses, and names the Everyone group first instead of counting it:
"Everyone, 2 members, 1 group".
- **Why summaries are separate:** the pin and the caller's chat counts
change with every chat event, and clients refetch them often, so they do
not come with the project, its templates and permissions.
- **Authorization:** summaries return only projects the caller can read.
They also carry the caller's pins, so they ask RBAC for `read_personal`
on the caller: an API key scoped without `user:read_personal` gets a
403. The summaries authorize each project with a full evaluation while
the caller has fewer than 200, because the partial evaluation
`rbac.Filter` prepares by default costs an organization member about 6
ms per request and a full evaluation about 0.03 ms per project.

<details>
<summary>Verification</summary>

`make gen/db` and the API docs and TypeScript types regenerate cleanly;
Go lint on the changed packages, the summaries, share counts, pin, chat
list, ACL and dbauthz tests pass; `pnpm lint` and the project page tests
pass. `TestChatProjectShareCounts` fails if either ACL filter
(organization membership, existing groups) is removed. The summaries
timings (1.6 ms at 10 projects, 4.6 ms at 50) are medians of 40 runs
against a local Postgres 13, measured before the share counts change.

Dogfood UAT with a premium license ran on an earlier response shape,
which carried the project and a people count inside each summary. It was
not repeated for this shape; the Go and Vitest tests cover it.

</details>

> [!NOTE]
> Most of this PR was written by AI agents (Xum, with UAT run through
Coder Agents). The verification above is from those runs.
2026-12-02 14:49:09 +07:00
Jaayden Halko 9c53f3d7ee feat: add per-user chat project pins (#32025)
Adds per-user chat project pins, the first backend layer of the Projects
page and pinned projects design. Nothing in the UI reads pins yet; the
sidebar and Projects page PRs stacked on top do.

- **Schema:** migration `000647_chat_project_pins` adds the
`chat_project_pins` table (`user_id`, `project_id`, `pin_order`,
`source` of `migration`/`default`/`user`, `created_at`). Unpinning
deletes the row. The migration pins every project to its owner in
today's sidebar order (`lower(name), id`); shared projects are not
pinned.
- **Shared rule for which projects a user's list matches:** the
migration also adds `chat_project_ids_for_user(viewer_id,
include_grants)`: owned projects, plus projects whose ACL names the user
or one of their groups (including Everyone) in an organization they
belong to. The project list and `GetChats` call it instead of each
keeping a copy of that predicate, and so do #32026's queries. Postgres
inlines it, so the ACL indexes still apply (same results and timings as
before on a 10,000-user, 305-project test database).
- **Endpoints:** `PUT` and `DELETE
/api/experimental/organizations/{organization}/chats/projects/{project}/pin`
pin and unpin. `PUT` takes no body and pins at the end; a project that
is already pinned keeps its place. `DELETE` removes the pin. The caller
needs read access to a project they can use (anything else is a 404) and
`update_personal` on themselves, because a pin is their personal data;
an API key scoped without `user:update_personal` gets a 403. Pins are
personal preferences, so they are not audited.
- **Reordering:** `PUT /api/experimental/chats/projects/pins/order`
takes `{"project_ids": [...]}`, the pinned projects in their new order.
The server saves the listed pins in that order and keeps every other pin
after them, in its current order. The table also holds pins the caller
can no longer see (lost access, sharing disabled), and this way no write
has to work out which pins those are. IDs the caller has not pinned are
ignored, so a project unpinned in another tab does not fail a reorder.
The route sits outside `/organizations/{organization}` because one pin
list spans organizations. It needs only `update_personal` on the caller.
Pins and reorders take a per-user advisory lock. The stored `pin_order`
only sorts the pins: it can have gaps after an unpin or a deleted
project, until the next reorder.
- **New projects** get a `default` pin for their creator inside the
create transaction, so an API key scoped to create projects needs the
pin's two permissions as well, and gets a 403 without them.
- **Chat list:** `exclude_own_project_chats=true` leaves out the
caller's own unpinned chats in projects the caller can use; clients list
those per project with `project_id`. Project pins don't change the
result, so pinning or unpinning never changes the chat list. Shared
chats and the caller's pinned chats are still returned, and so are chats
in projects the caller can no longer use, because no project list
reaches them. The filter sits in the same `WHERE` as the cursor, so
pages stay full.

User-facing docs land with the UI PR, since these routes stay under
`/api/experimental` with `x-apidocgen skip` like the other project
routes.

<details>
<summary>Verification</summary>

`make gen` (clean diff), `go build ./...`, `make lint/go`, and the pin,
chat list, migration (`TestMigration000647PinsOwnedProjects`,
`TestMigrateUpWithFixtures`), dbauthz and codersdk tests pass. `make
pre-commit` passes except `lint/actions/actionlint`, which needs a newer
local mise and fails the same way on `main`.

The dogfood UAT below ran when a pin took a `pin_order` position. It was
not repeated after reordering became its own call; the Go tests cover
that call, including overlapping reorders and pins.

Dogfood UAT ran against a dev deployment with a premium license (groups
and a second org created through the licensed APIs): upgrade from `main`
with case-sensitive names, pin/reorder/unpin/re-pin, 400 and 404 paths,
an 84-request concurrent pin burst with no 5xx, the chat list filter in
each sharing mode (as `pinned_projects_only`, before the rename to
`exclude_own_project_chats`), and cascade on project delete. Upgrade
output:

```text
 username |  name   | pin_order |  source
----------+---------+-----------+-----------
 usera    | Alpha   |         1 | migration
 usera    | beta    |         2 | migration
 usera    | gamma   |         3 | migration
 userb    | bown    |         1 | migration
 userb    | Bshared |         2 | migration
```

Creating a project afterwards appends a `default` pin at position 4, and
usera has no pin on userb's shared `Bshared`.

</details>

> [!NOTE]
> Most of this PR was written by AI agents (Xum, with UAT run through
Coder Agents). The verification above is from those runs.
2026-12-02 13:57:14 +07:00
Douglas Luman ca8a7c24a1 docs: keep Coder Agents off Agent Relay templates (#32861)
Templates allow Coder Agents by default, so a Coder Agents chat can pick
an Agent Relay template and create a workspace from it. This documents
how to block that.

- `docs/agent-relay/setup.md`: adds a "Keep Coder Agents off Relay
templates" recommendation to Step 3, with the CLI (`coder templates edit
<template> --agents-allowed=false`) and the dashboard path (**Admin
settings** > **AI** > **Coder Agents** > **Templates**, or the
template's settings page). It notes that the setting doesn't affect
Agent Relay, which creates workspaces with its service account.
- `docs/coder-agents/platform-controls/index.md`: adds a Template
routing example that links to the Relay template step.

`agents_allowed` is enforced only by the Coder Agents chat tools
(`list_templates`, `read_template`, `create_workspace`) and chat project
templates, so Relay's workspace creation is unaffected.
2026-12-01 16:38:59 -05:00
b-coder-b 9f5d29ea46 chore(docs): update release docs for v2.40.0 (#32858)
Automated docs update for v2.40.0 release.

Created by `releasetui`.
2026-12-01 19:23:24 +00:00
Denis Afonso dc436d4fab docs: apply review feedback to the ESR 2.34 to 2.40 upgrade guide (#32864)
The review of #32862 suggested readability fixes for the ESR 2.34 to
2.40 upgrade guide. They were applied on `release/2.40` in that PR, so
`main` is now behind the release branch for this page.

This brings the same change to `main`:
- SQL blocks after a `Check:` bullet are indented, so they stay inside
the list
- section references are anchor links instead of quoted names
- the Kubernetes part of the "Plan downtime" step is a nested list
- the `no_nats_pubsub` bullet in the NATS entry is labelled
`Alternative:`, and the text after `Check:` and `Action:` starts with a
capital
- "biannually" is "twice a year", and "the first five entries" is
dropped

**NOTE**: This does not need the `cherry-pick` label.
- `release/2.40` already has this change from #32862, and the page is
identical on both branches after this merges

🤖 Generated by Claude on behalf of @denisra.
2026-12-01 18:42:41 +00:00
Denis Afonso 0f9f531495 docs: add ESR 2.34 to 2.40 upgrade guide (#32860)
2.40 is the next Extended Support Release, and the docs have no guide
for customers who upgrade to it from 2.34:
- the latest guide covers 2.29 to 2.34
- `docs/reference/releases.md` still names 2.34 as the latest ESR

This adds the 2.34 to 2.40 upgrade guide:
- the page is `docs/install/operate/upgrade/esr-2.34-2.40-upgrade.md`,
which publishes at `/docs/install/operate/upgrade/esr-2-34-2-40-upgrade`
- it covers the steps to take before the upgrade, the changes that need
action, how to follow the database migrations in the `coderd` logs, and
the checks to run afterwards
- the sidebar gets an entry in
`docs/manifest/install/operate/upgrade.yml`, and `docs/manifest.json` is
rebuilt
- the releases page names 2.40 as the latest ESR and links the new guide

The wording was reviewed with Support before this PR, and the behavior
was checked against the `release/2.40` code and test upgrades from
2.34.21:
- the upgrades ran on a multi-replica Kubernetes deployment and on local
databases with injected migration failures
- Vale still reports advisory warnings for the unexpanded MCP, NATS and
TCP abbreviations and for two steps over 20 words, which are left as
reviewed

**NOTE**: Merge this after `v2.40.0` is published.
- the guide and the releases page link to the `v2.40.0` release notes,
which do not exist yet
- the release calendar on the releases page lists 2.40 as not released
until the release job regenerates it

🤖 Generated by Claude on behalf of @denisra.
2026-12-01 17:30:57 +00:00
Jeremy Ruppel b8aa0c1e4e fix(cli): fail before symlinking dotfiles over existing directories (#32713)
Fixes #32336

When a dotfiles repo has no install script and a dotfile matches an
existing directory in the symlink dir (almost always `~/.config`,
because Coder clones the repo into `~/.config/coderv2/dotfiles`), `coder
dotfiles` used to fail halfway with a raw `symlink ...: file exists`.
Files before the conflict were already moved to `.bak` and relinked, and
the rest were never linked.

`coder dotfiles` now checks every target before it backs up or links
anything. If any target is a non-empty directory (a symlink doesn't
count), the command exits non-zero without creating symlinks or backups.
The error lists every conflicting path and the recognized install script
names. Empty directories are still replaced, and with no conflicts,
behavior is the same as before. This PR doesn't add skipping or merging:
custom installation through an install script is the supported way to
manage directories, and the docs now say so.

```
cannot symlink dotfiles, these paths already exist as non-empty directories:
  /home/coder/.config
Add an install script to your dotfiles repository to install them instead. Recognized names: install.sh, install, bootstrap.sh, ...
```

The new `TestDotfiles/SymlinkConflictingDir` fails on `main`, where
`.bashrc` gets moved to `.bak` before `.config` errors, and passes with
the fix.

<details>
<summary>Implementation plan and decisions</summary>

### Decisions

- A target that exists as a non-empty directory (an `os.Lstat` result,
so a symlink doesn't count) is a conflict, whatever the repo entry is.
Empty directories are replaced, as on `main`.
- All or nothing: check every target before any rename or symlink. On
any conflict, create no symlinks or backups and exit non-zero.
- The error lists every conflicting path and the names from
`installScriptFiles()`, so it's right on Windows too.
- No docs URL in the error. `coder dotfiles` has no API client, so it
can't resolve a deployment's custom docs URL, and the error already
gives the user what they need to act.
- No merging and no skipping. Warning and continuing would leave the
user's config silently unapplied. Merging adds behavior with edge cases
(nested directories, existing files inside). An install script already
covers custom installation.
- With no conflicts, behavior is unchanged: existing files are backed up
to `.bak`, and existing symlinks are replaced.

### Changes

- `cli/dotfiles.go`: a check before the symlink loop that collects every
conflicting directory and returns one error.
- `cli/dotfiles_test.go`: `SymlinkEmptyDir` covers replacing an empty
directory, then replacing the resulting directory symlink on a second
run. `SymlinkConflictingDir`: The repo has `.config/foo` and `.bashrc`,
and the symlink dir already has a `.config` directory and a regular
`.bashrc`. The test asserts the error names `.config`, the existing
directory and file are untouched, and no `.bak` file is created.
- `docs/workspaces/workspace-dotfiles.md`: describes the symlink
fallback, the `--symlink-dir` flag, the directory conflict failure, and
that an install script replaces symlinking entirely.

### Verification

- The test fails on `main` and passes with the fix. It also fails again
when the conflict return is disabled.
- `go test ./cli -run TestDotfiles`, `make pre-commit`, markdownlint,
and Vale on the changed docs.
- Doc-check self-check: all blocking findings fixed.

</details>

---

_This PR was generated by Coder Agents on behalf of @jeremyruppel._
2026-12-01 12:28:05 -05:00
Nick Vigilante b911ed9782 docs: rename vague H2 and H3 headings and warn on them in Vale (#32635)
Closes DOCS-1025 (WCAG 2.2 SC 2.4.6).

- Rename 12 H2 and H3 headings whose whole text was a generic word
(`Overview`, `General`, `Other`, `Summary`, `Notes`). The issue lists 3;
`main` has 9 more, and a `warning` Vale rule has to ship with zero
findings.
- Add `Coder.VagueHeading` (`warning`): flags H2 and H3 headings that
are only `Overview`, `Details`, `Introduction`, `More`, `Notes`,
`Miscellaneous`, `Other`, `General`, `Info`, `Information`, `Summary`,
or `Background`. Documented in the style guide under "Descriptive
headings", with coverage tables updated.
- `configuration-reference.md` is generated, so `## General` is renamed
to `## Core server options` in `scripts/configdocgen`, with its test.

No inbound links pointed at the old anchors (checked with `git grep`).

<details>
<summary>Verification</summary>

- `vale` over `docs/`: zero `Coder.VagueHeading` findings. A scratch
file with `Overview`, `general`, `Overview of nsjail` confirmed it flags
the first two and passes the third.
- `make lint/style-claims`, `pnpm lint-docs`, and `go test
./scripts/configdocgen/` pass.
- `configdocgen` output matches the committed reference page.

</details>

> Generated by Coder Agents on behalf of @nickvigilante.
2026-11-30 18:17:59 +00:00
Nick Vigilante 262301db05 docs(docs/admin): apply the Administration content review copy fixes (#32638)
Applies the page-level copy notes from the
[DOCS-738](https://linear.app/codercom/issue/DOCS-738) Administration
content review that still hold after the Install spine move (#29304),
and fixes the control plane terminology drift left in hand-written
Administration pages since #28960.

This is the copy-only first slice of
[DOCS-1192](https://linear.app/codercom/issue/DOCS-1192). No page moves,
so no redirects. The sidebar restructure comes in a separate PR once the
IA decisions are settled.

<details>
<summary>Status of each DOCS-738 note</summary>

| Page | Note | Status |
|---|---|---|
| `admin` | Server, control plane, and `coderd` overlap | Settled by the
"Naming Coder's components" rule in #28960. This PR fixes the drift that
has crept in since. |
| `admin` | "configuration guide" link text | Applied. The link text now
matches the page title, "Configure control plane access", which replaced
"Setup" after the review. |
| `admin` | Landing page by role, terminology list | Deferred to the
restructure PR, because the role routes depend on the new sections. |
| `admin/setup` | Configuration reference linked only from the Tip |
Applied. It's linked from the intro now, and the Tip is gone. |
| `admin/setup` | Empty Up Next | Already filled. Renamed it to "Next
steps" and fixed "Setup" used as a verb. |
| `admin/setup/telemetry` | TL;DR note | Applied. "Turn telemetry on or
off" now leads the page. |
| `admin/setup/telemetry` | "Why we collect" | Applied: "Why we collect
telemetry" and "What telemetry we collect". The old anchors still
resolve. |
| `admin/setup/telemetry` | Heading case | No change. The headings are
already sentence case, which is the current style guide rule. |
| `admin/infrastructure` | Section blurb | Gone. #29304 moved the
section to Install > Plan. |
| `admin/infrastructure/architecture` | `coderd` versus control plane |
Settled by #28960 and the glossary. |
| `admin/templates/extending-templates` | Too many subtopics | Tracked
in [DOCS-874](https://linear.app/codercom/issue/DOCS-874). |
| `admin/templates/open-in-coder` | Spacing after the intro | No change.
The page is now `templates/open-in-coder.md`, and a caption paragraph
has since been added between the video and the first heading. I haven't
checked the rendered page. |
| `admin/integrations` | "container compute" | Applied. |
| `admin/networking` | "Tailscale's open source" | Applied. The sentence
now names Coder's Tailscale fork and what it provides. |
| `admin/networking/stun` | "The below glosses over" | Applied as "The
following description simplifies NAT traversal." I didn't use
"oversimplifies" because that would say the description is wrong. |
| `admin/monitoring` | Helm chart quick start leads the page | Applied.
The page opens with Coder's monitoring capabilities and a `<children>`
list (the hand-written list was missing two child pages), followed by
the Helm chart as its own section. |

</details>

<details>
<summary>Terminology fixes</summary>

- `monitoring/health-check.md`: "Coder server logs" becomes "`coderd`
logs" (EPS01, EPS02), and "the server running Coder" becomes "the
control plane host".
- `monitoring/logs.md`,
`integrations/oauth2-provider/troubleshooting.md`,
`users/password-auth.md`: "the server" becomes `coderd` or "the control
plane".
- `networking/workspace-proxies.md`: "primary coderd" becomes "the
control plane".
- `networking/reverse-proxy-caddy.md`: a firewall comment.
- `users/organizations-best-practices.md`: backticks around the `coderd`
Terraform provider name.

Left alone: peer-sense "server" in NAT prose, the NATS, webhook, and
hook servers, and the generated `configuration-reference.md`, which
still says "Coder server" and needs a `configdocgen` change.

</details>

Checks: `make lint/emdash`, `make lint/docs-html`, and `make
lint/docs-redirects` pass. markdownlint reports 0 errors on the changed
files. Vale reports nothing new compared with `main` on the changed
files. The doc-check self-check ran in author mode. It tightened two
claims and left no blocking findings.

Refs DOCS-1192

> [!NOTE]
> This PR was generated by Coder Agents on behalf of @nickvigilante.
2026-11-30 17:58:20 +00:00
Nick Vigilante 0aa72056c1 docs: qualify the offline claim on the air-gapped deployments page (#32821)
## Summary

The Air-gapped deployments page opened by saying every Coder feature
works offline.
Features that call a service outside the network, such as a hosted AI
provider, work only if the network can reach that service, and #32405
already says so on the requirements page and the platform chooser.
This PR gives the air-gapped page the same claim and rewrites the rest
of its intro to describe the page accurately.
Refs [DOCS-1914](https://linear.app/codercom/issue/DOCS-1914).

## Changes

- `install/prepare/airgap.md`, intro only:
- "All Coder features are supported in air-gapped / behind firewalls /
disconnected / offline" becomes "Coder can run in a network with no
internet access", followed by the hosted-service exception, worded as on
`install/server/index.md`.
- "This is a general comparison" now says what the table compares:
public and air-gapped deployments, component by component.
- "Keep reading for a full tutorial" is replaced: the page has no
tutorial, so the intro lists what the page covers and links to the
air-gapped K3s tutorial.

## Not in this PR

Two stale line references in the page's Dockerfile example, found while
making this change:

- "Comment out lines 40-49 if you plan on only using a volume or network
mirror" covers the `coder/coder` and `kreuzwerker/docker` providers and
stops partway through the `hashicorp/kubernetes` `RUN` command, so
following it leaves a line that starts with `&&` and the build fails.
  The seeded providers span lines 40-55.
- "Be sure uncomment line 60" points at a comment; the `ADD
network-mirror-example.tfrc` line is line 65.

Backport: after #32819 (the `release/2.40` backport of #32405) lands,
2.40 has the qualified claim on two pages and the old one on this page.
Adding the `cherry-pick` label after this merges keeps 2.40 consistent.

## Testing

- `make fmt/markdown`: only `airgap.md` changed.
- `make lint/emdash lint/docs-html lint/docs-manifest lint/markdown
lint/docs-redirects`: all pass.
- Vale on `docs/install/prepare/airgap.md`: no warnings.
- `grep -rn "All Coder features" docs/`: no matches.
- The K3s tutorial link resolves, and its link text matches the page
title.

<details>
<summary>Decision log</summary>

- The first sentence starts from the platform chooser's wording ("Coder
runs in a network with no internet access") and, per review, says Coder
_can_ run there, so it doesn't read as the default.
The platform chooser and the requirements page ("Coder runs without
internet access") keep their wording; they're outside this PR.
- The hosted-service example is a hosted AI provider, matching #32405,
because the Coder Agents `web_search` tool and hosted LLM providers are
the clearest case (`docs/coder-agents/architecture.md`).
- The page body is unchanged: DOCS-1782 owns the larger rework of this
page, so the Dockerfile line references are reported, not fixed.
- The Maven URL error noted in #32405 was already fixed by #32457.

</details>

---

_This PR was generated by Coder Agents on behalf of @nickvigilante._
2026-11-30 17:49:43 +00:00
Nick Vigilante 3f08db96a8 docs: lead the AWS install page with Amazon EKS (#32458)
## Summary

Rework the AWS install page so it leads with Amazon EKS and Helm, the
way enterprises install Coder on AWS.
The Community Edition and CloudFormation path stays as a
proof-of-concept option, with a clear note about the AWS resources it
creates.

Builds on #32405 (merged), which already sends EKS, AKS, and GKE readers
on the Cloud platforms page to the Kubernetes guide.
This branch is rebased onto `main`, so the diff holds only the AWS page
changes.
Refs [DOCS-1571](https://linear.app/codercom/issue/DOCS-1571).

## Changes

- `install/server/cloud/aws-marketplace.md`:
- The intro offers two paths: Helm on an EKS cluster you already run,
for deployments that others depend on, and the AWS Marketplace listing,
for a proof of concept.
- A new "Install Coder on Amazon EKS" section points to the Kubernetes
guide, Amazon RDS for PostgreSQL, the guide's AWS load balancer
settings, and a first template.
- The Marketplace section now opens by saying that the CloudFormation
stack creates an EKS cluster, sub-stacks, and a CodeBuild pipeline, and
that an existing cluster should use the EKS path instead.
    Its steps are unchanged.
  - Fixed typos: "from the from" in a heading and "lastest".
- `install/server/cloud/index.md`: the AWS tab lists the EKS path first,
then the Marketplace listing.
- `compute-engine.md` and `azure-vm.md`: one sentence each, pointing GKE
and AKS clusters to the Kubernetes guide.
- `docs/manifest/install/server/cloud.yml`: the AWS entry's description
now mentions both paths. `docs/manifest.json` is regenerated.

## Decisions for review

1. **The CloudFormation path is demoted, not removed.**
Ben said the page hurts more than it helps, but many customers install
from the Marketplace, so it stays below the EKS path.
2. **The sidebar title is still "AWS Marketplace".**
The page now covers EKS too, so a title such as "Amazon Web Services"
(the page's H1) would fit better.
That counts as a rename, which this pass rules out, so it's left for the
page moves in DOCS-1569.
3. **No EKS procedure is written here.**
The new section points to the Kubernetes guide, which already covers RDS
and the AWS load balancer.
   A tested, air-gapped EKS procedure is tracked as DOCS-1798.

## Testing

- `make gen/docs-manifest` and `make fmt/markdown`.
- `make lint/emdash lint/docs-html lint/docs-manifest lint/markdown`:
all pass.
- Vale on the four changed pages: 0 errors and 0 warnings. The remaining
suggestions are on lines this PR doesn't change.
- A relative link and anchor check on the changed pages: no broken
links.
- doc-check skill in author self-check mode. I fixed its one blocking
finding: the EKS steps named the load balancer settings but never said
to set them before `helm install`. I also added a link to the cluster
requirements.

<details>
<summary>Plan: issue scope to changes</summary>

| Scope item | What this PR does |
|---|---|
| Lead with EKS and link to the Kubernetes and Helm install | New intro
and "Install Coder on Amazon EKS" section, and the AWS tab on Cloud
platforms lists EKS first |
| Decide whether to keep, demote, or drop the CloudFormation path |
Demoted below EKS, with a lead-in that names the resources the stack
creates (decision 1) |
| Keep AWS Marketplace guidance | The Marketplace steps and screenshots
are unchanged |
| Check the other cloud platform pages for the same problem | The GCP
and Azure VM guides now point GKE and AKS clusters to the Kubernetes
guide |

Sources: Ben's view that the page hurts more than it helps, and Kirby's
report of a customer confused by the CloudFormation template's extra AWS
resources (install docs review, Nov 4).

</details>

---

_This PR was generated by Coder Agents on behalf of @nickvigilante._
2026-11-30 17:38:13 +00:00
Nick Vigilante 90bdd23b97 docs: Fix formatting in README.md for clarity (#32820)
Fix the formatting on the list of items under "What Coder is not"

<!--

If you have used AI to produce some or all of this PR, please ensure you
have read our [AI Contribution
guidelines](https://github.com/coder/coder/blob/main/contributing/AI_CONTRIBUTING.md)
before submitting.

-->
2026-11-30 12:32:31 -05:00
Simon Vasconcelos Lee 6bd3e2d1b0 docs: add Simafri to community install methods (#32597)
Adds Simafri to the community install methods, after Pethost. The link
opens a guide to running Coder v2.38.10 on a managed VPS with Docker
Compose and PostgreSQL 17.

**AI disclosure:** Claude Code drafted the guide and this row, and ran
the test below on a Simafri test server (Ubuntu 24.04, 2 vCPU, 4 GB) on
22 November. I have also tested it myself.

**Covered by the Claude Code run:** install of v2.38.7, first user,
upgrade to v2.38.10 with the guide's commands, Docker template push,
database dump loaded into a new empty database. Terminal output,
abridged:

```console
# docker compose pull -q coder
 Image ghcr.io/coder/coder:v2.38.10 Pulled
# docker compose up -d coder
 Container coder-coder-1 Started
# docker compose exec -T coder coder version
Coder v2.38.10+d2b40f3 Mon Nov 16 05:37:04 UTC 2026
# docker compose exec -T database psql -U coder -d coder_restore -Atc "select (select count(*) from users where username=\$\$bench\$\$) as users, (select count(*) from templates) as templates"
1|1
```

**Not covered by that run:** HTTPS and the wildcard certificate,
workspace creation, volume archives, restoring over the original
database, SMTP.

Disclosure: I work at Simafri.
2026-11-30 15:12:23 +00:00
Ben Potter 0929f00f34 docs: add the AWS Nitro Sandboxes template to the sandbox agents guide (#32366)
Adds the [AWS Nitro
Sandboxes](https://registry.coder.com/templates/daveahr2172/governed-agents-nitro)
template, merged in coder/registry#1253 and renamed in
coder/registry#1270, to the [sandbox agents
guide](https://coder.com/docs/@main/templates/extending-templates/sandbox-agents):

- A row in the registry template table, with a note that it is a
community template that Coder doesn't verify (`verified: false`, in the
`daveahr2172` namespace).
- An example under kernel, network, and secrets isolation.
- "Amazon Elastic Kubernetes Service (EKS)" is now spelled out in the
new row, its first use on the page, and shortened to "EKS" in the kernel
isolation table.

The other changed lines are the table formatter realigning columns.
`check-docs` failed on the first commit because the org no longer allows
the `reviewdog/action-setup` action, not because of this change.

---

_Generated by Coder Agents on behalf of @bpmct._
2026-11-30 09:00:26 -06:00
Ethan 6993824dd1 feat: allow scoped tokens to manage AI resources (#32653)
Closes CORE-916

A token can only be created with scopes from a hand-kept list of
requestable names, and that list has nothing for most Coder Agents
resources. As a result, a CI job that manages AI providers, MCP servers,
models or the system prompt, or one that just starts a chat, has to hold
an unscoped token.

This PR adds the names for `chat`, `ai_provider`, `mcp_server_config`
and `deployment_config`, the rest of `chat_model_config`, plus
`organization_member:read` and `assign_role:read`, which our Terraform
jobs also need.

I've tested locally that the calls of our dogfood Terraform plan and
apply jobs, and of `triage-via-chat-api.yaml`, all work with tokens that
hold only the scopes each job needs. That caught one bug, where `GET
/api/v2/organizations/{organization}/chats/models` returned a 403 to a
`chat_model_config:*` token, as the handler only accepted the exact
`chat_model_config:read` scope. It now accepts any scope that covers it.

Whilst here, I've corrected the description of
`deployment_config:update`, which the scopes reference gave as "Updating
health information."
2026-11-30 16:16:34 +11:00
Ethan ac92143dbe refactor!: remove the AI Gateway provider list route (#32651)
Relates to AIGOV-824

Stacked on #32650.

`GET /api/v2/ai-gateway/providers` was added in #28966, in September,
and first shipped in v2.38.0. It was a fix for the provider filter on
the AI Gateway sessions page. That filter called `GET
/api/v2/ai/providers`, which only owners could read, so the dropdown was
empty for auditors. Rather than open up the provider config, #28966
added a second route that returns just the `name`, `type`,
`display_name` and `icon` of every provider, deleted ones included, to
anyone who can read sessions, i.e. owners and auditors.

Now that `GET /api/v2/ai/providers` answers every signed-in user with
those same fields (#32650), the second route has no caller that it alone
can serve. Jake, who added it, and I agree that we should remove it
rather than keep two routes that list providers, so this PR does that.

The one thing only the old route did was return deleted providers, so
that sessions and spend recorded under a provider that has since been
deleted keep their label. So, `GET /api/v2/ai/providers` gains an
`include_deleted` query parameter. A deleted provider can share its name
with a live one, so each name appears once, as its live provider if
there is one, otherwise the most recently updated deleted one. Unlike
the old route, any caller can pass it, so members can now see the names
of deleted providers. A deleted provider comes back without its
configuration, for owners too.

The sessions provider filter and the Spend page now call `GET
/api/v2/ai/providers?include_deleted=true`, and show the same thing as
before. `codersdk.AIBridgeProvider`, `Client.AIBridgeListProviders` and
the `GetAIProviderFilterOptions` query go with the route.

## For changelog

- `GET /api/v2/ai-gateway/providers` has been removed (#32651)

> `GET /api/v2/ai-gateway/providers` has been removed, along with
`codersdk.AIBridgeProvider` and `Client.AIBridgeListProviders` in the Go
SDK. It listed providers only for users who can read AI Gateway
sessions, i.e. owners and auditors. `GET /api/v2/ai/providers` replaces
it, and now answers every signed-in user. Owners still get each
provider's full configuration from it, and everyone else gets the same
list with an empty `base_url`, an empty `api_keys` array, `null`
`settings` and no `status`.
  >
> Migration: Call `GET /api/v2/ai/providers?include_deleted=true`
instead. Each provider keeps its `name`, `type`, `display_name` and
`icon` fields, and `display_name` now holds the provider name when no
display name is set. In the Go SDK, `Client.AIProviders` now takes a
`codersdk.AIProvidersFilter`. Set its `IncludeDeleted` field to list
deleted providers too. An API token with an allow list needs
`ai_provider` in that list to call `GET /api/v2/ai/providers`, where the
removed route needed `aibridge_interception`.
2026-11-30 16:16:34 +11:00
Ethan fd74a160ec feat: let all users list AI providers (#32650)
Closes AIGOV-824

`GET /api/v2/ai/providers` now answers every signed-in user. Before, it
returned a 403 to anyone who isn't an owner.

Owners get exactly what they did before. Everyone else gets the same
list without each provider's configuration, i.e. `base_url`, `api_keys`,
`settings` and `status` come back empty:

```json
[
  {
    "id": "90f4a82a-c945-4598-93be-be9dde57c38d",
    "type": "openai",
    "name": "corp-openai",
    "display_name": "Corp OpenAI",
    "icon": "/icon/openai.svg",
    "enabled": true,
    "base_url": "",
    "api_keys": [],
    "settings": null,
    "created_at": "2026-11-24T11:56:44.789072Z",
    "updated_at": "2026-11-24T11:56:44.789072Z"
  }
]
```

Clients need the list to find out what a provider is called. They reach
a provider through AI Gateway at `/api/v2/ai-gateway/<provider-name>/`,
and the name is whatever an admin chose. Mux, for example, lists
providers with `GET /api/v2/ai/providers`, so a member's Mux only finds
providers that happen to have a default name.

To do this, I've split the permission in two. `ai_provider:read` now
only covers the fields that are filled in above, and every member holds
it, the same way they can read OAuth2 apps and workspace proxies. A
provider's base URL, keys and settings sit behind a new
`ai_provider:read_secret` permission, which only owners hold. `GET
/api/v2/ai/providers/{idOrName}` and the dashboard's AI settings pages
now check `ai_provider:read_secret`, so they're still owner only.

This doesn't show members much that's new. They can already read the
name, type, display name, icon and enabled state of every enabled
provider from `GET /api/v2/users/{user}/ai-provider-keys`, so the
additions are disabled providers and the two timestamps.

The next PR in the stack removes `GET /api/v2/ai-gateway/providers`,
which `GET /api/v2/ai/providers` replaces.
2026-11-30 16:16:33 +11:00
Susana Ferreira 26d2802630 docs: document the AI Gateway Spend page (#32798)
## Description

Documents the Spend page under **Admin settings** > **AI**, which
replaced the experimental AI spend page. The page is described once, in
AI Governance cost controls, and the Coder Agents docs link to it.

Related to AIGOV-685

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-11-27 12:09:50 +00:00
Mathias Fredriksson f6fe51a852 docs: warn that chats sharing a workspace are not isolated (#32754)
Chats attached to the same workspace share its files and don't know
about each other. If two chats use the same path, one overwrites the
other, so content from a private repository can end up in another
repository, including a public one.

This adds a short section on the risk and how to avoid it to the Coder
Agents architecture page, and links to it from the overview where it
mentions choosing a workspace.
2026-11-26 10:19:34 +02:00
Nick VigilanteandIan Evans 19da85b5d3 docs: turn the install landing pages into cards (#32405)
## Summary

Rework the install landing pages so a reader can see where to go at a
glance, without reading the planning material first.
The install landing page is now a hub of ten cards in three groups that
point to the high-impact and most searched pages, modeled on the GitLab
and Mattermost install pages, and the planning material moves to a new
Production deployment process page.
Every existing page URL stays the same; the sidebar gains two pages.

#31869 (the air-gapped K3s tutorial), which this PR links to, has
merged, and this branch is rebased onto `main`.
The cards need coder/docs-engine#388 to render as cards; without it, the
docs engine, GitHub, and the classic offline docs render the same block
as a plain link list, so the two PRs can merge in either order.
The docs home page cards moved to #32714.
Refs [DOCS-1568](https://linear.app/codercom/issue/DOCS-1568) and
[DOCS-1570](https://linear.app/codercom/issue/DOCS-1570).

## Changes

- `install/index.md`: a one-sentence intro, a tip that points to the
Quickstart and the CLI download, and three groups of cards.
- Install the control plane: Installation requirements, Air-gapped K3s
quickstart, Install on Kubernetes, and Installation methods.
- Run Coder in production: Production deployment process and Upgrade
Coder.
- Common tasks: Air-gapped deployments, Use an external database, TLS
and reverse proxies, and Image pull secrets.
- New `install/production-deployment.md` (Production deployment
process), the first child of Install: the five phases table with its
"When you can skip it" column, Move from evaluation to production,
Decisions worth making deliberately, and Who does the work, all moved
from the landing page.
Move from evaluation to production keeps the setup token sentence from
#32324.
- New `install/server/requirements.md` (Installation requirements), the
first child of Install the control plane: control plane CPU and memory,
PostgreSQL, platform versions, network, internet access, and license,
each traced to code or the existing platform pages.
- `install/server/index.md`: takes the three platform questions, the
offline notes, and the first air-gapped workspace build note from the
landing page.
The platform table gains a "Where the control plane runs" column, with
Rancher and OpenShift listed as Kubernetes.
- `install/server/kubernetes/index.md`: intro names EKS, AKS, GKE, K3s,
and OpenShift, and points offline clusters to the air-gap page and the
K3s tutorial.
- `install/server/cloud/index.md`: sends existing EKS, AKS, and GKE
clusters to the Kubernetes guide, notes that the AWS Marketplace guide
creates a new EKS cluster, and fixes the Azure tab, which said GKE
instead of AKS.
- `install/plan/index.md` and `install/prepare/index.md`: planning reads
as a recommendation, not a requirement, and Prepare links to the
requirements page.

## Decisions for review

1. **Card syntax.** Each card is one item in a plain link list,
`[Title](link): one-sentence description`, inside `<div class="cards">`.
The corpus compiles as `.md`, so it can't use JSX; this is the same
approach as `<div class="tabs">`, and it degrades to a readable list
wherever the plugin isn't present.
2. **The first six cards** come from the Nov 20 review with Ben.
Two card titles are shorter than their target page titles: "Air-gapped
K3s quickstart" opens "Install Coder on K3s in an air-gapped
environment", and "Installation methods" opens "Install the control
plane".
The 1-hour target from the Nov 4 review still isn't stated, because it
needs a timed run.
3. **The Common tasks cards come from search data, not page views.**
No page-view source was available (Search Console is on a personal
account, and Vercel analytics needs credentials).
The four cards are the install pages with the most result impressions in
Algolia over the 30 days to Nov 18: image pull secrets, air-gapped
deployments, the external database, and the NGINX and Apache reverse
proxy pages, which match the frequent `proxy` and `certificate`
searches.
   Semrush also shows "nginx reverse proxy" at 4,400 searches a month.
The TLS card opens the TLS & Reverse Proxy section of the control plane
setup page, which links Apache, Caddy, and NGINX, instead of one proxy
page.
Docker is left out because the Installation methods card already covers
it.
   Swap any card if page views tell a different story.
4. **"Choose your path" is gone.** Every row now has a card or the tip,
and Move from evaluation to production is a section of the new page.
The Architecture link that row carried now lives only on Plan your
deployment.
5. **Classic offline docs get no card styling.** They render the plain
list until the offline docs move to the docs engine.
6. **Rancher and OpenShift read as Kubernetes options.**
This reverses what I proposed in the Nov 4 install review (Rancher with
container runtimes, OpenShift with Linux).
Both guides install the Helm chart on a cluster, so a reader looking for
Kubernetes needs to find them.
   This PR only changes the table labels; no pages move.

## Previews

Both previews are built from this branch at `e1d00f4f10`.
A screenshot of the docs engine version of the install page is on
coder/docs-engine#388.

- **Docs engine:** check out coder/docs-engine#388
(`vigilante/coder-docs-cards`), and in `apps/docs` run
`DOCS_VERSION_ID=main DOCS_VERSION_REF=e1d00f4f10 DOCS_VERSION_ROOT=1
DOCS_ROOT=<this checkout>/docs pnpm sync`, then the same variables with
`pnpm exec next dev -p <port>`, and open `/install/`.
  The cards sit in a two-column grid and stack to one column on a phone.
- **Classic offline docs:** in `offlinedocs/`, run `pnpm install`, `pnpm
copy-images`, and `pnpm exec next dev -p <port>`, and open `/install/`.
The cards render as a bulleted link list with descriptions, and the tip
renders as an alert.

## Not in this PR

- Cards on the docs home page: #32714
([DOCS-1904](https://linear.app/codercom/issue/DOCS-1904)).
- New pages that need a tested run first: create your first template
([DOCS-1783](https://linear.app/codercom/issue/DOCS-1783)), an
air-gapped Helm install on EKS or AKS
([DOCS-1798](https://linear.app/codercom/issue/DOCS-1798)), and a small
reference architecture
([DOCS-1572](https://linear.app/codercom/issue/DOCS-1572)).
- Sidebar moves and renames
([DOCS-1569](https://linear.app/codercom/issue/DOCS-1569)).
- Pre-existing issues on `prepare/airgap.md`, which this PR links to: it
says the built-in database downloads PostgreSQL from `repo1.maven.org`,
but `cli/server.go` uses `repo.maven.apache.org`, and its first sentence
says all features are supported offline without the hosted-service
exception this PR adds to the requirements page.

Known tradeoff: platform versions (Kubernetes 1.19, Helm 3.5, and so on)
appear on both the requirements page and each platform page, so a
version bump has to update both.

## Testing

- `make gen/docs-manifest` and `make fmt/markdown`.
- `make lint/emdash lint/docs-html lint/docs-manifest lint/markdown
lint/docs-redirects`: all pass.
- Vale on the changed pages: 0 errors and 0 warnings on added lines.
- Links and anchors on the changed pages resolve, including
`admin/setup#tls--reverse-proxy` on the docs engine, and no page in
`docs/` links to an anchor this PR removed from the landing page.
- The docs engine single-version sync of this branch passes strict.
- In headless Chromium, the docs engine renders ten cards on the install
page with the expected titles and links, in light and dark at 1440px and
in one column at 390px; the classic offline docs render the same links
as lists.
- doc-check skill in author self-check mode at `eaab2994c4`, with fixes
in `e1d00f4f10`:
- Fixed: the requirements page and the platform chooser said every
feature works without internet access; both now say Coder runs offline,
and that features that call a hosted service, such as a hosted AI
provider, need it reachable.
- Fixed: the phase 5 "When you can skip it" cell now reads "Never", like
phase 3.
- Rejected: a finding that no setup token exists. #32324 adds it
(`cli/setuptoken.go`, the `Setup token:` prompt in `cli/login.go`, and
`setup_token` in `SetupPageView.tsx`).
- Not applied: renaming the "Air-gapped K3s quickstart" card, which is
the name from the Nov 20 review.
- An earlier run flagged the Helm chart default resources on the
requirements page as wrong, but `helm/libcoder/templates/_coder.yaml`
sets 2&nbsp;CPU cores and 4&nbsp;GiB as both requests and limits when
`coder.resources` is empty, so the sentence stands.

<details>
<summary>Plan and decision log</summary>

**Request.** Add pages where they're needed, and update the existing
landing pages so it's obvious where to go to install the control plane
right away.
Don't rearrange the sidebar or rename pages.

**Inputs.**

- The install section skeleton IA draft in Notion (Docs proposals),
which recommends Kubernetes as the golden path and air-gap first.
- Feedback from the Nov 4 install docs review with Stephen Kirby and
Ben, the Nick and Ian 1:1 (Nov 4), and the Nick and Ben 1:1 (Nov 5).
- The Nick and Ben weekly (Nov 20): the landing page still read as
text-heavy and didn't tell a reader where to go.
  The bar is the GitLab and Mattermost install pages.
Agreed: cards at the top, the text moved to an intro page, and
air-gapped and production paths visually distinct.

**What the feedback changed.**

- Kirby's three questions (network-gapped, cloud or on premises, VMs or
containers) open the platform chooser, Install the control plane.
- Kirby's point was "plan once, deploy once": planning matters, but most
of the lost time comes after IT approval.
So readers can install first, and Plan and Prepare stay visible as
recommendations, with a "When you can skip it" column, on the Production
deployment process page.
- The review called out the missing path from evaluation to production,
which is now a section of the Production deployment process page.
- Kirby's golden path is an enterprise past approval installing with
Helm on air-gapped EKS or AKS.
The K3s tutorial covers single-node evaluation only, so that gap is
filed as DOCS-1798 instead of being written here without a tested run.
- Nov 20: the landing page became six cards in two groups, following
GitLab's install page (requirements, methods, offline, reference
architectures, upgrades) and Mattermost's evaluate-to-production
journey.
The prose moved inward rather than being cut: planning to the new page,
platform choice and offline notes to the chooser.
- Nov 24: Nick asked for cards for the high-traffic pages on the install
landing page.
With no page-view data reachable, a third group, Common tasks, follows
the install pages with the most Algolia result impressions, and Ben's
caution against card sprawl keeps it to four.
Cards for the docs home page, built first by mistake, moved to their own
PR, #32714.
#31869 had merged, so the branch is rebased onto `main` without its
commits.

**Choices made.**

- Requirements traced to code: Helm chart default resources
(`helm/libcoder/templates/_coder.yaml`), Kubernetes version
(`helm/coder/Chart.yaml` `kubeVersion`), built-in PostgreSQL download
(`cli/server.go`), and the Kubernetes starter template's code-server
install (`examples/templates/kubernetes/main.tf`).
- Cards are a docs-engine remark plugin over a plain link list
(DOCS-1795, coder/docs-engine#388), not JSX, so the page reads the same
on GitHub and in the classic offline docs.
Each card description is one sentence and avoids abbreviations that
would need expanding.
- The new page is the first child of Install, so the sidebar reads as
the process followed by its five phases.
- Ian's suggestion to use includes for repeated content (such as the
air-gap Dockerfile) is deferred.
  This PR repeats only short routing sentences.

</details>

---

_This PR was generated by Coder Agents on behalf of @nickvigilante._

---------

Co-authored-by: Ian Evans <5760366+ianjevans@users.noreply.github.com>
2026-11-25 13:55:29 -05:00
Ben Potter 5f4bb0ddc1 docs: add side padding to Agent Relay architecture diagram (#32694)
The labels on the left of the Agent Relay architecture diagram sit right
against the frame on [the Agent Relay
page](https://coder.com/docs/ai-coder/agent-relay). The image had only
4px of margin on the sides, so the docs frame clipped close to the text.

This adds 36px of background on the left and right of
`agent-relay-stack.png` to match the top margin. No markdown changes.

| Before | After |
| --- | --- |
|
![before](https://raw.githubusercontent.com/coder/coder/recordings/recordings/agent-relay-diagram-padding/before.png)
|
![after](https://raw.githubusercontent.com/coder/coder/recordings/recordings/agent-relay-diagram-padding/after.png)
|

"After" is the live page with the new image swapped in.

---

_Generated by Coder Agents on behalf of @bpmct._
2026-11-25 12:36:30 -05:00
Nick Vigilanteandcoder[bot] 59e3889656 docs: redirect Customize your template pages to Template Fundamentals course (#31639)
Removes the four Quickstart "Customize your template" pages, their
sidebar entries, and their seven screenshots, and redirects the old URLs
to the Get started page.
Closes DOCS-1476. coder/coder#31133 was closed for this reason.

The Get started page's **What's next?** section now has two cards: one
for the Template Fundamentals course at
`https://coder.com/learn/coder-quickstart`, which replaces the removed
pages, and one for the full course catalog at `https://coder.com/learn`.
The cards use the `<div class="cards">` syntax from
coder/docs-engine#388, and GitHub renders the same source as a plain
link list.
The image-management guide links to the course too.

| Old page | Destination |
|---|---|
| `/docs/get-started/customize-your-template` | `/docs/get-started` |
| `/docs/get-started/customize-your-template/add-a-language` | same |
| `/docs/get-started/customize-your-template/install-command-line-tools`
| same |
| `/docs/get-started/customize-your-template/authenticate-to-github` |
same |

The rules use the relative format from #30805
(`get-started/customize-your-template...` to `get-started`), which also
blocks removed routes without a redirect.
The course defers the private-repository (`coder_external_auth`) lesson,
so the Get started page keeps a short numbered procedure for it: edit
the template, add the data source, publish, authenticate on the
create-workspace form, and clone over HTTPS.

Generated by Coder Agents on behalf of @nickvigilante.

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
2026-11-25 11:01:58 -05:00
Ethan 267f1d8c9e fix: stop lint/docs-redirects depending on the live docs site (#32739)
`lint` has failed on every push to `main` and `release/2.40` since the
docs site was republished on the 24th, e.g.
https://github.com/coder/coder/actions/runs/45560160492/job/139021802160

coder/docs-engine#273 has the docs site generate one page per REST API
endpoint from `coderd/apidoc/swagger.json`, at
`reference/api/<section>/<endpoint>`, and list them in `llms.txt`.
`lint/docs-redirects` downloads that list, and treats any page on it
that isn't in `docs/manifest.json` as a page we removed, so it reported
all 389 endpoint pages:

```
docs route "reference/api/agents/authenticate-agent-on-aws-instance" no longer resolves (from the live page list https://coder.com/beta-docs/@main/llms.txt). Add a rule to docs/redirects.json, for example: {"source": "reference/api/agents/authenticate-agent-on-aws-instance", "destination": "/"}
```

Nothing is broken on the site, those pages are live, and I don't think
the docs engine is doing anything wrong either. The actual problem is
that `make lint` depends on whatever coder.com is serving at the time,
so a docs site release can turn `main` red without a commit here. It
also fails where nobody can act on it: a PR only downloads the list when
it changes `docs/manifest.json` or `docs/redirects.json`, whilst every
push to `main` downloads it, and that run is after the merge. So PRs
kept passing lint and merging onto a red `main`.

To fix, `lint/docs-redirects` now runs with `-offline`, and only
compares the manifest and redirects against the base branch. A PR that
moves or removes a page without a redirect still fails, as that
comparison never needed the download.

I think this is the right fix, rather than just teaching the check about
endpoint pages, because the download wasn't catching anything. The site
is built from the manifest, so a page can only be on the live list and
missing from the manifest if a PR removed it, in which case the base
comparison already fails that PR, or if the docs engine made the page
itself. Today 391 live pages aren't in the manifest, and all of them are
the second kind: the 389 endpoint pages, plus 2 pages the site serves
with hyphens for dots, which the check already special-cased. Endpoint
pages would be the second special case of that kind, and the next docs
engine change that adds pages would need a third.

What we lose is a second failure on `main` when a page removal is merged
past a failing lint, and that failure clears by itself once the site is
republished without the page. On a push there's no base branch to
compare against, so only the rules themselves are validated there.

Alternatives I considered:

- Only skipping the endpoint pages, which is what this PR did at first.
It fixes today's failure and leaves the cause in place, as above.
- Deriving the endpoint pages from `swagger.json` in the check, so
they're compared like any other page. That means copying the docs
engine's URL rules into this repo and keeping the two in step, in order
to catch renamed or removed endpoints. In the last 90 days on `main`
that was one removal and no renames.
- Deleting the live comparison outright. I've kept it, as it's still
useful to run by hand without `-offline`, e.g. after a change to how the
docs engine builds its routes. So that it's usable, the first commit
stays: routes of the endpoint page form are left out of that comparison
whilst their section page is still in the manifest, and it prints how
many were skipped. `go run ./scripts/docsredirectscheck -branch main`
goes from 389 failures to passing.
- Comparing against the previous commit on push runs, so that `main`
keeps a removed-route check. That's the comparison the PR already ran,
and a failure there comes after the merge.

The URL of an endpoint page changes whenever its `@Summary` or tag does,
and nothing here will notice. Catching that would mean requiring a
redirect on those API changes, which I've left out of this PR. This also
needs backporting to `release/2.40`.
2026-11-25 07:53:58 +00:00
Nick Vigilante 255a9884d2 Revert "docs: update Agent Relay docs for GA and v0.17.0" (#32708)
Reverts coder/coder#32552
2026-11-24 19:18:12 +00:00
Nick Vigilante 005d5a87c0 docs: update Agent Relay docs for GA and v0.17.0 (#32552)
Updates the Agent Relay docs for general availability and for
agent-relay v0.17.0, and adds the version requirements table from
RELAY-61.

- **Beta to GA:** the sidebar state goes from `[premium, beta]` to
`[premium]`, and every page drops its beta callout.
The monitoring and SIEM notes now say metric names, log messages, and
fields can change between releases, and tell readers to review alerts
when they upgrade.
Anthropic's own "public beta" line for self-hosted environments stays,
because Anthropic's docs still say public beta.
- **Version requirements:** `setup.md` gets one table of minimum
versions for Coder, Agent Relay, the Terraform provider, both modules,
and the Claude Code CLI.
The "v0.16.0 or later" qualifiers across the pages are removed, because
the table sets a single GA baseline.
Module examples move to 1.0.1, the latest tag. Its only change from
1.0.0 is in the README.
- **v0.17.0, Claude Code poll loop**
([agent-relay#189](https://github.com/coder/agent-relay/pull/189)):
after it handles a session, a pool claims the next one right away and
waits 5 seconds only after an empty or failed poll.
The "one session every 5 seconds" claim and the provisioner sizing
formula that depended on it are replaced in `claude-code.md`.
`siem.md` lists the renamed `backoff` log field, which replaces
`interval`.
- **v0.17.0, redelivery**
([agent-relay#165](https://github.com/coder/agent-relay/pull/165)): if
Anthropic redelivers a session while its previous workspace still has a
start build or a delete in progress, Agent Relay fails the session
instead of building again.
This is covered in the build budget, setup failure, and reap delay text,
plus a new troubleshooting entry.
- **`install_cli`:** the docs no longer say `install_cli = true` removes
the Claude Code CLI minimum.
The modules skip the install when a CLI is already on `PATH` and never
upgrade it.

## Open questions

- **GA versions (Steven Masley, per RELAY-61):** the table uses the
latest versions as of today: Coder 2.39, Agent Relay v0.17.0, Terraform
provider v2.20.0, and modules 1.0.0.
If GA ships with newer releases, the table, the early access upgrade
steps, and the `claude-code.md`/`cursor.md` module notes need the new
numbers.
- **Stability at GA:** should the monitoring and SIEM pages promise
anything about metric and log stability, or does "can change between
releases" stay?
- **Backport:** the v0.16.0 docs were backported to `release/2.39`
(#32122). This PR probably needs the same once the GA versions are
settled.

Related: #32519 adds a section to `claude-code.md` in a different part
of the page. It shouldn't conflict.

<details>
<summary>Verification notes and decision log</summary>

Verified against agent-relay `v0.16.0...v0.17.0`:

- `serviceclaudecoderunners/poller.go` `pollLoop`: `drain` polls again
right after each handled hint (`maxHintsPerPoll = 1`).
`pollIntervalDefault` (5s) is the startup delay and the backoff after
`ErrEmptyPoll`, a retryable poll error, or a license lapse. The relay
sets no limit on concurrent builds (README, Claude Code pools).
- `workspacedispatcher/dispatcher.go` `reconcile`: with
`TerminalOnUnfinishedBuild` (set to `redelivered(hint.Attempt)` in
`serviceclaudecoderunners/dispatch.go`), `blocksRedelivery` (START or
DELETE pending, starting, or canceling, or deleting) sends the
non-retryable nack `agent-relay: the previous workspace was not ready
for this session; send a new message to retry` and logs `redelivery
found a predecessor build or delete in progress, failing current work
order`. `retirePredecessorLocked` runs only for a START that isn't
deleting. It cancels the build through `settleBuild`, then deletes the
workspace. A running delete is left alone.
- A new message is a first delivery, and `AwaitDeleting: true` makes it
wait for the delete and then build fresh.
- `poller.go`: the `poll loop started` record's field is now `backoff`.
No other code emits `interval`.
- No CLI flags, environment variables, Helm values, or metric names
changed between v0.16.0 and v0.17.0.
- Registry `agent-relay-{claude-code,cursor}` v1.0.1 `main.tf`
`install_cli`: "A CLI already in the image is used as is and never
upgraded."

Decisions:

- The table states one GA baseline instead of a matrix with one row per
relay release. RELAY-61 narrowed the scope to "latest versions as of
GA", and the relay doesn't check module pairing at runtime, so older
rows couldn't be verified.
- The Claude Code CLI minimum of 2.1.224 is kept. Neither the relay nor
the module checks it, so it's left as stated policy.
- Not documented: the example image bumps (#156, #181, #183), the
mock-clock refactor (#166), and the test-only PRs, because users see no
change.

Checks: `make lint/emdash`, `make lint/docs-manifest`, `make
lint/docs-html`, markdownlint, and Vale (no new alerts compared with
`main`).
A `doc-check` self-check found 3 blocking accuracy findings: the
`install_cli` wording twice, and the redelivery cleanup wording. All 3
are fixed.

</details>

Refs DOCS-1797, RELAY-61

> Generated by Coder Agents on behalf of @nickvigilante.
2026-11-24 13:41:55 -05:00
Susana Ferreira 7c7dd8fb63 chore: remove the retention start from the AI spend users response (#32687)
## Description

Only the old spend page read `retention_start` from the per-user AI
spend response, to limit its date picker. That page is gone, and the AI
Gateway retention endpoint now serves this purpose, so the field is
removed. The server still narrows a default period to the retention and
rejects an explicit one that starts before it.

Related to AIGOV-729

## Changes

- Remove `RetentionStart` from `codersdk.OrganizationAISpendReport`.
- Keep the retention start local to `aiSpendRetainedPeriod`, its only
reader.
- Regenerate the API docs and TypeScript types, and update the tests and
mocks.

Depends on #32686.

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-11-24 18:11:49 +00:00
Susana Ferreira dfe6402910 feat: add an AI Gateway data retention endpoint (#32659)
## Description

Pages that read raw AI Gateway data and have a date picker don't handle
data retention consistently. AI Sessions allows start dates whose data
is already purged. AI spend only learns the retention after a request.

The new AI spend page reads aggregated data, which is never purged, in
some views and raw data in others. For consistency, the Overview and
Detailed report tabs should accept the same date range, so both are
limited to the retention.

The retention is in the deployment config, but only Owners can read it.
This adds an experimental endpoint that returns only the retention, so
these pages can offer only retained dates.

## Changes

- Add `GET /api/experimental/ai-gateway/retention`, returning
`retention_ms`. Zero means data is never purged.
- Any authenticated user with the AI Gateway feature can read it, since
it holds no usage data.
- Add `codersdk.AIGatewayRetention` and the
`ExperimentalClient.AIGatewayRetention` method.

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-11-24 18:07:38 +00:00
Nick VigilanteandIan Evans 933efa59c4 docs: add disaster recovery page (#32356)
## Summary

Adds a disaster recovery page.
Customers keep asking for more than the one-paragraph disaster recovery
note in the validated architecture docs.
The incident response content moved to #32402.

## Changes

- New `docs/install/operate/disaster-recovery.md` (explanation),
covering:
- database backups, including the encryption keys that live outside the
database;
  - restore testing;
  - what HA does and doesn't cover;
- region outages: why Coder can't fail over across regions, failing over
to a cold standby database, and what happens to workspaces in the failed
region;
  - outage impact for direct and relayed connections;
  - orphaned resources after a restore.
- Sidebar entry, plus links from the sizing page's disaster recovery
paragraph and the Operate landing page.

## Notes for reviewers

- The source draft says the workspace agent buffers activity while it's
disconnected. The code shows only a reconnect loop (`agent/agent.go`,
`runLoop`), so the page says the agent keeps running and reconnects, and
makes no claim about buffering.
- The claim that direct sessions survive an outage comes from
`tailnet/configmaps.go`. When the coordinator connection drops, peers
are marked lost and removed only after `lostTimeout` (15 minutes) passes
with no WireGuard handshake. The page leaves the constant out.
- The access URL step in the region failover procedure relies on agents
getting `CODER_AGENT_URL` from the access URL at build time
(`provisionersdk/scripts/bootstrap_linux.sh`,
`coderd/provisionerdserver/provisionerdserver.go`), so keeping the URL
lets agents in surviving regions reconnect without a rebuild.
- The single-region database claim rests on Coder taking one PostgreSQL
connection URL with no read-replica option, plus the latency guidance in
`docs/admin/networking/high-availability.md`.
- The PDF doesn't mention that a restored database still lists
workspaces that were deleted after the backup. The page covers this and
how to remove them with `coder delete --orphan`.

## Testing

- `make lint/emdash`, `make lint/docs-manifest`, `make lint/docs-html`,
and `make lint/docs-redirects` (offline) pass.
- markdownlint and Vale on the new and edited pages: 0 findings.
- Relative links and anchors resolve.

<details>
<summary>Plan and decision log</summary>

- Source: the "Coder Disaster Recovery" PDF attached to DOCS-1214. Its
sections cover backup, restore validation, HA, multi-region, workspace
impact, and orphaned workspaces after a restore.
- Placement: Install > Operate, next to Upgrade, because these are
day-two operations.
- Verified against code:
  - Terraform state is stored in `workspace_builds.provisioner_state`.
- The built-in PostgreSQL data lives under the config root
(`cli/server.go`).
- `coder delete --orphan` removes a workspace without deleting its
resources.
- Corrected from the PDF: removed the agent "buffers activity" claim,
and added the case of workspaces that were deleted after the backup.
- Review feedback (@bpmct): added a "Plan for a region outage" section
covering no automatic cross-region failover, the single-region database,
a cold standby in a recovery region, and disk replication for workspaces
in the failed region. It replaces the two-sentence cross-region note
under the HA table.
- Split: the incident response page that this PR first included now
lives in #32402 (DOCS-1796), following review feedback that asked for a
generic incident response page.

</details>

---

_This PR was generated by Coder Agents on behalf of @nickvigilante._

---------

Co-authored-by: Ian Evans <5760366+ianjevans@users.noreply.github.com>
2026-11-24 12:46:04 -05:00
Nick Vigilante 1465f64d86 docs: list what air-gapped templates and workspaces download (#32457)
## Summary

List what a default deployment and the Docker and Kubernetes starter
templates download from the internet, what fails when each download is
blocked, and the offline replacement for each.
The most common place an air-gapped install stalls is the first
workspace build, not the control plane, and the air-gapped deployments
page didn't cover it.

Refs [DOCS-1782](https://linear.app/codercom/issue/DOCS-1782).

## Changes

All changes are in `docs/install/prepare/airgap.md`.

- **Component table:**
- Fixes the PostgreSQL row: the built-in database downloads from
`repo.maven.apache.org` (`cli/server.go`), not `repo1.maven.org`.
- Adds four rows: trial license (`v2-licensor.coder.com`), the access
URL tunnel (`*.try.coder.app`), the default GitHub sign-in and external
auth providers, and the template builder (`registry.coder.com`).
- **New section, "What templates and workspaces download":** a table for
the Docker and Kubernetes starter templates that covers Terraform
providers, Coder Registry modules, JetBrains IDE version lookups, the
workspace image and `image_pull_policy = "Always"`, code-server, and
code-server extensions.
- **Firewall exceptions:** the old list said code-server.dev was
"install via Arch User Repository (AUR)" and v2-licensor.coder.com was
for "developing Coder in Coder".
The new list separates what the Coder server and provisioners reach from
what workspaces reach, and adds `registry.coder.com`.

## Notes for review

- **Base:** this branch is based on `main`, not stacked on #31869.
`main` has changed this page six times since #31869 branched, including
the table rows and the firewall section this PR edits.
#31869 adds only two lines to this page, in the Kubernetes tab, which
this PR doesn't touch, so the two shouldn't conflict.
- **Not covered:** templates other than the Docker and Kubernetes
starters, AI features, and IDE marketplaces beyond the existing
JetBrains and VS Code sections.
The page tells readers to check their own templates for the same kinds
of downloads.
- **Follow-up:** once this merges, the install landing page in #32405
can link the new section's anchor instead of the top of the page.

## Testing

- `make fmt/markdown` and `make lint/emdash lint/docs-html
lint/markdown`: all pass.
- Vale on `airgap.md`: 0 errors, 0 warnings, 0 suggestions.
- A relative link and anchor check on the page: no broken links.
- doc-check skill in author self-check mode. I fixed its four blocking
findings: the providers row was missing `hashicorp/http`, the JetBrains
IDE version lookup was missing, the page wrongly said that creating a
template from a starter works offline, and it used "the Coder server"
instead of "the control plane". The firewall intro is now narrowed to
what the list covers.

<details>
<summary>Evidence for each new claim</summary>

| Claim | Source |
|---|---|
| Built-in PostgreSQL downloads from `repo.maven.apache.org` |
`cli/server.go`,
`BinaryRepositoryURL("https://repo.maven.apache.org/maven2")` |
| A trial requests a license from `v2-licensor.coder.com` |
`enterprise/trialer/trialer.go` (`LicenseRequestURL`), called from
`coderd/users.go` when the first user starts a trial |
| No access URL means a tunnel through a Coder-hosted server |
`cli/server.go` (`devtunnel.New` when `AccessURL` is empty),
`wg-tunnel-host` flag description |
| Default GitHub sign-in and external auth providers on new deployments
| `cli/server.go`, `getGithubOAuth2ConfigParams` and
`maybeAppendDefaultGithubExternalAuthProvider`, which apply only when no
users exist at first start and no explicit providers are set |
| Template builder resolves modules from `registry.coder.com` |
`codersdk/deployment.go`, template builder registry default |
| Starter templates ship in the binary | `examples/examples.go`,
`//go:embed` |
| Docker starter: `kreuzwerker/docker`, `code-server` and `jetbrains`
modules, `codercom/example-base:ubuntu` |
`examples/templates/docker/main.tf` |
| Kubernetes starter: `hashicorp/kubernetes`, `curl` of
`code-server.dev/install.sh`, `image_pull_policy = "Always"` |
`examples/templates/kubernetes/main.tf` |
| The `jetbrains` module needs `hashicorp/http` and looks up IDE
versions from `data.services.jetbrains.com` unless `ide_config` is set |
coder/registry `registry/coder/modules/jetbrains/main.tf` |
| Provider downloads come from `github.com` (`coder/coder`,
`kreuzwerker/docker`) and `releases.hashicorp.com`
(`hashicorp/kubernetes`, `hashicorp/http`) |
`registry.terraform.io/v1/providers/<provider>/<version>/download/linux/amd64`
responses |
| Creating a template from a starter still runs `terraform init` |
`coderd/templateversions.go` creates an import job, which
`provisioner/terraform/provision.go` initializes |
| `code-server` module offline mode runs
`${install_prefix}/bin/code-server` and can't install extensions |
coder/registry `registry/coder/modules/code-server/main.tf` and `run.sh`
(v1.6.0) |
| code-server's install script downloads from GitHub |
`https://code-server.dev/install.sh` (api.github.com and github.com
releases) |

</details>

---

_This PR was generated by Coder Agents on behalf of @nickvigilante._
2026-11-24 12:44:26 -05:00
Garrett Delfosse 74a15cbcaa feat: adopt OpenTelemetry GenAI semantic conventions for Coder Agents traces (#32411)
Aligns Coder Agents traces with the [OpenTelemetry GenAI semantic
conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/) so
customers can ingest per-user model usage, spend, and tool activity
without custom mapping. Scope follows the requesting team's Slack ask:
agent spans, inference spans with token usage, GenAI attributes,
per-user attribution, and visibility into tools that cannot be reached.

Closes CODAGT-1523.

## Changes

- Span names follow the conventions: `chat_turn` becomes `invoke_agent
coder`, `stream` becomes `chat {model}`, and `tool_call` becomes
`execute_tool {tool}`. Every stage span now carries a `stage` attribute
with the old stage name, which matches the Prometheus `stage` label.
Metrics are unchanged.
- GenAI spans carry `gen_ai.operation.name`, `gen_ai.conversation.id`
(the chat ID), `user.id` (the chat owner), and `coder.organization.id`,
`coder.workspace.id`, `coder.chat.parent_id`, `coder.chat.root_id`.
- `chat` spans are `CLIENT` spans with the provider, request model, and
`gen_ai.request.stream` set at creation (so samplers can see them), plus
requested max tokens and temperature, response ID (including OpenAI
Responses metadata on non-streaming calls), the finish reason the
provider reported (omitted when none, kept when Coder rejects the
response), `gen_ai.output.type=json` for native OpenAI structured
output, and token usage with cache read/write (only when nonzero) and
reasoning breakdown. `gen_ai.usage.input_tokens` includes cached tokens,
as the spec requires. Fantasy reports them separately (Google providers
use the OpenAI-compatible client, which does the same).
- `execute_tool` spans carry the tool name, call ID, and type
(`function` for built-in tools, `extension` for MCP and caller tools),
all set at creation.
- Every model call records a `chat` span: assistant streams
(`stage=stream`), and, as `stage=model_call`, the advisor, compaction
summaries plus titles, status labels, and chat summaries (via
`StageTracer.TraceModelCalls` in `resolveModelCall`). `model_call` has
no histogram, so the `stream` metric is unchanged.
- Failed spans get `error.type`. A tool that returns an error result, as
MCP clients do for an unreachable server, ends its span with
`error.type=tool_error` without recording the result text.
- GenAI attributes carry metadata only; prompts, responses, and tool
payloads are not recorded. The docs note that other spans and events in
the trace, such as AI Gateway spans and server log events, can contain
content.
- Docs state known limits: Anthropic server-tool responses undercount
input tokens in both spans and AI Gateway cost control (the client keeps
first-iteration occupancy), the OpenAI-compatible client drops reported
cache writes, request attributes are what Coder requested, and the
exporter is OTLP/gRPC, plaintext unless a certificate is configured.
- New docs page:
`docs/coder-agents/platform-controls/opentelemetry-tracing.md`.
- `coderd/x/chatd/ARCHITECTURE.md` gains a GenAI semantic conventions
subsection under Lifecycle tracing.

Existing attributes (`provider`, `model`, `chat_id`, `tool_name`, ...)
are kept so current queries on attributes keep working. Queries on span
names need to switch to the `stage` attribute or the new names.

<details>
<summary>Decision log</summary>

- **Convention version:** semconv v1.41.0, the last core release that
ships the GenAI attributes. Later releases moved them to
`semantic-conventions-genai`. The PR uses the Go constants from
`go.opentelemetry.io/otel/semconv/v1.41.0`, which is already in the
module graph. No experiment gate: chatd is already under `x/`, and the
docs page notes that the conventions may change.
- **Rename vs. attributes only:** spans are renamed because the
conventions define the span names. The `stage` attribute keeps lifecycle
identity stable for dashboards and tests.
- **Agent name:** `gen_ai.agent.name=coder` for root chats and subagents
alike. `chat_kind` and `coder.chat.parent_id` tell them apart.
- **Provider name mapping:** configured provider type to well-known
values (`openai`, `anthropic`, `azure.ai.openai`, `aws.bedrock`,
`gcp.gemini`). Anthropic providers with Bedrock settings report
`aws.bedrock`. The `invoke_agent` span gets the provider after `prepare`
resolves the turn's model, since the turn span starts first. Other types
(`openrouter`, `openai-compat`, `vercel`, `copilot`) are passed through
as-is.
- **No content capture:** `gen_ai.input.messages`,
`gen_ai.output.messages`, and tool arguments/results are opt-in in the
conventions and not needed for usage and spend attribution, so they are
left for a follow-up behind an explicit deployment flag.
- **Out of scope:** GenAI metrics (`gen_ai.client.token.usage`,
`gen_ai.client.operation.duration`), an aggregated token total on the
`invoke_agent` span, a cost attribute, span links between subagent and
parent traces, and correlation IDs with AI Gateway interceptions (an
open question in the issue). Subagent turns join the parent only through
`coder.chat.root_id`; a span link needs the spawning span context
persisted across chats and runners. Spans carry tokens, not cost; cost
stays in the existing cost API.
- **Identity snapshot:** chat identity is taken when the turn opens. A
workspace created mid-turn appears on spans from the next turn.

</details>

---

Generated by Coder Agents on behalf of @f0ssel.
2026-11-24 11:41:03 -05:00
Nick VigilanteandCoder Prototypes e28931cfb1 docs: add how-to for rolling out a security update to every workspace (#31982)
Adds an admin how-to that walks through getting a patched package (for
example an updated `ca-certificates` after a certificate authority is
compromised) into every new and existing workspace. Until now the steps
were spread across image management, template versioning, update
policies, automatic updates, and bulk operations.

The new page
`docs/templates/managing-templates/roll-out-security-updates.md` covers:

1. Rebuilding the image and pinning a new tag or digest, and why a
re-pushed mutable tag can be skipped.
2. Publishing and promoting a template version (dashboard and CLI).
3. Making future starts use the active version: template update policy
(Premium), automatic updates, and autostop requirement (Premium).
4. Updating existing workspaces with a `coder list` | `coder update`
loop (first, because the dashboard handles 25 workspaces per page) or
bulk **Update…**. It warns that bulk **Start** keeps the current version
and that dormant workspaces are skipped.
5. Confirming with the `outdated:true` filter and checking the package
with `coder ssh`.
6. Other places to update, outside the image: dev containers,
`envbuilder` caches, persistent home volumes, and persistent VM disks.
It also covers prebuilt workspaces.

It also adds the page to the sidebar
(`docs/manifest/templates/managing-templates.yml`, regenerated
`docs/manifest.json`) and links to it from `image-management.md` and the
Bulk operations section of `workspace-management.md`. The page links to
existing pages instead of repeating them.

The CLI commands and their output were run against a local dev
deployment: `templates push`, the `coder list --search ...
outdated:true` table, the JSON/`jq`/`xargs coder update -y` loop, the
empty result, and `coder ssh ... -- dpkg-query`. Dashboard steps are
checked against the UI code only.

**Verified against**
- `site/src/pages/WorkspacesPage/WorkspacesPage.tsx`,
`WorkspacesPageView.tsx`, `WorkspacesTable.tsx`,
`BatchUpdateModalForm.tsx`, `batchActions.ts` (Bulk actions labels, bulk
Start uses the current version, bulk Update skips dormant and starts
stopped workspaces, default `user:me` filter)
- `site/src/api/api.ts` (`updateWorkspace`, `changeWorkspaceVersion`,
`startWorkspace`)
- `site/src/pages/TemplatePage/TemplatePageHeader.tsx`,
`TemplateLayout.tsx`, `TemplateVersionsPage/TemplateVersionsPage.tsx`,
`VersionRow.tsx`, `TemplateVersionEditorPage/TemplateVersionEditor.tsx`,
`PublishTemplateVersionDialog.tsx` (Edit files, Build, Publish, Promote
to active version, Promote…)
-
`site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx`,
`Sidebar.tsx` (Operations section, require-active-version label, Premium
badge, Save)
- `site/src/pages/WorkspaceSettingsPage/WorkspaceSettingsForm.tsx`,
`Sidebar.tsx` (Automatic Updates, Update Policy)
- `site/src/modules/workspaces/actions.ts`,
`site/src/utils/workspace.tsx`
- `coderd/database/dbauthz/dbauthz.go` (`InsertWorkspaceBuild`
require-active-version check, exemption for users who can update the
template)
- `enterprise/coderd/coderd.go`,
`enterprise/coderd/dbauthz/accesscontrol.go`, `codersdk/deployment.go`
(`access_control` Premium gating; bulk actions not license-gated)
- `coderd/autobuild/lifecycle_executor.go`, `coderd/workspaces.go`
(autostart uses the active version under the policy or `always`)
- `coderd/rbac/roles.go`, `docs/admin/users/groups-roles.md` (Template
Admin has workspace read only)
- `cli/templatepush.go` (`--activate` default true),
`cli/templateedit.go`, `cli/update.go`, `cli/start.go` (dormant
activation, active-version selection), `cli/list.go`,
`cli/cliui/filter.go` (`--all` ignores `--search`), `cli/ssh.go`
- `coderd/searchquery/search.go` (`outdated` filter)
- `examples/templates/docker/main.tf`,
`examples/templates/kubernetes/main.tf`
- `docs/templates/extending-templates/prebuilt-workspaces.md`,
`docs/admin/integrations/devcontainers/envbuilder/envbuilder-security-caching.md`,
`docs/workspaces/devcontainers/working-with-dev-containers.md`

**Open questions for the reviewer**
- `envbuilder` caching: `envbuilder` isn't in this repo, so I couldn't
confirm that changing the base image reference (for example to a new
digest) always avoids a cached image. The page says to change the
reference and links the upstream caching doc. An `envbuilder` expert
should confirm.
- Docker and Kubernetes pull behavior for re-pushed mutable tags is
described from the vendors' documented defaults and the example
templates. I didn't test it on a real cluster.
- `workspace-management.md` Bulk operations still says "top-right
**Actions** dropdown", but the UI label is **Bulk actions**. I left it
alone to avoid conflicting with #31137, which edits the same section.
Should it be fixed there or here?
- The template update policy has several names: "Template update
policies" in the docs, the UI checkbox "Require workspaces automatically
update when started.", and `--require-active-version`. `index.md` still
tells readers to enable "**Template Update Policies**", which doesn't
match the UI. Not changed here.
- Doc-check suggestion not applied: adding links to the new page from
`change-management.md` and `index.md#update-templates`, which is outside
this change's scope.
- Dashboard steps were checked against the UI code, not run in a
browser.

> Generated by Coder Agents.

Closes DOCS-1354


Supersedes #31810, reopened under a human author for attribution.

---------

Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com>
2026-11-24 10:19:42 -05:00
John T SkarbekandClaude Sonnet 5.5 c484ad2be4 fix: keep the provisioner key secret out of request paths and logs (#32532)
Linear: [PLE-94](https://linear.app/codercom/issue/PLE-94). One of three
independent PRs split out of the original masking change.

## Root cause
`codersdk.Client.GetProvisionerKey` sent the real provisioner key secret
in the URL path (`/api/v2/provisionerkeys/<key>`) as well as in the
`Coder-Provisioner-Daemon-Key` header. The path ends up in proxy/access
logs, the server request logger (`path`, `params_provisionerkey`) and
the SDK's `sdk request` debug log. The server ignores the path value:
the route uses `ExtractProvisionerDaemonAuthenticated` and
`fetchProvisionerKey` returns the header-authenticated key. Nothing
reads `{provisionerkey}` on that route (`ExtractProvisionerKeyParam` is
only mounted on the org-scoped route, where the value is a key name).

## Fix
- The SDK now sends a fixed placeholder segment,
`/api/v2/provisionerkeys/me`; the secret travels only in the header. Old
servers ignore the path, and old clients still work with new servers.
- `loggermw` masks the `provisionerkey` route param (keeping at most a 4
character prefix) in `params_*` and `path` as a backstop for old
clients. It only applies when the route pattern is the top-level
`/provisionerkeys/{provisionerkey}`; the org-scoped
`/organizations/{organization}/provisionerkeys/{provisionerkey}` carries
a key name and is left alone.
- Swagger annotation and generated docs now describe the path param as
an ignored placeholder (edited by hand, not via `make gen`).

Sibling PRs (independent, disjoint files):
- https://github.com/coder/coder/pull/32526
- https://github.com/coder/coder/pull/32533

## Follow-ups not included
- AI Gateway prompt, tool and thought content logged in
`aibridgedserver.go` (~511-613) and `aibridge/recorder/log_recorder.go`
- `rich_parameter_values` in `runner.go` (~443)
- Proxy `response_body` in `aibridgeproxyd.go` (~1102)
- Terraform `TF_LOG` output relayed to logs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 08:11:09 -05:00
Ehab Younes 326a0bd4a8 fix: close silent ssh connections when keep-alives stop (#32601)
Bump the gliderlabs/ssh fork to coder/ssh#8, which runs one keep-alive per
connection and closes the whole connection when the client stops answering,
instead of only the session channel. Connections whose session had ended, or
that only carried port forwards, were never probed and could stay Ongoing in
the connection log indefinitely.

- Keep probing every third of CODER_AGENT_SSH_MAX_TIMEOUT (24h by default)
- Report connections that end with a read error, such as the tailnet TCP
  retry limit after a client vanishes, or that the keep-alive closes, as
  network_error with the read error as disconnect_detail
- Keep reporting a clean client close as client_closed
- Wrap the agent's connection to record its first read error while still
  forwarding the client session ID
- Document when a vanished client's connection closes and the tradeoff of
  lowering the timeout

Closes CLIENT-1113
2026-11-24 15:17:05 +03:00
Sas SwartandClaude Opus 5.5 4a7d214f53 feat(site): show AI spend per organization (#32204)
Users in more than one organization can now pick an organization in the
avatar menu and see their AI spend and budget there. Before, the menu
showed one figure from a site-wide effective group, so these users
couldn't see their spend in their other organizations.

The menu now polls two endpoints every 60 seconds: `GET
/users/me/ai/spend` for the site-wide spend, as before, and `GET
/users/me/ai/spend/organizations` (#32202) for the per-organization
breakdown. The menu can't know that a user is in more than one
organization until the second request returns, so it always makes both
requests.

- **Organization selector:** appears only when the per-organization
response lists more than one organization. It's a menu item that expands
a `DropdownMenuRadioGroup` inside the existing menu, so the menu stays
open while the user switches. Each organization shows a warning or
exceeded badge with a screen reader label, in API order, and typeahead
matches the organization name. The selection lives in local component
state. It starts on the entry that matches `organization_id`, or on the
first entry if none matches. If a refetch drops the selected
organization, it falls back the same way.
- **Avatar badge:** the badge on the avatar, and its screen reader
label, follow the selected organization.
- **Single organization, or no breakdown:** users in one organization
see the site-wide spend, as before. The menu also shows the site-wide
spend, without a selector, while the per-organization request has no
data, for example when it fails or the server predates it.
- **Exceeded state:** any user at or over their limit,
single-organization users included, sees an "AI spend" header with a red
"Limit exceeded" label. Below the bar, the menu says when AI requests
resume: "AI requests are paused until {period end}". A $0 budget counts
as exceeded even with no spend, because AI Gateway blocks requests once
spend reaches the limit. The shared `getSeverity` helper is unchanged,
so other views still show $0 of $0 as normal. The normal and warning
states look the same as before.
- **Invalid values:** if the shown organization reports a negative spend
or limit, the menu keeps the selector and shows "AI spend unavailable",
so the user can still switch. A single-organization user with invalid
values sees no spend section, as before.
- **Failed polls:** when a refetch fails, the menu keeps the last spend
and adds "Couldn't refresh AI spend:" followed by the server's error
message, for whichever endpoint it's showing. Before, it hid the
section, which would close an open selector while the user was choosing.
`UsageIndicator` still hides spend on error.

A pure helper, `getUserMenuSpend` in `viewedSpend.ts`, decides which
spend to show. The severity map moved into `severityIndicators.tsx`,
next to a shared `SeverityBadge`. The cost controls page now describes
the selector and the exceeded state.

Stacked on #32203. Review only the last three commits here.

### Open questions

A $0 budget blocks every AI Gateway request, but the shared
`getSeverity` helper in `site/src/utils/budget.ts` still shows $0 of $0
as normal. This PR only changes the user menu. Two other screens use the
shared helper:

- The AI usage indicator on the Agents page (`UsageIndicator`) shows
users their own spend. Should a $0 budget show as exceeded there too, to
match the menu?
- The group budget amounts (`AIBudgetAmount`) show admins each group's
budget. Should a group with a $0 budget, where AI is deliberately off,
show as exceeded or stay neutral?

Out of scope, tracked in AIGOV-738: organization search, the count badge
on the collapsed row, sorting organizations by severity, the workspace
quota row, and a shared app-wide current organization.

`UserDropdown.test.tsx` checks the exceeded text because the ticket asks
for it. A Pixel story also covers that state. The failed-poll state has
a Vitest test but no story yet.

Refs [AIGOV-766](https://linear.app/codercom/issue/AIGOV-766)

<details>
<summary>Screenshots</summary>

#### Multiple organizations

<img width="2530" height="1800" alt="image"
src="https://github.com/user-attachments/assets/8b29ca6b-78b8-4a50-a5d8-0f1892bfb509"
/>

#### Organization picker with severity badges

<img width="2530" height="1800" alt="image"
src="https://github.com/user-attachments/assets/58ecc2b2-d7f0-4517-aaa0-bac6306f7ffe"
/>

#### Selected organization over its limit

<img width="2530" height="1800" alt="image"
src="https://github.com/user-attachments/assets/e4ef8647-db88-44dd-9f7a-22111f92527c"
/>

#### AI spend unavailable for the selected organization

<img width="2530" height="1800" alt="image"
src="https://github.com/user-attachments/assets/bbd51bd1-c250-4e0a-ae86-819185855f89"
/>

</details>

---

*Generated by Coder Agents on behalf of @SasSwart.*

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 11:53:23 +02:00
Sas SwartandClaude Opus 5.5 dcbe84a23b feat: add organization member AI spend endpoint (#32203)
Adds `GET /api/v2/organizations/{organization}/members/{user}/ai/spend`,
which returns a user's effective AI budget and current-period spend
inside one organization. Admins, and users themselves, can use it to
look up spend in a specific organization.

The endpoint resolves the budget inside that organization only, the same
way AI Gateway resolves a request made there. The response has the same
shape as the user spend endpoint, plus `organization_id`.

Users can read their own spend, and admins can read the spend of a user
whose membership in that organization they can read. The endpoint
returns 404 when the user isn't a member of the organization, or when
the caller can't read the user. It requires the AI Governance license.

Organization admins can read every user, so only the organization and
membership checks keep them out of other organizations. The tests cover
both sides: an organization admin reading a member of their own
organization (200) and of another organization (404).

Also adds `Client.OrganizationMemberAISpendStatus` to `codersdk`, and
links the endpoint from `cost-controls.md`.

Stacked on #32202, which adds `GET
/users/{user}/ai/spend/organizations`. Review only the last two commits
here.

Refs [AIGOV-766](https://linear.app/codercom/issue/AIGOV-766)

---

*Generated by Coder Agents on behalf of @SasSwart.*

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 11:53:23 +02:00
Susana Ferreira 1b9f2d8181 feat!: add the client to the AI spend CSV export (#32474)
## Description

Adds the client to the stable `GET
/api/v2/organizations/{organization}/ai/spend/export` CSV export, so the
Detailed report page (https://github.com/coder/coder/pull/32482) can
export the same data with the same filters.

## Changes

- `ExportOrganizationAISpend` groups rows by client as well, and takes a
`client` filter. Usage without a recorded client is reported as
`Unknown`, like `/ai/spend/users`.
- The export accepts a `client` query parameter, and adds a `client`
column at the end of the CSV, so existing columns keep their position.
- `OrganizationAISpendDetailsFilter` takes a `Client`.
- Update the Spend export docs and the query and handler tests.

## Breaking change

The AI spend CSV export (`GET
/api/v2/organizations/{organization}/ai/spend/export`) now has a
`client` column at the end, and splits rows by it.

If you rely on one row per user, group, model and provider, sum
`cost_micros` and the token columns across clients to get the previous
totals.

Closes AIGOV-733

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-11-24 09:48:47 +00:00
Sas SwartandClaude Opus 5.5 c236edcb8d feat: add per-organization AI spend endpoint (#32202)
Adds `GET /api/v2/users/{user}/ai/spend/organizations`, which returns a
user's AI budget and current-period spend in each of their
organizations. The avatar menu uses it to show spend to users who belong
to more than one organization (#32204).

The response lists each organization the user is a current member of and
the caller can read, sorted by name. Each entry has the effective group,
budget, and spend that AI Gateway resolves for a request in that
organization. When no group budget applies, the effective group is the
organization's `Everyone` group. `organization_id` names the
organization of the user's site-wide effective group, so the menu opens
on the numbers the user sees today. It's null when that organization
isn't in the list.

`GET /users/{user}/ai/spend` is unchanged. Its API docs now say that it
resolves the site-wide effective group, and point to the new endpoint
for the per-organization breakdown.

dbauthz filters the user's organizations to those the caller can read,
so an organization-scoped admin only sees the organizations they
administer. The handler queries spend only for those organizations. A
new query, `GetUserAISpendByEffectiveGroupsSince`, reads the spend for
all of them in one call. It reads existing tables, so there's no
migration, and dbauthz checks it the same way as `GetUserAISpendSince`:
the caller must be able to read the user.

Refs [AIGOV-766](https://linear.app/codercom/issue/AIGOV-766)

<details>
<summary>Decisions</summary>

- **Separate endpoint.** An earlier version of this PR added
`organizations` and `organization_id` to `GET /users/{user}/ai/spend`.
Following review, the breakdown moved to its own route ([AIGOV-766
comment](https://linear.app/codercom/issue/AIGOV-766/show-spend-per-org-to-users-in-several-orgs#comment-6855c55c)).
Because the breakdown depends on who is asking, a dedicated route keeps
the existing endpoint's response the same for every caller.
- **`organization_id` on the new response.** The comment's schema left
it out, but its frontend notes and its test rely on it, so the response
includes it.
- **Existing endpoint left as on `main`.** An organization-scoped admin
can still see a user's site-wide effective group, budget, and spend
through `GET /users/{user}/ai/spend`, even when that group is in another
organization. The earlier version of this PR hid those fields; this
version keeps the existing behavior, as the review asked.
- **Authorization check.** dbauthz post-filters
`GetOrganizationsByUserID` with `read` on each organization. The
endpoint itself requires read on the user, as the existing spend
endpoint does.
- **Empty result.** A caller who can read the user but none of their
organizations gets `200` with an empty `organizations` list and a null
`organization_id`, so the response doesn't reveal that memberships
exist.
- **Per-organization spend.** Each entry reports spend on the user's
current effective group in that organization, which is what budget
enforcement compares.

</details>

---

*Generated by Coder Agents on behalf of @SasSwart.*

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 10:08:06 +02:00
eb922f8a9c docs: describe support channels and what to include in a support request (#31992)
Expands the Support landing page, which currently only points to GitHub
issues and Discord:

- Splits **Community support** (GitHub, Discord) from **Premium
support** (the [Coder support portal](https://help.coder.com) and the
account team).
- Adds **What to include in a support request**: version (`GET
/api/v2/buildinfo`), support bundle and logs, reproduction steps,
impact, and **deadlines**. Deadlines matter most here: knowing a
customer's event or rollout date early changes how we prioritize.
- Notes that a proposed fix is welcome but doesn't replace reproduction
details.

The manifest description already mentions premium support, so no
manifest change is needed.

## Needs Support / CS confirmation before merge

- [ ] OK to publish help.coder.com as the Premium support entry point
- [ ] Wording for contacting the account team, and whether to mention
shared Slack channels
- [ ] Wording of the proposed-fix paragraph

Linear: DOCS-1731


Supersedes #31945, reopened under a human author for attribution.

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Co-authored-by: Rowan Smith <rowan@coder.com>
Co-authored-by: coderagents[bot] <254784001+coderagents[bot]@users.noreply.github.com>
2026-11-23 18:06:18 -05:00
Nick Vigilante aa8a770ea3 docs: use provisioner key env var in VM and Docker provisioner examples (#32626)
## Summary

The VM and Docker examples on the external provisioners page set
`CODER_SESSION_TOKEN`, so a reader who follows the page's recommended
scoped-key path and pastes a key from `coder provisioner keys create`
gets an auth failure.
This switches both examples to `CODER_PROVISIONER_DAEMON_KEY`, which
matches the Scoped Key and Helm sections on the same page.

Fixes #30066

## Changes

- `docs/install/operate/provisioners/index.md`: the VM and Docker
examples now set `CODER_PROVISIONER_DAEMON_KEY=<your-provisioner-key>`,
with one line explaining where the key comes from and that a user token
still works through `CODER_SESSION_TOKEN`.

## Testing

- Ran a throwaway CLI test (not committed) against `enterprise/cli` with
a real provisioner key:
- `CODER_SESSION_TOKEN=<provisioner key> coder provisioner start` fails
with `must provide a pre-shared key or provisioner key when not
authenticated as a user`.
- `CODER_PROVISIONER_DAEMON_KEY=<provisioner key> coder provisioner
start` logs `starting provisioner daemon`.
- `markdownlint-cli2`, Vale, `make lint/emdash`, `make lint/docs-html`,
and `make lint/docs-manifest` pass.

<details>
<summary>Investigation notes</summary>

- Provisioner keys and session tokens travel in different headers:
`Coder-Provisioner-Daemon-Key` (`codersdk/client.go`) versus
`Coder-Session-Token`.
`coder provisioner start` only reads a key from `--key` or
`CODER_PROVISIONER_DAEMON_KEY`
(`enterprise/cli/provisionerdaemonstart.go`).
- Without a key or PSK, the CLI treats the session token as a user API
key and selects an organization, which returns 401 for a provisioner
key.
- The two examples date from March 2023 (#6443), before provisioner keys
existed (`--key` landed in #14002, July 2024), so they were written for
user tokens.
User tokens still work, so the examples were outdated rather than
broken, but they contradicted the page's recommended path.
- No other page under `docs/` pairs `CODER_SESSION_TOKEN` with `coder
provisioner start`.
`docs/admin/users/organizations.md` already uses
`CODER_PROVISIONER_DAEMON_KEY`.

</details>

---

_Generated by Coder Agents on behalf of @nickvigilante._
2026-11-23 18:04:39 -05:00
Nick VigilanteandLisa Fiander 54fc9e3e14 ci: remove the workflow that updated coder.com's own docs renderer (#32560)
## Merge order

Merge this together with coder/coder.com#1231, which removes coder.com's
own docs renderer and its `/api/algolia-docs-sync` endpoint, ideally
just before it. Merged earlier, coder.com's Algolia docs index and its
build-time docs redirects stop updating while that renderer still
exists; merged later, the `algolia-and-isr` job fails on every `docs/**`
push because its endpoint is gone. coder/coder.com#1231 itself follows
coder/coder.com#1230 and the docs-engine changes that move code-server's
docs into the engine.

## Summary

`deploy-docs.yaml` kept coder.com's classic docs renderer up to date.
Its `algolia-and-isr` job POSTed every `docs/**` push to coder.com's
Algolia docs sync, which reindexed the Algolia `docs` index and
revalidated the static pages, and its `vercel-rebuild` job fired a full
coder.com rebuild when `docs/manifest.json` or `docs/redirects.json`
changed. coder.com/docs has been served by the docs engine since
October, and coder/coder.com#1231 removes the renderer, the sync
endpoint, and coder.com's build-time reading of the manifest and
redirects. After that, the first job fails on every docs push and the
second rebuilds coder.com for nothing, so the whole workflow goes.

This removes `deploy-docs.yaml` and the two test scripts that only
exercised its logic (`test-deploy-docs-diff.sh` for the surgical-reindex
diff parser, `test-deploy-docs-release.sh` for the release-tag step
inside the Algolia job). It drops the three paths from doc-check's path
filter and from CODEOWNERS, and rewrites the short "How exclusion from
coder.com works" section of `docs/.style/README.md`, which described
exclusion through coder.com's old renderer, to describe the docs
engine's manifest-driven sync.

After merge, the `ALGOLIA_DOCS_SYNC_SECRET` and
`DEPLOY_DOCS_VERCEL_WEBHOOK` repository secrets are unused and can be
deleted.

## Verification

Nothing else in the repository references what this removes. A code
search on `main` for `deploy-docs`, `test-deploy-docs`,
`DEPLOY_DOCS_VERCEL_WEBHOOK`, `ALGOLIA_DOCS_SYNC_SECRET` and
`algolia-docs-sync` finds only the six files this PR changes. No CI job
runs the two test scripts; doc-check only lists them in a path filter.
The branch is one commit on `main` (462b474):

```
removed  .github/workflows/deploy-docs.yaml             +0/-596
modified .github/workflows/doc-check.yaml               +0/-3
removed  .github/workflows/test-deploy-docs-diff.sh     +0/-291
removed  .github/workflows/test-deploy-docs-release.sh  +0/-217
modified CODEOWNERS                                     +0/-3
modified docs/.style/README.md                          +3/-10
```

The workflow ran on every recent docs push to `main` (latest 2026-11-20,
all successful), so removing it stops those runs; nothing else depends
on their results.

AI disclosure: this PR was prepared with AI assistance under the [AI
contribution
guidelines](https://github.com/coder/coder/blob/main/contributing/AI_CONTRIBUTING.md);
the change and the evidence above are for Nick to verify before it
leaves draft.

Linear: https://linear.app/codercom/issue/DOCS-1462

---

🤖 Built with AI assistance.

Co-authored-by: Lisa Fiander <lisa@coder.com>
2026-11-23 12:56:53 -05:00
Kyle CarberryandClaude Opus 5.5 11f72a8ae9 ci: publish release images and charts through coder/ghcr-publisher (#32566)
GitHub grants package write access to a whole repository, not to a
workflow, branch or environment. Today `ghcr.io/coder/coder`,
`coder-base` and the OCI charts list coder/coder with Write, so any
workflow on any branch here can request `packages: write` and overwrite
a release tag with this repository's `GITHUB_TOKEN`. The `release`
environment and the tag rulesets don't stop that. GHCR accepts neither
App tokens nor OIDC, so the repository boundary is the only way to
separate who publishes.

With this change, releases push to `*-staging` packages and trigger
**coder/ghcr-publisher**, a locked repository that will be the only one
with Write on the public packages. Before copying a digest, it verifies
three things:
- this `release.yaml` attested it,
- on `release/X.Y` (or `main` for an RC), with the signer being
`release.yaml` at that same ref,
- built from the commit the `vX.Y.Z` tag points to.

It copies by digest and never moves an existing version tag. It moves
`latest` only to the highest stable version.

### Changes
- **release.yaml**
- Images, the base image and the OCI charts are pushed to
`coder-staging`, `coder-base-staging` and `chart-staging/*`.
- The charts get attestations for their OCI manifest digests. The
existing `.tgz` attestations don't cover those digests.
- The base and image attestations no longer `continue-on-error`, because
promotion depends on them.
  - The final image is built on the fresh base image **by digest**.
- A `repository_dispatch` is sent with a `coder-ghcr-dispatch` token
(`contents: write` on `ghcr-publisher` only).
- The job waits until every public tag serves the expected digest,
before the GitHub release is published.
- `latest` is no longer built here. The separate latest SBOM asset is
dropped; it described the same image.
- **docker-base.yaml**
- Only checks, on PRs that touch them, that `Dockerfile.base` builds for
every platform. It no longer publishes, and no longer needs `packages:
write`.
- Non-release and local builds keep using
`ghcr.io/coder/coder-base:latest`. coder/ghcr-publisher moves it to the
base of each new highest stable release (roughly weekly for 2.39),
instead of the Monday/Wednesday/Friday rebuild. So preview images and
the `coder-preview:main` scan see Alpine updates about weekly, and a
`Dockerfile.base` change reaches preview images at the next stable
release. Release images always build a fresh base.
- **verify-releases.md**
- Releases since 2026-11-16 (#32212) are built on `release/X.Y`, so the
documented `--source-ref refs/tags/vX.Y.Z` and cosign identity fail for
current releases.
- Checked: `gh attestation verify` on v2.39.4 fails with the tag ref and
passes with `refs/heads/release/2.39`. v2.39.1 still passes with its
tag. Cosign verifies v2.39.4 with the new identity.

### Review fixes (second commit set)

Two independent reviews (one functional, one adversarial) found the
following, now fixed:
- **A writer could get a real release to attest their image.** The index
was built from, and its digest read back from, mutable staging tags. A
writer moving `coder-staging:vX` mid-release could get their image
attested. Now every digest comes from the registry's response to our own
push (`docker push`, `docker manifest push`, depot, `helm push`), the
index is built from per-arch **digests**, and syft and cosign run on
`image@digest`. Tested against a local registry with Docker 29: each
parsed digest matches what the registry stores, and the index contains
exactly the pushed children.
- **Commit binding.** The provenance commit field is the dispatched
branch head, not the released commit (which differs whenever an older
commit is released). Each artifact now gets a release attestation
(`https://coder.com/attestations/release/v1`) stating version, commit
and target package, and the publisher requires it, plus an approved
`release` environment on the run.
- **Re-runs:** a tag an earlier attempt promoted is accepted, and the
publisher keeps that build.
- **Tokens:** the tagging and promotion App tokens are revoked right
after use.
- **Docs:** `SOURCE_REF` is now correct for RCs (checked in bash and
PowerShell).

Image *provenance* attestations are best-effort again, as before; the
publisher relies on the release attestations instead.

### Prerequisites (all done 2026-11-22)
1. coder/ghcr-publisher#1 and coder/ghcr-publisher#2 merged (#2 checks
the release attestations this PR now produces).
2. The staging packages exist (created 2026-11-20), with coder/coder
**Write** and `ghcr-publisher` **Read** set under Manage Actions access:
`coder-staging`, `coder-base-staging`, `chart-staging/coder`,
`chart-staging/coder-provisioner`, `chart-staging/coder-ai-gateway`.
3. The `coder-ghcr-dispatch` App exists and is installed on
`ghcr-publisher` only (coder/gcp#472, coder/github-org-terraform#206),
and `CODER_GHCR_DISPATCH_APP_ID` and `CODER_GHCR_DISPATCH_APP_KMS_KEY`
are set in the `release` environment. `coder-release-publisher` is
uninstalled from `ghcr-publisher`.

### After merge
- Backport to release/2.39, 2.38, 2.37, 2.34 and 2.29. Each branch runs
its own `release.yaml`.
- After one real release promotes successfully, switch the five public
packages to coder/coder **Read** and ghcr-publisher **Write**. Only then
is the overwrite path closed.

Tested:
- The publisher's checks against the real v2.39.4 attestations: pass on
the right ref, fail on a wrong ref, wrong commit or wrong signer.
- The anonymous digest lookup against live image, base and chart tags
(matches crane).
- actionlint and zizmor are clean.
- No release has run with this yet.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:05:46 -05:00
Nick Vigilante 013d00e8ea docs: list AI Gateway before Agent Firewall in the AI Governance sidebar (#32554)
## Summary

Lists AI Gateway before Agent Firewall under AI Governance in the docs
sidebar.
The sidebar now matches the AI Governance landing page, which already
introduces AI Gateway first.

## Changes

- `docs/manifest/ai-governance.yml`: swap the order of the two child
includes, and reorder the section description to "AI Gateway, Agent
Firewall, and reporting."
- `docs/manifest.json`: regenerated with `make gen/docs-manifest`.

No page content, paths, or redirects change.

## Testing

- `make gen/docs-manifest`, `make lint/docs-manifest`, `make
lint/docs-html`, and `make lint/emdash` pass.
- Checked that the regenerated `docs/manifest.json` differs from `main`
only in the AI Governance children order and its description.

Closes
[DOCS-1858](https://linear.app/codercom/issue/DOCS-1858/move-ai-gateway-above-agent-firewall-in-the-ai-governance-docs-sidebar)

---

_Generated by Coder Agents on behalf of @nickvigilante._
2026-11-20 13:29:46 -08:00
Nick Vigilante eabd63b0fc docs: add an air-gapped K3s install tutorial (#31869)
Adds a tutorial that installs Coder on a single-node K3s cluster in a
fully air-gapped environment. It stages every artifact on an
internet-connected workstation, builds a Coder image with a Terraform
provider mirror and a workspace image with code-server preinstalled,
carries everything to the host on removable storage, runs every host
command on the host itself, and ends with a workspace that has no
outbound access. The page is added under the Kubernetes install pages in
the sidebar and linked from the air-gapped deployments page.

The commands were first run end to end on an arm64 Raspberry Pi 4 Model
B with 4 GB of memory running Ubuntu Server 26.04 LTS, with SSH from the
workstation. After review moved the page to a strict air gap, the whole
page was run again on amd64: staging on a Linux workstation, then the
host steps on an Ubuntu Server 26.04 systemd container on a network with
no internet access and no route to the workstation. The starter
Kubernetes template needs three changes to work in this environment (the
hardcoded `amd64` agent architecture, the `Always` image pull policy,
and the code-server install in the startup script), and the chart's
default 2 CPU and 4Gi memory request does not schedule on a 4 GB host.
The page makes each change with a command and states the expected
output.

Maintenance and limits for the reviewer:

- Versions are pinned in the page (K3s, Coder, both Terraform providers,
code-server, Helm, PostgreSQL). The release automation in
`scripts/releaser/docs.go` only updates
`docs/install/server/kubernetes/index.md`, so these will not update on
release.
- The architecture is set once with `ARCH` and `K3S_BINARY`. The current
host steps were run on amd64 only. The arm64 run on the Pi predates the
move to removable storage.
- A host with no default route can't start K3s, so the page checks for
one and adds the black-hole route from the K3s air-gap docs. The test
sandbox can't load kernel modules, so a `veth` interface stood in for
the `dummy` interface type. `dummy.ko` ships in Ubuntu 26.04's base
`linux-modules` package.
- The Dockerfiles and the PostgreSQL manifest are new content that
overlaps with the example Dockerfile on the air-gapped deployments page.
I left that page's Dockerfile alone because it has separate problems,
which are tracked outside this PR.
- No identifiers were stripped from the page. Every host address, user
name, and host name is a placeholder.
- The doc-check review suggestion about the `wget` command in the final
verification step is not applied. The workspace image includes `wget`,
so a failure means the request did not succeed.

---
🤖 Built with AI assistance.
2026-11-20 16:19:23 -05:00
Steven Masley 462b474729 fix: refuse unknown built-in PostgreSQL data versions (#32489)
<!-- Authored with Coder Agents on behalf of @Emyrk -->

Refs
https://linear.app/codercom/issue/CORE-634/upgrade-embedded-postgresql-to-a-non-eol-version.
Precedes #32144.

Refuse to start built-in PostgreSQL when an existing data directory has
a missing or unsupported version, rather than letting embedded-postgres
replace its data.

- An existing `PG_VERSION` other than 13, including 18 or 19, now
returns an error without starting PostgreSQL.
- A missing marker also returns recovery guidance instead of
initializing over existing data.
- Fresh databases and existing PostgreSQL 13 databases keep their
current behavior.
- Development database recovery uses the same guard.

<details><summary>Agent context</summary>

The bundled embedded-postgres v1 library can delete an existing data
directory whose version does not match its PostgreSQL 13 binary. This
change checks the directory before invoking the library, without
changing the binary version or migrating data. Only Coder builds
containing this guard gain the protection; already-released older
binaries remain unchanged.

</details>

---

<sub>Coder Agents on behalf of @Emyrk.</sub>
2026-11-20 13:43:07 -06:00