3328 Commits
Author SHA1 Message Date
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
Taruj Goyal 734a0cae07 feat: scope browser-only connections to a template (#30578)
Add per-template `browser_only` enforcement while preserving `CODER_BROWSER_ONLY` as a deployment-wide override.

Refs #29157. Supersedes #29204 (closed by stale bot). Rebased onto current `main`, with migration renumbered to `000643`.

### Changes

- Add `templates.browser_only` (default `false`) to the database, SDK, and template create/update APIs.
- Require the `browser_only` entitlement to enable the setting, but allow disabling and continue enforcement after license expiry.
- Reject agent coordinate connections with 409 and enforce per-template tunnel restrictions through `AuthorizeTunnel`.
- Return non-fatal tunnel policy errors in both AGPL coordinator and pgcoord, preserving other active tunnels on shared connections.
- Exclude browser-only workspaces from Desktop workspace updates and enforce the restriction in MCP agent connections.
- Fix `TestMigration000617ConnectionLogsMethod` to use raw SQL, avoiding schema compatibility issues.

### Open questions

- **Naming:** Keep `browser_only` or use `require_browser_connections`?
- **Performance:** `AuthorizeTunnel` adds a database query under the coordinator mutex. Consider a narrower query if needed.
- **Feature reporting:** Should the feature report as enabled when any template uses it?

### Out of scope

Dashboard UI, CLI flag, and Terraform provider support (requires a separate `coder/terraform-provider-coderd` change).

### Verification

- Relevant unit and integration tests passed, including coordinate rejection, tunnel isolation, workspace filtering, and non-fatal policy errors in both coordinators.
- `golangci-lint` passed with no issues.
- Regenerated database, SDK TypeScript, Swagger/API reference, and audit-log artifacts.
- Not manually verified with Coder Desktop, multi-node deployments, workspace proxies, or UI.

### AI disclosure

Most changes and the rebase were completed with Claude Code (Opus 5/5.5), following the [AI contribution guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING).
2026-11-18 22:07:12 +00:00
Nick Vigilanteandcoder[bot] 579b9995e8 fix: document WebSocket routes as 101 responses in the Swagger spec (#30125)
Six WebSocket routes were documented as `200` responses: `chats/watch`,
`chats/{chat}/stream`, `chats/{chat}/stream/git`,
`chats/{chat}/stream/parts`, `workspaces/{workspace}/watch-ws`, and
`workspaceagents/{workspaceagent}/watch-metadata-ws`.

Mark them `@Success 101`, matching the other WebSocket routes, and
describe each message. `chats/{chat}/stream` and `stream/parts` send a
JSON array batch of events per message, so they keep `{array}`; the
others send one event per message.

Also document that the previous template version route returns `204`
with no body when there is no previous version.

Part of DOCS-1122, split from #30121.

<details>
<summary>CI flakes unrelated to this change</summary>

On `d23267b7c3`, two checks failed in code this PR does not touch.

-
[`TestChatTurnStopsAtStepLimit/Default`](https://github.com/coder/coder/actions/runs/40809166900/job/123235512188)
in `coderd/x/chatd` (test-go-pg, ubuntu): this PR changes only Swagger
comment annotations and generated docs, and does not touch the `chatd`
package.
-
[`updateWorkspace.spec.ts:76`](https://github.com/coder/coder/actions/runs/40809166900/job/123235512158)
(test-e2e): this PR changes no UI code, and the test exercises workspace
parameter updates.

</details>

---
🤖 Built with AI assistance.

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
2026-11-18 14:05:18 -05:00
Ben PotterandNick Vigilante 3617b3d384 docs: document 2-second sandbox startup with prebuilt workspaces (#32391)
Follow-up to #32280. The sandbox agents guide said sandbox runtimes boot
in milliseconds but didn't say how fast a Coder workspace can be.

- `sandbox-agents.md`: some sandboxes advertise millisecond startup, but
about 2 seconds is good enough and worth the infrastructure flexibility.
Links the [Improving Coder Workspace Startup
Times](https://www.youtube.com/watch?v=-xcVJQWVCxs) video (1.5 min to 2
seconds on Kubernetes) in Fast startup.
- `speed-up-templates.md`: links the same video in the intro.

> Generated by Coder Agents on behalf of @bpmct.

---------

Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
2026-11-18 18:18:33 +00:00
df7f2076fd docs: explain how the init script obtains the workspace agent (#31976)
## Summary

Adds a short note to the base image guidance on the image management
page, so template authors don't expect a speedup the init script can't
deliver:

- The init script downloads the agent from the Coder server on every
workspace start, which keeps the agent at the server's version.
- An agent binary already in the image isn't used by the init script, so
adding the agent to the image doesn't skip the download.
- To skip the download, the note links to [Build tools into the
image](https://github.com/coder/coder/blob/main/docs/workspaces/speed-up-templates.md#build-tools-into-the-image),
which describes starting `coder agent` directly.

Refs DOCS-1323.
Supersedes #31803, reopened under a human author for attribution.

> Generated by Coder Agents.

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

- `provisionersdk/scripts/bootstrap_linux.sh`: always downloads
`${ACCESS_URL}bin/coder-linux-${ARCH}` with curl, wget or busybox and
retries until it succeeds. `BINARY_DIR` only changes where the binary is
downloaded to.
- `provisionersdk/scripts/bootstrap_darwin.sh`: always downloads into a
new `mktemp` directory.
- `provisionersdk/scripts/bootstrap_windows.ps1`: always downloads to
`$env:TEMP\sshd.exe`.
- `provisionersdk/agent.go`: these scripts are the only init scripts
given to the Terraform provider.
- `cli/agent.go`, `cli/root.go`: `coder agent` is a hidden command. It
reads `CODER_AGENT_URL`, `CODER_AGENT_TOKEN` and `CODER_AGENT_AUTH`
(default `token`).
- `docs/workspaces/speed-up-templates.md` on `main` (from #32280)
already documents installing the agent in the image and starting it
directly.

</details>

<details>
<summary>History</summary>

This branch was originally stacked on the sandbox agents guide.
That guide landed on `main` in #32280 under a different name, so the
merge with `main` kept main's version and the PR now contains only the
image management note.

</details>

---------

Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com>
Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Co-authored-by: Ben Potter <me@bpmct.net>
2026-11-18 13:08:07 -05:00
Nick Vigilante b2474d19d7 feat: own the docs accessibility checks the axe Linter doesn't run on Markdown (#30905)
## Merge order

This PR was stacked on #30879, which has merged. It now targets `main`
and has no remaining dependency.

## Summary

The axe Linter checks only one rule in Markdown, `heading-order`, and
markdownlint `MD001` already covers it for Markdown headings. This PR
adds owned checks for the raw HTML in docs Markdown that neither tool
sees, so the coverage stays when the licence ends.

- `Coder.HeadingOrder` (Vale) flags heading-level skips and counts raw
`<hN>` headings, such as the `<h3>` headings `scripts/apidocgen` emits,
which `MD001` ignores.
- `Coder.EmptyHeading` (Vale) flags headings with no text, in Markdown
and raw HTML.
- `Coder.LinkName` (Vale) flags links with no text: `[](url)`, links
whose only content is an image with empty alt text, and empty `<a
href>`.
- `docshtmlcheck` now rejects `aria-*`, `role`, `tabindex`, and `lang`
attributes, and `iframe`, `object`, `area`, `form`, `input`, `select`,
`textarea`, `button`, and `meta` elements. No docs page uses any of
them, so the 32 axe HTML rules that check them have nothing to check,
and this keeps it that way.
- The style guide's decorative-image example changes from
`![](decorative.png)`, which `MD045` rejects, to `<img src="…" alt="">`.
No docs page used the old form.
- The style guide's checks table gains a row per new check, and the
coverage counts move the descriptive-link-text section from planned to
tool-checked (22 of 90 rules tool-checked, up from 21 on `main`).

## Design

All three Vale rules are `script` rules on `raw` scope, because heading
levels, empty headings, and links with no text only show up in the raw
source. Raw scope also reaches YAML front matter, fenced code, HTML
comments, and inline code, so the scripts skip those themselves. Fence
tracking matches the opening marker's character and length, so a
four-backtick fence holding a three-backtick one stays closed correctly.
The patterns use only capture groups that always participate, because
Tengo's `text.re_find` panics on a group that didn't match.

`Coder.HeadingOrder` is built to agree with `MD001` without reporting
the same skip twice. It tracks the previous heading of any kind and the
previous Markdown heading. It stays quiet on a Markdown heading that
`MD001` already reports (a skip measured against the previous Markdown
heading) and reports the skips `MD001` can't see: a raw HTML heading
that skips, and a Markdown heading that skips only because a raw HTML
heading sits before it. On a probe file covering each case, the two
tools reported disjoint lines. The one remaining divergence is by
design: after `## A`, `<h3>B</h3>`, `#### C`, `MD001` reports C (it sees
H2 to H4) while this rule sees a clean H2, H3, H4 sequence and stays
quiet, so the author still gets exactly one finding.

The `docshtmlcheck` guard is a separate `guard.go` that runs on each
start tag the existing tokenizer already walks. The elements stay in
`allowedElements`, so authors get a message explaining why the element
doesn't belong rather than the generic unknown-element one, and a closed
`<button>` still balances. Guard findings get their own kinds
(`disallowed-element`, `disallowed-attribute`) and their own summary
footer. I included `form` alongside the form controls the issue lists,
since a form with no controls has no use either.

Known gaps, documented in each rule's header and none hit by the current
corpus: setext headings, headings inside block quotes or list items, raw
HTML headings or links split across lines, reference-style links, and
inline code delimited by more than one backtick. There is no Vale rule
test harness in the repository, so the hit and non-hit probe files used
below live outside the tree.

## QA

I ran each Vale rule against a probe file with hits and non-hits, with
the repository `.vale.ini` and the pinned Vale 3.7.1.

- `Coder.HeadingOrder`: reported the raw `<h4>` after an `##` and the
`###` that follows a raw `<h1>` after a `###`. It stayed quiet on the
two skips `MD001` reports, on `#` lines in front matter, fenced code,
and an HTML comment, and on a clean sequence. markdownlint on the same
file reported only the two `MD001` lines, so no line got both.
- `Coder.EmptyHeading`: reported `##`, `### ###`, `<h2></h2>`,
`<h3>&nbsp;</h3>`, and `<h4> <br/> </h4>`. It stayed quiet on text
headings, seven `#` marks, an empty `<h2>` in inline code, and lone `#`
lines in front matter, fences, and comments.
- `Coder.LinkName`: reported all 7 hit cases (empty, whitespace, `![]()`
inside a link, raw empty-alt `<img>` inside a link, empty `<a href>`,
`<a href>` around an empty-alt image, `<a href>` holding only `&nbsp;`).
It stayed quiet on all 9 non-hit cases, including a bare decorative
image, `<a id>` anchors, inline code, comments, and fenced code.

Findings on the current corpus (`docs/`, excluding the exempt style
guide): `Coder.HeadingOrder` 0, `Coder.EmptyHeading` 0, `Coder.LinkName`
0, `docshtmlcheck` guard 0. The other Vale findings are unchanged from
before the PR. No corpus pages changed.

## Testing

- `go test ./scripts/docshtmlcheck/ ./scripts/styleclaims/`: 140 passed.
The guard tests were written first and failed before `guard.go` existed.
They cover each element, each attribute (including case-insensitive
names and attributes wrapped across lines), lookalike names such as
`data-role`, code and comment exclusion, the reported line and message,
and the `run` exit code and footer.
- `make lint/docs-html`: clean.
- `make lint/style-claims`: clean, so the checks table, the coverage
counts, and the annotations agree with `.vale.ini` and the rule files.
- `make lint/emdash`: clean.
- `pnpm check-docs` (markdownlint and table formatting): 0 errors across
515 files.
- Vale 3.7.1 over `docs/` with `--no-exit`, run directly rather than
through `make lint/prose` because the worktree's mise config isn't
trusted: no findings from the new rules.

## Upstream

Not applicable. These checks are specific to the Coder docs corpus and
its style guide, so there's nothing to send to Vale, markdownlint, or
goldmark.

## Linear

https://linear.app/codercom/issue/DOCS-1318

---

🤖 Built with AI assistance.
2026-11-18 12:24:23 -05:00
Thomas KosiewskiandJaayden Halko 2c96f05186 feat: show the overview card in Coder Agents chats (#31412)
Shows the overview card container from #31590 in Coder Agents chats. The
card sits in the chat's top-right corner, and a list button in the chat
top bar shows and hides it, as in the Codex desktop app. The card and
the button exist only while the right panel is closed, the transcript is
not full width, and the page is not an embed. Both show only from an
84rem chat, so the card never covers the transcript and the transcript
never moves. Below 84rem the card does not mount, so its cost and
attachment requests do not run. Phones and narrow windows do not show
the card.

The card shows by default and stays open until the user hides it. The
choice is stored in localStorage under `agents.overview-card-open`, for
every chat. The right panel keeps its own saved preference. A row opens
the right panel on its tab, which hides the card. The card returns when
the panel closes.

The Repositories section lists every repository the git watcher reports,
by folder name with its branch below. A clean repository shows `+0 −0`,
so a chat keeps a Repositories row when AI Gateway turns cost off. The
card reads the attachments through `useChatAttachments` from #31411, so
it shows the Summary panel's list and shares its query. When the earlier
attachments fail to load, the card shows the error and a **Retry**
button in Attachments, as the Summary panel does.

The docs describe the card in the Coder Agents overview and add it to
the places that show spend. #31260 (do not merge) stays the hands-on
reference.

1600px chat with the card open:

![1600px chat with the overview card
open](https://github.com/user-attachments/assets/6d1760c7-0707-42e2-8284-2a5e133e3f71)

1600px chat after the user hid the card:

![1600px chat after the user hid the
card](https://github.com/user-attachments/assets/d7cf7d7a-92c8-4fa4-9096-2c12043e0a06)

960px chat, no card and no button:

![960px chat without the card or the
button](https://github.com/user-attachments/assets/384d7db8-7c2f-4c1a-9a75-a9d59ae0dd4f)

## Decision and open questions for Jaayden

Decision you can reverse: a clean repository row is plain text, not a
button. The Git panel lists only repositories with changes, so a click
on a clean row used to open the default Git view. To reverse it, give
the clean row its `onClick` back in `ChatOverviewCardView`.

1. Should a new chat show the card instead of the Summary panel? This PR
keeps the right panel's saved preference as it is.
2. A chat with no repository and no cost shows "Nothing to show yet". Is
that the placeholder you want?
3. Subagents (#31410): the heading says "not idle" instead of "active"
because errored subagents stay in the list, and the ones that need the
user sort first. Do that wording and order work for you?
4. A row click (#31478) moves focus to the active right panel tab. Do
you prefer the Git view switcher instead?

## How to test

1. Open Storybook at `pages/AgentsPage/AgentChatPageView`, stories
`OverviewCardBesideTranscript`, `OverviewCardHiddenWhenNarrow`,
`OverviewCardHiddenInFullWidth`, and `OverviewCardHiddenByUser`.
2. Run `pnpm exec vitest run --project=unit
src/pages/AgentsPage/AgentChatPage/AgentChatPage.test.tsx
src/pages/AgentsPage/hooks/useChatOverview.test.ts` in `site/`. The page
tests set the chat width with the repo's `MockResizeObserver`. They
check that a narrow chat requests none of the card's data, and that
**Retry** in the card requests the earlier attachments again.
3. In a dev deployment, open a chat in a window at least 84rem wide.
Hide the card with the list button, reload, and check that it stays
hidden.

## What to look at first

1. `hooks/useChatOverview.ts`: one `canShow` value gates both the toggle
and the card, so the page only renders what the hook returns. The hook
measures the chat's outer element with a `ResizeObserver` through
`observeChat`, and `OVERVIEW_MIN_CHAT_WIDTH_REM` holds the 84rem value
in one place, so the button and the card cannot disagree.
2. `AgentChatPageView.tsx`: the page passes `observeChat` as the chat
element's ref and destructures it from the hook result. The React
Compiler treats an object that holds a ref callback as a ref, so the
page keeps it apart from the other values.
3. `components/ChatOverviewCard.tsx`: this PR adds `ChatOverviewToggle`
to the container from #31590.

<details>
<summary>Review history</summary>

The repository's frontend-deep-review ran three rounds on the first
version, a clean-context advisor ran once, then one strict code quality
review ran, then a polish pass and one final review round ran on the
whole stack.

Polish pass changes:

- Split `ChatOverviewCard.tsx` into the container plus
`ChatOverviewToggle`, with the view in `ChatOverviewCardView.tsx`
(#31409). The `getOverviewCost` tests moved to
`ChatOverviewCard.test.tsx` unchanged.
- Added `useChatOverview`, which owns the visibility gate and the open
state.
- The card builds repository rows with `repoLabel`, the repository's
branch, and `countRepoChanges`. Before, it filtered repositories through
`computeRepoStats` only to add the clean ones back.
- The docs say that you cannot select a clean repository row.

Final round fixes: renamed the top bar prop `overview` to
`overviewToggle`, inlined the toggle value in the hook, and corrected
three doc comments.

Follow-up fixes, after the final round:

- The card no longer mounts below an 84rem chat. Before, it stayed
mounted and CSS hid it, so its queries kept running. The repo has no
element-size hook, so `useChatOverview` observes the chat element
itself. The `@container/chat` class and the `@min-[84rem]/chat` classes
are gone.
- The card wires the earlier attachments request into the view, so a
failure shows its error and a retry.
- New tests: the hook test checks the 84rem boundary on both sides, and
two page tests check the narrow chat's requests and the card's retry.
Each fails without its fix. The existing page tests now set a 1600px
chat width before they look for the card. Their assertions did not
change.
- The container moved to #31590, because this PR grew past 600 changed
lines. GitHub cannot insert a PR in the middle of a stack, so I removed
stack #31413 and linked the six PRs again as stack #31591.
- Safari: Playwright 1.63.0 downloaded WebKit, but WebKit does not start
on this host, because system libraries such as `libsoup-3.0` and
`libGLESv2` are missing. I did not check the narrow right panel or the
card in WebKit. The `@container/chat` wrapper that the check was about
no longer exists.

Skipped in the polish pass: passing the card's placement class from the
page. That keeps the 84rem breakpoint in one file with the toggle, and
moving it adds a pass-through prop.

Declined:

- The page test checks that the card is gone while the right panel is
open (`toBeNull`). That unmount is the behavior under test, and no
callback or request captures it.
- `@container/chat` traps the right panel's `fixed inset-0` overlay
below the `lg` breakpoint. I rendered `NarrowWithSidebarPanel` at 390px
and 900px in Chromium, and the panel still covers the viewport. The
follow-up fixes removed `@container/chat`.
- `try`/`catch` around `localStorage` in `overviewCardStorage.ts`. The
file follows `sidebarTabStorage.ts`.
- Final round: move `ChatOverviewToggleProps` into the hook. The hook
imports only a type from the component file, so no runtime cycle exists.

</details>

---
_Generated with [`xum`](https://github.com/coder/xum) • Model:
`anthropic:claude-opus-5-5` • Thinking: `high`_

---------

Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
2026-11-18 16:55:09 +00:00
Jaayden Halko 17a2b62205 feat: add an API to attach templates to chat projects (#30754)
Adds the API for attaching workspace templates to a chat project, on the
schema and queries in #32309. A project can attach templates, turn on a
limit that restricts its chats to them, and set a default template with
either a default preset or default parameter values. Attaching a
template never grants access to it: every reader is checked against the
template's own sharing. This PR stores and returns `limit_templates`;
#32310 enforces it.

- The limit is opt-in. `limit_templates` is off unless a request turns
it on, which is what every existing project gets.
- Templates are attached and detached one at a time with `PUT` and
`DELETE /chats/projects/{project}/templates/{template}`, so a caller
never replaces a list they can only partly see. Attaching needs project
`update` and template `use`. Detaching needs project `update` and
template `read`, and a template the caller cannot read is reported as
not found. `POST /chats/projects` accepts `template_ids`,
`limit_templates`, and `default_template` for the new project.
- `PATCH /chats/projects/{project}` sets `limit_templates` and
`default_template`, and no longer changes which templates are attached.
The default must be an attached template the caller can read, and its
preset must belong to the template's active version. Default parameter
names and values are checked against that version for templates on the
classic parameter flow; dynamic parameters are checked when a workspace
is built. Detaching the default template clears the default.
- Project responses list only the attached templates the caller can
read, as `templates`, and count the rest as `hidden_template_count`.
`default_template` is omitted when the caller cannot read it. Deleted,
deprecated, and agent-disabled templates are left out and are not
counted as hidden.
- Editing uses `chat_project:update`, which the project owner and the
project `admin` ACL role have.
- Attaching and detaching are audited as writes to the project, with the
template list before and after, including the templates attached while
creating a project. Changes to `limit_templates` and the default
template are part of the project's own audit diff.

Not included: showing which project members lack access to an attached
template, and MCP server attachments.

Stack (merge top to bottom):
- #32309
- #30754 👈
- #32310
- #30755
- #32371
- #32372
- #30756
- #32373
- #32374
- #32375
- #30898
- #32376
- #32377
- #32378
- #32379
2026-11-18 20:36:34 +07:00
7c7e2e73cf feat: honor disable-model-invocation in uploaded skill content (#31159)
Addresses @ethanndickson's [review comment on
#30882](https://github.com/coder/coder/pull/30882#discussion_r4344815088):
the same `SKILL.md` file could be manual-only in Claude Code and the
project dialog but automatic in Coder, because the server and the
browser each handled `disable-model-invocation` in their own way.

The server now owns the key for personal, organization, and project
skills:

- When a create or update request leaves `model_invocable` unset,
`disable-model-invocation: true` in the content turns automatic use off,
and `false` turns it back on. The key is read with the function
workspace skills use, so a file gets the same setting in both places.
Only YAML booleans count, so a quoted `"true"` is ignored.
- An explicit `model_invocable` in the request always wins.
- New content without the key leaves the setting unchanged, so editing
text never turns it back on.
- Content is stored as uploaded. Every API response returns content
whose key agrees with `model_invocable`: when the stored file says
otherwise, the server replaces the value of the key or adds the key
before the first one, and leaves every other byte alone.
- **Download** and **Export all** save the content the API returns, so
the browser no longer edits the file. `withDisabledModelInvocation` is
removed.
- An upload is rejected with a 400 when the key holds a value the server
can't replace with a boolean, such as a list. A later change to
`model_invocable` can then always reach the file.

Two edges:

- Adding the key makes the returned file about 30 bytes larger, so a
file at the 64 KB upload limit can be too large to upload again.
- A skill stored before the upload check with a value the server can't
replace is returned as stored.

Workspace skills already honor the key since #31147.

#31160, the frontend PR on top of this one, adds the switch to the
personal and organization skill editors.

> Generated by an agent on behalf of the user

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
2026-11-18 14:04:49 +07:00
Jaayden HalkoandJake Howell d1a58b9f5d feat: add script to check for title case (#21484)
Historically, much of the UI used title case. This PR adds a lint check
that reports title case UI text so it can be converted to sentence case,
and converts the existing text.

- `site/scripts/check-sentence-case.mjs` runs as `pnpm
lint:sentence-case` and is part of `pnpm lint`. It reads JSX text and
string/template literals from the TypeScript AST and skips literals that
are code rather than UI text (imports, types, property names, tagged
templates, values of JSX attributes that are not displayed such as
`className` or `style`, and operands of `===`/`case` comparisons). JSX
text across inline elements and conditional JSX is checked as one
phrase. `--fix` lowercases the reported words. The checker is a
heuristic: it is not meant to model every code shape, so use a
`sentence-case-expect` comment where it guesses wrong.
- Proper nouns (Coder products, role names, third-party products,
protocols, font names) live in `PROPER_NOUNS`. For other deliberate
exceptions, a `sentence-case-expect` comment on the line above
suppresses the report and fails when that line no longer needs it.
- Existing UI text is converted to sentence case, and tests that assert
on it are updated.
- Deployment option lookups (`useDeploymentOptions`) now use CLI flags
instead of display names, so they do not depend on UI wording.

## Performance

`pnpm lint:sentence-case` takes **1.6 s** and is 2% to 4.5% of `pnpm
lint`. Measured on 82317c925e in a dev workspace (Xeon Platinum 8375C,
16 vCPUs, Node 22.23.4, TypeScript 6.0.2, warm file cache). CI buffers
the output of the lint steps, so its log has no per-step times to
compare against.

| Measurement (20 runs) | Result |
|---|---|
| Wall time | 1.64 s mean, 0.03 s standard deviation, 1.62 s to 1.71 s |
| CPU time | 3.0 s |
| Peak memory (RSS) | 154 MB, of which 116 MB is Node with `typescript`
loaded |
| Input | 1,301 of the 2,199 `.ts` and `.tsx` files in `site/src` (the
rest are excluded), 210,684 lines, 6.1 MB |
| Throughput | About 130,000 lines per second |
| Time per file | 0.5 ms median, 3 ms at the 95th percentile, 76 ms
maximum (`src/api/api.ts`, 121 KB) |

Each step of `pnpm lint`, median wall time of 5 runs:

| Step | Wall time |
|---|---|
| `lint:check` (Biome) | 0.96 s |
| `lint:oxlint` | 0.32 s |
| `lint:types` (`tsc`) | 5.8 s with its incremental cache, 45 s without
|
| `lint:circular-deps` | 5.7 s |
| `lint:compiler` | 15.6 s |
| `lint:sentence-case` | 1.6 s |
| `knip` | 6.6 s |
| All of `pnpm lint` | 37 s with the `tsc` cache, 76 s without |

<details>
<summary>Where the time goes, scaling, and limits</summary>

Phases of one run, from in-process timers. The split between parsing and
checking is approximate.

| Phase | Time | Share |
|---|---|---|
| Node startup | 0.03 s | 2% |
| Load the `typescript` module | 0.32 s | 20% |
| Find and read the files | 0.04 s | 2% |
| Parse (`ts.createSourceFile`) | 0.83 s | 52% |
| Check logic | 0.38 s | 24% |

Scaling, from synthetic inputs passed to `checkSource` (median of 3 to 5
warm runs):

- Clean input is linear in size: 0.2 ms to 0.35 ms per KB for one file
from 54 KB to 7 MB. 100,000 string literals take 0.3 s, 100,000 sibling
JSX elements take 0.8 s, and JSX nested 800 levels deep takes 10 ms.
- Conditional JSX stays bounded by the 64-variant cap: 1 to 48
conditional children in one element take at most 3.4 ms.
- Reporting and fixing add no measurable time. On the merge base with
`main` (378 reports in 175 files), a check, `--fix`, and a second
`--fix` each take 1.6 s to 1.7 s.
- The 21 unit tests run in about 30 ms, 1.7 s including Vitest startup.

Two limits, neither reachable with the current source:

- Time is quadratic in the reports for one file, because the fixed text
is rebuilt once per report. A 3.5 MB file takes 0.7 s clean and 18.0 s
with 12,800 reports. The most reports in one file on the merge base is
16.
- One JSX element with more than about 120,000 text phrases fails with
`RangeError: Maximum call stack size exceeded`, because the phrases are
spread into `push`.

</details>

---------

Co-authored-by: Jake Howell <jake@hwll.me>
2026-11-18 13:36:16 +07:00
Jake Howell 935e0b5735 fix(site): migrate template filters to FilterCombobox (#31781)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.


Replace the legacy template filter controls with the shared
`FilterCombobox` on both the Templates page and AI Settings → Templates,
matching the workspace filtering UI.

- Combine author, organization, deprecated, and compatibility-mode
filters in one input with removable chips while retaining URL-backed
filter queries.
- Keep `author:me` available to users without permission to list other
users, without fetching the user list.
- Update the compatibility-mode documentation and Storybook stories for
the new controls.

<img width="538" height="312" alt="image"
src="https://github.com/user-attachments/assets/c7b541eb-0f4e-4456-b31c-70dd85cfe0e9"
/>
2026-11-18 12:41:14 +11:00
e0b74e6817 docs: add Migrate to Coder section and Microsoft Dev Box migration guide (#31979)
> [!NOTE]
> Coder Agents generated this PR.

Adds a "Migrate to Coder" group to the docs sidebar with a short index
page, and a guide for teams moving from Microsoft Dev Box to Coder.

- `docs/install/plan/migrate.md` (new): says who the guides are for and
lists them.
- `docs/install/plan/migrate/dev-box.md` (new): who it's for, what
carries over, a concept-mapping table, 11 numbered migration steps, and
**Learn more**. The steps cover the inventory, the control plane, Entra
ID (OIDC), templates on Azure (image, network, persistence, access,
quotas), customizations and dotfiles, Git auth and secrets, RDP,
editors, schedules and hibernation, Intune, and the pilot and cut-over.
Each step links to existing Coder docs instead of repeating them.
- `docs/install/plan/migrate/ona.md` (moved from `migrate-from-ona.md`):
relative links only, plus a redirect from
`install/plan/migrate-from-ona` in `docs/redirects.json`.
- `docs/manifest/install/plan/migrate.yml` (new) and
`docs/manifest/install/plan.yml`: the new group, with the Ona guide
under it. This follows the existing `upgrade.md` plus `upgrade/` layout.
`docs/manifest.json` is regenerated.

Microsoft retirement dates come from Microsoft's own [Dev Box retirement
guide](https://learn.microsoft.com/azure/dev-box/dev-box-retirement-guide):
the closing-down period started September 14, 2026, and the service
retires September 18, 2028.

### Follow-ups outside this PR

- **Starter template is broken today.** The registry `azure-windows`
template pins `windows-rdp` at `~> 1.0`, which now resolves to 1.4.0.
That version requires `agent_name`, so `terraform plan` fails with
`agent_name must be set when enable_native_rdp is true.` The copy in
`examples/templates/azure-windows/main.tf` also passes `resource_id =
null`, which 1.4.0 rejects at `terraform init`. The guide tells readers
to set `agent_name = "main"` until both templates are fixed.
- **Activity detection docs.** `docs/workspaces/workspace-scheduling.md`
and `docs/templates/managing-templates/schedule.md` say only some
session types count as activity, but the code counts any connection
through the agent (`agent/agent.go` `Collect`,
`coderd/workspacestats/reporter.go`). The guide follows the code. Those
pages need a separate fix, and an SME should confirm RDP end to end.
- **Comparison page.** The coder.com comparison page compares Coder with
Windows 365 and VDI, not Dev Box, and still says Dev Box is in
"maintenance mode". The guide no longer links to it, so DOCS-1414's
comparison-link item waits until the page is corrected.

<details>
<summary>Reusable outline for future migration guides
(DOCS-1414)</summary>

The repo has no place for page templates, so the outline lives here.

```md
---
title: Migrate from <Platform> to Coder
---

<1 to 2 sentences: who it's for (persona and current setup) and the outcome.>
<Optional: dated facts about the platform, citing the vendor's own announcement.>

## Before you begin
<Access, licenses (mark Premium), cloud permissions.>

## What carries over
<Architecture difference in 2 to 3 sentences. "You can keep" list, then "You rebuild" list.>

## Concept mapping
| <Platform> (link to the vendor's docs for each concept) | Coder (link to Coder docs) |

## Step 1: Inventory your <Platform> resources
## Step 2: Deploy the Coder control plane
## Step 3: Connect your identity provider
## Step 4: Replace <environment definition> with templates
## Step N: Bring your devcontainer.json   (Codespaces, Ona, DevPod)
## Step N: Configure Git authentication and secrets
## Step N: Set up editors (and remote desktops, if relevant)
## Step N: Speed up workspace startup (prebuilt workspaces)
## Step N: Replace schedules and cost controls
## Step N: Move agent workloads
## Step N: Pilot and cut over
<One neutral link to the coder.com comparison page, if one exists and is current.>

## Learn more
```

Rules: facts only, with no scoring or positioning language. Check every
mapping row against the vendor's current public docs and record the date
checked in the PR. Link to Coder docs rather than repeating them. Mark
Premium features inline.

</details>

### Verified against

Microsoft docs checked November 5 and November 10, 2026, in the
MicrosoftDocs/azure-docs source (`articles/dev-box/`) and on
learn.microsoft.com:
- `dev-box-retirement-guide.md` (dates, workload deletion)
- `overview-what-is-microsoft-dev-box.md`,
`concept-dev-box-architecture.md` (dev centers, projects, pools,
definitions, network connections, Microsoft-hosted network, Intune
enrollment, Entra join, Windows 10 and 11 client editions)
- `how-to-manage-dev-box-pools.md` (local admin or standard user
setting)
- `concept-what-are-dev-box-customizations.md`,
`how-to-configure-team-customizations.md`,
`how-to-configure-user-customizations.md` (WinGet, PowerShell, Git-Clone
tasks, Key Vault secrets)
- `how-to-configure-azure-compute-gallery.md`
- `how-to-configure-stop-schedule.md` (one stop time per pool),
`how-to-configure-stop-on-disconnect.md`,
`how-to-configure-dev-box-hibernation.md`,
`how-to-auto-delete-dev-box.md`, `tutorial-dev-box-limits.md` (maximum
dev boxes per developer)
- `concept-dev-box-role-based-access-control.md`,
`how-to-install-dev-box-cli.md`, `how-to-set-up-dev-tunnels.md`,
`quickstart-create-dev-box.md`, `how-to-enable-single-sign-on.md`
- Intune [supported operating
systems](https://learn.microsoft.com/intune/fundamentals/ref-supported-platforms)
(Windows client editions, no Windows Server)

Coder side:
- Registry `azure-windows` template (`main.tf`, `README.md`) and
`examples/templates/azure-windows/`: azurerm resources, Windows Server
2022 image, one resource group, virtual network, and storage account per
workspace, VM deleted on stop, persistent `F:` disk, `windows-rdp`
module, generated admin password shown in metadata, no Entra join, no
`daily_cost`
- Registry `windows-rdp` module at `release/coder/windows-rdp/v1.4.0`:
**Web RDP** (subdomain app) and **RDP Desktop** (Coder Desktop) apps,
`agent_name` validation, Devolutions Gateway install from PowerShell
Gallery on every start. Reproduced the plan failure with Terraform
1.17.1.
- Registry `dotfiles` module: Bash script only
- `cli/dotfiles.go`, `cli/dotfiles_windows.go` (`install.ps1`,
`bootstrap.ps1`, `setup.ps1`, run with PowerShell, cloned with Git)
- `enterprise/coderd/workspacequota.go` (build denied when consumed plus
cost exceeds budget), `docs/admin/users/quotas.md`
- `coderd/schedule/autostop.go` (autostop requirement stops at the start
of quiet hours), `docs/reference/cli/server/index.md`
(`CODER_QUIET_HOURS_DEFAULT_SCHEDULE`, `CODER_ALLOW_CUSTOM_QUIET_HOURS`)
- `docs/workspaces/workspace-access/remote-desktops.md`,
`docs/admin/networking/index.md` (agents must reach the access URL)
- `docs/admin/users/oidc-auth/microsoft.md`,
`docs/admin/users/idp-sync.md`, `docs/admin/users/organizations.md`,
`docs/admin/users/groups-roles.md`,
`docs/templates/template-permissions.md` (Premium markers, organization
roles)
- `coderd/workspacestats/reporter.go`, `coderd/agentapi/stats.go`,
`agent/agent.go` (any connection through the agent extends the autostop
deadline)
- `docs/admin/external-auth.md` (Azure DevOps via Entra ID),
`docs/admin/security/secrets.md`
- `agent/usershell/usershell_windows.go` (scripts run with PowerShell on
Windows)
- No hibernation feature exists in the Coder codebase.

Checks run: `make gen/docs-manifest`, `make pre-commit-light`
(markdownlint, `lint/emdash`, `lint/docs-redirects`, typos), Vale (0
alerts on the new pages), `lint/docs-html`, `lint/docs-manifest`,
`docsredirectscheck -base origin/main -branch main`, a check that all
159 relative links and anchors in the three pages resolve, and a
`doc-check` self-review.

### Open questions for the reviewer
- **Intune and Entra join:** the guide says Coder doesn't enroll
workspaces in Intune, that Intune needs a Windows client image, and
links Microsoft's Entra VM sign-in docs. Should a separate guide cover
setting up Intune with Coder?
- **Windows client editions:** the guide tells readers to check
Microsoft licensing before using Windows 10 or 11 images on Azure VMs.
It makes no licensing claim itself.
- **Windows support in registry modules:** the guide now says the
`dotfiles` module is Bash only. Whether `git-clone` and other modules
work on Windows is unverified.

Closes DOCS-1414, Closes DOCS-1416


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

---------

Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com>
Co-authored-by: Ian Evans <5760366+ianjevans@users.noreply.github.com>
2026-11-17 22:38:59 +00:00
Ben Potter ed9e9a84ec docs: add sandbox agents guide and startup time tips (#32280)
Adds a "Sandbox agents" guide under Extending templates, and adds
startup time tips from the [Improving Coder Workspace Startup
Times](https://www.youtube.com/watch?v=-xcVJQWVCxs) livestream to the
speed-up templates guide.

**Sandbox agents**
(`docs/templates/extending-templates/sandbox-agents.md`) is organized
around three traits: kernel, network, and secrets isolation, plus fast
startup. Each trait has a short methods table with tradeoffs, plus
examples and references.

- Starts with the coder-labs registry templates (agent-sandbox, Plain
Sandbox, OpenShell) that implement all three, and calls out
[agent-sandbox](https://agent-sandbox.sigs.k8s.io/).
- Explains what the sandbox covers for CLI Agents, Coder Agents, and
Agent Relay.
- Shows how to define sandbox profiles as immutable parameters with one
preset each, and how to control which profile an agent gets.
- Kernel: gVisor, Kata, and EKS Nitro Sandboxes (`isolated-sandbox`
RuntimeClass in EKS Auto Mode).
- Network: separate proxy Pod vs. sidecar, example rules using an
internal GitHub and artifact store, and a cloud firewall layer (AWS
Network Firewall, Route 53 Resolver DNS Firewall) that also limits DNS.
- Secrets: `api_key_scope = "no_user_data"`, a scoped AI Gateway token
(skipped for prebuilds, optional `lifetime`), per-workspace EKS Pod
Identity, and just-in-time credentials from Vault.

**Speed up templates** (`docs/workspaces/speed-up-templates.md`) gets
new sections for pre-warming Kubernetes nodes (with GKE, EKS, and AKS
alternatives), building tools into the image, prebuilt workspaces
(including one preset for each configuration), and skipping the
Kubernetes rollout wait (with coder-logstream-kube to surface Pods that
can't start). It links the
[fast-workspaces-lab](https://github.com/coder-contrib/fast-workspaces-lab)
repo for the sample base image, node schedule, and prebuild templates.

**Agent Firewall** gets a notice on its index page and in the glossary
that it is being phased out, pointing to the sandbox guide. The sandbox
guide doesn't mention Agent Firewall.

Two diagrams in the speed-up templates guide come from the talk's slide
deck, cropped to the diagram.

Notes for reviewers:

- The scoped AI Gateway token (`user:read_personal`) isn't tied to a
workspace, so with several organizations, AI Gateway uses the user's
effective group for budgets. The page doesn't mention this.
- The Nitro (coder/registry#1253) and Cilium (coder/registry#1254)
registry templates are still open, so they aren't linked yet.

<details>
<summary>Decisions and checks</summary>

- **Structure:** three traits, several ways to get each, and simple
tradeoffs.
- **Sysbox** is not listed as kernel isolation, because system calls
still reach the node's kernel.
- **Deployments** stay the recommendation over bare Pods, because
`wait_for_rollout` and coder-logstream-kube cover the startup and error
cases.
- **Token lifetime** is left commented out in the example: Coder can't
revoke the token at stop, and a lifetime shorter than autostop breaks
running workspaces.
- **Process logging** wording: the eBPF sidecar runs inside the sandbox
with gVisor, Kata, or Nitro, so the page asks readers to test it.
- **"CLI Agents"** is kept as the term for agents that run fully in the
workspace.
- **Verified in code:**
- `mutable = false` is enforced on later builds
(`coderd/dynamicparameters/resolver.go`).
- Presets match by subset, also without a `preset_id`
(`coderd/database/queries/prebuilds.sql`, `coderd/workspaces.go`).
- `no_user_data` blocks the Git SSH key and external auth
(`coderd/gitsshkey_test.go`, `coderd/externalauth_test.go`).
- Token creation is rejected for the prebuilds system user
(`coderd/apikey.go`), and the default token lifetime is 7 days
(`codersdk/deployment.go`).
- No Coder code sets `CODER_SESSION_TOKEN` in a workspace; registry
modules such as `coder-login` do.
- **Checks run:** `make lint/emdash`, `make lint/docs-html`, `make
lint/docs-manifest`, markdownlint, markdown-table-formatter, Vale (0
errors), and the pre-commit hook.

</details>

🤖 This PR was generated by Coder Agents on behalf of @bpmct.
2026-11-17 13:52:32 -06:00
Nick Vigilanteandcoder[bot] da64286fe3 docs: fix GerundHeading, Semicolons, and UnitSpacing findings (#31990)
Fixes the `warning`-level findings that the Vale findings spike review
marked valid:

- **`Coder.GerundHeading`**: `docs/.style/styles/Coder/README.md`,
"Authoring a new rule" is now "Author a new rule". Nothing links to the
old anchor.
- **`Coder.Semicolons`**:
`templates/extending-templates/docker-in-workspaces.md`. Each semicolon
is now a sentence break, with the new sentence on its own line.
- **`Coder.UnitSpacing`**: added `&nbsp;` between number and unit in
`get-started/index.md` (10 minutes), `mcp-server.md` (5 minutes),
`ai-governance/ai-gateway/setup.md` (60 days), and
`reference/feature-stages.md` (60 seconds).

These three rules now have 0 findings in `vale docs/`, and the changed
files have no new findings from other rules.

---
AI-generated by Superblink on behalf of @nickvigilante.


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

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
2026-11-17 13:17:25 -05:00
Susana Ferreira 3211ca066e feat: add organization unpriced AI models endpoint (#31753)
## Description

Adds the experimental `GET
/api/experimental/organizations/{organization}/ai/model-prices/unpriced`
endpoint behind the "N models not set up" warning on the organization AI
spend page
([Figma](https://www.figma.com/design/6TkixpkUIM5Qv6I7qhM3xZ/AI-Gov---user-spend?node-id=70-11964&t=KQwENGjcQvVT9qkh-4)).
It lists the models used in the period that still hold no price in the
organization, using the query from this stack.

## Changes

- Add the `organizationUnpricedAIModels` handler and
`ExperimentalClient.OrganizationUnpricedAIModels`:
- Reuses `aiSpendRetainedPeriod`, since token usage is subject to data
retention.
- Returns the applied period, `count`, and `models` (provider name,
display name, icon and type, model, token count), most unpriced tokens
first.
- Requires read on the organization's model prices (owners and
organization admins), so the UI only requests it for users who can set
prices.
- Add handler tests for the response, period validation, organization
scoping and role access.

Note: pagination will be added in a follow-up.

Closes AIGOV-730

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-11-17 15:34:04 +00:00
Jaayden Halko 1f1aa6ae3c feat: add chat project template schema and queries (#32309)
Adds the database layer for attaching workspace templates to chat
projects: the schema, the queries, their authorization, and the audit
type. Nothing calls the new queries yet, and the existing create and
update handlers pass the new parameters unset. The API, the limit's
enforcement, and the agent tools follow in the PRs above.

- Attachments live in a `chat_project_templates` table (`project_id`,
`template_id`, `created_by`, `created_at`), deleted with the project or
the template. `chat_projects` gains `limit_templates` (default `false`),
`default_template_id`, `default_template_version_preset_id`, and
`default_parameters jsonb`. A project stores a default preset or default
parameter values, not both.
- `InsertChatProjectTemplates` needs project `update` and `use` on every
template. It skips templates that are already attached, and templates
outside the project's organization, so an attachment never crosses
organizations. `DeleteChatProjectTemplate` needs project `update` and
template `read`, and clears the project's default when it detaches the
default template. Both checks are in dbauthz.
- `GetChatProjectTemplatesByProjectIDs` is authorized through the
project, and leaves out deleted, deprecated, and agent-disabled
templates. It does not check the caller's access to each template, so
callers do that before they expose one.
- `UpdateChatProjectByID` changes the template settings only when the
request sets them, so an update that omits them cannot write back a
stale snapshot.
- `AuditableChatProjectTemplates` is the audit form of a project's
attached templates, logged as a write to the project. The new
`chat_projects` columns are tracked in the project's own audit diff,
with the default parameter values masked because they may hold
credentials.

**NOTE**: the migration adds one table and four columns and changes no
existing rows. Existing projects keep unlimited template access.

Stack (merge top to bottom):
- #32309 👈
- #30754
- #32310
- #30755
- #30756
- #30898
2026-11-17 21:59:01 +07:00
Jaayden Halko 4866d0fb1f feat: add display names to project skill actions (#31747)
closes CODAGT-1506

Project skill action chips show the skill's slug (`deploy-bot`,
`security-review`), because skill names must be kebab-case. This adds an
optional display name that labels the chip instead.

Project skills get a `display_name` column, set through `display_name`
on the create and update requests. It is limited to project skills (the
same rule as `action`), trimmed, single line, and at most 64 Unicode
code points. The chip, its tooltip, and the "More" menu show the display
name, sort by it, and fall back to the skill name when it is empty. When
a display name is set, the tooltip and the menu item also show the
`/name` slash command, so actions that share a display name stay
distinguishable. Clicking an action still inserts `/name`, and the `/`
menu is unchanged.

The project skill editor shows a **Display name** field under **Show as
action** only while that switch is on. Turning the switch off hides the
field but keeps its value, and saves omit `display_name` while the
action is off, so the stored value stays. The display name lives in the
database rather than SKILL.md frontmatter, so downloading and
re-importing a skill does not carry it.

To share the code-point length check with the editor, `countCharacters`
and `maxCharacters` move from `ChatProjectDialog.tsx` into
`site/src/utils/formUtils.ts`.

<img width="637" alt="Project skill editor with the Display name field
under Show as action"
src="https://raw.githubusercontent.com/coder/coder/assets/pr-skill-action-display-name/pr/edit.png"
/>

<img width="520" alt="Action chips labeled with display names, with the
tooltip open"
src="https://raw.githubusercontent.com/coder/coder/assets/pr-skill-action-display-name/pr/chips.png"
/>

Refs CODAGT-1506
2026-11-17 17:55:35 +07:00
Sas Swart 4ac8f0a2aa docs: document how AI Gateway assigns a request's organization (#31925)
Documents how AI Gateway assigns every request to one organization, and
how that organization now decides the effective group, budget,
overrides, and spend. Adds a **Request organization** page and corrects
pages that still described budget resolution as deployment-wide.

Refs AIGOV-753. Describes behavior merged in #30902, #31118, #31119,
#31120, #31121, #31583, and #31584.

## Changes

- New page `docs/ai-governance/ai-gateway/request-organization.md`
(sidebar, after Cost control): resolution order, the effective group
fallback, rejected requests, what the organization controls, a multi-org
worked example, reports that still resolve across all orgs, and the
caveat for standalone gateways older than v2.40.
- `cost-controls.md`: removes "the effective group is deployment-wide",
scopes overrides and effective group resolution to the request's
organization, and adds the reporting caveat.
- `standalone.md`: older replicas check budgets across all
organizations.
- `coder-agents/platform-controls/{index,spend-management}.md`: these
said an override beats every group budget, which is no longer true for
chats in another organization.

## For reviewers

- **Mismatch rejection is not documented.** The ticket and RFC describe
rejecting a workspace/chat org mismatch. A chat can only bind a
workspace in its own org (`coderd/exp_chats.go`), chatd requests resolve
to the chat's org even with a workspace, and no client request can carry
both inputs. The page says the two always agree instead.
- **"v2.40" is inferred.** `release/2.39` is on aibridged API v1.5 and
`main` is on v1.6, so v1.6 ships in v2.40. A 2.39.x backport would make
this wrong.
- **Custom prices.** The price lookup reads per-org prices, but no API
or CLI can set them yet, so the page says custom prices apply in every
org. This needs an update when per-org prices ship.
- **Site-wide reports.** The avatar menu, Agents usage indicator, `GET
/api/v2/users/{user}/ai/spend`, Members tab budget, Groups page combined
limit, and `blocked_users` metric still resolve across all orgs
(`TODO(AIGOV-527)`), so they can disagree with what was enforced.

## Release note draft

```markdown
- AI Gateway budgets and spend follow the request's organization (#31119, #31120, #31121, #31583, #31584)

  > Every AI Gateway request now belongs to one organization: the workspace's organization for workspace session tokens, the chat's organization for Coder Agents, and otherwise the organization of the user's effective group. Budgets, user overrides, and spend apply within that organization only, instead of across all of the user's organizations. Users in one organization see no change. Users in several organizations can hit a smaller budget, or have no limit at all, in another organization's workspaces and chats. Requests are rejected when the user is no longer a member of the workspace's or chat's organization, or of any organization.
  >
  > Migration: Set budgets in every organization your users send AI requests from. Upgrade standalone AI Gateway replicas to v2.40. Older replicas keep checking budgets across all organizations until upgraded.
```

## Validation

`make pre-commit-light`, Vale on the changed files, and `make
lint/docs-manifest` pass. A `doc-check` author self-check found 13
blocking findings, all fixed. Not applied: a suggested test pinning the
site-wide spend endpoint (code change, out of scope for this docs PR).

<details>
<summary>Decision log and verified behavior</summary>

Sources: AIGOV-753, epic AIGOV-749 and its delivered tickets (AIGOV-712
to 716), the canceled AIGOV-717, and the RFC "AI Gateway Model RBAC and
Org-Scoping" (Phase 1).

Verified against `main` (`a3aab79775`):

| Claim | Evidence |
|---|---|
| Order: workspace session token, chat org, site-wide effective group |
`coderd/aibridgedserver/orgresolver.go` `resolveOrganization` |
| Workspace session token = `coder_workspace_owner.session_token` |
`provisionerdserver.WorkspaceSessionTokenName`, `workspaceAttribution`
(API tokens excluded) |
| Rejections return `403 unauthorized` | `coderd/aibridged/http.go`
IsAuthorized failure path |
| Rejected: deleted workspace, not a member of the workspace/chat org or
org deleted, no live org | `orgresolver.go` `ErrUnknownWorkspace`,
`ErrUnknownOrganizationMember`, `ErrNoOrganization` |
| Chat request takes chat org even with a workspace |
`enterprise/aibridged_integration_test.go` "delegated organization with
workspace" |
| With an org, only that org's groups, override, and Everyone group
count | `coderd/aibridge/budget/budget.go`, #31119 |
| Fallback with no budgets: default org, then earliest membership |
`GetUserEveryoneFallbackGroup` |
| Budget counts only spend recorded against its group |
`GetUserAISpendSince` keyed on `effective_group_id` |
| Notifications use the per-request effective group |
`coderd/aibridgedserver/notifications.go` |
| Per-org prices not settable |
`UpsertOrganizationAIProviderModelConfig` has no non-test caller |
| v2.39 gateways: site-wide budget check, no org recorded |
`release/2.39` `coderd/aibridged/http.go`,
`aibridge/recorder/drpc_recorder.go` |

Page vs. section: a dedicated explanation page, because
`cost-controls.md` is already long and RFC Phases 3 and 4 (model RBAC,
"require organization scope") will build on the same resolution rules.

</details>

---

*This PR was generated by Coder Agents on behalf of @SasSwart.*
2026-11-17 09:51:14 +02:00
Nick Vigilante 6e2ff20d00 docs: document patch release and backport policy (#31993) 2026-11-16 20:00:39 -05:00
Ethan 3795d72713 fix: search AI Gateway models and clients by substring (#32159)
Closes AIGOV-801

Typing `hai` into the model filter on the AI Gateway sessions page shows
the haiku models for a moment, then "No models found". Whilst the
debounced request is pending, the menu filters the options it already
has by a case-insensitive substring, but `GET /api/v2/ai-gateway/models`
only matched a case-sensitive prefix, and Bedrock identifiers start with
`anthropic.`. The client filter matched the same way, so it had the same
problem.

To fix, both endpoints now match a case-insensitive substring.

This needed one change to the model menu. When the page loads with a
model already in the filter, the menu used to look that model up on the
server, by searching for its name and taking the first result. That's
the same pattern as the user filter, where the lookup fetches the
avatar, but a model option needs nothing from the server, so all it did
was check that the model exists. With a substring search, the first
result for `claude-3-5-sonnet-20241022` can be
`anthropic.claude-3-5-sonnet-20241022-v2:0`, so the check would fail for
a model that does exist. The menu now skips the lookup and just shows
the model from the filter as selected. The only visible difference is
that a model name in the URL that doesn't exist now shows as selected,
instead of "All models". The client menu has the same lookup, which
still works, as no client name contains another, so I've left it alone.

The prefix match was added in #22230 (models) and #22694 (clients) so
the queries could use the B-tree indexes. That only works on a C
collation database, and only for models, as the clients query wraps the
column in `COALESCE`. On an `en_US.utf8` database it's a plain filter
either way. On a C collation database a model search with no matches
does get slower, from instant to a few seconds with 5M synthetic rows,
but I think that's worth it for a search that works.
2026-11-17 11:52:12 +11:00
McKayla はな 0be6e7a034 feat: add a setting for web terminal font size (#32027) 2026-11-16 15:03:30 -07:00
b0ae8adab5 feat(coderd): protect pending jobs only while the provisioner queue is moving (#32099)
Stops the pending job reaper from failing jobs in a queue that's still
moving. This is an alternative to #31469 that came out of Steven's
[review](https://github.com/coder/coder/pull/31469#pullrequestreview-5847958482)
asking whether 2h is enough, and it builds on George's work there.

A pending job past 30m is now only protected while a matching online
provisioner is making progress, meaning it finished a job in the last
30m or is running one that's still being updated. A moving queue never
gets reaped and a frozen one still does at 30m like today. There's no
absolute cap.

No migration since it uses the existing
`provisioner_jobs_worker_id_organization_id_completed_at_idx`. One
tradeoff is that a stuck build whose provisioner keeps heartbeating
counts as progress, so if every matching provisioner is stuck like that,
the queue waits until that build is canceled.

Still a draft so we can talk it through with Spike and Steven.

Part of CORE-586

---------

Co-authored-by: George Katsitadze <george.katsitadze@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 07:45:24 -06:00
Jake Howell acafa545ad feat(site): show cited sources in the message action bar (#32148)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Move cited web pages from the separate source-pill row into a compact
Sources control in the message action bar, alongside Copy and
Attachments. Stacked site icons open a list of cited page titles and
hosts, while each search row keeps the pages that search found.
Non-HTTP(S) sources remain unlinked.

Collect and deduplicate citations across each completed turn so they
appear with its final assistant output, including when steps are
collapsed. Add regression tests, Storybook coverage, and documentation
for the control.

<img width="762" height="458" alt="image"
src="https://github.com/user-attachments/assets/0bc59d13-6f42-48a6-8c38-46922bbdca50"
/>

Refs CODAGT-1476.

<details>
<summary>Review follow-up</summary>

Long source titles wrap, non-web URLs remain fully visible, and new-tab
links have visual and accessible indicators. Opening Sources focuses the
first web link, with dialog fallback when no link exists. The action bar
wraps on narrow screens.

Attachments and citations share turn splitting, host selection, and
completion checks. Folded-block source lookup skips row slicing when a
row has no citations. A synthetic 10,000-row helper benchmark improved
from 23.9 ms to 5.2 ms (median); this is not an end-to-end rendering
measurement.

</details>
2026-11-16 20:25:37 +11:00
Jon Ayers 96e91a4d6a chore(docs): update release docs for v2.37.14 (#32250) 2026-11-16 00:27:10 -06:00
Jon Ayers 0d53f090d0 chore(docs): update release docs for v2.34.21 (#32249) 2026-11-16 00:26:43 -06:00
Jon Ayers 75e2519022 chore(docs): update release docs for v2.39.4 (#32246) 2026-11-16 00:26:26 -06:00
Jon Ayers 5645e68015 chore(docs): update release docs for v2.38.10 (#32247) 2026-11-16 00:18:41 -06:00
Jon Ayers e45fe9d8dc chore(docs): update release docs for v2.29.29 (#32248)
Automated docs update for v2.29.29 release.

Created by `releasetui`.
2026-11-16 01:17:42 -05:00
Jon Ayers 6f169d86a9 chore(docs): update release docs for v2.29.28 (#32234)
Automated docs update for v2.29.28 release.

Created by `releasetui`.
2026-11-16 00:20:08 -05:00
Nick Vigilante a921700974 ci: report only wrong, missing, and broken findings in CI doc-check reviews (#32199) 2026-11-13 17:31:09 -05:00
Nick VigilanteandBen Potter 1baff57cb0 fix: resolve docs and code conflicts found in the main docs audit (#32158)
## Summary

Addresses 106 of the 113 conflicts between the docs and the code that
the November audit of `main` found: 102 are fixed and 4 have an interim
docs fix. Every finding was re-checked against the code before it was
fixed. Most fixes are docs-only. Three are small code fixes where the
docs described the intended behavior and the code was wrong, each in its
own commits so it can be split out. No change in this PR alters template
build or agent behavior.

## Changes

Fixes by area (finding counts): templates 28, install 13, integrations
and monitoring 13, auth and security 12, networking 11, Coder Agents 9,
AI governance 7, reference 7, workspaces 6.

Code fixes. Each needs a look from the code owner. If an owner prefers
not to take one, drop its commits and I will change the docs to describe
the current behavior instead.

| Commits | Change | Risk to check |
|---------|--------|---------------|
| `fix: keep built-in listener defaults in packaged coder.env`, and
three follow-up commits | `coder.env` comments out `CODER_HTTP_ADDRESS=`
and the three `CODER_TLS_*` lines, so an untouched package install
listens on `127.0.0.1:3000` as the docs say. Only the
`CODER_HTTP_ADDRESS=` line changed behavior. The TLS options default to
empty, so commenting them out is for consistency. The Lima examples
rewrite the commented line and fail if the line is not found. A test
compares every option that the file sets against the built-in defaults.
| The deb and RPM packages were not built or installed. Every released
package through v2.39.0 ships the empty line, and upgrades keep an
existing file (`config\|noreplace`), so the upgrade pages now say how to
fix it. |
| `fix(cli/clilog): accept log sinks that are all disabled`, and three
follow-up commits | `--log-human=/dev/null` with no other log location
no longer fails with "no loggers provided". It is the documented way to
disable logging. An empty location still fails with that error when no
other sink is set, as before. | Behavior change: with `/dev/null`, the
server and the provisioner daemon can start with no log output. |
| `fix(cli): detect CODER_PROC_PRIO_MGMT by presence`, and a comment
follow-up | Log line only. With the variable set to an empty value, the
agent now logs that process priority management is enabled, which is
what `agentexec` already does. No detection or behavior change. | Low. |

Two option descriptions in `codersdk/deployment.go` are corrected, with
the CLI reference, configuration reference, and golden files
regenerated: the default quiet hours schedule (the max deadline is the
quiet hours window on the next day that the template's autostop
requirement applies) and `--experiments` (`*` opts in to the experiments
marked safe, also in `enterprise/cli/provisionerdaemonstart.go`).

### Code fixes that were reverted after review

Two code fixes from the first version of this PR are reverted in the
branch. The net diff has no change under `agent/` or `coderd/`. The docs
now describe what the code does, and both issues stay open for the
owner.

- **`error` merge strategy for `coder_env` (DOCS-1669).** The fix made
`merge_strategy = "error"` fail whenever a name was set twice, whatever
the resource order. Existing template versions that pair an `error`
entry with a later `replace` or `append` entry would start to fail every
build after `terraform apply`. That is a breaking change that needs its
own PR and release note. The fix and its tests are in `dff8e7c6ce` and
can be cherry-picked. `environment-variables.md` now says the check runs
only when the `error` resource is processed.
- **Nice value before the capability drop (DOCS-1687).** The fix let
`coder agent-exec` apply a negative nice value by calling `setpriority`
before it drops effective capabilities. The current order is deliberate:
with the fix, any local process could run the agent binary with
`--coder-nice=-20` when the binary has the `CAP_SYS_NICE` file
capability. `process-priority.md` now says a nice value below the
agent's own is not applied, and no longer tells admins to grant
`CAP_SYS_NICE`.

## Not included

Seven findings are left out.

- DOCS-1629: covered by #31639.
- DOCS-1703 and DOCS-1724: covered by #31980.
- DOCS-1584, DOCS-1683, DOCS-1685, DOCS-1686: each needs an owner
decision, and no neutral docs wording exists until that decision is
made. The validation comment on each issue names the decision.

Four fixes are interim, so their issues stay open:

- DOCS-1600: the AI Gateway pages now agree that the legacy metric names
are deprecated and "will be removed in a future release". The code still
emits them, and its TODO names v2.37, which has shipped. The owner still
needs to set the removal release.
- DOCS-1689: the page now says **New Template** opens the builder only
for users with the Owner role, because the page gates on read access to
the deployment config. Whether Template Admins should get the builder is
still open.
- DOCS-1669 and DOCS-1687: docs-only for now. Refer to [Code fixes that
were reverted after
review](#code-fixes-that-were-reverted-after-review).

## Review notes

- Claims that describe product intent and need an owner's yes: the
Premium qualifier on per-organization workspace sharing (the API route
has no license check, the dashboard needs multiple organizations),
`organization` port sharing in OSS, the telemetry field list, and the
`1-5` cron range in the prebuilds schedule example.
- Not run end to end: the PostgreSQL TLS procedure on a cluster, the
OpenShift and air-gapped examples, the BSD `date` and `tar` forms on
macOS, the Windows command on the multiple Kubernetes clusters page, and
the keep-alive script in `docs/reference/index.md` (only its comparison
logic was run, against sample values). Nothing was checked on a live
deployment.
- Likely merge conflicts with open PRs: #31990 (`mcp-server.md`,
`feature-stages.md`, `docker-in-workspaces.md`), #31982
(`workspace-management.md`), #31980 (`health-check.md`), #31977
(`manage-provisioner-jobs.md`), #31869 (`airgap.md`), #30486
(`add-envbuilder.md`), and #31326 and #31531 (`codersdk/deployment.go`
and generated files).

## Testing

- `make pre-commit` (gen, fmt, lint, slim build), before the PR opened
and again after the review changes.
- `go test` for `./cli/clilog/...`, `./codersdk/`, `./cli/`
(`TestServer`, `TestAgent`, and golden files), and `./enterprise/cli/`
(provisioner, server, and help golden files). `./agent/agentexec/...`
and `./coderd/provisionerdserver/...` pass after the reverts. Linux
only. CI covers macOS and Windows.
- The `coder.env` test fails against the file on `main` and passes
against the new one. It reads the file with `godotenv`, which accepts
CRLF line endings.
- An empty `CODER_HTTP_ADDRESS=` was confirmed end to end with a full
build of the server (output below).
- The new `sed` and `grep` lines in the Lima examples were run with GNU
tools against the old and the new form of `coder.env`. The Lima VMs were
not started.
- `--log-human=/dev/null` and `CODER_LOGGING_HUMAN=` were confirmed with
the same build (output below).
- `coder agent-exec --coder-nice=-5 -- echo` from a full build, as a
non-root user: `coder-agent: failed to adjust niceness to -5 ...:
permission denied` on stderr, the command output on stdout, exit code 0.
- `postgres-ssl.md` rendered with the GitHub Markdown API: two ordered
lists with three and five items, where `main` has six lists.
- markdownlint, the table formatter, `make lint/emdash`, `make
lint/docs-html`, `make lint/docs-manifest`, `make lint/docs-redirects`,
`make lint/style-claims`, and Vale on the changed lines.
- A doc-check self-review of the docs diff by four independent
reviewers. It found six problems, which are fixed. The accuracy and
coverage lenses ran on every area. The language and structure lenses ran
in full on only part of the diff.

<details>
<summary>Test and terminal output for the code fixes (Linux)</summary>

```console
$ go test ./codersdk/ -run TestPackagedCoderEnvKeepsDefaults -count=1 -v
--- PASS: TestPackagedCoderEnvKeepsDefaults (0.00s)
ok  	github.com/coder/coder/v2/codersdk	0.071s

$ go test ./cli/clilog/ -run TestBuilder -count=1 -v
--- PASS: TestBuilder (0.00s)
    --- PASS: TestBuilder/NoSinks (0.00s)
        --- PASS: TestBuilder/NoSinks/JSONDevNull (0.00s)
        --- PASS: TestBuilder/NoSinks/StackdriverDevNull (0.00s)
        --- PASS: TestBuilder/NoSinks/NoConfiguration (0.00s)
        --- PASS: TestBuilder/NoSinks/HumanDevNull (0.00s)
    --- PASS: TestBuilder/WithHuman (0.00s)
    --- PASS: TestBuilder/WithFilter (0.00s)
    --- PASS: TestBuilder/WithJSON (0.00s)
    --- PASS: TestBuilder/Verbose (0.00s)
    --- PASS: TestBuilder/FromDeploymentValues (0.01s)
        --- PASS: TestBuilder/FromDeploymentValues/Defaults (0.00s)
        --- PASS: TestBuilder/FromDeploymentValues/EmptyHumanEnv (0.00s)
        --- PASS: TestBuilder/FromDeploymentValues/Override (0.00s)
ok  	github.com/coder/coder/v2/cli/clilog	0.171s

$ TMPDIR=$HOME/.cache/agentexec-tmp go test ./agent/agentexec/... ./coderd/provisionerdserver/... -count=1
ok  	github.com/coder/coder/v2/agent/agentexec	4.236s
ok  	github.com/coder/coder/v2/coderd/provisionerdserver	2.404s

# Full build of the server (go build ./cmd/coder). An empty value stops it before it connects to the database.
$ CODER_HTTP_ADDRESS= coder server --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable'
Encountered an error running "coder server", see "coder server --help" for more information
error: TLS is disabled. Enable with --tls-enable or specify a HTTP address

# With the variable unset, the server passes that check and goes on to the database.
$ coder server --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable'
2026-11-13 02:19:41.901 [warn]  ping postgres: retrying  error="dial tcp 127.0.0.1:1: connect: connection refused"  try=11
Encountered an error running "coder server", see "coder server --help" for more information
error: connect to postgres: connect to postgres: unable to connect after 11 tries; last error: dial tcp 127.0.0.1:1: connect: connection refused

# An empty log location with no other sink still stops the server.
$ CODER_LOGGING_HUMAN= coder server --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable'
Encountered an error running "coder server", see "coder server --help" for more information
error: make logger: no loggers provided, use /dev/null to disable logging

# /dev/null passes the logger check. The server prints no log lines and goes on to the database.
$ coder server --log-human=/dev/null --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable'
Encountered an error running "coder server", see "coder server --help" for more information
error: connect to postgres: connect to postgres: unable to connect after 11 tries; last error: dial tcp 127.0.0.1:1: connect: connection refused
```

</details>

## Linear

Fixes DOCS-1583, DOCS-1585, DOCS-1586, DOCS-1587, DOCS-1588, DOCS-1589,
DOCS-1590, DOCS-1591, DOCS-1592, DOCS-1593, DOCS-1594, DOCS-1595,
DOCS-1596, DOCS-1597, DOCS-1598, DOCS-1599, DOCS-1601, DOCS-1602,
DOCS-1603, DOCS-1604, DOCS-1605, DOCS-1606, DOCS-1607, DOCS-1608,
DOCS-1609, DOCS-1614, DOCS-1618, DOCS-1619, DOCS-1620, DOCS-1624,
DOCS-1635, DOCS-1639, DOCS-1644, DOCS-1651, DOCS-1652, DOCS-1653,
DOCS-1654, DOCS-1655, DOCS-1656, DOCS-1657, DOCS-1658, DOCS-1659,
DOCS-1660, DOCS-1661, DOCS-1662, DOCS-1663, DOCS-1664, DOCS-1665,
DOCS-1666, DOCS-1667, DOCS-1668, DOCS-1670, DOCS-1671, DOCS-1672,
DOCS-1673, DOCS-1674, DOCS-1675, DOCS-1676, DOCS-1677, DOCS-1678,
DOCS-1679, DOCS-1680, DOCS-1681, DOCS-1682, DOCS-1684, DOCS-1688,
DOCS-1690, DOCS-1691, DOCS-1692, DOCS-1693, DOCS-1694, DOCS-1695,
DOCS-1696, DOCS-1697, DOCS-1698, DOCS-1699, DOCS-1700, DOCS-1701,
DOCS-1702, DOCS-1704, DOCS-1705, DOCS-1706, DOCS-1707, DOCS-1708,
DOCS-1709, DOCS-1710, DOCS-1711, DOCS-1712, DOCS-1713, DOCS-1714,
DOCS-1715, DOCS-1716, DOCS-1717, DOCS-1718, DOCS-1719, DOCS-1720,
DOCS-1721, DOCS-1722, DOCS-1723, DOCS-1725, DOCS-1726, DOCS-1727

Part of DOCS-1600, DOCS-1689, DOCS-1669, DOCS-1687

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

### Scope

- One PR for all findings, as agreed with the reviewer. The code fixes
are separate commits so an owner can ask for any of them to move to its
own PR. Nothing in the PR is a breaking change, so the title has no `!`.
- A finding was skipped only when an open PR already covers it, or when
every available wording would assert an undecided product behavior.
- Each validation comment on the Linear issues records the evidence, the
corrections to the original finding, and what was not verified.

### Docs or code

- The default was a docs-only fix that describes what the code does.
- A code fix was chosen when the docs describe a behavior the code
plainly intended and the code change is small and testable: the packaged
env file, the log sink check, and the log line for the environment
variable presence check.
- The `error` merge strategy and the nice value ordering started as code
fixes and went back to docs-only after review. The first breaks existing
template versions. The second weakens a deliberate security ordering.
- The SCIM `userName` finding (DOCS-1609) took the docs path. The
handler is unchanged.

### Wording choices worth a second look

- `feature-stages.md` says `--experiments=*` enables only the
experiments marked safe, and points to the "Get safe experiments" API.
It does not list the other experiments, because the list would drift and
those experiments are hidden on purpose. The `--experiments` flag help
now says the same.
- `agent-metadata.md` replaces the writes-per-second formula with a
description of the batcher (each server replica writes one statement
every 5 seconds, or sooner at 500 entries).
- `extending-templates/index.md` no longer calls `startup_script`
deprecated. The provider documents it as an alias for a `coder_script`.
- `postgres-ssl.md` separates client verification from server
verification, so the server verification steps work alone.
- `rpm.md`, `upgrade.md`, and the 2.29 to 2.34 ESR upgrade page explain
the empty `CODER_HTTP_ADDRESS=` line that older packages shipped,
because upgrades keep the old file. The behavior changed in v2.34.0 with
the serpent upgrade in #24926.
- The keep-alive script in `docs/reference/index.md` reads the current
deadline and skips the request when it is already later. The comparison
is on text, so it applies only when the API returns a UTC timestamp,
which needs the database to use the UTC time zone. Otherwise the script
sets the deadline on every pass, as it did before, and the page says so.
- `external-auth.md` anchors the new GitHub Enterprise regex example.
The older unanchored examples on that page and on `git-providers.md` are
not changed here.

### Self-review findings that were rejected

- "The builder opens for Template Admins": the Templates page needs a
successful deployment config read, which the Template Admin role does
not have.
- "Organization Admins can set AI model prices": the price write
authorizes against a site-level object, which organization-scoped grants
do not match.
- "The provisioner chart sets no default resources":
`helm/libcoder/templates/_coder.yaml` applies 2000m and 4096Mi when
`coder.resources` is empty.

### Automated review, round 1

The `coder-agents-review` app left 45 findings on `8853332`. Fixed: the
two reverts above, the anchored regex, the `coder.env` follow-ups (Lima
examples, upgrade notes, a comment in the file, and a test that covers
every option in the file), the clilog change, the two option
descriptions, and the docs findings (CORS behavior, token lifetime
example, keep-alive script, agent metadata, refresh token errors,
`switch` form type, `dbcrypt` skip list, and a stray line in a YAML
example).

Declined, with the reason on each thread:

- Refactoring the `agentexec` logging and renaming its log field: not
related to a docs conflict.
- Rewording the "process priority management not enabled (linux-only)"
log message: the docs quote the message, and the wording predates this
PR.
- Problems in code and docs that this PR does not change (the
`Capabilities` subtest, the Helm values comment, the AWS provider path
in `airgap.md`, and others in the review's out-of-scope list).

### Automated review, round 2

The app left 14 new findings on `04925bd`, and accepted the three
declined threads on `cli/agent.go`. All 14 are fixed. The main one: the
round 1 change that removed the "no loggers provided" error went too
far, because an empty log location would then start a server with no
logs. The error is back for every case except `/dev/null`.

Reported by the app as out of scope and not changed: the swagger
annotation for `GET /api/v2/experiments/available` declares an array,
but the handler returns an object with a `safe` array. Three Storybook
fixtures keep the old `--experiments` description.

### Automated review, round 3

The app confirmed that all round 2 findings are fixed, and left 10 small
findings on `f55cb6d` (8 P4, 2 Nit). All are fixed: the TLS condition
and the release range in the `coder.env` notes, one place for the
`/dev/null` rule in `clilog`, two test cases, a clearer test failure,
and the CPU example in `agent-metadata.md`.

### Automated review, rounds 4 and 5

Round 4 left one P4 on `8fffb38` (name the `--trace` option in the
logging note), which is fixed. Round 5 on `2ce754e` reports no new
findings and says every earlier finding is fixed or closed. The app did
not post an approval: it leaves its out-of-scope items and the code
fixes to a human reviewer. Two threads on `cli/agent.go` stay open on
purpose for the code owner.

### Doc-check review

The doc-check workflow left 12 comments on `2ce754e` (10 blocking, 2
suggestions). All are fixed in `c888885`: "refer to" or "visit" in place
of "see" for cross-references on the lines this PR added, the **New
template** label as the dashboard shows it, one instruction per step in
the server verification procedure of `postgres-ssl.md`, and two wording
changes in `process-priority.md`. The `CAP_SYS_NICE` sentence keeps a
short reason, which differs from the suggested text.

The `coder-agents-review` app then reviewed that commit (rounds 6 and
7). Round 6 left two P4 findings, fixed in `30b2c79`: the `failed to
adjust niceness` message is described once, in the troubleshooting
entry, with where it appears, and the client verification steps in
`postgres-ssl.md` render as one numbered list. Round 7 reports no new
findings. `2a6035c` then softens one sentence from that fix, because the
agent logs the stderr of devcontainer CLI commands. The app was not run
again on that commit.

### Adjacent gaps found and not fixed here

- `add-envbuilder.md` has the same `zip` command that
`template-from-scratch.md` had.
- `template-from-scratch.md` leaves the reader in `build/` after `cd
$_`, before a step that runs from `template-tour`.

</details>

---

_Generated by Coder Agents on behalf of @nickvigilante._

---------

Co-authored-by: Ben Potter <me@bpmct.net>
2026-11-13 21:34:59 +00:00
Nick Vigilante bd268cb28d feat: add output formats to coder organizations members edit-roles (#30145)
Uses the `cliui` output helpers from #30508.

`coder organizations members edit-roles` printed only `Member roles
updated to [...]`, while `members list` supports `-o table|json` and
`-c`.

It now accepts `-o text|table|json` and `-c`.
Table and JSON show the updated member using the `members list` row type
and columns.

**Behavior change:** Additive.
Default text output is unchanged.
The command now fetches the member after updating roles, on every
invocation; if that read fails, it exits with an error even though the
roles were already updated.

<details>
<summary>Decisions</summary>

- The update endpoint doesn't return user data, so the member is re-read
to build the table and JSON rows.

</details>

Closes [CLI-27](https://linear.app/codercom/issue/CLI-27)

_This PR was generated by Coder Agents on behalf of @nickvigilante._
2026-11-13 14:33:32 -05:00
Nick Vigilante 32e1f2502f feat: add JSON output to coder tokens create (#30135)
Uses the `cliui` output helpers from #30508.

`coder tokens create` printed only the new token's secret, so scripts
had to call `tokens view` afterwards to get the token's ID, expiry, and
scopes.

This adds `-o/--output` with `text` (default) and `json`.
The JSON document contains the token's metadata from `APIKeyByID` plus
the one-time `key`.

**Behavior change:** Additive.
The default output is still just the secret, so `$(coder tokens create
...)` keeps working.
The command now makes one extra API call after creating the token; if it
fails, the command prints a warning to stderr and still outputs the
secret rather than exiting with an error.

<details>
<summary>Decisions</summary>

- The metadata lookup uses the key ID parsed from the `<id>-<secret>`
token, the same convention `tokens view` and `tokens remove` use.
- A failed metadata lookup never fails the command, because the token
already exists and the secret can't be shown again.

</details>

Closes [CLI-14](https://linear.app/codercom/issue/CLI-14)

_This PR was generated by Coder Agents on behalf of @nickvigilante._
2026-11-13 12:45:32 -05:00
Dmitry Makovey 872105c4bb fix: bump bundled terraform to 1.17.2 (#32110)
Bumps the bundled Terraform from 1.17.1 to
[1.17.2](https://github.com/hashicorp/terraform/releases/tag/v1.17.2)
(released 2026-11-11). 1.17.2 pins `klauspost/compress` v1.20.2, which
contains the fix for
[GHSA-fpmh-frq8-7rj8](https://github.com/klauspost/compress/security/advisories/GHSA-fpmh-frq8-7rj8)
/ [GO-2026-6865](https://pkg.go.dev/vuln/GO-2026-6865) (panic in the
zstd decoder on a crafted frame). 1.17.1 pins v1.19.1.

Iron Bank reports GO-2026-6865 against `/opt/terraform/terraform` in
`coder/coder-enterprise/coder-service-2:2.38.7` (High). The Iron Bank
image takes its Terraform from the version coder bundles, so this bump
is how that finding goes away.

This is a patch bump, so `maxTerraformVersion` stays at 1.17.9. It does
not change the Go toolchain Terraform is built with (still go1.26.10) or
its `go-getter` pin (still v1.8.6).

## Changes

Same file set as #30516:

- `provisioner/terraform/install.go`: `TerraformVersion`
- `install.sh`, `scripts/Dockerfile.base`
- `mise.toml`, `mise.lock` (checksums from HashiCorp's
`terraform_1.17.2_SHA256SUMS`)
- `flake.nix` (fetchurl SRI hashes derived from the same SHA256SUMS)
- `docs/install/prepare/airgap.md`
- `provisioner/terraform/testdata/generation.sha1`: fixture fingerprint,
regenerated with `generate.sh --if-needed`. No plan or state fixture
changed.

I checked the checksum conversion first by deriving the 1.17.1 values
from `terraform_1.17.1_SHA256SUMS`; it reproduces every value currently
in `flake.nix` and `mise.lock`.

## Verification

```
$ mise install terraform        # mise.lock checksums verified against the download
$ mise exec -- terraform version
Terraform v1.17.2 on linux_amd64
$ ./provisioner/terraform/testdata/generate.sh --if-needed
only generation.sha1 changed
$ go test ./provisioner/terraform/ -run 'TestInstall|Version|Golden' -count=1
ok  github.com/coder/coder/v2/provisioner/terraform  (75 tests passed, 0 failed)
```

`flake.nix` was not evaluated with Nix; its hashes come from the same
SHA256SUMS as `mise.lock`.

## AI disclosure

Prepared with an AI coding agent on behalf of @droopy4096. The agent ran
the verification above; a human review is still needed before merge.
2026-11-13 09:39:18 -07:00
John T Skarbek 54fe847c6f chore: remove references to torn-down dev.coder.com instance (#31702)
The `dev.coder.com` instance has been torn down and now only redirects
to another instance. Nothing in the repo calls it. Every reference was a
test fixture, mock, story, Helm test input, docs example, or comment.

Replace all occurrences with `coder.example.com` and update the comments
that claimed the mocks were fetched from that instance. The Helm golden
files were updated to match their inputs.

Closes DOG-43

https://linear.app/codercom/issue/DOG-43/scan-codercoder-repo-for-remaining-references-to-devcodercom-and
2026-11-13 16:38:44 +00:00