Commit Graph
3362 Commits
Author SHA1 Message Date
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
Garrett Delfosse d3a57ec1ca fix(site/src/pages/AgentsPage/AgentSettingsPage/AgentSettingsSkillsPage): keep organization skills visible across many organizations (#32410) 2026-11-20 13:59:56 -05:00
Susana Ferreira 13381e306d feat: paginate the organization unpriced AI models endpoint (#32170)
## Description

Paginates the experimental `GET
/api/experimental/organizations/{organization}/ai/model-prices/unpriced`
endpoint from #31753. The list is keyed by the requested model, which
clients set, so it has no upper bound.

## Changes

- `GetUnpricedAIModels` takes `limit_opt` and `offset_opt`, and each row
carries the `count` of every model. A zero limit returns every model, so
the unpriced models notification is unchanged.
- The endpoint reads `limit` and `offset` with
`parseOrganizationAISpendPage` (default 10, maximum 100), as the other
AI spend endpoints do.
- `count` is now the number of models over every page.
- `ExperimentalClient.OrganizationUnpricedAIModels` takes an
`OrganizationAISpendPage`.
- Add query and handler tests for pagination.

Related to AIGOV-730

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-11-20 17:48:01 +00:00
Ehab Younes d807abc2e3 feat: honor --use-keyring together with --global-config (#32392)
An explicit --use-keyring flag or CODER_USE_KEYRING value now selects the
keyring backend even when --global-config points at a custom directory.
When --use-keyring is left at its default, a custom --global-config still
selects file storage so existing callers keep finding <dir>/session.

Removes the test-only RootCmd.UseKeyringWithGlobalConfig override and the
duplicate clitest.NewWithDefaultKeyringCommand helper.

Closes CLI-1, #29105
2026-11-20 19:02:08 +03:00
Molly Fraser 35bd24ee3b feat(site/src): show organizations on the AI Gateway session summary (#32313)
Adds an **Organization** row to the Session summary card on the AI
Gateway session detail page, using the `organizations` field added to
the session response in #32057. Each organization is a badge linking to
`/organizations/<name>` and showing `display_name || name`, as in the
Connection Logs details popover. Sessions with no organization recorded,
which only exist from before v2.39, show "Not recorded". The row is
shown only when `useDashboard().showOrganizations` is true, so
single-organization deployments see no change. The AI Gateway audit docs
mention the new row.

Refs AIGOV-754. Stacked on #32260.

## Notes for reviewers

- **Several organizations:** all are listed, wrapping like the Provider
row. The label stays singular ("Organization"), matching "Provider".
- **Cost** is still the whole session's cost, as agreed for AIGOV-754.
- **Tests:** stories only, since the change is visual.
`SessionSummaryTable` has `OneOrganization`, `MultipleOrganizations` and
`OrganizationNotRecorded`; `Default` covers the hidden row.
`SessionThreadsPageView` has `WithOrganizations`, which covers the page
passing the organizations through. New shared fixtures:
`MockAIBridgeSessionOrganization` and `MockAIBridgeSessionOrganization2`
in `testHelpers/entities.ts`.

<details>
<summary>Decisions and plan</summary>

- **Scope (Sas, 16 Nov):** the detail page organization row is a
separate PR after the list filter, built this sprint if time allows.
There is no design, so it follows existing patterns.
- **Behavior:** no row on single-org deployments; "Not recorded" for an
empty list; one linked badge per organization.
- **Badge link:** `<Badge asChild hover>` around the router link, as in
`WorkspacesTable.tsx`, so the focus ring is not clipped and long names
truncate with an ellipsis and a `title`.
- **Stack:** #32057 (backend) → #32260 (list filter) → this PR.
- **Checks run:** `pnpm lint:types`, Biome, `frontend-deep-review` (all
findings fixed), and doc-check on `audit.md` (no blocking findings).

</details>

---

Code written by @mollymaefraser, with Coder Agents used as a guide:
explaining the existing code path, reviewing each step, and running
reviews.
2026-11-20 09:23:59 +00:00
Bobby Ho 88d3494b9a feat: require a setup token to create the first user on a tunnel (#32324)
fix(security): require setup token for first user on tunnels

Prevent unauthorized users from claiming Owner access on public `try.coder.app` tunnels before initial setup.

- Generate a setup token at startup when using a tunnel with no existing users.
- Require the token for first-user creation via the API, web UI, and CLI.
- Block GitHub/OIDC first-user signup until setup is complete.
- Support custom tokens via `--setup-token` / `CODER_SETUP_TOKEN` and non-interactive CLI setup.
- Update development scripts, documentation, and tests.
- Preserve existing behavior for deployments with an access URL or existing users.

Validated with automated tests and 23/23 manual scenarios using a real tunnel.

Refs CORE-784
2026-11-19 20:22:21 -07:00
Nick VigilanteandCoder Prototypes feb6e809c4 docs: add provisioner metrics and a metrics signpost page (#31977)
## Summary

Admins who start from the External provisioners docs had no way to find
out which Prometheus metrics exist for provisioners, or how to turn them
on for standalone provisioner daemons.
This PR documents both, and turns the deployment metrics page into a
signpost to the monitoring docs for each area.

## Changes

- **`docs/install/operate/provisioners/index.md`:** expands the
"Prometheus metrics" section. The heading and its `#prometheus-metrics`
anchor are unchanged.
- It explains which metrics each provisioner daemon reports and which
the control plane reports. For built-in provisioners, the control plane
also reports the daemon metrics.
- Two tables list each metric's purpose and link to the generated
[Available
metrics](https://coder.com/docs/admin/integrations/prometheus#available-metrics)
table for types and labels.
- It explains how to read the queue wait metric. Jobs whose tags no
provisioner matches don't appear in it until a provisioner acquires
them.
- It shows how to turn on the daemon's Prometheus endpoint with
`--prometheus-enable` / `CODER_PROMETHEUS_ENABLE` and
`--prometheus-address` / `CODER_PROMETHEUS_ADDRESS`. It corrects the
stated default address from `localhost:2112` to `127.0.0.1:2112`.
- It covers the `coder-provisioner` Helm chart: the fixed `0.0.0.0:2112`
address, the `prometheus-http` container port, and the missing Service.
It adds a Pod discovery example with `coder.podAnnotations` and a
`PodMonitor` alternative.
- **`docs/install/operate/provisioners/manage-provisioner-jobs.md`:**
links from the troubleshooting section to the metrics section.
- **`docs/admin/monitoring/metrics.md`:** becomes a signpost page.
- It keeps the control plane setup links and the `#setting-up-metrics`
anchor.
- It adds a table of monitoring pages per area (provisioners, workspace
proxies, prebuilt workspaces, AI Gateway, Agent Relay), and notes which
areas serve metrics on their own endpoint.
  - It links to the full metrics list.

No new pages, so `docs/manifest.json` is unchanged.

## Testing

- `make lint/emdash`, `go run ./scripts/docshtmlcheck`, markdownlint,
and `markdown-table-formatter` are clean on the changed files.
- Vale reports 0 errors and 0 warnings. Its 4 suggestions are on lines
this PR doesn't change.
- The pre-commit hook (`pre-commit-light`, including
`lint/docs-redirects`, `lint/markdown`, and `lint/style-claims`) passed.
- A script resolved every relative link and anchor in the changed files.

<details>
<summary>Verified against</summary>

- `provisionerd/provisionerd.go` (`NewMetrics`): names of the five
provisioner daemon metrics.
- `provisionerd/runner/runner.go`: where the job and build metrics are
recorded.
- `cli/server.go:1273-1296`: the control plane registers the daemon
metrics only for built-in provisioners, and sets `num_daemons` to the
built-in count. `cli/server.go:385-389` registers the provisioner server
metrics.
- `coderd/provisionerdserver/provisionerdserver.go:1011-1019`:
`coderd_provisioner_job_queue_wait_seconds` is recorded only when a
provisioner daemon acquires a job. `coderd/coderd.go:2602` and
`enterprise/coderd/provisionerdaemons.go:365` pass the same metrics to
built-in and external provisioners.
- `coderd/jobreaper/detector.go:26-28`: a pending job that nothing
acquires is failed after 30 minutes, without a queue wait observation.
- `coderd/wsbuilder/metrics.go` and
`coderd/wsbuilder/wsbuilder.go:357-373`:
`coderd_workspace_builds_enqueued_total`.
- `enterprise/cli/provisionerdaemonstart.go:204-218, 371-383`: the
flags, env vars, and `127.0.0.1:2112` default. A standalone daemon sets
`num_daemons` to 1 and registers the Go, process, and `promhttp`
collectors.
- `cli/agent.go:603-611`: the metrics handler serves every path, so the
default `/metrics` scrape path works.
- `helm/provisioner/templates/_coder.tpl:40-41, 81-96`: the fixed
address, and the `prometheus-http` port that appears only when
`CODER_PROMETHEUS_ENABLE` is `"true"`. The chart has no Service
template.
- `helm/libcoder/templates/_coder.yaml:24-33`,
`helm/libcoder/templates/_helpers.tpl:20-22`, and
`helm/provisioner/tests/testdata/labels_annotations.golden`:
`coder.podAnnotations` and `coder.podLabels` land on the Pod template,
which carries the `app.kubernetes.io/name` and
`app.kubernetes.io/instance` labels.
- `enterprise/cli/proxyserver.go:243-250`: workspace proxies serve
metrics on their own listener.
- Tests that pin these claims: `coderd/workspaces_test.go` (queue wait),
`helm/provisioner/tests/testdata/default_values.golden` (fixed address),
and `enterprise/cli/testdata/coder_provisioner_start_--help.golden` (CLI
default).

</details>

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

- **Kept the `## Prometheus metrics` heading.** Renaming it gained
nothing and would break external links to `#prometheus-metrics`. The AI
Gateway and Agent Relay pages that the signpost table links to use the
same heading.
- **Kept `<a id="setting-up-metrics"></a>` on `metrics.md`.** External
links to that anchor keep working, and `scripts/docshtmlcheck` passes
with it.
- **Dropped the Type and Labels columns.** `scripts/metricsdocgen` fills
one marked block in `prometheus.md`, so it can't generate these tables.
Types and labels drift the most, so the page now points to the generated
table for them. Extending the generator, or adding a check that metrics
named in `docs/` exist in `scripts/metricsdocgen/generated_metrics`,
would need a separate PR.
- **Rewrote the queue wait guidance.** The earlier text said a rising
value can mean no provisioner matches a job's tags. The code records the
value only when a provisioner acquires a job, so unmatched jobs never
reach the metric. The page now links to the existing troubleshooting
steps for finding them, instead of restating a command.
- **Reworded the signpost intro.** The workspace proxies page explains
how to turn on metrics but doesn't list them, so the table describes
each linked page as covering monitoring, not listing metrics.
- **"Separate endpoint" column.** Checked in code for workspace proxies.
Agent Relay has no server code in this repo, so its "Yes" comes from
`docs/agent-relay/monitoring/index.md`.

</details>

<details>
<summary>Related gaps not edited</summary>

- `docs/admin/integrations/prometheus.md:14` and
`docs/admin/networking/workspace-proxies.md:221` still say
`localhost:2112`. The server and proxy default is `127.0.0.1:2112`
(`codersdk/deployment.go:2658`).
- `docs/workspaces/speed-up-templates.md:42-44` implies that control
plane metrics include `coderd_provisionerd_job_timings_seconds`. That
holds only for built-in provisioners.
- `docs/admin/networking/workspace-proxies.md#observability` explains
how to turn on the endpoint but doesn't list any proxy metrics.
- `docs/admin/networking/` (DERP and tailnet, for example
`coder_derp_server_*` and `coder_servertailnet_*`) has no metrics
section.
- `docs/admin/monitoring/health-check.md` links to the database metrics
flag but doesn't list the `coderd_db_*` metrics.
- `docs/admin/monitoring/notifications/` doesn't list the
`coderd_notifications_*` metrics.
- `docs/admin/users/` (`coderd_api_active_users_duration_hour`, license
metrics) and `docs/admin/security/audit-logs.md` have no metrics
sections.
-
`docs/templates/extending-templates/prebuilt-workspaces.md#available-metrics`
lists metrics without types or labels, and doesn't say how to turn them
on.

</details>

Disclosure: these changes were generated by Coder Agents.

Closes DOCS-892


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

---------

Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com>
2026-11-19 12:59:31 -05:00
Nick VigilanteandCoder Prototypes 01b0a234e8 docs: add Verify Coder releases page (#31983)
Adds a how-to page, `docs/admin/security/verify-releases.md` (sidebar:
**Administration > Security > Verify releases**). It shows Coder
deployment administrators how to check release artifacts with the
evidence each release already publishes:

- GPG verification of `coder_<version>_checksums.txt` with its `.asc`
signature, then a SHA-256 check of the artifact (Linux `sha256sum`,
macOS `shasum`, Windows `Get-FileHash`).
- GPG verification of the standalone CLI binaries on
`releases.coder.com/coder-cli/<version>/` using their detached `.asc`
signatures.
- `gh attestation verify` for SLSA build provenance on release files,
Helm charts (including charts pulled from `oci://ghcr.io/coder/chart`)
and `oci://ghcr.io/coder/coder:v<version>`, pinned to `release.yaml` and
the release tag.
- `cosign verify-attestation --type spdxjson` for the image SBOM, with
the keyless certificate identity and steps to extract the SPDX document.
- Short macOS (`codesign`, `spctl`) and Windows
(`Get-AuthenticodeSignature`) code-signature checks.

The attestation steps in `release.yaml` use `continue-on-error`. The
page therefore calls provenance best-effort, does not promise every
artifact is attested, and gives a fallback when `gh attestation verify`
returns `HTTP 404: Not Found`.

Verified against:
- `.github/workflows/release.yaml`: build targets, attestation steps and
subject globs, the SBOM steps (`syft`, `cosign attest`), the `latest`
tag logic, the `releases.coder.com` upload, Helm publishing
- `scripts/release/publish.sh`: checksum file name and GPG signing of
the checksum file
- `scripts/sign_with_gpg.sh`: detached armored signatures
- `scripts/build_go.sh`, `scripts/build_windows_installer.sh`,
`scripts/archive.sh`, `scripts/sign_windows.sh`,
`scripts/sign_darwin.sh`, `scripts/notarize_darwin.sh`: which files are
code-signed and notarized
- `scripts/image_tag.sh`: image name and tag format
- `Makefile`: slim binary and `.asc` handling
- `mise.toml`: the release pipeline uses cosign 2.4.3
- `release.key`: the public key in the repo root
- Every command except the macOS and Windows code-signature checks was
run against release v2.38.6: Linux and macOS commands in a shell,
Windows commands in PowerShell 7 on Linux. GPG checksum and binary
signatures, `gh attestation verify` on files, Helm charts and the OCI
image, and Cosign 3.1.4 SBOM verification all succeeded. Cosign 2.4.3
without the flag also succeeded.

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

- Placed under `admin/security/` because the Security section lists its
child pages automatically, and the page is meant to be linked from the
trust center.
- PowerShell variables are case-insensitive, so `${VERSION}` works in
both shells. Single-line commands are shared, and tabs appear only where
commands really differ.
- Cosign 3 needs `--new-bundle-format=false` to find the SBOM
attestation. Without it, it reports "none of the attestations matched
the predicate type: spdxjson". Cosign 2 rejects the flag, so the page
tells Cosign 2 users to remove it.
- The `gpg --import` example output uses `<key ID>` rather than the real
key ID, to stay consistent with the fingerprint placeholder.
- Dropped Cosign's first output line because it ends in a spaced `--`,
which the punctuation rules ban.
</details>

Open questions for the reviewer:
- **Security: GPG fingerprint.** The page has a `TODO(security)`
placeholder. For reference, `gpg --show-keys release.key` reports
primary key `21C9 6B1C B950 7188 74F6 4DBD 6A5A 671B 5E40 A3B9` (`Coder
Release Signing Key <security@coder.com>`, expires 2029-01-18,
encryption subkey expired). That key signed the v2.38.6 checksums.
Please confirm this is the fingerprint to publish, and whether
`raw.githubusercontent.com/coder/coder/main/release.key` is the right
place to download it.
- **Security: signing identities.** Placeholders remain for the Apple
Developer ID / Team ID and the Windows EV certificate subject. The page
publishes the Sigstore certificate identity
`https://github.com/coder/coder/.github/workflows/release.yaml@refs/tags/v<version>`
with issuer `https://token.actions.githubusercontent.com`. Both come
from the public workflow path and were seen in real verification output.
Please confirm that is acceptable to publish.
- **Not run:** the macOS `codesign -dvv` / `spctl --assess -t install`
steps and Windows `Get-AuthenticodeSignature` come from script comments.
They need a check on real macOS and Windows machines, including expected
output.
- **Cosign format risk:** the SBOM attestation uses the older cosign
format, which Cosign 3 has deprecated. Consider a release-workflow step
that runs the documented verify command so a format change gets caught.
- **Public URL:** is `releases.coder.com/coder-cli/<version>/` meant to
be a documented download location?
- **Trust center link:** the trust center is outside this repo, so
someone needs to add the link to this page there.
- **Likely merge conflict:** open PR #31806 also edits
`docs/manifest/admin/security.yml` and `docs/manifest.json`.

Generated by Coder Agents.

Closes DOCS-1219


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

---------

Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com>
2026-11-19 12:58:51 -05:00
Ben Potter 5f61a045ab docs: refocus sandbox agents intro on Coder's approach (#32451) 2026-11-19 09:19:28 -06:00
Susana Ferreira 8705d80fe0 feat: add provider, model, and client spend to the AI spend users endpoint (#32330)
## Description

Extends the experimental `GET
/api/experimental/organizations/{organization}/ai/spend/users` endpoint
with the per-user details behind the AI spend overview and the detailed
report. Each user now returns their spend per provider, model, and
client, and whether each has unpriced usage.

## Changes

- Rewrite `ListOrganizationAISpendUsers` with `GROUPING SETS`, returning
one row per user and provider, model, or client:
  - Adds the `user_ids` and `group_id` filters.
  - Pages, counts, and totals users, not their rows.
- Reads the provider display name, icon, and type from `ai_providers`,
including deleted providers. The live provider wins when a name was
reused, like `GetAIProviderFilterOptions`.
- Update the SDK and handler:
- Each user returns `provider_spend`, `model_spend`, and `client_spend`,
most expensive first, each with `has_unpriced_usage`.
  - `totals` returns `has_unpriced_usage`.
- Remove the `providers`, `clients`, and `models` name arrays and
`unpriced_usage_count`.
  - Accept `user_ids` (comma-separated, maximum 100) and `group_id`.
- Return more than 100 `user_ids` on the group members AI spend endpoint
as a validation error, like `/ai/spend/users`.
- Switch the Spend page to the new fields, with no UI changes.
- Update the query and handler tests.

<details>
<summary>Dogfood performance</summary>

- Benchmarked on **dogfood**, comparing the existing query on **main**
with the updated query in **this PR**.
- Tested **1, 7, 15 and 30-day windows**, ending at **November 18, 2026,
00:00 UTC**, exclusive.
- Each query ran **five times per window**, one at a time, with query
order and window order rotated across rounds to reduce ordering bias.

The table shows PostgreSQL execution time in **seconds, average
(min-max)**.

| Days | Main | This PR |
|------|-----:|--------:|
| 1 | 0.288 (0.199-0.501) | 0.223 (0.184-0.275) |
| 7 | 11.413 (4.076-40.003) | 4.107 (3.529-4.828) |
| 15 | 9.961 (8.053-16.917) | 7.253 (6.873-7.736) |
| 30 | 14.979 (12.276-23.177) | 8.499 (7.813-9.169) |

All five runs are included. Main's first seven-day run took **40.003s**
with unusually high read I/O time, which raises its average. Cache and
concurrent load can affect these results.

</details>

Closes AIGOV-734

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-11-19 14:59:20 +00:00
Ben Potter 690d107fdb docs: explain how to keep a workspace running without a connection (#32315)
The answer to "how do I keep a workspace up while a long job or coding
agent runs?" only lived in the [reference
page](https://coder.com/docs/reference/#workspace-agents), which is hard
to find. This adds a **Keep a workspace running without a connection**
section to the scheduling page under Activity detection:

- Background processes (Claude Code in `tmux`, Herdr, `nohup` jobs)
don't count as activity.
- `coder schedule extend` from the CLI, and `PUT /extend` from a script
with a user token.
- **Keep coding agents running:** template examples for Claude Code and
Herdr. A `coder_script` uses the owner's build session token once to
mint a token scoped to `workspace:read` + `workspace:update` and
allow-listed to the workspace. It also installs a `coder-keepalive`
helper. Claude Code calls the helper from `managed_settings` hooks, and
Herdr calls it from a `post_start_script` loop. Neither needs a module
change. Matching README examples: coder/registry#1262.

This deliberately avoids app status / AgentAPI reporting.

<details>
<summary>Validation</summary>

On a local v2.38.8 deployment, I used three Docker workspaces with no
IDE, SSH, or terminal connection. Autostop was 2m, and Claude Code went
through dogfood's AI Gateway running about 30 sequential tool calls over
about 11 minutes. The template used the snippets from this page
verbatim, with the unmodified modules from registry `main`.

| Workspace | Result |
| --- | --- |
| Control (no keep-alive) | Stopped about 1 minute after its deadline
while Claude worked |
| Claude Code hooks | Deadline moved to now + 1h at 13:32, and again at
13:43. No changes after Claude finished |
| Herdr loop | Deadline moved to now + 1h at 13:32. No changes after the
agent went idle |

The scoped token from inside the workspace: `PUT /extend` returns 200.
Stopping or deleting the workspace returns 403. Other workspaces,
`/users/me`, and token creation return 404. A full `GET
/workspaces/{id}` is forbidden with the allow list, which is why the
helper uses `?include_related=latest_build`.

</details>

---

🤖 Generated with Coder Agents using Claude.
2026-11-19 07:46:47 -06:00
Molly Fraser 7f245d8296 chore!: remove legacy AI Gateway metric aliases (#32381)
Removes the deprecated `coder_aibridged_*` and `coder_aibridgeproxyd_*`
Prometheus metric aliases, which were scheduled for removal in v2.37.
The embedded AI Gateway and AI Gateway Proxy now emit only
`coder_ai_gateway_*` and `coder_ai_gateway_proxy_*`.

- Replace `NewMetricAliasRegisterer` with
`prometheus.WrapRegistererWithPrefix` in `cli/server.go` and
`enterprise/cli/aibridgeproxyd.go`.
- Delete `coderd/prometheusmetrics/metricalias.go` and its test (no
remaining callers).
- Drop alias support from the metrics docs scanner.
- Update the AI Gateway monitoring and rebranding migration docs: legacy
names are removed as of v2.40.

**Breaking:** dashboards and alerts that still use the legacy names stop
matching. The monitoring docs show a temporary `metric_relabel_configs`
bridge.

Closes AIGOV-447.

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

| File | Change |
|---|---|
| `cli/server.go` | Remove the `TODO(deprecation)` comment; register
embedded gateway metrics with
`prometheus.WrapRegistererWithPrefix(aibridgemetrics.PrometheusMetricPrefix,
...)`. |
| `enterprise/cli/aibridgeproxyd.go` | Same swap with the
`coder_ai_gateway_proxy_` prefix; drop the unused `prometheusmetrics`
import. |
| `coderd/prometheusmetrics/metricalias.go`, `metricalias_test.go` |
Delete; the two call sites above were the only callers. |
| `scripts/metricsdocgen/scanner/prefix.go` | Remove
`NewMetricAliasRegisterer` from `prefixFuncs`. |
| `scripts/metricsdocgen/scanner/scanner_test.go` | Remove the alias
fixture and the legacy-alias assertion; the remaining literal-prefix
case already covers plain `WrapRegistererWithPrefix`. |
| `scripts/metricsdocgen/README.md` | Drop the
`NewMetricAliasRegisterer` mention. |
| `docs/ai-governance/ai-gateway/monitoring.md` | State that legacy
names are no longer emitted as of v2.40; reword the relabel snippet as a
temporary bridge and explain its cost. |
| `docs/ai-governance/ai-gateway/rebranding-migration.md` | Mark metrics
as "No (removed in v2.40)"; rewrite the Metrics section; remove the
now-obsolete "dropping the old names" section. |

Release note: the `!` title applies `release/breaking`, so the change is
listed under breaking changes in the v2.40 release notes.

Verification: `make gen` (no metrics reference changes), `make lint`,
`pnpm run format-docs`, `pnpm run lint-docs`, doc-check and test-audit
self-review, and targeted tests for `enterprise/cli` (AI Gateway /
proxy), `cli` (AI Gateway), `scripts/metricsdocgen`, and
`coderd/prometheusmetrics`.

</details>

Code written by @mollymaefraser, with Coder Agents used as a guide.
2026-11-19 13:24:00 +00:00
Molly Fraser a50d929128 feat(site/src): add organization filter to AI Gateway sessions list (#32260)
Adds an organization filter to the AI Gateway sessions list, using the
`organization` search key added in #32057. Choosing an organization adds
`organization:<name>` to the sessions query, so the list shows sessions
with at least one interception attributed to that organization. The
filter is a new `OrganizationFilter` in `pages/AIBridgePage/filters/`,
shaped like the provider, client and model filters, with options from
the shared `getOrganizationFilterOptions` helper (the same source as the
Connection Logs and Audit filters). The shared
`useOrganizationsFilterMenu` it first reused was removed in #32367. It
is shown only when `useDashboard().showOrganizations` is true, so
single-organization deployments see no change. The AI Gateway audit docs
mention the new filter.

Refs AIGOV-754. Stacked on #32057.

## Open questions for reviewers

- **Permission behind the org list:** the menu lists only organizations
where the user can read **audit logs** (`organizationCheck` in
`filters/OrganizationFilter.tsx`), not AI Gateway interceptions. Owners
and auditors, who can see this page today, have both. A custom role that
can see sessions but not audit logs would get an empty list. Connection
Logs has the same behavior. Is this acceptable, or should it check AI
Gateway interceptions instead (a one-line change)?
- **#31040 (Tracy):** that draft reworks this filter bar and already has
an Organization option. This PR adds the filter to the current bar; if
#31040 lands first, this moves into it.

## Notes for reviewers

- **Tests:** `ListSessionsPage.test.tsx` checks that picking an
organization sends `organization:<name>` in the request. The
`WithOrganizations` story shows the opened menu, and `Default` shows the
bar without it. Hiding the filter on single-org deployments has no
Vitest test, because FE1 does not allow presence assertions. It is the
same one-line `showOrganizations` check as Connection Logs.
- The filter starts at "All organizations", not the default
organization.
- The cost shown for a session is the whole session's cost, even with
the filter on, as agreed for AIGOV-754.

<details>
<summary>Decisions and plan</summary>

- **Scope (call with Sas and Susana, 13 Nov):** filter only, no
Organization column. No backend change for cost: show the whole
session's cost, not per org. Org logic is per page.
- **Approach:** build on the current filter bar rather than wait for
#31040, which is a draft and conflicts with `main`. Follow the
Connection Logs pattern (`ConnectionLogPage.tsx`,
`ConnectionLogFilter.tsx`).
- **Stack:** #32057 (backend) → this PR (list filter) → follow-up PR for
the organization row on the session detail page
(`SessionSummaryTable.tsx`).
- **Single-org:** no UI change on single-org deployments.
- **Checks run:** `pnpm lint:types`, Biome, the `ListSessionsPage`
Vitest suite, `frontend-review` (FE1 to FE10), `frontend-deep-review`
(all findings fixed), and doc-check on `audit.md` (no blocking
findings).

</details>

---

Code written by @mollymaefraser, with Coder Agents used as a guide:
explaining the existing code path, reviewing each step, running tests
and reviews, and writing parts of the test setup.
2026-11-19 12:11:46 +00:00
Molly Fraser 4bccdc4ed6 feat: show and filter by organization in AI Gateway sessions API (#32057)
Adds an `organization` filter to `GET /api/v2/ai-gateway/sessions` (and
its `/api/v2/aibridge/sessions` alias) and returns the organization an
interception was attributed to, and how it was chosen, on sessions,
threads and agentic actions, as proposed in the surface definitions on
AIGOV-754. No migration: `aibridge_interceptions.organization_id` and
`organization_source` already exist (000634).

The filter accepts an organization name or ID and keeps sessions with at
least one interception in that organization; the count uses the same
rule so pagination totals match. Each session, on the list and detail
responses, lists the organizations its interceptions were attributed to,
ordered by name, with the distinct sources used for each, or `[]` when
none was stored. Each thread carries the organization of its root
interception and each agentic action carries its own, or null when none
was stored. The new filter is listed in the AI Gateway monitoring docs.

Refs AIGOV-754

## Open questions for reviewers

- **Multi-org sessions** (AIGOV-776): the filter is row-level, like
provider and model. A session spanning two orgs is listed under each
org's filter, and with the filter on, `threads`, `started_at` and
`ended_at` only cover the matching interceptions, while providers,
models, tokens and `organizations` cover the whole session. Is that the
desired behavior?
- **Unknown org ID:** an unknown org name returns 400, but an unknown
org ID returns an empty page, because `parseOrganization` does not look
up UUIDs. This matches workspaces and templates, but the spec says 400.

## Notes for reviewers
- `aiBridgeSessionOrganizations` returns an empty list if the
organizations JSON from the query can’t be decoded, rather than failing
the whole request. The field is supplementary, so a decoding problem
shouldn’t take down the sessions list, but it does mean a SQL bug here
would show up as empty data rather than an error. The alternative is to
log the error before returning the empty list.
- A thread’s organization is taken from its root interception only. If
later requests in the same thread were attributed to a different
organization, that shows on each agentic action’s own organization
field.

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

- `coderd/database/queries/aibridge.sql`:
- `@organization_id` filter in `CountAIBridgeSessions` and the
`session_page` CTE of `ListAIBridgeSessions`.
- New `sorg` lateral in `ListAIBridgeSessions` that groups the session's
interceptions by organization, collects distinct sources, joins
`organizations` (deleted orgs still resolve) and returns a JSON array.
- `ListAIBridgeSessionThreads` resolves the organization name, display
name and icon through a `LEFT JOIN LATERAL` in the final `SELECT`. A
plain join on `organizations` is not safe there: the query has two
`@authorize_filter` placeholders, and the injected filter can reference
a bare `id`, which would be ambiguous next to `organizations.id`. The
lateral only exposes the three selected columns. This answers the
authorize-filter open question from the surface proposal.
- `coderd/database/modelqueries.go`: the hand-written
`ListAuthorizedAIBridgeSessions`, `CountAuthorizedAIBridgeSessions` and
`ListAuthorizedAIBridgeSessionThreads` gain the new argument and scan
columns. The compiler does not catch a mismatch here; it fails at
runtime.
- `enterprise/coderd/aibridge.go`: pass `OrganizationID` into
`CountAIBridgeSessionsParams`, which is built field by field, and list
the `organization` key in `@Param q`.
- `coderd/searchquery/search.go`: `organization` key via
`parseOrganization`.
- `codersdk/aibridge.go`: `AIBridgeInterceptionOrganizationSource` enum,
`AIBridgeInterceptionOrganization`, `AIBridgeSessionOrganization`, new
response fields and `AIBridgeListSessionsFilter.Organization`, per the
proposed Go definitions.
- `coderd/database/db2sdk/db2sdk.go`: decode the session organizations
JSON, never returning nil; `AIBridgeInterceptionOrganizationSource`
converter; build one organization per interception while grouping thread
rows, and use it for the thread (root interception) and each agentic
action.
- `site/`: add `organizations: []` to two frontend mocks, now that the
field is required in the generated types.
- `docs/ai-governance/ai-gateway/monitoring.md`: `organization` added to
the sessions API query filters.
- Tests: `TestAIBridgeSessions` (name and ID parsing),
`TestAIBridgeListSessions/Filters` (by name and ID, checks count and
page), `FilterErrors/UnknownOrganization`,
`TestAIBridgeListSessions/Organizations` (multi-org ordering and
sources, no-org session returns `[]`, filtering by either org returns
the multi-org session and never the no-org one),
`TestAIBridgeGetSessionThreads/Organizations` (thread uses the root's
org, each action its own, null when none, session `organizations` on the
detail endpoint), and `TestAIBridgeInterceptionOrganizationSource`
(every database source maps to an SDK value).
- Remaining files are generated by `make gen`.

</details>

---

Code written by @mollymaefraser, with Coder Agents used as a guide:
explaining the existing code path, reviewing each step, and running
tests.
2026-11-19 09:07:56 +00:00