Commit Graph
903 Commits
Author SHA1 Message Date
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
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
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
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
Spike Curtis 4f6a56427e feat: report pubsub health from the pubsub backend (#31621)
Fills in the `pubsub` section of the deployment health report on the
server. Stacked on #31620.

- New `pubsub.ReportingPubsub` interface: `Pubsub` plus
`HealthReport(ctx) healthsdk.PubsubReport`. The `Pubsub` interface
itself is unchanged.
- The PostgreSQL, NATS and in-memory backends implement it. Each reports
its backend name (`postgres`, `nats` or `memory`) and its connection
state:
- **PostgreSQL:** tracks the `pq` listener's connected state from its
event callback. When it's not connected, the report has severity
`warning` and `EPS01`.
- **NATS:** warns with `EPS02` if the embedded server isn't `Running()`,
and with `EPS01` for each publish or subscribe connection whose
`Status()` isn't `CONNECTED`.
  - **In-memory:** always `ok`.
- `coderd.Options.Pubsub` is now a `ReportingPubsub`.
`ReplicaSyncPubsub` stays a plain `Pubsub`.
- `coderd/healthcheck` has a new `Pubsub` check, which counts toward
`healthy` and the overall severity like the other sections.
`formatHealthcheck` applies the dismissed setting for it.
- New health codes `EPS01` (not connected) and `EPS02` (embedded NATS
server not running), documented in
`docs/admin/monitoring/health-check.md`.
- Test helpers follow the type change: `coderdtest.Options.Pubsub` and
the pubsub returned by `dbtestutil.NewDB` are now `ReportingPubsub`, and
a few test wrappers embed `ReportingPubsub` instead of `Pubsub`.

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

- `HealthReport` returns a `healthsdk.PubsubReport` rather than filling
one in place. This matches the `healthcheck.Checker` methods. `ctx` is
unused for now.
- The healthcheck layer sets `Dismissed`, so backends don't need to know
about health settings.
- Problems are reported as warnings, not errors, so they show on the
health page without marking the deployment unhealthy. Both backends
reconnect on their own.
- Postgres connection state comes from the listener event callback, not
from `pq.Listener.Ping`, so the health check doesn't do database I/O.
Closing the pubsub also marks it disconnected.
- NATS `conn` gains `Status()`, which `*natsgo.Conn` already implements.
The pools are immutable after construction, so `HealthReport` reads them
without locking.
- The docs say the pubsub section appears in the JSON response, because
the health UI doesn't show it until a later PR in this stack.
- psmock is not regenerated: none of its users pass it to coderd.

</details>

---
Generated by Coder Agents on behalf of @spikecurtis.
2026-11-13 17:20:31 +01:00
Nick Vigilante 0f2a2434dc docs: remove accredited and per-framework retention claims (DOCS-1218) (#30777)
Removes two compliance claims in `docs/` that overstate what Coder
provides.

- `docs/install/server/rpm.md`: Iron Bank images are hardened and
vulnerability-scanned, not accredited. The sentence now says that.
- `docs/admin/setup/data-retention.md`: the "Compliance Considerations"
list gave retention periods for SOC 2, HIPAA, PCI DSS, and GDPR. SOC 2
doesn't prescribe a period, and HIPAA's 6-year rule covers compliance
documentation, not audit logs. The list is replaced with neutral
guidance; the existing warning to consult security and compliance teams
stays.

Resolves DOCS-1218.

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

- **Cut the list instead of correcting it.** A corrected per-framework
list would still need Security and Legal sign-off and ongoing upkeep,
and it would read as Coder advising on the customer's obligations. The
page's warning already routes readers to their compliance team.
- **Sweep of `docs/`** for `compliant`, `certified`, `accredited`,
`FIPS`, `FedRAMP`, `HIPAA`, `SOC 2`, `STIG`, `GDPR`, `DORA`, `CMMC`,
`PCI`, and `Iron Bank`. No other claims that Coder itself is compliant,
certified, or accredited. Remaining hits describe the customer's
requirements, protocol conformance (OAuth 2.1, OIDC, SCIM), or a
third-party plugin certification, and stay.
- **Out of scope:** whether the Iron Bank image is current is tracked
separately.
- Checks: `markdownlint-cli2`, `vale`, `check_emdash.sh`, and the
pre-commit hook pass locally.

</details>

---

_Generated by Coder Agents on behalf of @nickvigilante._
2026-11-12 13:20:32 -05:00
Nick Vigilanteandcoder[bot] 71ab161291 docs: add guide for self-hosting a STUN server (#31996)
Adds a how-to guide for self-hosting a STUN server with coturn and
pointing `CODER_DERP_SERVER_STUN_ADDRESSES` at it.
The guide is linked from the STUN and NAT page, the networking overview,
and the air-gapped comparison table.

Refs #16537, DOCS-310

**Verification**

- Both coturn install paths were run on an Ubuntu 24.04 VM and checked
with `coder netcheck` against a v2.39.0 deployment configured with only
self-hosted STUN servers: the coturn 4.6 package under systemd with the
documented config, and the `coturn/coturn:4.18.0` container with a
published UDP port. Hostname and IP entries in
`CODER_DERP_SERVER_STUN_ADDRESSES` both worked.
- A client on a separate home NAT network got `p2p` connections from
`coder ping`, and the STUN servers logged requests from both the client
and the agent. With the STUN servers stopped, connections fell back to
DERP and `coder ping` printed the "could not connect to STUN over UDP"
hints. Running workspaces picked up the new STUN list without a restart.
- Custom relay map path, checked in-process only (a throwaway
`derphealth` test, not committed): with a nil built-in region,
`tailnet.NewDERPMap` drops `CODER_DERP_SERVER_STUN_ADDRESSES`, and
hand-written STUN-only regions loaded from a relay map file report
`can_stun: true`. The documented `jq` filter lists them for both
built-in and custom maps.
- Source-verified only: each address becomes its own STUN-only region
(`tailnet.STUNRegions`), which backs the "two or more servers" advice.
With the built-in relay off, a relay map that has only STUN-only nodes
fails startup (`tailnet.NewDERPMap`, pinned by
`TestNewDERPMap/RequireDERPNodes`), which backs the "keep at least one
relay node" note.
- Not tested: Kubernetes or ingress setups. The VM-only guidance follows
Spike's comment on #16537.

markdownlint, Vale, `lint/emdash`, `lint/docs-manifest`, and
`lint/docs-html` pass on the changed files, and a doc-check self-check
left no blocking findings.

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

- **Dropped `stund`.** It has no releases, packages, or container
images, so the guide had readers build an unpinned binary from
Tailscale's `main` branch with no distribution security updates. It also
answers only binding requests that carry a `FINGERPRINT` attribute, so
generic STUN test tools can't check it. Its only advantage over coturn
is a smaller, memory-safe, STUN-only codebase, and coturn's `stun-only`
mode covers the practical need.
- **The built-in relay is optional unless you use
`CODER_DERP_SERVER_STUN_ADDRESSES`.** `cli/server.go` sets the built-in
region to `nil` when `CODER_DERP_SERVER_ENABLE=false`, and
`tailnet.NewDERPMap` adds STUN regions only when that region exists,
numbering them from its region ID. Deployments with a custom relay map
add STUN-only regions to that map instead, so the prerequisite became a
"Use a custom relay map" section under Configure Coder. The page doesn't
drop the relay entirely, because the built-in relay is still required
for `CODER_DERP_SERVER_STUN_ADDRESSES`, and a custom relay map still
needs at least one relay node.
- **Changed the `jq` filter.** The old filter matched generated
`coder_stun_*` region codes, so it returned an empty list for STUN
regions written into a custom relay map. The filter now selects nodes
with `STUNOnly` set.

</details>

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

---

_Generated with Coder Agents on behalf of @nickvigilante._

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
2026-11-12 10:20:36 -05:00
Ehab Younes 1126533c31 feat: export workspace last used time to Prometheus (#31346)
Add an opt-in coderd_workspace_last_used_timestamp_seconds gauge that
reports workspaces.last_used_at, the value the dormancy threshold
measures inactivity from. To enable it, set
--prometheus-collect-workspace-stats or
CODER_PROMETHEUS_COLLECT_WORKSPACE_STATS.

A separate WorkspaceStats collector refreshes the gauge once a minute
in the background from a new GetWorkspaceLastUsedForMetrics query. Each
series has a workspace_id label, so a workspace that reuses a deleted
workspace's name starts a new series. Workspaces owned by deleted users
are excluded.

Closes CLIENT-1065
2026-11-11 15:02:18 +00:00
Molly Fraser 0a7ef88af9 feat: add option to disable the embedded AI Gateway (#31967)
Adds `--ai-gateway-embedded-enabled` /
`CODER_AI_GATEWAY_EMBEDDED_ENABLED` (default `true`) so standalone-only
deployments can stop `coderd` from starting the in-memory AI Gateway.

`CODER_AI_GATEWAY_ENABLED` stays the global switch: the AI Gateway
entitlement, `/api/v2/ai-gateway/serve`, and cost-control metrics still
depend only on it. The embedded daemon now starts only when both options
are `true`.

| `ENABLED` | `EMBEDDED_ENABLED` | Result |
|---|---|---|
| `true` | `true` | Unchanged |
| `true` | `false` | No embedded gateway; standalone gateways keep
working |
| `false` | any | No AI Gateway |

Refs AIGOV-514

## Open questions for reviewers

- **Coder Agents does not work with the embedded gateway disabled.**
`chatd` still starts, but model calls fail with "AI Gateway transport
factory is not configured" because there is no in-process transport.
AIGOV-597 (routing Agents through standalone gateways) was canceled. The
docs and option help state that Agents requires the embedded gateway. Is
that acceptable, or should `chatd` also be turned off in this mode?
- **Option name:** the ticket proposed
`CODER_AI_GATEWAY_EMBEDDED_ENABLED` tentatively. OK to keep?

## Verification

```
$ go test ./cli/ -run 'TestServer_AIGateway' -count=1
ok      github.com/coder/coder/v2/cli   0.518s
$ go test ./enterprise/coderd/ -run 'TestAIGatewayServe' -count=1
ok      github.com/coder/coder/v2/enterprise/coderd     0.755s
```

`TestServer_AIGatewayEmbedded` fails when the new check is removed.

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

- `codersdk/deployment.go`: new option and
`AIBridgeConfig.EmbeddedEnabled` field; updated `--ai-gateway-enabled`
description.
- `cli/server.go`: outer `if Enabled` sets up cost-control metrics and
the blocked-users collector (the standalone `/serve` endpoint uses these
too). Inner `if EmbeddedEnabled` creates the daemon, registers the
in-memory handler, and adds its cleanup.
- `cli/server_test.go`: `TestServer_AIGatewayEmbedded` covers the three
modes by checking for the embedded daemon's startup log.
- `enterprise/coderd/aibridgeserve_test.go`:
`TestAIGatewayServeEmbeddedDisabled` checks the entitlement and `/serve`
still work with embedded disabled.
- `docs/ai-governance/ai-gateway/standalone.md`: new "Disable the
embedded gateway" section.
- Remaining files are generated by `make gen`.
- Found during review: keeping metrics inside the embedded check would
have dropped cost-control metrics for standalone gateways.

</details>

---

Generated with Coder Agents; reviewed, revised, and verified by
@mollymaefraser.
2026-11-11 11:50:16 +00:00
dylanhuff-at-coder 3728e7a4e1 perf: use the build parameter index in GetTemplateParameterInsights (#31765)
Speeds up `GetTemplateParameterInsights`, which the insights collector
runs every 5 minutes on every replica. The `@>` array join could only
hash on `name`, so every run scanned all of
`workspace_build_parameters`. Unnesting the build IDs and joining on
`(workspace_build_id, name)` lets the existing unique index serve it,
and the results don't change since each build ID shows up at most once
per group.

On 8.4M synthetic build parameters the collector's 5 minute window went
from 5,193 ms to about 31 ms. `TestGetTemplateParameterInsights` is new
and passes on both the old and new SQL. This also fixes the Prometheus
docs example, which summed per-replica copies of the same metric.

I split the `workspace_app_stats` index into #31766 so this one has no
migration and can be backported to 2.34 through 2.39 (2.34 to 2.38
without the docs hunk).

The pre-push hook skipped tests on this push because of a stale
`origin/main` in my checkout. An earlier full run only failed in
`agent/` and `site/`.

Part of [CORE-439](https://linear.app/codercom/issue/CORE-439).
2026-11-10 09:30:21 -08:00
coder[bot] ad3818e850 docs: fix broken AWS HA and Red Hat OpenShift links (#31933)
Fixes the two broken links from the [Nov 9 weekly-docs
run](https://github.com/coder/coder/actions/runs/42591777635).

## Changes

- **`docs/admin/networking/high-availability.md`**: The AWS Prescriptive
Guidance page on managed PostgreSQL for multi-tenant SaaS returns 404.
The whole guide appears to be retired (welcome page, other sections, and
PDF all 404). The link now points to [Configuring and managing a
Multi-AZ deployment for Amazon
RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.MultiAZ.html),
the AWS counterpart to the existing GCP Cloud SQL HA link.
- **`docs/install/server/openshift.md`**: Adds the equivalent [OKD build
configuration
page](https://docs.okd.io/latest/cicd/builds/understanding-buildconfigs.html)
first, followed by the existing Red Hat OpenShift Container Platform
link. Linkspector can still check the OKD link.
- **`.github/.linkspector.yml`**: Ignores `docs.redhat.com`. Red Hat's
edge returns 403 to automated requests, including GitHub runner IPs and
headless Chrome, so the check fails intermittently.

## Why not retries?

The pinned linkspector (v0.5.6) already defaults to `retryCount: 3`, but
it only retries 429 responses and network errors. A 403 is returned
immediately, and the Puppeteer fallback only retries on thrown
exceptions. Adding 403 to `aliveStatusCodes` would apply to every
domain, so it isn't used here.

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
2026-11-09 16:30:53 +00:00
Ethan a0be9d0e1d feat: make message_agent always steer (#31175)
`message_agent` no longer takes an `interrupt` flag, and always steers.
If the child is busy, it gets the message before its next model call and
keeps working. To correct or redirect a busy child, the parent just
calls `message_agent`, and `interrupt_agent` only stops it, which is the
same split the API has after #31174. The tool result also drops
`interrupted`, as it was just whether the child was running before the
send.

That was the last caller of the interrupt busy behaviour, so chatd and
chatstate drop it too. `SendMessage` never interrupts now. On a busy
chat it only ever adds the message to a lane, so the sends that moved a
running chat to interrupting, or a `requires_action` chat back to
running, are gone, along with the send's inline interruption finish for
chats with no worker. Most of the diff is deleted tests.

A steer send to a paused chat, or to an errored chat whose next message
is being edited, no longer fails with a 429 at the queue limit when it's
delivered straight away, which is whenever the message being edited is a
queue message.

Part of CODAGT-1140
2026-11-09 15:55:17 +11:00
Kyle CarberryandJon Ayers b798061108 perf: reuse import-time lock file and cache terraform version (#29825)
Workspace builds now reuse the lock file that `terraform init` wrote
during template import, which takes a minimal Docker build from about
3.1s to 1.65s, measured from build created to agent connected.

---------

Co-authored-by: Jon Ayers <jon@coder.com>
2026-11-06 19:32:46 -06:00
coder[bot] 155861f04e docs: replace ensure, should, and since per the Vale spike review (#31879)
Applies the Vale findings spike review's `ensure`, `should`, and `since`
decisions, following
`word-choice.md#choose-words-that-have-one-meaning`.

## `ensure`, `ensures`, `ensuring`: every row marked valid

- 148 lines in 70 files.
- Most became `make sure`, `makes sure`, or `making sure`.
- When the subject isn't a person, I used a verb that reads better, such
as `guarantees`, `keeps`, `prevents`, `maintains`, or `provides`.
- `admin/monitoring/health-check.md:227`: "Make sure that" is now "Make
sure", so the step stays within `Coder.StepLength`.
- Left as-is: `admin/setup/configuration-reference.md:1339`, which is
generated from `codersdk`.

## `should` and `since`: only rows with a verdict or a note

- `.style/README.md`: "what should be routed elsewhere" is now "what to
route elsewhere".
- `.style/content-guidelines.md`:
  - "Avoid mixing those modes within a single page."
  - "Every page must be accurate"
  - "Check docs claims against the actual implementation"
  - "must include the documentation"
  - "Support owns the content they produce."
  - "because they don't change"
- `.style/styles/Coder/README.md`: "must link to the matching section".
- `admin/external-auth.md`:
  - "The redirect URI for Gitea is ..."
- "Use custom authentication and token URLs ...", which is now active
voice.
- `envbuilder-releases-known-issues.md`: "so it's experimental and prone
to breaking changes".

Rows marked unsure with no note were left alone: `content-guidelines.md`
lines 49, 330, and 405, and `envbuilder/index.md:24`.

The changed files have no new findings from other rules.

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

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
2026-11-06 22:26:01 +00:00
coder[bot] d91aa1bebd docs: replace may with can or might per the Vale spike review (#31878)
Replaces `may` with `can` (ability or permission) or `might`
(possibility), following
`word-choice.md#choose-words-that-have-one-meaning`. The Vale findings
spike review marked every `may` row valid.

- 247 lines in 110 files: 75 became `can` and 162 became `might`. The
rest are small rewordings, such as "may wish" becoming "might want".
- Applied the reviewer notes:
- `.style/content-guidelines.md`: "docs may be written ahead" is now
"you can write docs ahead", which also drops the passive voice.
- `admin/external-auth.md`: now "You can grant access to a subset of
repositories.", so the sentence doesn't end on a preposition.
- Also fixed a typo in `gcp-to-aws.md`: "may needed" is now "might
need".

## Left as-is

- **`admin/setup/configuration-reference.md` (7 lines):** this page is
generated from `codersdk` deployment options (`<!-- DO NOT EDIT |
GENERATED CONTENT -->`), so the fix belongs in the Go option
descriptions, followed by `make gen`.
- **Text that quotes the product:**
- `admin/monitoring/health-check.md:196` matches the derphealth message.
- The heading at `templates/troubleshooting.md:45`, the first "may" on
line 47, and the link on line 67 match the web terminal's "your
workspace may be incomplete" warning and its anchor.
- `admin/integrations/oauth2-provider/troubleshooting.md:269` quotes a
server error.

The changed files have no new findings from other rules.

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

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
2026-11-06 17:17:35 -05:00
Atif Ali ae6b1faea3 fix: make SSH connection hints consistent across CLI, dashboard and docs (#31188)
SSH hints across the CLI, dashboard and docs used different, sometimes
broken, workspace names. This makes them consistent with minimal,
non-breaking changes and no new syntax:

- Plain `ssh` hostnames: `<agent>.<workspace>.<owner>.<suffix>` (or
`<workspace>.<suffix>` for single-agent workspaces). Works with
`config-ssh` (with or without `--no-wildcard`) and Coder Connect.
- `coder` CLI arguments: `[<owner>/]<workspace>[.<agent>]`, with the
owner unless the workspace was given by its bare name.

Built on #31192, which is now merged into `main`.

## Changes

- **`coder ping` multi-agent error**: now suggests `coder ping
<workspace>.<agent>` instead of listing agents without a runnable
command. Owner-qualified and UUID inputs retain `<owner>/<workspace>`.
JSON-mode errors leave stdout empty, and ping still does not autostart
stopped workspaces.
- **`coder ssh` multi-agent error**: when run directly (no
`--ssh-host-prefix`/`--hostname-suffix`), it suggested `ssh
coder.dogfood.matifali`, which never resolves without a matching SSH
config entry or Coder Connect. For an agent named `dev`, it now suggests
`coder ssh dogfood.dev`, or `coder ssh bob/dogfood.dev` if the workspace
was given as `owner/name` or by ID. Here `.dev` selects the agent; it is
not an SSH hostname suffix. The ProxyCommand path used by `config-ssh`
and the IDE plugins still suggests the full hostname.
- **`coder show` / `coder create`**: the access column dropped the
owner, so `coder show bob/dogfood` or `coder show <id>` suggested `coder
ssh dogfood.dev`. It now keeps the owner unless the workspace was given
by its bare name.
- **`coder config-ssh`**: the example `ssh <workspace>.coder` is
ambiguous for multi-agent workspaces. It now names an agent, `ssh
<agent>.<workspace>.<owner>.coder`, reading a stopped workspace’s known
agents from its latest successful start using the same template version.
With `--no-wildcard`, the hint reuses the workspace snapshot and
resources used to write the Host entries.
- **Dashboard "Connect via SSH"**: rendered `...<owner>.undefined` when
the deployment has no hostname suffix. It now falls back to `coder ssh
<owner>/<workspace>` for single-agent workspaces, or `coder ssh
<owner>/<workspace>.<agent>` otherwise. With a hostname suffix, owned
single-agent workspaces show `ssh <workspace>.<suffix>` unless that
hostname collides with the deployment’s legacy prefix block. Prefix
collisions, shared workspaces and multi-agent workspaces retain the full
agent/workspace/owner hostname. The count includes agents across all
resources and devcontainers. Commands remain undefined while the SSH
config loads, with a spinner instead of a premature fallback. If the
initial load fails, it displays the error while keeping the CLI command
available.
- **Docs**: workspace access docs said `config-ssh` prints `ssh
coder.<workspace>`; it prints `ssh <workspace>.coder`. Added the
multi-agent hostname, noted it in the Desktop docs, and updated the
Gateway host and the networking page to `<workspace>.coder`.

## Before / after

```console
$ coder ssh dogfood
error: multiple agents found, please specify the agent name, available agents: [coder dev]
Try running:
         $ ssh dev.dogfood.matifali       # before: does not resolve
         $ coder ssh dogfood.dev          # after: dev is the agent name
```

## Compatibility

Hostname parsing (`findWorkspaceAndAgentByHostname`,
`normalizeWorkspaceInput`) is unchanged, so every hostname that resolves
today still does. The VS Code, JetBrains Gateway and Toolbox plugins
write their own `Host` entries and run `coder ssh --stdio
--ssh-host-prefix <prefix>`, so they don't reach the changed hints.
`TestSSH_AgentHostnames` connects with their
`<prefix>--<owner>--<workspace>.<agent>` form, and with the
`<agent>.<workspace>.<owner>` forms used by `config-ssh` and the
dashboard.

## Verification

CLI/resource race tests pass, including the complete original `TestSSH`
suite and the new agent-hostname round trips. `TestConfigSSH_Example`
checks running two-agent and stopped one-/two-agent workspaces whose
import defaults differ, with and without `--no-wildcard`. It verifies
the hint has a matching generated Host entry and reuses workspace
history once per stopped workspace. `TestShow` covers bare names,
owner-qualified names and UUIDs; `TestCreate/CreateForOtherUser` checks
the owner-qualified preview. Mutation checks confirmed the new
assertions fail when the protected behavior is removed.

`TestPing_AgentSuggestions` covers bare names, owner-qualified names,
UUIDs and JSON-mode errors with a shared fixture. The tests fail without
the new hints; an owner-omission control also fails the qualified/UUID
cases. The original network-heavy `TestPing` suite remains unchanged and
passes its normal race run.

Normal and strict new-code Go lint, frontend checks/lint/typechecking,
all eleven SSHButton stories, and docs checks pass. Browser checks
verified copied SSH/CLI commands and keyboard dismissal; screenshots
were visually inspected. The single-agent follow-up adds 25 command-copy
cases covering ownership, agents across resources, subagents, and
zero/unknown counts. All 53 affected SSHButton, AgentRow, and
AgentDevcontainerCard stories pass, with browser validation of both real
callers and regression/mutation controls for the command-selection
guards.

<details>
<summary>CI follow-up and validation commands</summary>

After #31192 merged, the parent commits were dropped and the remaining
eleven commits were rebased onto the merge commit `fb6d287528`.
Range-diff and full-tree comparisons confirm no implementation changes.
Revalidated the complete SSH/ping/config race suite and strict lint
after that rebase.

Latest rebase preserves the implementation and carries the docs edits to
main’s renamed `docs/workspaces/` paths. The SSHButton documentation
links and preview URL use the new routes. Revalidated the full
SSH/ping/config CLI race suite, strict lint, 25 frontend tests, 53
stories, and docs/manifest/redirect checks. The local shell’s Oh My Zsh
update prompt interrupted the first race run; the unchanged suite passed
with `DISABLE_AUTO_UPDATE=true` scoped to the test process.

Latest review follow-up: connection commands remain undefined during
initial loading, and each instruction is gated on its own command. A
cached SSH suffix remains usable after a failed refetch; a story
captures that state. Rebased directly onto `main` at `fb6d287528` after
#31192 merged. The P2 follow-up preserves native hostnames that collide
with legacy prefix blocks, uses workspace-specific history for stopped
agents, and retains safe precreated devcontainer names.

Earlier stress runs of the unmodified `TestSSH` suite exceeded the 6,144
MiB guard under 35-repeat stress. Its existing scenarios remain
unchanged. The three added agent-qualified hostname cases have
independent full SSH round-trip coverage in `TestSSH_AgentHostnames`,
with a shared fixture. The current top-PR changed-test selector chooses
seven tests without the unrelated `TestSSH` scenarios, and the complete
selected set passes 35 repetitions at parallelism 16 with the same
memory guard. No test cases, repetitions, parallelism or memory checks
were removed.

```sh
go test -race -tags=testsmallbatch ./cli ./cli/cliui -run '^TestSSH$|^TestSSH_AgentHostnames$|TestPing|TestConfigSSH|TestShow|TestCreate|Test_agentSSHSuggestion|Test_suggestWithOwner|TestWorkspaceResources|Test_noWildcardHostNames|Test_previousStartResources|TestCommandHelp' -count=1 -parallel=4
GOMEMLIMIT=6GiB golangci-lint run --allow-serial-runners --concurrency=4 --new-from-rev=origin/main ./cli/...
GOMEMLIMIT=6GiB make lint/go/new-code GO_LINT_CONCURRENCY=4
CODER_TEST_MEMORY_LIMIT_MIB=6144 TS_DEBUG_DISCO=true TS_DEBUG_DERP=true go test -tags=testsmallbatch -p=4 -count=35 -parallel=16 -shuffle=1 -timeout=10m -run '^(TestConfigSSH_Example|TestCreate|TestPing_AgentSuggestions|TestSSH_AgentHostnames|TestShow|Test_agentSSHSuggestion|Test_suggestWithOwner)(/.*)?$' ./cli
cd site
pnpm check
pnpm lint
pnpm test src/modules/resources/SSHButton/SSHButton.test.tsx
pnpm test:storybook src/modules/resources/SSHButton/SSHButton.stories.tsx src/modules/resources/AgentRow.stories.tsx src/modules/resources/AgentDevcontainerCard.stories.tsx --run
```

</details>

Follow-up to #19943. Tracks
[CLI-67](https://linear.app/codercom/issue/CLI-67/fix-coder-ssh-suggestions-for-multi-agent-workspaces).

Preview:
https://coder.com/docs/@fix%2Fssh-multi-agent-hint/workspaces/workspace-access

> 🤖 This PR was created with the help of Coder Agents, and has been
reviewed by my human. 🧑💻
2026-11-05 10:19:38 +05:00
coder[bot]andNick Vigilante a988af518c docs: rename the user-guides folder to workspaces (#31650)
> [!NOTE]
> Generated by Coder Agents. The branch and this description were
written by an AI agent and need human review.

## Summary

Fourth stacked PR for the docs IA overhaul. PR C renamed the User guides
sidebar section to **Workspaces**. This PR renames its folder to match,
so the folder tree and the sidebar agree (DOCS-1154). The section's
title, position, and contents don't change.

- `docs/user-guides/**` moves to `docs/workspaces/**` with `git mv`: 33
files. That includes pages that are not in the sidebar and the three
pages PR C moved in (`persistent-shared-workspaces.md`,
`cloning-git-repositories.md`, `speed-up-templates.md`).
- `docs/manifest/user-guides.yml` and `docs/manifest/user-guides/` (4
files) move to `docs/manifest/workspaces.yml` and
`docs/manifest/workspaces/`, and `index.yml` lists `workspaces.yml` in
the same position.
- Every relative link and image path is fixed, in moved pages and in
pages that link to them. This was done in one scripted pass from a clean
tree. `docs/images/` stays where it is, so images under
`docs/images/user-guides/` keep their names; only the relative paths
that point at them change.
- Commit 2, `chore: point in-product docs links at the new docs paths`,
updates docs URLs outside `docs/`, then regenerates the files built from
them with `make gen`. You can drop that commit; the redirects cover the
old URLs.
- Updated sources: `site/` `docs()` links and hardcoded docs URLs,
`cli/sharing.go` help text, `README.md`, `examples/templates/` READMEs
and `docker/main.tf`, templatebuilder base READMEs, and the doc-check
skill's audience persona.
- Regenerated files: the `coder sharing add/remove` CLI golden files,
`docs/reference/cli/sharing/{add,remove}.md`, and
`examples/examples.gen.json`.
- Commit 3, `fix: keep docs links healthy before the release`, keeps
links working on the live site until a release that includes this stack
becomes the default docs version:
- In hand-written pages, the docs commit's rewrite left 4 absolute
`https://coder.com/docs/workspaces/...` URLs. They are now relative
links, anchors kept: `admin/networking/wildcard-access-url.md`,
`install/operate/upgrade/esr-2.24-2.29-upgrade.md` (2 links), and
`workspaces/workspace-access/jetbrains/gateway.md`.
- Every hardcoded, unversioned `https://coder.com/docs/workspaces/...`
URL that commit 2 introduced outside `docs/` goes back to
`https://coder.com/docs/user-guides/...`. That covers 32 URLs in
`README.md`, `cli/sharing.go`, the examples and templatebuilder READMEs,
`examples/templates/docker/main.tf`, the `UserDropdownContent.tsx`
constant and its story assertion, and a JSDoc link in
`site/src/api/queries/workspaces.ts`. `make gen` then regenerated the
CLI golden files, `docs/reference/cli/sharing/{add,remove}.md`, and
`examples/examples.gen.json`. See "Post-release follow-up".
- The `site/` `docs()` changes stay, because those URLs are versioned
(`/docs/@vX.Y.Z/...`) and resolve once the release ships.

Stack: `docs/ia-ai-sections` (#31645, with Templates squash-merged in
#31646) → `docs/ia-tutorials-nav` (#31647) → **this PR**.

Refs: Linear DOCS-1154, DOCS-1179.

## Move map

| Old | New |
| --- | --- |
| `docs/user-guides/**` (33 files) | `docs/workspaces/**` |
| `docs/manifest/user-guides.yml` | `docs/manifest/workspaces.yml` |
| `docs/manifest/user-guides/**` (4 files) |
`docs/manifest/workspaces/**` |

## Redirects added

| Source | Destination |
| --- | --- |
| `/docs/user-guides` | `/docs/workspaces` |
| `/docs/user-guides/:path*` | `/docs/workspaces/:path*` |

Updated existing rules so none of them chain through the new wildcard:

| Source | Old destination | New destination |
| --- | --- | --- |
| `/docs/ai-coder/ide-agents` | `/docs/user-guides/workspace-access` |
`/docs/workspaces/workspace-access` |
| `/docs/tutorials/best-practices/speed-up-templates` |
`/docs/user-guides/speed-up-templates` |
`/docs/workspaces/speed-up-templates` |
| `/docs/tutorials/cloning-git-repositories` |
`/docs/user-guides/cloning-git-repositories` |
`/docs/workspaces/cloning-git-repositories` |
| `/docs/tutorials/persistent-shared-workspaces` |
`/docs/user-guides/persistent-shared-workspaces` |
`/docs/workspaces/persistent-shared-workspaces` |

**coder.com and router static redirects:** a chain simulation of
coder.com's and the router's static rules together with this branch's
`docs/redirects.json` finds one problem from this PR. The static
`/docs/workspaces` → `/docs/user-guides/workspace-management` rule in
both repos would hide the new `docs/workspaces/index.md` behind a
redirect to `/docs/workspaces/workspace-management`.
coder/coder.com#1201 and coder/docs-engine#304 remove it, together with
the Templates loops from #31645, once a release with this layout is the
docs mainline. If this PR ships in a later release than #31645, drop the
`/docs/workspaces` part of those PRs until then. The other static
`/docs/user-guides/...` destinations there still work; each now takes
two redirects.

## Deviations from the proposal

- **Not in Proposal 1.** The proposal only renamed the sidebar title.
This folder rename was requested afterward so the folder-driven renderer
shows the same name.
- **Generated files belong to commit 2.** Commit 1 doesn't edit
generated docs. They change only through their sources and `make gen`.
- **Left unchanged on purpose:**
  - `docs/images/user-guides/` keeps its name, as requested.
- `.github/workflows/test-docs-preview-mapper.sh` uses
`docs/user-guides/...` as synthetic fixture paths.
- `docs/templates/extending-templates/jetbrains-airgapped.md` has a
"file a GitHub issue" link whose URL-encoded body names
`coder.com/docs/user-guides/workspace-access/jetbrains/jetbrains-airgapped`.
That URL was already wrong before this PR (the page lives under
`templates/`), and it only pre-fills an issue body, so I left it.
- Database migrations and notification golden files: none of them
contain `user-guides` links.

## Open questions for Nick

1. Should `docs/images/user-guides/` be renamed to
`docs/images/workspaces/` in a follow-up, or stay as is?
2. Frontend review nits on existing code that this PR only touched; I
didn't change them:
- `UserDropdownContent.tsx` defines `CODER_DESKTOP_DOCS_URL` as a
hardcoded `https://coder.com/docs/...` URL instead of
`docs("/workspaces/desktop")`, which `SSHButton.tsx` uses for the same
page.
- The `UserDropdown` and `SecretsPageView` stories' `play` functions
only assert link attributes.

## Post-release follow-up

After a release that includes this stack becomes the default docs
version on coder.com, point these hardcoded URLs at the new paths. They
work today and redirect after the release. Anchors are unchanged. Rerun
`make gen` afterward to update the CLI golden files,
`docs/reference/cli/sharing/{add,remove}.md`, and
`examples/examples.gen.json`.

| Current (old) URL | Post-release URL | Files |
| --- | --- | --- |
| `https://coder.com/docs/user-guides/desktop` |
`https://coder.com/docs/workspaces/desktop` |
`site/src/modules/dashboard/Navbar/UserDropdown/UserDropdownContent.tsx`,
`UserDropdown.stories.tsx` |
| `https://coder.com/docs/user-guides/devcontainers` |
`https://coder.com/docs/workspaces/devcontainers` | `README.md` |
| `https://coder.com/docs/user-guides/shared-workspaces` |
`https://coder.com/docs/workspaces/shared-workspaces` | `cli/sharing.go`
(CLI help, 2 places) |
| `https://coder.com/docs/user-guides/workspace-access` |
`https://coder.com/docs/workspaces/workspace-access` | `README.md` |
|
`https://coder.com/docs/user-guides/workspace-access/jetbrains/toolbox`
| `https://coder.com/docs/workspaces/workspace-access/jetbrains/toolbox`
| `examples/templates/docker/main.tf` |
| `https://coder.com/docs/user-guides/workspace-dotfiles` |
`https://coder.com/docs/workspaces/workspace-dotfiles` |
`coderd/templatebuilder/bases/{azure-linux,docker,kubernetes}/README.md`,
`examples/templates/{azure-linux,docker,kubernetes}/README.md` |
| `https://coder.com/docs/user-guides/workspace-management` |
`https://coder.com/docs/workspaces/workspace-management` | `README.md`,
`coderd/templatebuilder/bases/{aws-linux,aws-windows,azure-linux,digitalocean-linux,docker,kubernetes}/README.md`,
`examples/templates/{aws-linux,aws-windows,azure-linux,azure-windows,digitalocean-linux,docker-devcontainer,docker-envbuilder,docker,kubernetes-devcontainer,kubernetes,nomad-docker}/README.md`,
`site/src/api/queries/workspaces.ts` (JSDoc) |

## Validation run

- `make gen/docs-manifest`: clean diff afterward.
- `make lint/docs-manifest`, `lint/docs-redirects` (`-base
docs/ia-tutorials-nav`: 36 rules OK), `lint/docs-html`, `lint/emdash`:
pass.
- `pnpm check-docs` (markdownlint + table formatter): pass.
- Vale over `docs/`: identical to `docs/ia-tutorials-nav` (12 warnings,
1 error, 645 suggestions, all pre-existing).
- Local relative-link check over `docs/**/*.md`: 0 unresolved (3410
links and images in 498 files).
- `grep -rn user-guides docs/` finds only `docs/redirects.json`, image
paths under `docs/images/user-guides/`, and the issue link above.
- Pre-commit hook: `make pre-commit-light` on the docs commit, and the
full `make pre-commit` (gen, fmt, lint/go, lint/ts, build, and others)
on the chore commit. `make gen` left a clean tree.
- Targeted tests:
- Go: `go test ./cli -run TestCommandHelp`, `./examples/...`,
`./coderd/templatebuilder/...`.
- Site: Vitest for the touched directories (22 files, 409 tests), and
the `UserDropdown` and `SecretsPageView` story tests (2 files, 59
tests).
- Every `docs()` path and `coder.com/docs` URL in the chore diff
resolves to a page and heading in this branch.
- Frontend deep review (all 8 roles) on the `site/` diff: no blocking or
should-fix findings; the nits are in question 2.
- Restacked on the rebased `docs/ia-tutorials-nav` (on `main` at
`ccf5ec74ae`). After the restack, `make gen/docs-manifest` (clean),
`lint/docs-manifest`, `lint/docs-redirects` (36 rules OK),
`lint/docs-html`, `lint/emdash`, `pnpm check-docs`, and the
relative-link and anchor check over the changed pages pass.
- Page counts: `docs/**/*.md` (excluding `.style`) 485 → 485;
`manifest.json` routes 482 → 482 (moves only).
- **Link health (commit 3):**
- linkspector 0.5.6 with `.github/.linkspector.yml` over all of `docs/`,
like the weekly docs job, run locally.
- `origin/main`: 0 errors. Before the fix (`7382a41faa`): 11 errors. 10
were `https://coder.com/docs/<new path>` 404s: the 6 from #31645 plus 4
`workspaces/...` URLs. The 11th was a transient Red Hat URL failure in
`install/server/openshift.md`, which is unchanged from `main` and passed
on reruns. After the fix (`c1f287fc1b`): 0 errors. Nothing is new
compared with `main`.
- After the fix: `make gen/docs-manifest` (clean), `lint/docs-manifest`,
`lint/docs-redirects` (36 rules OK against `docs/ia-tutorials-nav`),
`lint/docs-html`, `lint/emdash`, `pnpm check-docs`, and the
relative-link check (0 unresolved in 3419 links) pass. The full `make
pre-commit`, including `make gen`, passed on the commit.
- Outside `docs/`, no line in this stack adds an unversioned
`coder.com/docs` URL compared with `main`.
  - Tests after the fix:
- Go: `go test ./cli -run 'TestCommandHelp|TestServerYAMLConfig'`,
`./examples/...`, `./coderd/templatebuilder/...`, `./cli/cliui`.
- Site: Vitest for the touched directories (21 files, 404 tests), and
the `UserDropdown` story tests (28 tests).
- **Skipped:** the docs-engine sync check, which was not available in
this environment.

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

- Same one-shot move script as PRs A to C, with a single rule,
`docs/user-guides/` → `docs/workspaces/`. It resolves each relative link
against the page's old directory, maps the target through the move,
recomputes it from the new directory, and also rewrites
`coder.com/docs/...` and
`github.com/coder/coder/(blob|edit|tree)/main/docs/...` URLs. It skips
fenced code blocks and inline code, and refuses to run on a dirty
`docs/` tree.
- After #31645 and #31647 got their link-health fixes, a plain rebase of
this branch conflicted in `esr-2.24-2.29-upgrade.md`, where both changed
the same table rows. Instead of resolving by hand, I rebuilt the docs
and chore commits from the fixed `docs/ia-tutorials-nav` with the same
scripts. The resulting docs commit differs from the earlier one only by
#31645's fix, and the chore commit touches the same 36 files.
- No hand edits were needed in the docs commit. The sidebar sources were
renamed with `git mv` and their `path`/`include` prefixes rewritten.
- The redirect script repointed every existing destination under
`/docs/user-guides` before appending the two new rules.
- Restacked on 2026-11-03 onto `docs/ia-tutorials-nav` at `76aed1a618`.
The chore commit conflicted with #31603 in
`site/src/pages/WorkspacesPage/WorkspaceHelpPopover.tsx`; both links
keep `main`'s `target="_blank" rel="noreferrer"` with only the path
changed, and the `WorkspacesPage` Vitest suite (24 tests) passes. Folded
into the docs commit: the `../user-guides/` links in
`docs/coder-agents/bring-your-own-mcp-servers.md`, a page `main` added,
now point at `../workspaces/`.

</details>

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Co-authored-by: Nick Vigilante <nick.vigilante@coder.com>
2026-11-04 17:41:22 -05:00
coder[bot]andNick Vigilante f97eee3c49 docs: redistribute tutorials and rename top-level sidebar sections (#31647)
> [!NOTE]
> Generated by Coder Agents. The branch and this description were
written by an AI agent and need human review.

## Summary

Third of three stacked PRs for the docs IA overhaul (Proposal 1,
sections 1 and 4). This PR dissolves Tutorials and finishes the
top-level nav.

- **Tutorials redistribution.** Every remaining `docs/tutorials/` page
moves to the section it belongs to (`git mv`, table below). The
`tutorials/index.md` and `tutorials/best-practices/index.md` hub pages
are deleted, so `docs/tutorials/` no longer exists. That matters for the
folder-driven beta renderer: no stray "Tutorials" group is left.
`example-guide.md` was already deleted on `main` in #30711.
- **Duplicate Tutorials entries are dropped.** Each of these pages stays
in the sidebar at its real location: Quickstart, Image management, JFrog
Artifactory, Island browser integration, Deploy Coder on Azure with an
Application Gateway, Pre-install JetBrains IDEs, and JetBrains IDEs
air-gapped. Scale Coder was also a duplicate, already listed under
Install > Validate > Scale testing, and it stays there.
- **Istio** (`admin/integrations/istio.md`) gets its sidebar entry under
Administration > Integrations, after Island. Before this PR, only
Tutorials linked to it.
- **Nav renames.**
- About becomes **Home**, with no children; `about.yml` is renamed
`home.yml`. A third commit, `docs: title the docs landing page Home`,
changes the `docs/README.md` front matter title from About to Home and
deletes the stale HTML comment that said the first section must be
titled About.
  - Quickstart becomes **Get started**.
  - User guides becomes **Workspaces**.
- **Support** (with Support bundle) becomes a top-level section and goes
last; `about/support.yml` moves to `support.yml`.
- **Screenshots.** Nothing to do here: #31465 already deleted
`about/screenshots.md` on `main` and added its redirect.
- **Final top-level order:** Home, Get started, Install, Templates,
Workspaces, Coder Agents, AI Governance, Agent Relay, MCP server,
Administration, Reference, Support.
- Commit 2, `chore: point in-product docs links at the new docs paths`,
makes two edits outside `docs/`. You can drop it.
- `README.md`: the `docs/about#why-coder` link now points to
`docs#why-coder`.
- `cli/server.go`: the built-in PostgreSQL error message now links to
`install/server/external-database`.
- The last commit, `fix: keep docs links healthy before the release`,
reverts both of those back to the URLs that are live today
(`https://coder.com/docs/about#why-coder` and
`https://coder.com/docs/tutorials/external-database`). Both are
hardcoded, unversioned `https://coder.com/docs/...` URLs, and the new
paths 404 on the live site until a release that includes this stack
becomes the default. See "Post-release follow-up". No hand-written page
in this PR's moves had an absolute `coder.com/docs` link to a moved
page, so `docs/` needed no changes. Net, this PR changes nothing outside
`docs/`.

Stack: `docs/ia-ai-sections` (with Templates squash-merged in #31646) →
**this PR** → `docs/ia-workspaces-folder` (folder rename).

Refs: Linear DOCS-1154, DOCS-1179.

## Move map

| Old | New | Sidebar position |
| --- | --- | --- |
| `tutorials/configuring-okta.md` |
`admin/users/oidc-auth/configuring-okta.md` | Administration > Users >
OpenID Connect (last) |
| `tutorials/best-practices/organizations.md` |
`admin/users/organizations-best-practices.md` | Administration > Users,
after Organizations |
| `tutorials/best-practices/security-best-practices.md` |
`admin/security/security-best-practices.md` | Administration > Security
(last) |
| `tutorials/reverse-proxy-apache.md` |
`admin/networking/reverse-proxy-apache.md` | Administration >
Networking, before Troubleshooting |
| `tutorials/reverse-proxy-caddy.md` |
`admin/networking/reverse-proxy-caddy.md` | same |
| `tutorials/reverse-proxy-nginx.md` |
`admin/networking/reverse-proxy-nginx.md` | same |
| `tutorials/gcp-to-aws.md` | `install/operate/gcp-to-aws.md` | Install
> Operate, before Uninstall |
| `tutorials/azure-federation.md` |
`install/operate/azure-federation.md` | same |
| `tutorials/image-pull-secret.md` |
`install/operate/image-pull-secret.md` | same |
| `tutorials/postgres-ssl.md` | `install/server/postgres-ssl.md` |
Install > Install the control plane (last) |
| `tutorials/external-database.md` |
`install/server/external-database.md` | same (**deviation**, see below)
|
| `tutorials/best-practices/scale-coder.md` |
`install/validate/scale-coder.md` | unchanged: Install > Validate >
Scale testing |
| `tutorials/faqs.md` | `reference/faqs.md` | Reference (last) |
| `tutorials/persistent-shared-workspaces.md` |
`user-guides/persistent-shared-workspaces.md` | Workspaces, after Shared
workspaces |
| `tutorials/cloning-git-repositories.md` |
`user-guides/cloning-git-repositories.md` | Workspaces (end) |
| `tutorials/best-practices/speed-up-templates.md` |
`user-guides/speed-up-templates.md` | Workspaces (end) |
| `tutorials/index.md` | deleted | |
| `tutorials/best-practices/index.md` | deleted | |

All paths are relative to `docs/`. Every relative link and image path is
fixed, in moved pages and in pages that link to them, including the
`github.com/coder/coder/edit/main/docs/...` link in the FAQ page and the
link to the build timeline in
`templates/extending-templates/script-ordering.md`, which is new on
`main`.

## Redirects added

| Source | Destination |
| --- | --- |
| `/docs/tutorials/azure-federation` |
`/docs/install/operate/azure-federation` |
| `/docs/tutorials/best-practices/organizations` |
`/docs/admin/users/organizations-best-practices` |
| `/docs/tutorials/best-practices/scale-coder` |
`/docs/install/validate/scale-coder` |
| `/docs/tutorials/best-practices/security-best-practices` |
`/docs/admin/security/security-best-practices` |
| `/docs/tutorials/best-practices/speed-up-templates` |
`/docs/user-guides/speed-up-templates` |
| `/docs/tutorials/cloning-git-repositories` |
`/docs/user-guides/cloning-git-repositories` |
| `/docs/tutorials/configuring-okta` |
`/docs/admin/users/oidc-auth/configuring-okta` |
| `/docs/tutorials/external-database` |
`/docs/install/server/external-database` |
| `/docs/tutorials/faqs` | `/docs/reference/faqs` |
| `/docs/tutorials/gcp-to-aws` | `/docs/install/operate/gcp-to-aws` |
| `/docs/tutorials/image-pull-secret` |
`/docs/install/operate/image-pull-secret` |
| `/docs/tutorials/persistent-shared-workspaces` |
`/docs/user-guides/persistent-shared-workspaces` |
| `/docs/tutorials/postgres-ssl` | `/docs/install/server/postgres-ssl` |
| `/docs/tutorials/reverse-proxy-apache` |
`/docs/admin/networking/reverse-proxy-apache` |
| `/docs/tutorials/reverse-proxy-caddy` |
`/docs/admin/networking/reverse-proxy-caddy` |
| `/docs/tutorials/reverse-proxy-nginx` |
`/docs/admin/networking/reverse-proxy-nginx` |
| `/docs/tutorials/best-practices` | `/docs` (deleted hub, **please
confirm**) |
| `/docs/tutorials` | `/docs` (deleted hub, **please confirm**) |
| `/docs/about` | `/docs` |

Exact rules are used instead of a `/docs/tutorials/:path*` wildcard,
because the pages went to many different sections. The `/docs/about`
rule stays: classic coder.com adds the `/docs/about` alias only when the
first section is titled About, so after the rename that URL needs the
redirect. `/docs/about/screenshots` → `/docs` is already on `main`
(#31465), so this PR doesn't add it.

**coder.com and router static redirects:** a chain simulation of
coder.com's and the router's static rules together with this branch's
`docs/redirects.json` finds no loops or hidden pages from this PR. The
static `/docs/tutorials/...` and `/docs/about` rules there still work;
some now take two redirects. The only loops in the stack come from the
Templates move; see #31645, coder/coder.com#1201, and
coder/docs-engine#304.

## Deviations from the proposal

- **`external-database.md` goes to `install/server/`, not
`templates/`.** The page covers the control plane's PostgreSQL database,
so it sits next to `postgres-ssl.md`.
- **Dead links to the Tutorials hub.**
- `admin/index.md` linked to "Tutorials and FAQs"; it now links to the
FAQs only.
- The style guide's link-wording examples in
`docs/.style/style-guide/word-choice.md` linked "Quickstart" to
`tutorials/index.md`; they now link to `get-started/index.md`.
- **Support icon.** Top-level sections have icons, so Support gets
`info.svg`.
- **Home title.** Titling the first section Home was checked against
both renderers. Classic coder.com renders `/docs` from its own landing
component, and docs-engine maps `README.md` to the root page and already
titles it Home. `docs/README.md` stays in place, because classic serves
`/docs.md` from it and docs-preview references it. Its front matter
title is now Home, and the warning comment about the About title is
gone.
- **Other page titles not changed.** Only the sidebar titles changed.
The front matter titles of `get-started/index.md` and
`user-guides/index.md` stay as they are.
- **Proposal page count.** The proposal expected 469 pages, measured
against an older `main`. Current `main` already differs, so I report
counts below instead of matching that number.

## Open questions for Nick

1. Confirm the redirect targets for the two deleted hubs (both `/docs`).
2. `speed-up-templates.md` lands in Workspaces, as the proposal says,
but it is mostly about template build performance. Should it go to
Templates instead?
3. Confirm `external-database.md` under Install (see PR B).
4. The sidebar sources still live under `docs/manifest/`, mirroring the
new folders (`home.yml`, `support.yml`, and so on). Moving them next to
the Markdown files is the follow-up PR waiting on the naming decision
(DOCS-1154).

## Post-release follow-up

After a release that includes this stack becomes the default docs
version on coder.com, point these hardcoded URLs at the new paths. They
work today and redirect after the release.

| Current (old) URL | Post-release URL | Files |
| --- | --- | --- |
| `https://coder.com/docs/about#why-coder` |
`https://coder.com/docs#why-coder` | `README.md` |
| `https://coder.com/docs/tutorials/external-database` |
`https://coder.com/docs/install/server/external-database` |
`cli/server.go` (built-in PostgreSQL error message) |

## Validation run

- `make gen/docs-manifest`: clean diff afterward.
- `make lint/docs-manifest`, `lint/docs-redirects` (`-base
docs/ia-templates`: 34 rules OK), `lint/docs-html`, `lint/emdash`: pass.
- `pnpm check-docs` (markdownlint + table formatter): pass.
- Vale over `docs/`: the same 12 warnings and 1 error as `main`, all
pre-existing (suggestions: 645, the same as PRs A and B).
- Local relative-link check over `docs/**/*.md`: 0 unresolved.
- Pre-commit hook: `make pre-commit-light` on both docs commits, and the
full `make pre-commit` on the chore commit. `make gen` left a clean
tree.
- After the Home title commit, the full docs lint set above was re-run
and passed again (34 redirect rules OK, 0 unresolved links). Vale on
`docs/README.md` shows only its pre-existing alert.
- Restacked on the rebased `docs/ia-ai-sections` (on `main` at
`ccf5ec74ae`). After the restack, `make gen/docs-manifest` (clean),
`lint/docs-manifest`, `lint/docs-redirects` (34 rules OK),
`lint/docs-html`, `lint/emdash`, `pnpm check-docs`, and the
relative-link and anchor check over the changed pages pass.
- **Link health (fix commit):**
- linkspector 0.5.6 with `.github/.linkspector.yml` over all of `docs/`,
like the weekly docs job, run locally.
- `origin/main`: 0 errors. This branch before the fix (`5fe2b627df`, on
the pre-fix `docs/ia-ai-sections`): the same 6
`https://coder.com/docs/<new path>` 404s as #31645, plus a transient Red
Hat URL failure in `install/server/openshift.md`. That URL is unchanged
from `main`, and it passed on reruns. After rebasing onto the fixed
`docs/ia-ai-sections` and adding this fix (`c664641e1e`): 0 errors.
Nothing is new compared with `main`.
- After the fix: `make gen/docs-manifest` (clean), `lint/docs-manifest`,
`lint/docs-redirects` (34 rules OK against `docs/ia-ai-sections`),
`lint/docs-html`, `lint/emdash`, `pnpm check-docs`, and the
relative-link check (0 unresolved) pass. The full `make pre-commit`
passed on the commit.
- Page counts across the stack:

| | `main` | after A | after B | after C |
| --- | --- | --- | --- | --- |
| `docs/**/*.md` (excl. `.style`) | 490 | 487 | 487 | 485 |
| `manifest.json` routes | 495 | 492 | 492 | 482 |

The 10 routes removed in C are the 2 Tutorials hubs, 7 duplicate
Tutorials entries, and the duplicate Scale Coder entry. The Istio entry
moved, so it nets to zero.
- **Skipped:** the docs-engine sync check, which was not available in
this environment.

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

- Rebuilt on the new `docs/ia-templates`, which is based on `main` at
`9839406ff7` (2026-11-02). After #31646 squash-merged PR B into
`docs/ia-ai-sections`, this branch was rebased onto it with `git rebase
--onto`; the tree didn't change. It was rebased again onto
`docs/ia-ai-sections` after #31645's link-health fix commit
(`def074caab`), which applied cleanly.
- Restacked on 2026-11-03 onto `docs/ia-ai-sections` at `4c356c6314`,
after #31645 was rebased onto `main` at `ccf5ec74ae`. The restack
applied cleanly. Folded into the docs commit: the links between
`shared-workspaces.md` and `persistent-shared-workspaces.md` that `main`
added in #31152 now resolve from the moved page. `git range-diff`
against the previous head (`c664641e1e`) shows only those changes and
the sidebar entry `main` added for Bring your own MCP servers.
- The same one-shot move script as PRs A and B did the move and link
pass from a clean tree. Run on the old base, it reproduced the old
commit except for the three hand edits listed under Deviations (dead
Tutorials hub links), which were reapplied by hand.
- The sidebar changes were applied with a three-way merge of each YAML
file from the earlier version of this branch onto the current files, so
entries added on `main` since then (for example Nix(OS) under
Integrations) stay in place.
- Changes from the earlier version of this branch: the Screenshots page
and its redirect are gone from this PR, because #31465 did both on
`main`. `admin/index.md` was reworded on `main`, and the Tutorials hub
link was removed from the new wording. One more page link is fixed
(`script-ordering.md`).

</details>

<details>
<summary>CI flake on <code>70232dbbfb</code></summary>

The `fmt` job failed because GitHub canceled the step on the Depot
runner, before any formatting ran. A rerun of the failed jobs passed.

</details>

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Co-authored-by: Nick Vigilante <nick.vigilante@coder.com>
2026-11-04 17:30:25 -05:00
coder[bot]andNick Vigilante a7f3e3b685 docs: promote the AI sections and Templates to the top level of the sidebar (#31645)
> [!NOTE]
> Generated by Coder Agents. The branch and this description were
written by an AI agent and need human review.

## Summary

First of three stacked PRs for the docs IA overhaul (Proposal 1, section
3). This PR dissolves `docs/ai-coder/` into four top-level sidebar
sections, in this order, where "Run AI coding agents in Coder" used to
be: **Coder Agents**, **AI Governance** (with Agent Firewall and AI
Gateway nested under it), **Agent Relay**, and **MCP server**.

- Files move with `git mv`, so `git log --follow` keeps their history.
The move includes every file in the moved folders, including pages that
are not in the sidebar, such as `agent-firewall/example-policy.md`, and
pages added to `main` after the first version of this PR, such as
`agents/projects.md` (#30684) and `agents/acp-subagents.md` (#31430).
- `docs/ai-coder/index.md`, `best-practices.md`, and `ide-agents.md` are
deleted. Each has a redirect (see below).
- `docs/manifest/` mirrors the new folders: `coder-agents.yml` (+
`coder-agents/`), `ai-governance.yml` (+ `ai-governance/`),
`agent-relay.yml`, and `mcp-server.yml`. `ai-coder.yml` is deleted. The
Projects and ACP subagents entries from `main` move with Coder Agents.
- Every relative link and image path is fixed, both in the moved pages
(their base directory changed) and in pages that link to them. This was
done in one scripted pass from a clean `main` checkout. Every link was
then checked to resolve on disk.
- Commit 2, `chore: point in-product docs links at the new docs paths`,
updates docs URLs outside `docs/`: `site/` `docs()` links, Go error
strings and comments, `README.md`, `server.json`, templatebuilder
modules, and the doc-check skill. Commit 4 reverts the unversioned
`https://coder.com/docs/...` URLs among them (see below), so after this
PR only these differ from `main` outside `docs/`: the `site/` `docs()`
links, the versioned `cli/cliui` troubleshooting links, and repo file
paths in comments and the doc-check skill's examples
(`docs/coder-agents/...`, `docs/templates/...`). You can drop commit 2;
the redirects cover the old URLs.
- **#31646 (Templates) was squash-merged into this branch** as
`98377a3a3b`. This PR now also carries the Templates move
(`docs/admin/templates/**` → `docs/templates/**`, plus
`template-from-scratch.md` and `testing-templates.md`) and its chore
changes. Refer to #31646 for that part's move map, redirects, and
review.
- Commit 4, `fix: keep docs links healthy before the release`, keeps
links working on the live site until a release that includes this stack
becomes the default docs version:
- Hand-written pages that linked to moved pages with absolute
`https://coder.com/docs/...` URLs now use relative links, anchors kept.
The new paths 404 on the live site today, but relative links resolve for
every version and are checked locally.
- Hardcoded, unversioned `https://coder.com/docs/<new path>` URLs
outside `docs/` that the chore commits introduced (Go strings including
the prebuilds metric help, CLI help, the
`agentFallbackTroubleshootingURL` default, `README.md`, `server.json`,
examples, templatebuilder files, and one `site/` constant) go back to
their current paths. Then `make gen` regenerated the generated table in
`docs/admin/integrations/prometheus.md`,
`scripts/metricsdocgen/generated_metrics`, the CLI golden files, and
`docs/reference/cli/templates/{create,edit}.md`. See "Post-release
follow-up".
- The `site/` `docs()` changes and the `cli/cliui` links stay, because
those URLs are versioned (`/docs/@vX.Y.Z/...`) and resolve once the
release ships.
- Commit 5, `docs: prefix relative links in the moved pages with ./`,
adds `./` to 13 relative links that the move script wrote without it, in
`docs/mcp-server.md` and three Templates pages.
They resolved, but every other relative link in the docs starts with
`./` or `../`.
- Commit 6, `docs: keep the coding agent module guidance in the
templates docs`, adds an **AI agent modules** section to
`docs/templates/extending-templates/modules.md`.
Deleting `docs/ai-coder/index.md` removed the only instructions for
adding a terminal coding agent to a template with a registry module.
The example (`registry.coder.com/coder/claude-code/coder`, `version =
"~> 5.2"`) passes `terraform validate`, and the Template Builder labels
it cites match `site/src/pages/TemplateBuilder/ModuleSelectStep.tsx`.

Stack: **this PR** (with #31646 squash-merged in) →
`docs/ia-tutorials-nav` (#31647, Tutorials + nav renames) →
`docs/ia-workspaces-folder` (#31650, folder rename).

Refs: Linear DOCS-1154, DOCS-1179, and DOCS-1479 for the coder.com and
router redirect fix.

## Move map

| Old | New |
| --- | --- |
| `docs/ai-coder/agents/**` (25 files) | `docs/coder-agents/**` |
| `docs/ai-coder/ai-governance.md` | `docs/ai-governance/index.md` |
| `docs/ai-coder/agent-firewall/**` (9 files) |
`docs/ai-governance/agent-firewall/**` |
| `docs/ai-coder/ai-gateway/**` (26 files) |
`docs/ai-governance/ai-gateway/**` |
| `docs/ai-coder/agent-relay/**` (3 files) | `docs/agent-relay/**` |
| `docs/ai-coder/mcp-server.md` | `docs/mcp-server.md` |
| `docs/ai-coder/index.md` | deleted |
| `docs/ai-coder/best-practices.md` | deleted |
| `docs/ai-coder/ide-agents.md` | deleted |

## Redirects added

Appended to `docs/redirects.json`, using the absolute `/docs/...` format
that `main` validates today. Wildcards cover every page under each moved
folder, including pages that are not in the sidebar and the pages added
to `main` since the first version of this PR.

| Source | Destination |
| --- | --- |
| `/docs/ai-coder` | `/docs/coder-agents` (deleted hub, **please
confirm**) |
| `/docs/ai-coder/best-practices` | `/docs/coder-agents` (deleted,
**please confirm**) |
| `/docs/ai-coder/ide-agents` | `/docs/user-guides/workspace-access`
(deleted, **please confirm**) |
| `/docs/ai-coder/ai-governance` | `/docs/ai-governance` |
| `/docs/ai-coder/mcp-server` | `/docs/mcp-server` |
| `/docs/ai-coder/agents/:path*` | `/docs/coder-agents/:path*` |
| `/docs/ai-coder/agent-firewall/:path*` |
`/docs/ai-governance/agent-firewall/:path*` |
| `/docs/ai-coder/ai-gateway/:path*` |
`/docs/ai-governance/ai-gateway/:path*` |
| `/docs/ai-coder/agent-relay/:path*` | `/docs/agent-relay/:path*` |

None of the 3 existing rules in `docs/redirects.json` points into
`ai-coder/`, so no destinations needed updating.

**coder.com and router static redirects.**
coder.com applies its own `redirects.json` and the rules it generates
from this file before it hands `/docs` to the docs-engine router, which
applies its own static `redirects.json` before the page.
Three older static rules in both repos send `/docs/templates`,
`/docs/templates/open-in-coder`, and `/docs/templates/troubleshooting`
to `/docs/admin/templates/...`, and the `/docs/admin/templates/:path*`
rule here sends them back, so each loops once a release with this layout
is the docs mainline.
A static `/docs/workspaces` rule would also hide the new
`docs/workspaces/index.md` page from #31650.
coder/coder.com#1201 and coder/docs-engine#304 (draft, DOCS-1479) remove
those rules; they must merge when that release becomes the mainline, not
before, because the old-layout mainline still needs them.
A chain simulation of every page and static source on each branch of
this stack finds no other loops or hidden pages.
The `/docs/ai-coder/...` and other legacy rules there still work; some
now take two redirects.

## Deviations from the proposal

- **Glossary "IDE agent" entry.** The proposal says to remove this link
and leave plain text. I pointed it at Access your workspace
(`docs/user-guides/workspace-access/index.md`) instead, the same page
the `ide-agents` redirect uses, because "Refer to IDE agents." with no
link reads as a dead end. The "Coding agent" entry now links to Coder
Agents, as the proposal says.
- **Top-level icons.** The new sections need icons. I chose `wand.svg`
(Coder Agents, the old ai-coder icon), `ai_intelligence.svg` (AI
Governance), `link.svg` (Agent Relay), and `plug.svg` (MCP server).
- **Coding agent module guidance.** Kept on the Reuse template code page
(commit 6) instead of deleted with `docs/ai-coder/index.md`. The
best-practices and IDE-agent pages are deleted as proposed.
- **Order relative to Administration.** In this PR the four sections sit
where `ai-coder` was, after Administration. PR C moves Administration
after MCP server to reach the final order.
- **`docs/mcp-server.md` repo link.** A relative link to
`codersdk/toolsdk/toolsdk.go`, outside `docs/`, was re-based for the new
depth.
- **Left unchanged on purpose:**
- Database migrations and the notification `.golden` files rendered from
them still contain `coder.com/docs/ai-coder/...` URLs. Existing
migrations can't be edited, so those links rely on the redirects.
- `aibridge/client/client.go` links to a commit-pinned GitHub permalink,
which still resolves.
- Test fixtures in `scripts/docsredirectscheck` and
`.github/workflows/test-docs-preview-mapper.sh` use `ai-coder` as sample
data.
-
`site/src/pages/AgentsPage/components/ChatElements/tools/Tool.stories.tsx`
uses `https://coder.com/docs/ai-coder/ai-gateway` as a sample web search
result. Changing it would only change a visual snapshot.

## Open questions for Nick

1. Do you agree with the three redirect targets for the deleted pages
above?
2. Should the "IDE agent" glossary entry link to Access your workspace
(current) or be plain text (proposal)?
3. Are the icons for the new top-level sections OK?
4. Open PRs that touch the moved files, checked with `git merge-tree`
against this branch. I didn't change them.
- #31169 merges cleanly: Git's rename detection carries its edit to
`docs/ai-governance/ai-gateway/clients/claude-code.md`, and its new
relative link still resolves at the new path.
- #30262 now targets `tk/ai-gateway-responses-ws-endpoint` and conflicts
with `main` in 21 files. Against this branch it conflicts in the same 21
files, with `codex.md` at its new path, so this PR doesn't add new
conflicts. Its new relative links still resolve after the move.
- #30805 conflicts in `docs/redirects.json`. It already conflicts with
`main` there, because `main` added the `/docs/about/screenshots` and
`/docs/install/cli` rules.

## Release

No backport to `release/2.39` for now; Nick may apply it by hand later.
A cherry-pick of this branch onto `release/2.39` conflicts in 25 files,
and #31647 and #31650 would need the same treatment to keep the stack
together.
coder/coder.com#1201 and coder/docs-engine#304 merge when the first
release line that carries this layout becomes the docs mainline (2.38
today).

## Known limitations

- **CLI newer than its server.** The `cli/cliui` troubleshooting links
append `/templates/troubleshooting#...` to the server's versioned docs
URL.
A CLI from this release against an older server prints
`/docs/@v2.38.x/templates/troubleshooting#...`.
The router's static
`/docs/templates/:page(open-in-coder|troubleshooting)` rule redirects
that to the old page today, but coder/docs-engine#304 removes that rule
to fix the loop, so after the cutover that case gets the version's
not-found page.

## Post-release follow-up

After a release that includes this stack becomes the default docs
version on coder.com, point these hardcoded URLs at the new paths. They
work today and redirect after the release, so nothing breaks in the
meantime. Anchors are unchanged. Rerun `make gen` afterward to update
`docs/admin/integrations/prometheus.md`,
`scripts/metricsdocgen/generated_metrics`, the CLI golden files, and
`docs/reference/cli/templates/{create,edit}.md`.

| Current (old) URL | Post-release URL | Files |
| --- | --- | --- |
| `https://coder.com/docs/ai-coder/agents` |
`https://coder.com/docs/coder-agents` |
`.claude/skills/doc-check/output.md`, `README.md` |
| `https://coder.com/docs/ai-coder/agents/architecture` |
`https://coder.com/docs/coder-agents/architecture` |
`coderd/x/chatd/chattool/execute_test.go`,
`codersdk/toolsdk/workspacetools/execute.go` |
| `https://coder.com/docs/ai-coder/ai-gateway` |
`https://coder.com/docs/ai-governance/ai-gateway` | `README.md`,
`coderd/templatebuilder/modules/claude-code/module.json`,
`coderd/templatebuilder/modules/codex/module.json` |
| `https://coder.com/docs/ai-coder/mcp-server` |
`https://coder.com/docs/mcp-server` | `server.json` |
| `https://coder.com/docs/admin/templates` |
`https://coder.com/docs/templates` | `README.md` |
|
`https://coder.com/docs/admin/templates/extending-templates/docker-in-workspaces`
|
`https://coder.com/docs/templates/extending-templates/docker-in-workspaces`
| `examples/templates/docker-devcontainer/main.tf` |
|
`https://coder.com/docs/admin/templates/extending-templates/parameters`
| `https://coder.com/docs/templates/extending-templates/parameters` |
`examples/parameters-dynamic-options/README.md`,
`examples/parameters/README.md`, `examples/parameters/main.tf`,
`examples/templates/kubernetes-envbox/README.md`,
`examples/workspace-tags/README.md` |
|
`https://coder.com/docs/admin/templates/extending-templates/prebuilt-workspaces`
|
`https://coder.com/docs/templates/extending-templates/prebuilt-workspaces`
| `coderd/prebuilds/api.go`,
`enterprise/coderd/prebuilds/metricscollector.go` (metric help text) |
|
`https://coder.com/docs/admin/templates/extending-templates/workspace-tags`
| `https://coder.com/docs/templates/extending-templates/workspace-tags`
| `examples/workspace-tags/README.md` |
| `https://coder.com/docs/admin/templates/managing-templates` |
`https://coder.com/docs/templates/managing-templates` |
`cli/templatecreate.go`, `cli/templateedit.go` (CLI help) |
|
`https://coder.com/docs/admin/templates/managing-templates/image-management`
| `https://coder.com/docs/templates/managing-templates/image-management`
| `coderd/templatebuilder/bases/docker/README.md`,
`coderd/templatebuilder/bases/kubernetes/README.md` |
| `https://coder.com/docs/admin/templates/troubleshooting` |
`https://coder.com/docs/templates/troubleshooting` |
`agent/agentscripts/agentscripts.go`,
`coderd/render/escape_internal_test.go`, `codersdk/deployment.go`
(`agentFallbackTroubleshootingURL` default) |
| `https://coder.com/docs/tutorials/template-from-scratch` |
`https://coder.com/docs/templates/template-from-scratch` |
`site/src/pages/TemplateBuilder/TemplateAlternatives.tsx` |

## Validation run

- `make gen/docs-manifest`: clean diff afterward.
- `make lint/docs-manifest`, `lint/docs-redirects` (`go run
./scripts/docsredirectscheck -base origin/main`: 15 rules OK, no
removed-route warning), `lint/docs-html`, `lint/emdash`: pass.
- `pnpm check-docs` (markdownlint + table formatter): pass.
- Vale (`vale --no-exit docs/`): the same 12 warnings and 1 error as
`main`, all pre-existing. Suggestions drop from 646 to 645; the one
removed was in the deleted `ide-agents.md`.
- Local relative-link check over `docs/**/*.md`: 0 unresolved links or
images (also 0 on `main`).
- Pre-commit hook: `make pre-commit-light` on the docs commit, and the
full `make pre-commit` (gen, fmt, lint/go, lint/ts, build, and others)
on the chore commit. Both passed.
- Targeted tests:
- Go: `go test ./coderd/x/chatd/chattool/... ./codersdk/toolsdk/...
./coderd/templatebuilder/...`.
- Site: Vitest for the touched directories (107 files, 1879 tests), and
the story tests for `CoderAgentsProductCard`, `GroupSettingsPageView`,
`GatewayKeysPageView`, and `ModelForm` (4 files, 63 tests).
- Every `docs()` path and anchor in the `site/` and Go diff resolves to
a page and heading in this branch.
- Frontend deep review (all 8 roles) on the `site/` diff of PRs A and B:
no blocking or should-fix findings. Nits on existing code that this PR
only touched, not changed here: a single-use `docsLink` constant in
`ChatAccessDeniedAlert.tsx`, and assertion-only `play` functions in the
`GatewayKeysPageView`, `ModelForm`, `CoderAgentsProductCard`, and
`GroupSettingsPageView` stories.
- Page counts: `docs/**/*.md` (excluding `.style`) 490 → 487;
`manifest.json` routes 495 → 492. With #31646 squash-merged in, the
counts don't change, because the Templates move only moves files.
- **Link health (commit 4):**
- linkspector 0.5.6 with `.github/.linkspector.yml` over all of `docs/`,
like the weekly docs job (`umbrelladocs/action-linkspector`, `reporter:
local`, `filter_mode: nofilter`). I ran it locally with Chrome in
`--no-sandbox` mode.
- `origin/main`: 0 errors. Before the fix (`17e54ad555`): 6 errors, all
`https://coder.com/docs/<new path>` 404s (`shared-workspaces.md:19`,
`esr-2.24-2.29-upgrade.md:80-82`, `tasks-to-chats-migration.md:73`,
`prometheus.md:298`). After the fix (`def074caab`): 0 errors. A first
run after the fix also flagged a Red Hat URL in
`install/server/openshift.md`. That URL is unchanged from `main`, and it
passed on a rerun, so the failure was transient.
- After the fix: `make gen/docs-manifest` (clean), `lint/docs-manifest`,
`lint/docs-redirects` (15 rules OK against `origin/main`),
`lint/docs-html`, `lint/emdash`, `pnpm check-docs`, and the
relative-link check (0 unresolved in 3416 links) pass. The full `make
pre-commit`, including `make gen`, passed on the commit.
  - Tests after the fix:
- Go: `go test ./cli -run 'TestCommandHelp|TestServerYAMLConfig'`,
`./enterprise/cli -run TestEnterpriseCommandHelp`, `./coderd/render`,
`./agent/agentscripts`, `./coderd/prebuilds`,
`./enterprise/coderd/prebuilds`, `./coderd/x/chatd/chattool/...`,
`./codersdk/toolsdk/...`, `./coderd/templatebuilder/...`.
    - Site: Vitest for `src/pages/TemplateBuilder` (7 files, 67 tests).
- **After the rebase onto `ccf5ec74ae`** (commits 5 and 6 included):
`make gen/docs-manifest` (clean), `lint/docs-manifest`,
`lint/docs-redirects` (15 rules OK), `lint/docs-html`, `lint/emdash`,
`pnpm check-docs`, and a relative-link and anchor check over the changed
pages pass.
The only unresolved anchor,
`docs/ai-governance/ai-gateway/cost-controls.md` →
`enterprise.md#list-organization-ai-spend-by-user`, is also broken on
`main`.
The pre-commit hook (`make pre-commit-light`, because both new commits
touch only `docs/`) passed on commits 5 and 6. The rebased code commits
rely on CI for Go and TypeScript checks.
- **Redirect chains:** a Node simulation of coder.com's static rules,
its generated rules from this branch's `docs/redirects.json`, the
router's static rules, the page, then this branch's rules on a miss,
over every page and exact static source, reports the 3 loops above and
nothing else new; with coder/coder.com#1201 and coder/docs-engine#304
applied, 0.
- **Skipped:** the docs-engine sync check, which was not available in
this environment.

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

- Rebuilt on `main` at `ccf5ec74ae` (2026-11-03) to clear conflicts with
`main`, after an earlier rebase the same day onto `1a963c628d`. The
previous rebuild was on `9839406ff7` (2026-11-02), and the first version
on `9b8d880d63` (2026-10-23).
- Rebase conflicts with #31603, which added `target="_blank"
rel="noreferrer"` to docs links: 4 `site/` files in the chore commit and
5 in the Templates commit. Each kept `main`'s version of the link with
only the docs path changed. Vitest for the 7 affected page directories
(233 tests) and the story tests for the 8 changed or affected stories
(102 tests) pass, and every `docs()` path in `site/src` resolves except
the same 13 that are unresolved on `main`.
- Rebase conflict: `docs/manifest/coder-agents.yml`. `main` added
`docs/ai-coder/agents/bring-your-own-mcp-servers.md`; it moves to
`docs/coder-agents/` with its sidebar entry, and its
`../../user-guides/` links become `../user-guides/`.
- Folded into the Templates commit: a link that `main` added to
`docs/user-guides/workspace-dotfiles.md` (#31606) now points at
`../templates/extending-templates/environment-variables.md`.
- `git range-diff` against `def074caab`, the head before both rebases,
shows only those changes.
- The move script reads every page from the clean `main` checkout and
resolves each relative link (inline, reference-style, and HTML
`src`/`href`) against the page's **old** directory. It maps the target
through the move map and recomputes the link from the page's **new**
directory. It runs once and refuses to run on a dirty `docs/` tree, so
it can't apply the path math twice. It also rewrites absolute
`coder.com/docs/...` and
`github.com/coder/coder/(blob|edit|tree)/main/docs/...` URLs, and skips
fenced code blocks and inline code.
- Before reusing the script, I ran it on the old base and diffed the
result against the old commit. The only differences were the two
hand-edited glossary entries and table padding from the formatter, so
the rebuild applies the same changes to the current `main`.
- Afterward, `grep -r ai-coder docs/` finds matches only in
`docs/redirects.json`.
- Changes from the earlier version of this branch: 2 more pages move
(`agents/projects.md`, `agents/acp-subagents.md`) and their sidebar
entries move with them. The chore commit also updates
`SessionSummaryTable.tsx` (new on `main`) and the doc-check skill's
`output.md` (its examples moved there from `SKILL.md`). The
`AICostControl.tsx` anchor question is gone, because `main` fixed it.

</details>

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Co-authored-by: Nick Vigilante <nick.vigilante@coder.com>
2026-11-04 17:15:42 -05:00
a9643ffcd3 feat: add rootless Podman starter template and EKS Auto Mode guidance (#30804)
## Summary
- EKS Auto Mode supports kernel sysctls via the NodeClass
`advancedCompute` field since 2026-10-01 ([AWS
announcement](https://aws.amazon.com/about-aws/whats-new/2026/10/eks-auto-mode-advanced-compute-config/)),
so rootless Podman no longer requires a separate managed node group;
document the custom NodeClass recipe and the `idsPerPod` requirement for
`hostUsers: false` pods
- Document native overlay storage (real-filesystem graph root + clearing
the image's `mount_program` pin), which removes the `/dev/fuse` device
plugin dependency on kernel 5.13+
- Add a "Nested container engines" section: one level of nesting is
supported; the dev container `docker-in-docker` feature is not, with
`docker-outside-of-docker` as the documented alternative
- Add the `kubernetes-podman-rootless` starter template (`coder
templates init --id kubernetes-podman-rootless`):
- persistent `/home/coder` volume (`fs_group_change_policy =
"OnRootMismatch"`), so repos, images and build cache survive restarts
- startup script fails with the Podman log when the API socket doesn't
start
  - `kubernetes_pod_v1`, pinned to amd64 (the image is amd64-only)

Refs DOCS-1277. Related follow-up: DOG-74.

## Testing
- 2026-10-14, EKS Auto Mode v1.37 sandbox: rootless Podman on pure Auto
Mode nodes with native overlay, including builds with cache mounts,
Testcontainers-style Postgres, and the Docker-compatible API socket
- 2026-11-02, same cluster, starter template at 0227e04 on a 20 GiB gp3
home volume:
- ext4 home, `overlay` driver with native overlay diff, graph root on
the volume
- `podman run`, classic `docker build` via the agent's `DOCKER_HOST`,
Docker API socket
- after stop/start: home files, all images, and subuid-owned layer files
(`101233:101233` on disk, `1234:1234` in the container) intact; built
image runs without a rebuild
- Fail-fast startup path tested with a stub `podman` only (exit 1,
prints the `newuidmap` error)
- `terraform validate` (no deprecation warnings), markdownlint, CI `gen`
and `lint-docs`

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
2026-11-03 22:47:39 +00:00
Steven Masley bc5dd20a05 feat: report Agent Relay builds in telemetry (#31407)
Telemetry builds now report whether Agent Relay created them. Before
this, relay workspaces looked like any other build.

A start build counts as a relay build when it has the
`agent_relay_session_id` parameter. Stop and delete builds never get the
field. For those builds, the new `agent_relay` field on `WorkspaceBuild`
reports:

- `provider`: `claude_code`, `cursor`, `ambiguous`, or `unknown`
- `client_platform`: Claude Code only. Lowercased, characters outside
`[a-z0-9_]` become `_`, and cut to 15 characters
- `attempt`: omitted when missing or not an integer, so `0` is sent
- `session_id_hash` and `pool_hash`: SHA-256 hashes

No other parameter values are sent. Other builds leave the field out.

The snapshot fetches these parameters with one new batch query. The
workspace-create event reads the stored parameters with one extra query,
only when telemetry is enabled, so it reports the same data as the
snapshot. `docs/admin/setup/telemetry.md` lists the parameters that are
read.

The collector side is
[coder/coder-telemetry-server#56](https://github.com/coder/coder-telemetry-server/pull/56).
Merge this PR first.

Refs
[RELAY-9](https://linear.app/codercom/issue/RELAY-9/telemetry-report-agent-relay-usage-from-codercoder)

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

- **Detect relay builds from parameters.** This needs no relay changes.
Relay registration or
[CORE-426](https://linear.app/codercom/issue/CORE-426) provenance
metadata can come later.
- **Builds only, not workspaces.** `GetWorkspaces` doesn't return the
latest build's parameters, so a workspace field would cost another
query. The collector can join on `workspace_id`.
- **Provider comes from parameter names only.**
`agent_relay_claude_code_*` means Claude Code and `agent_relay_cursor_*`
means Cursor. A build with both reports `ambiguous`; a build with
neither reports `unknown`. coderd stores every declared parameter on
every build (ephemeral ones with their default), so a Claude Code start
after a stop still reports `claude_code`.
- **Start builds only.** Stop and delete builds of a relay workspace
carry the same parameters but are not dispatches, so the snapshot skips
them before querying parameters.
- **Hash session ID and pool.** Pool names are user content, and
sessions only need counting.
- **Known gaps.** Cursor has no client platform. Relay version and
health would need relay registration.
- **Parameter names are shared with coder/agent-relay.** If agent-relay
renames one, telemetry silently stops reading it.

</details>

<details>
<summary>Manual test on <code>develop.sh</code></summary>

Ran on `8ad7cd491f` with `CODER_TELEMETRY_ENABLE=true
CODER_TELEMETRY_URL=http://127.0.0.1:8081` and `go run
./scripts/telemetry-server --port 8081` as the collector.

Pushed three templates with no infrastructure, each declaring the same
parameters as the real modules:

- `relay-claude`: `agent_relay_session_id`, `_delivery_id`, `_pool`,
`_client_platform`, plus ephemeral `agent_relay_attempt` and
`agent_relay_claude_code_lock_to_account`
- `relay-cursor`: `agent_relay_session_id`, `_delivery_id`, `_pool`,
`agent_relay_cursor_pool_name`, `_idle_release_timeout`, `_repo_url`
- `relay-plain`: `region`

Created workspaces with `POST /api/v2/users/me/workspaces` and
`rich_parameter_values`, the same call the relay makes. Then ran stop
and start builds on the relay workspaces, and restarted coderd to get a
periodic snapshot.

| Workspace | Build 1 (create event and snapshot) | Builds 2 and 3
(stop, start) |
|---|---|---|
| Claude (`claude_in_slack`, attempt 1) | `claude_code`, platform,
attempt 1 | `claude_code`, platform, no attempt |
| Cursor | `cursor` | `cursor` |
| Plain | field omitted | n/a |
| Claude template, no session ID | field omitted | n/a |

- Stop and start builds keep `agent_relay_claude_code_lock_to_account`,
with an empty value, so Claude Code rebuilds still report `claude_code`.
- No session ID, pool name, or `region` value appears in the captured
telemetry. The hashes match `sha256` of the inputs.
- Fed the captured snapshot through the conversion code in
coder/coder-telemetry-server#56: all 8 builds converted, 6 of them with
`agent_relay` set.
- No telemetry errors or panics in the coderd logs.

This run predates the start-only change: build 2 (stop) carried the
field then. Stop and delete builds are now omitted, which
`TestTelemetry_WorkspaceBuildAgentRelay` covers.

</details>


---

*Generated by Coder Agents on behalf of @Emyrk.*
2026-11-03 15:48:10 -06:00
Mathias Fredriksson 540552f7b7 feat: expose the workspace template to agent commands (#31606)
The agent now sets CODER_WORKSPACE_TEMPLATE_ID and
CODER_WORKSPACE_TEMPLATE_NAME for every command it runs, from new
template_id and template_name manifest fields. Templates run different
scripts in different orders, so a user's own script needs to know which
template it runs under to coordinate with that template's scripts.

The Agent API goes to v2.16 because release/2.39 shipped v2.15.
CODER_WORKSPACE_BUILD_ID loses its nil checks: an agent only connects
to servers that support its API version, and those always send the
build ID. The environment variables docs now list the variables the
agent sets.
2026-11-03 12:34:49 +02:00
Ethan d70ce38559 feat: record the OAuth2 client registration method of MCP server configs (#31558)
Relates to CODAGT-779

Currently we can't tell whether the OAuth2 client of an MCP server
config was entered by an admin, or registered by Coder with Dynamic
Client Registration (RFC 7591). The next PR in the stack needs to know
this, so it can register a new client when a config is updated.

This PR adds `mcp_server_configs.oauth2_client_registration` (`manual`
or `dynamic`) and returns it to admins on the API. Create stores
`dynamic` when it registers the client, and `manual` otherwise. An
update resets it to `manual` when it switches away from the `oauth2`
auth type, or when it changes the client ID, secret, auth URL or token
URL of a `dynamic` config, since the admin has replaced Coder's client.

Existing rows default to `manual`, as there's nothing in the data that
tells us which clients came from Dynamic Client Registration.
2026-11-03 12:39:30 +11:00
Nick Vigilante 16551fd67f feat: enable Coder.AbbreviationFirstUse (#30878)
Adds `Coder.AbbreviationFirstUse`, a Vale rule that requires each
abbreviation to be expanded on its first use on a page, in the form
"Expanded Form (ABBR)". It supports [WCAG 2.2 Level AAA Success
Criterion 3.1.4
(Abbreviations)](https://www.w3.org/TR/WCAG22/#abbreviations). Following
the "Adding a Vale rule" pattern in `docs/.style/README.md`, the PR has
two commits: the cleanup first, then the enable.

## Cleanup commit

431 first uses expanded across 167 pages, so the rule ships with zero
findings across `docs/`, excluding `docs/.style/style-guide/`. The
branch was rebuilt on current `main`, so pages added or moved since the
first draft are covered.

- Where the first use is a bold UI label (**CA Path**, **Add redirect
URI**, **Redirect URI**), the label stays as the UI shows it and the
expansion goes elsewhere in the same paragraph or list item.
- Reversed forms such as "PKCE (Proof Key for Code Exchange)" are
flipped to the expanded-first form.
- A few sentences took a small rewording to fit the expansion: list
steps that would pass the 20-word limit (`Coder.StepLength`), and spots
where the expansion would nest parentheses.
- MITM is expanded as "machine-in-the-middle" rather than
"man-in-the-middle". Every use describes the AI Gateway Proxy
intercepting traffic on purpose, so "on-path attacker" doesn't fit. The
inclusive-language table on `accessibility-and-inclusion.md` gains the
substitution: "on-path attacker" for the attack, "machine-in-the-middle"
for the feature.
- Unrelated fixes on lines already being edited: `DERP MAP` → `DERP
map`, and `ENV` → "environment variable" in `faqs.md`.

## Enable commit

**Rule design.** The rule is a `conditional`. `first` matches 2 to 6
capitals, each optionally followed by digits (`EC2`, `P2P`), and a
lookahead lets a plural `s` count as a use of the singular. `second`
captures the abbreviation in `word (ABBR)`, including `(CI/CD)` and
`(PCI DSS)` pairs. Vale collects the captures across the page's blocks
in document order, so a later expansion doesn't cover an earlier use.
Within a single paragraph, list item, or table cell, an expansion
anywhere in the block counts.

**Scope.** `scope: ~heading` skips headings, because a page title often
names an abbreviation that the first paragraph then expands. Vale
already skips front matter, code blocks, inline code, and link URLs.
`.vale.ini` turns the rule off for the pages generated from Go source
that `Coder.UnitSpacing` already skips: `docs/reference/{api,cli}/*.md`,
`configuration-reference.md`, and `prometheus.md`.

**Severity: `warning`.** Whether an abbreviation is familiar enough to
skip is a judgment call, so this is guidance with legitimate exceptions,
not hard policy.

**Exceptions**, each group commented in the rule file:

| Group | Entries | Reason |
| --- | --- | --- |
| Known to every reader | AI, API, AWS, CLI, CPU, DNS, GCP, HTTP(S), ID,
IDE, IP, JSON, OS, PR, RAM, SDK, SQL, SSH, TLS, UI, URL, VM, YAML |
Abbreviations every reader of the docs knows. Plurals such as VMs and
SDKs pass too |
| Units, clock times, file and package formats | GB, KB, MB, AM, PM,
CSV, GIF, JPEG, PDF, PNG, RPM, SVG, VSIX, ZIP | Readers know these by
the abbreviation, not the expansion |
| Not abbreviations | NOTE, TIP, OK, README, SKILL, ALL, AND, ANY,
ERROR, MUST, NOT, ON, OR, DELETE, GET, POST, PUT, ILIKE, VACUUM, LOGIN,
PLAIN, NUL, CRON, TERM, DOCS, `DOC\d+`, `RFC\d+`, TL, DR | Alert labels,
file names, emphasis in capitals, HTTP methods, SQL keywords, SMTP auth
mechanisms, rule labels in `docs/AGENTS.md`, RFC numbers, TL;DR |
| Names written in capitals | VS, IDEA, IU, NGINX, SUSE, GNU, XFCE, DX,
IBM, DCV, TRAMP, MSYS2, NET, VSX, ARM, AMD, GPT, AES, GCM, HMAC, HS256,
RSA, SHA, SHA256 | The capitals are the product, company, or algorithm
name (VS Code, IntelliJ IDEA, .NET, Open VSX, Amazon DCV, AMD) |

The "known to every reader" group is the list that needs judgment, and
it's the one to push back on. The other groups only stop the regex from
treating words and names as abbreviations.

**Documentation.** A new "Expand abbreviations on first use" section on
`accessibility-and-inclusion.md`, and the style guide README's checks
table, coverage table, and rule counts (90 → 91 rules, 22 → 23
tool-checked).

## Known limits

- The rule checks that an expansion exists, not that it's correct: any
word followed by `(ABBR)` satisfies it.
- An abbreviation in an image's alt text is checked before the paragraph
around it, so one alt text (`aws-marketplace.md`) carries its own
expansion.
- Some expansions read heavily in dense table cells and inline lists,
for example the four Kubernetes services in `docker-in-workspaces.md`.
They're correct, but a reviewer may prefer adding a specific
abbreviation to the exceptions instead.

## Testing

- `vale docs/` (Vale 3.7.1 through mise): zero
`Coder.AbbreviationFirstUse` findings. Findings from every other rule
match `main` file for file.
- `pnpm run format-docs`, `pnpm run lint-docs`,
`scripts/check_emdash.sh`, and `make lint/prose` run clean, and the
repository pre-commit hooks (including `lint/style-claims`) pass on both
commits.

Linear: DOCS-1311

Generated by Coder Agents on behalf of @nickvigilante.
2026-11-02 14:41:15 -05:00
Nick Vigilante 3edce9f87c docs: add quick paths to the install landing page and retire the CLI page (#31513)
The install landing page presented five phases that had to be read in
order, which doesn't fit every install.
This keeps the five-phase structure and adds the flexibility discussed
with Ben and Ian: put the options up front, offer shortcuts, and let
users skip what doesn't apply.

- Adds a **Choose your path** table that sends evaluators to the
Quickstart, users with a chosen platform to the control plane pages, and
everyone else through the phases in order.
- Adds a **Run Coder on a single server** section as the quick option.
It names what the Quickstart skips (sizing, DNS and TLS through the
tunnel, the identity provider, the license, and the external database),
explains what the built-in database means, and links to the migration
steps for when users outgrow it.
- Explains each of the five phases in more detail: what it does, who
needs it, what you finish with, and when you can skip it.
- Adds **Decisions worth making deliberately** for the choices that are
costly to change later.

The Slack discussion and the 1:1 described bundled versus external
PostgreSQL as irreversible.
The docs already describe a migration path
(`docs/admin/setup/index.md`), so the page calls it costly instead: it
needs downtime plus a dump and restore.
Topology, size, and network position come from the existing Plan page.

## Retire the CLI install page

[coder.com/downloads](https://coder.com/downloads) now covers what
`docs/install/cli.md` offered, so the page is gone:

- `/docs/install/cli` redirects to `https://coder.com/downloads`, and
the page is out of the sidebar.
- Inbound links point where the sentence means: the downloads page for
getting the binary, the CLI reference for usage (`sessions-tokens.md`,
`creating-templates.md`, `feature-stages.md`), and the Quickstart's
install step for running Coder with the install script
(`aws-marketplace.md`).
- The page's only content the downloads page lacks, installing the CLI
from your own deployment (air-gapped, version-matched), moves to a new
**Install the CLI** section in `user-guides/workspace-access/index.md`.
  The Zed and Claude Desktop guides link there.
- Winget and the Windows Visual C++ note already live in the Quickstart,
so they aren't moved.

This overlaps #31205, which edits `install/cli.md`, `zed.md`, and
`rpm.md`.
Whichever merges second needs a rebase, and #31205 should drop its
`cli.md` hunk.

A separate PR can add per-phase "skip if" notes to the phase pages, and
the install questionnaire stays a follow-up.

Checks: `make lint/emdash`, `lint/docs-html`, `lint/docs-manifest`,
`lint/docs-redirects`, markdownlint, and Vale.
Vale's remaining findings on changed files are on lines this PR doesn't
edit.

---

🤖 Generated with Coder Agents.
2026-11-02 14:23:49 -05:00
Mathias Fredriksson c0f7663e95 feat: support editing queued chat messages (#29215)
The owner of a chat can edit a queued message through
`PATCH /api/v2/chats/{chat}/queue/{queuedMessage}`. chatd never sends
a row under edit (`editing_since`): rows ahead of it still send in
order, and a turn that ends at it puts the chat in the new `paused`
status. Ending the head's edit, deleting it, or promoting a queued row
continues the chat. Interrupting sends still run ahead of the queue.

The chat state machine classifies a queue whose head is under edit as
its own sub-state (R1P, I1P, A1P, E1P, XE1P, P), so every path to
`paused` is in the transition matrix. A chat whose family has a paused
member cannot be archived, and auto-archive skips that family. Queue
edit and delete are owner-only, because both can send the next message
with the owner's credentials.

`ChatQueuedMessage` gains `editing_since` and `reasoning_effort`, and
`ChatStatus` gains `paused`.

Closes CODAGT-1028
Refs CODAGT-971
2026-10-30 15:52:22 +02:00
Nick Vigilante 4e8c5bf1a6 docs: Update title from 'Template' to 'Templates' (#31553)
Laughable typo

<!--

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

-->
2026-10-29 20:18:18 +00:00
Michael Suchacz d1f308d9f3 feat: let organization members turn off organization skills in chats (#31134)
## Stack

Organization skills load into every member's Coder Agents chats in their
organization, with no way for a member to opt out. This stack adds a
per-organization setting that lets members turn them off for their own
chats, bottom to top:

1. **#31134** data model, API, and chatd (this PR)
2. #31135 admin and member controls in the dashboard, the `/` menu, and
docs

## What changes

Organizations get `members_can_disable_skills`, off by default. Users
who can update organization skills change it with `PUT
/api/experimental/organizations/{organization}/skill-settings`, which
writes an organization audit entry. Anyone who can read the organization
can `GET` it.

While the setting is on, each member saves their own choices with `PATCH
/api/experimental/organizations/{organization}/members/{user}/skill-preferences`:
`all_skills_disabled` (a master switch that also covers skills created
later) and `skills`, a sparse map from skill ID to on or off. `GET`
returns the setting, the master switch, and `disabled_skill_ids`. The
routes follow the personal-settings rules: without `read_personal` or
`update_personal` on that user the caller gets 404, a PATCH while the
setting is off gets 403, and a key that is not an organization skill
that member can read gets a 400 that names the key. The check runs as
the member, not the caller, so an owner or user admin editing someone
else's choices is held to that member's skills. Turning the setting off
keeps the choices but ignores them.

Migration 000636 adds the column and two tables keyed by organization
membership. Both cascade when the membership goes away, and the
per-skill table also cascades when the skill is deleted, so a recreated
skill loads by default.

chatd reads the preferences as the chat owner when it builds the skill
index and when it loads a body for `read_skill` or for a structured
skill invocation (#30861). A skill the member turned off is left out of
the index, and both loads report it as not found, including later in a
running chat. If the preferences cannot be read, turn preparation fails,
as it already does when the skill metadata cannot be read.

Older migration tests created organizations with `dbgen.Organization`
and `GetDefaultOrganization`, which now select the new column before it
exists, so they insert organizations with raw SQL instead.

## Review focus

- Authorization in `coderd/organizationskillpreferences.go` and the five
new dbauthz methods (`read_personal` and `update_personal` on the user,
`organization_skill` update for the setting).
- `GetOrganizationSkillMemberPreferencesRow.Excludes` is the one rule
chatd applies; #31135 mirrors it in `activeOrganizationSkills`.

## Testing

- Go tests cover the queries and cascades, dbauthz, both routes
(including the audit diff and each 400 case), and chatd (index,
`read_skill`, skill invocations, master switch, a change during a chat).
Each new test fails with its code path removed.
- Remote dogfood UAT (10 scenarios, real model) passed on the pre-split
branch head `186c28d81ab`, which has the same code except the fix below.
It found one issue: two spellings of one skill ID with opposite values
stored a random result. The PATCH now rejects every aliased key with a
400. A second run on the stack's top head at the time, `718dd6d1bd1`,
passed: every aliased form returns 400 and stores nothing, and chats
leave out a skill the member turned off, including in `read_skill`.
- Polish and the test audit stayed inside the implementation diff. No
new dependencies.
- Rebased on main as one commit. The migration is now 000636, after
main's 000634 and 000635. Every organization skill load passes the chat
owner, including main's skill invocation path, so `/skill` invocations
honor the opt-out too. The model's skill index leaves out a skill that
is not model-invocable or that the member turned off. Apart from that,
the diff is unchanged.

> Xum, an AI agent, opened this PR for @ibetitsmike and wrote this
description.
2026-10-29 12:53:50 +00:00
Michael Suchacz 3697bb38ce feat!: choose the computer use model per organization (#31300)
> [!NOTE]
> Xum opened this PR for Mike (Coder agent). Mike reviews it before
merge.

Fixes CODAGT-1472.

Computer use now runs on a chat model that each organization picks.
Before, it ran a fixed model on the first enabled AI provider of a
deployment-wide provider type, sorted by name. On dogfood that
provider's key is rejected, so every computer use subagent failed.

## What changed

- **Setting.** A new `computer_use` organization model override, set in
the **Computer use** row of **Organization settings** on the Coder
Agents admin page. Without an override, computer use runs on the
organization's default model. If the chosen model is disabled, deleted,
or unusable for the chat owner, computer use falls back to the default
model, as other overrides do. It also falls back when the chosen model
moves to an AI provider that is not Anthropic or OpenAI, and the row
then says that the saved model is ignored.
- **API.** `PUT
/api/v2/organizations/{organization}/chats/model-overrides/computer_use`
returns 404 while the `chat-virtual-desktop` experiment is off, and 400
unless the model's AI provider type is Anthropic or OpenAI.
- **chatd.** The `computer_use` subagent runs on that model, and the
computer tool flavor follows the model's provider type. OpenAI computer
use always uses the Responses API, so a model that sets
`use_responses_api: false` gets a configuration error. When no usable
model exists, `computer_use` is unavailable, and the reason says whether
a saved computer use model was skipped and why the default model cannot
be used. The default model is read under the chat owner's model ACLs, as
chat turns do.
- **UI.** The row lists only enabled Anthropic and OpenAI models. A
warning icon with the tooltip "Make sure that the selected model
supports computer use." appears when the model in effect (the selected
one, or the default) is not on a curated list of canonical model IDs
known to accept the computer tool (`knownComputerUseModels` in
`knownModels/catalog.ts`, exact match only). It also appears when the
model's AI provider type is OpenAI and its **Use Responses API**
override is Off, because OpenAI computer use needs the Responses API.
The warning does not block saving. I built the list from a live probe on
2026-10-26 that sent each Anthropic and OpenAI model one request with
the computer tool.
- **Docs.** `virtual-desktop.md`, `models.md`, `organizations.md`, and
`architecture.md` describe the new setting, and chatd's
`ARCHITECTURE.md` describes the computer use model routing.

![The Computer use row with an uncurated model selected shows the
warning icon and its
tooltip](https://github.com/user-attachments/assets/3948d936-5d8f-4ff9-a6de-14094c154dc8)

![The Computer use model picker lists only Anthropic and OpenAI
models](https://github.com/user-attachments/assets/913cd4a0-3cdf-4e5d-b2f9-582b9fca999c)

## Breaking change

This removes the deployment-wide computer use provider setting
(`agents_computer_use_provider`), its experimental `GET`/`PUT
/api/experimental/chats/config/computer-use-provider` endpoints (shipped
since v2.35), the Virtual desktop settings card, and its audit field.
Migration 000635 deletes the stored value. After the upgrade, computer
use runs on each organization's default model until an admin picks a
computer use model. Computer use subagents created before the upgrade
keep the model they inherited from their parent chat, so a follow-up
message to one of them can fail; a new computer use subagent uses the
organization's computer use model. Telemetry now reports the
per-organization overrides instead of the provider, and `null` when it
cannot read them.

## Testing

- `make pre-commit` passes. `go test` passes for `./coderd/x/chatd/...`,
`./coderd/database/migrations/`, and the targeted coderd, telemetry,
dbauthz, enterprise audit, and codersdk tests. Vitest and the touched
Storybook stories pass.
- Each new Go test fails when its target behavior is removed from
production code.
- Remote dogfood UAT ran on an isolated Coder instance built from the PR
head, with real Anthropic and OpenAI models:
- 110234e: the row with the experiment on and off, the picker, the
warning icon cases, save and clear, the 400 for other provider types,
which model and computer tool each computer use subagent used
(Anthropic, OpenAI, default, and disabled override), a real desktop
session on an Anthropic and an OpenAI model, the unavailable reasons,
the upgrade through migration 000634, and the removed endpoints.
- 09ce818: an override whose model moved to an unsupported AI provider.
- 7925be9: the alert for a moved and a disabled override, and a computer
use subagent on an Anthropic model.
- 2a01eaf: the row, and computer use subagents on the override and on
the default model.
- 47f5bd1: the warning icon for an OpenAI model with **Use Responses
API** set to Off, On, and Default. With Off, a computer use subagent on
that model fails with a configuration error before any provider request.
With Default, it runs with the computer tool through the Responses API.
- 81d33b4: the unavailable reasons for a disabled override, a cleared
override, and missing credentials, and a computer use subagent on an
Anthropic override. This round found that the docs named the wrong
section of the model form for **Use Responses API**. aeb3d02 fixes that
step, and a re-read of the docs against the recorded UI passed.
2026-10-29 13:00:05 +01:00
Callum Styan 2255794d65 feat: add response_size_bytes metric to chatd (#29816) 2026-10-28 18:35:20 -07:00
dylanhuff-at-coder a736d65c98 fix: require SSH permission to fetch external agent credentials (#31388) 2026-10-28 07:44:13 -07:00
Ehab Younes deb76fadf3 docs: list VS Code session ID sources and View related connections (#31371) 2026-10-27 20:06:53 +00:00
131d4fc3df docs: add guide for tracing workspace connections (#31342)
## Summary

Adds a Monitoring guide for deployment administrators and platform teams
to collect client, `coderd`, and agent logs, correlate entries by client
session ID, and interpret connection and workspace lifecycle fields.
Links it from Connection logs and adds it to the docs navigation.

Replaces #30707 under @matifali, carrying forward its changes and review
history with accuracy fixes in 052d9e840f and the follow-up prose fixes
in 3a777bf195 and 04feb81d33.

Resolves
[CLIENT-1032](https://linear.app/codercom/issue/CLIENT-1032/document-how-a-platform-team-can-use-this-data).

Preview:
https://coder.com/docs/@superblink%2Fclient-1032-trace-connections/admin/monitoring/trace-connections

> [!NOTE]
> This guide is intended for the 2.39.0 docs under the multi-PR launch
exception. Coder Remote 1.17.2 and Toolbox plugin 0.9.5 must be
available before merge. At the last source check, the VS Code
prefix/release PRs (coder/vscode-coder#1164 and coder/vscode-coder#1165)
remained open, and Toolbox 0.9.5 remained a draft release.

## Validation

- Full Markdown and table-format checks passed (525 files).
- Emdash, docs HTML, manifest, and changed-page Vale checks passed, with
zero Vale findings.
- Docs self-check found no remaining verified blockers; all 28 relative
links and procedure word counts passed.
- Product behavior was source-verified. No live IDE/deployment
validation was performed, and the PowerShell example was not executed
because `pwsh` is unavailable.

<details>
<summary>Review decisions and remaining caveats</summary>

- Keep this as a log-correlation how-to in Monitoring, not a
failure-recovery procedure. The introduction and instructions reflect
that scope.
- Omit Coder version pins because the docs are versioned. Readers must
match their Coder CLI and workspace agents to the control plane. Keep
extension/plugin/Toolbox version requirements because those products
release independently.
- Document log pruning before new-file creation, including
modification-time ordering and the `coder-*.log` pattern; missing
connection events can also result from reporting failures.
- Include Toolbox forwarded-channel session IDs, disambiguate
terminal/speedtest logger messages, clarify nonzero command exits, and
cover all documented `autostop` and `network_error` cases.
- Follow merged #31289's Toolbox 3.9.0 prerequisite. The plugin's draft
release notes still name 3.7.2; maintainer confirmation is needed before
changing that requirement.
- The optional suggestion for an invocation-level log-retention
regression test was not implemented: this is a docs-only correction with
no production behavior change.
- The original dependency timeline and discussion remain on #30707.
#30759 has since merged; the former description's unmerged status is
historical.

</details>

> 🤖 This PR was created with the help of Coder Agents, and has been
reviewed by my human. 🧑💻

---------

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com>
Co-authored-by: default <default@example.com>
2026-10-28 00:03:30 +05:00
Nick Vigilante 21471da74c feat: enable Coder.Semicolons Vale rule (#30787)
Depends on #30782.

Adds `Coder.Semicolons`, a Vale rule that flags a semicolon in prose.
It enforces [No semicolons in
prose](https://github.com/coder/coder/blob/main/docs/.style/style-guide/capitalization-and-punctuation.md#no-semicolons-in-prose).

- Severity: `warning`.
- Scope: paragraphs, list items, headings, and blockquotes in `docs/**`
except `docs/.style/style-guide/**`.
  Table cells, code spans, and code blocks keep their semicolons.
- Baseline: 137 findings.
The cleanup commit fixes 112 of them across 61 files by splitting
sentences, or by using a comma or a connecting word where a split reads
badly.
- Excluded in `.vale.ini`: `docs/reference/{api,cli}/*.md` and
`docs/admin/setup/configuration-reference.md`.
Their text is generated from Go source (CLI flag help, Swagger
comments), and 25 findings live there.
Fixing them means editing Go and regenerating, so I used a commented
exclusion like `Coder.UnitSpacing` does.
  Say so if you prefer the Go fix.
- Result: `vale --output=line docs/` reports 0 `Coder.Semicolons`
findings outside the style guide.
- Three headings lost a semicolon, so their anchors changed.
I updated the links in `docs/.style/` and in `.claude/`
(`DOCS_STYLE_GUIDE.md`, the `write-docs` and `doc-check` skills).

Linear: DOCS-1261

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

- Scope list is `paragraph`, `list`, `heading`, `blockquote`. Without
`blockquote`, a semicolon in a `>` quote goes unreported, which I
checked.
Table cells are outside those scopes, so they stay exempt without extra
config.
- Token is `(?<!TL);(?!DR)`. `TL;DR` in `telemetry.md` is an
abbreviation, not punctuation.
- `&nbsp;` entities and `style="a: b;"` attributes don't match. Vale can
report a real semicolon on the wrong line of a paragraph that contains
an entity or raw HTML (for example, `modules.md:69` pointed at a
semicolon on line 71), so cleanup used a paragraph-wide search instead
of trusting reported lines.
- A semicolon inside a fenced block in a blockquote
(`ai-gateway/monitoring.md:105`, a YAML comment) isn't reported and
stays.
- Cleanup default: `; x` becomes `. X`, then I reviewed the diff and
hand-fixed list fragments, parentheticals, and headings.
Each new sentence sits on its own line, outside table cells. The
hand-written part of `prometheus.md` is also reformatted to one sentence
per line.
- Heading rewrites: `Verify against the code and document exact values`,
`Evidence justifies a claim and does not belong in the claim`, `STUN
returned different addresses and you may be behind a hard NAT`.
- `prometheus.md` is in the generated-page exclusion for
`Coder.UnitSpacing` but not here. Its semicolon was in hand-written
prose, so I fixed it.
- Enable commit updates the footer, the checks table (scope text matches
`.vale.ini`), the coverage counts (Capitalization and punctuation 3/7 to
4/6, total 20 to 21 tool-checked and 25 to 24 planned), and the "What
the tooling checks" counts.

Tests (fixtures in `/tmp`, not committed), each run with LF and CRLF
files:

- Flagged: paragraph, list item, ordered list item, heading, blockquote.
- Not flagged: table cell, code span, fenced block, `&nbsp;` and
`&amp;`, an HTML `style` attribute, and `TL;DR`.
- `go run ./scripts/styleclaims`, `make lint/emdash`, and the pre-commit
hook (markdown, typos, style-claims) pass.

</details>

*Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on
behalf of @nickvigilante.*
2026-10-27 16:44:17 +00:00
Phorcys 🐾andNick Vigilante 3ed2dfd8ca docs: promote usage of Nix(OS) and discourage use of envbuilder (#31141)
Adds a **Nix(OS)** docs page (`docs/admin/integrations/nixos.md`)
presenting Nix flakes as an alternative to dev containers. It covers
both Nix on an existing distribution (e.g. a Debian image, via the
[Nix(OS) module](https://registry.coder.com/modules/coder-labs/nix)'s
`nix develop` mode) and full NixOS workspaces (the [AWS EC2
(NixOS)](https://registry.coder.com/templates/coder-labs/aws-nixos)
template). Both work in containers or VMs.

The page is added to the sidebar under Integrations, after Dev
Containers. Other pages get one-line links to it:

- Dev Containers overview (`admin/integrations/devcontainers/index.md`)
- Image management, "Let developers customize their own environment"
- Templates overview, Best Practices
- Managing templates, Next steps
- Extending templates, Dev Containers
- Envbuilder (managing templates)
- Dev Containers user guide intro

---

Generated with [Xum](https://mux.coder.com/) using Claude

---------

Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
2026-10-27 15:24:46 +00:00
Ehab Younes 0d1cba2def feat: expose connection duration and client session ID in connection logs (#30759)
Show how long each SSH and reconnecting PTY connection lasted, and let
users find connections that share a client session ID. No schema changes.

API (ssh_info):
- Add client_session_id, the ID supplied by the client (the Coder CLI
  or a tool that launches it), if any.
- Add a client_session_id:<32 hex chars> filter.

UI:
- Each row shows the connect → disconnect time range and the duration
  as badges. A connection with no disconnect shows "Ongoing", equal
  timestamps show an "Unknown" start, and a disconnect recorded before
  its connect is labeled as such.
- The info icon opens a details popover instead of a hover tooltip. It
  uses the default popover styling and sentence-case labels, and lets
  users copy the client session ID and open "View related connections"
  for the same workspace.

Closes CLIENT-1010
2026-10-27 14:04:37 +03:00
Ehab Younes 28192213ab feat!: label the VS Code family and report built-in app usage per app (#29906)
The session banner now labels the VS Code family "VS Code Family", so it isn't confused with the VS Code editor. coderd_insights_applications_usage_seconds now reports built-in apps per app instead of per family.

- Generate the frontend's family labels from the Go table in codersdk.
- Add the connection_method label: workspace_app for template apps, and ssh, reconnecting_pty, or port_forwarding for built-in apps.
- Rename the application_name label to display_name. For built-in apps it holds the registry name, "Unknown" for unknown, and "Other apps" for overflow.
- Built-in apps get one series per app name, only for apps used in the window. The series limit and the fold rule are shared with the template insights API.
- Breaking: selectors with a value for application_name, or with slug="", match nothing. The Prometheus docs map each old series to its new one.

Closes #29940
Closes CLIENT-1034
Closes CLIENT-1036
2026-10-27 09:58:36 +00:00
Nick Vigilante 81c40579dc feat: enable Coder.StepLength Vale rule (#30791)
Adds `Coder.StepLength`, a Vale `script` rule for [Keep steps
short](https://github.com/coder/coder/blob/main/docs/.style/style-guide/procedural-writing.md#keep-steps-short).
It flags an ordered-list step whose instruction, the step's first
paragraph, has more than 20 words, counted as [How to count
words](https://github.com/coder/coder/blob/main/docs/.style/style-guide/voice-and-tone.md#how-to-count-words)
describes.
Paragraphs below the instruction explain the step and aren't counted.

- Severity: `warning`.
- Scope: `docs/**` except `docs/.style/style-guide/**`.
- Baseline: 124 findings in 60 hand-written files.
The cleanup shortens each long instruction, moves its explanation into
one paragraph below it, or splits a step that holds several actions.
After cleanup `vale docs/` reports 0 `Coder.StepLength` findings, and
the other rules report no new findings on the changed files.
- The guide section now says the limit covers the instruction, and that
one action or one explanation must not be broken across paragraphs to
meet it.
- Generated pages (`docs/reference/{api,cli,agent-api}`,
`configuration-reference.md`, `prometheus.md`): no findings, so no
`.vale.ini` exclusion is needed.

Linear: DOCS-1272

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

**Review change (Ian's review)**

- The first version limited every paragraph of a step to 20 words.
The cleanup for it chopped explanations into several short paragraphs,
which made steps harder to read and sometimes changed their meaning.
- The rule now counts only the first paragraph segment of each step.
The content files were reset to `main` and the cleanup was redone
against the narrower rule.
- Cleanup preferences, in order: shorten the instruction; keep a short
instruction and put the explanation, with its original wording, in one
paragraph below it; split a step into one step for each action; for
descriptive lists (such as "How it works"), keep each item one
statement.
- `docs/admin/users/oidc-auth/microsoft.md` keeps the split into
separate steps, with Ian's wording suggestions applied.
"click" became "select" in step 16 because `Coder.SelectClick` flags it.

**Rule shape**

- A `script` rule (Tengo) with `scope: raw`, because the count depends
on Markdown structure that per-paragraph scopes hide.
- A step is an ordered-list item with a `1.` or `1)` marker.
  A nested ordered item is its own step.
  Bullets, even under a step, are not steps.
- The instruction ends at a blank line, a fence, a nested list, a table
row, a blockquote, block-level HTML, or an explicit hard break (`<br>`,
a trailing backslash, or two trailing spaces).
- Fenced code blocks, HTML comments, tables, images, and nested bullets
add no words.
- CRLF: `\r` counts as whitespace, and offsets come from the raw text.

**Counting approximations (also in the rule header)**

- A code span and a `**bold**` or `__bold__` span are one word each.
- Words split on whitespace, so a hyphenated compound and
`30&nbsp;seconds` are one word.
- Link text counts word by word, destinations are skipped, images add no
words, and `<https://...>` autolinks are one word.
- A token with no letter or digit, such as the `>` in `**A** > **B**`,
is not a word.
- Tengo indexes strings by rune but measures them in bytes, so the
script rewrites each non-ASCII rune to ASCII of the same byte length
first.

**Tests** (fixtures under `/tmp/sltest/`, not committed; run with the
repo `.vale.ini`, LF and CRLF)

- Flagged: a long instruction, a short action and a long result in one
paragraph, a long nested ordered step.
- Not flagged: a long paragraph below a short instruction, text after a
`<br>` hard break, a long paragraph after a code block, a long nested
bullet.
- LF and CRLF output is identical.
- Pre-commit hooks (`fmt/markdown`, `lint/markdown`, `lint/emdash`,
`lint/style-claims`, `lint/typos`) pass.
- Not run on Windows or macOS.
The rule is plain text processing, and the CRLF cases simulate Windows
line endings on Linux.

</details>

*Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on
behalf of @nickvigilante.*
2026-10-26 20:43:38 -04:00
Mathias Fredriksson 1aff810443 chore: sync fantasy with upstream v0.45.5 (#31288)
Moves the fantasy pin to the tip of `coder_2_33` (`85ffbbe`). That
commit is coder/fantasy#72, which merges 87 upstream
charmbracelet/fantasy commits, v0.40.0 to v0.45.5. Between the two pins
117 files change. Upstream's own v0.40.0 to v0.45.5 change, without
tests, testdata, examples, `go.sum` and the kronk provider, is 43 files,
+2271/−928.

## What reaches chatd

chatd builds only the `anthropic`, `openai` and `openaicompat` fantasy
clients (`chatprovider.ModelFromConfig`); other vendors reach it through
the AI Gateway on one of those. So the upstream changes to the Google,
Vercel, OpenRouter, Bedrock, Azure and kronk providers, and to the
`fantasy.Agent` loop and its retries, do not run in chatd. These do:

- **Chat Completions and openaicompat streams** keep reasoning on
batched and DeepSeek-shaped chunks, keep `finish_reason: length` when
tool calls are truncated, and stop sending empty reasoning fields.
openaicompat drops assistant turns that hold only reasoning.
- **Token usage.** When an OpenAI-shaped backend reports reasoning
tokens apart from completion tokens (reasoning larger than output),
output tokens now include them, so that backend's reported output tokens
and cost rise. OpenAI's own shape, where reasoning is a subset, is
unchanged.
- **Responses.** A content-filtered turn no longer reads as a tool-call
turn.
- **Context overflow.** Baseten, Fireworks and Parasail prompt-length
errors set `ContextTooLargeErr`, which compaction acts on.
- **Anthropic.** Tool calls whose content block never closes are
reported. For Claude 5 models, thinking defaults to `display:
"summarized"` when the chat config sets none; a configured display still
wins. `TestThinkingDropBlockModel_RetriesWithEffort` now expects the
field in the retry body.
- **Anthropic keepalives.** Fantasy forwards `message_start`,
`message_delta` and unknown events as content-free `keepalive` parts.
The first one arrives before any model output, so this PR makes
`ttft_seconds` and the `time_to_first_token` stage skip them, as they
skip warnings. They still reset the stream silence guard.
`processStepStream` ignores them, and the debug recorder counts them in
its part count but records no content.
- **Tool-result media** now goes through upstream's shared
`ToolRunBuffer`, which replaces coder/fantasy#64 and does the same
thing.

#72 keeps coder's anthropic-sdk-go and openai-go forks, Go 1.26 and
kronk v1.31.5, so upstream's SDK and Go moves do not come along.

`go mod tidy` raises the modules fantasy v0.45.5 requires, among them
otel exporters v1.47, the AWS SDK, `google.golang.org/api` v0.307 and
go-openapi v1. All are upgrades.

The `go.mod` comment now names #72 as the upstream sync.

coder/coder#29861 stacks on this PR to pin coder/fantasy#62.

<details>
<summary>Verification</summary>

- `go build ./...`.
- `go test` passes on every package that imports fantasy
(`coderd/x/chatd/...`), and `go test ./coderd -run
'TestChat|TestExpChat|TestMCP|TestAIBridge'` passes.
-
`TestGuardedStreamTTFTStage/WarningsAndKeepalivesThenContentObservesOnce`
fails without the TTFT change (TTFT observed 0s instead of 1s) and
passes with it.
- `make pre-commit` passes. The generated Prometheus docs pick up the
metric help change.

Not verified against live backends in this PR: the stream fixes, the
token usage change and the context-overflow patterns have no coder test
against a real provider. coder/fantasy#72 reports a local chatd run
against the AI Gateway on Anthropic, Responses, OpenAI Chat and
openaicompat.

</details>

> 🤖 This PR was created with the help of Coder Agents, and _will be_
reviewed by a human. 🏂🏻
2026-10-27 11:29:10 +11:00
George KandAtif Ali aa9b0a950a docs: document declarative script ordering (#31227)
Add a Beta guide for `coder_script_order` with startup and shutdown
examples, module and dev container ordering, failure handling, and
migration from `coder exp sync`. Add navigation and glossary entries.
Recommend declarative ordering for whole scripts and clarify when to
use `coder exp sync` for coordination within script bodies.

Fix fragment links and heading anchors in the offline docs renderer so
section links stay on the current page and repeated headings get
unique IDs.

Refs:
https://linear.app/codercom/issue/CORE-555

---------

Co-authored-by: Atif Ali <atif@coder.com>
2026-10-26 16:13:53 -07:00
Nick Vigilante 7eacfe95b2 feat: enable Coder.LatinAbbreviations Vale rule (#30794)
Builds on #30782, which is merged; the branch now merges `main`.

Adds `Coder.LatinAbbreviations`, a Vale rule that enforces [Latin
abbreviations](https://github.com/coder/coder/blob/main/docs/.style/style-guide/accessibility-and-inclusion.md#latin-abbreviations).

- Suggests "for example", "that is", and "and so on" for `e.g.`, `i.e.`,
and `etc.`, including `eg.`, `ie.`, and a missing final period (`e.g`).
- Severity: `suggestion`. Scope: `docs/**` except
`docs/.style/style-guide/**`, limited to paragraphs, lists, headings,
and blockquotes. Table cells and code are skipped.
- Baseline: 170 findings in 91 files. The brief estimated 148.
- Cleanup: 153 findings fixed across 81 hand-written pages, 0 left in
linted pages. The count is lower than the original 158 because other PRs
on `main` already rewrote or removed some of the lines, and
`parameters.md` was deleted on `main`.
- `vs.` and `et al.` aren't flagged.

Commits:

1. `docs(docs): use English forms of Latin abbreviations`
2. `feat(docs/.style): enable Coder.LatinAbbreviations Vale rule`

Generated pages: `.vale.ini` skips `docs/reference/{api,cli}/*.md` and
`docs/admin/setup/configuration-reference.md` for this rule, as it does
for `Coder.UnitSpacing`.
Their prose comes from CLI flag help text and Swagger comments in Go
source, and `make gen` rewrites them, so a hand edit fails the `gen`
check (an earlier revision of this PR edited
`configuration-reference.md` and failed `gen` for that reason).
Cleaning them means editing Go and regenerating the help golden files
and API docs, which is left for a follow-up.

Linear: DOCS-450

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

- `extends: substitution`, so the message names the replacement:
"Consider 'for example' instead of 'e.g.'".
- `scope: [paragraph, list, heading, blockquote]`. The single scope
`paragraph` skips list items, blockquotes, and headings, so all four are
listed. Table cells have their own scope and stay excluded.
- Explicit `[Ee]` and `[Ii]` classes with `ignorecase: false`, so
sentence-initial `E.g.,` still matches but the browser name `IE.`
doesn't.
- `eg.` and `ie.` require the trailing period so ordinary words and file
extensions stay quiet.
- Cleanup rules, applied by script and then reviewed line by line:
- `e.g.` and `i.e.` become "for example," and "that is," (capitalized at
the start of a sentence), with a comma added when the original had none.
- `etc.` becomes "and so on", with the sentence-ending period kept when
`etc.` closed the sentence.
- Lines inside table rows, fenced blocks, and code spans are untouched,
so are the style guide and the generated pages.
  - Hard-wrapped lines keep their wrapping, and CRLF files keep CRLF.
- The rest of the Vale output is unchanged: the per-rule counts for
every other rule match the pre-cleanup run.

Test cases (fixtures under `/tmp/latin-test/`, not committed), run with
LF and CRLF line endings:

- Flagged (15 each): `e.g.,` in a paragraph, `i.e.,`, `etc.` at the end
of a sentence and before a comma, `eg.`, `ie.`, `e.g` and `i.e` without
the final period, `E.g.,`, `I.e.,`, `Etc.`, a blockquote, a list item, a
numbered item, and a heading.
- Not flagged: a table row with `e.g.,`, `i.e.,`, and `etc.`, code
spans, a fenced block, "for example", "that is", "and so on", `IE.`,
`genre`, `series`, `egg`, `tie`, `etcetera`, `vs.`, `et al.`.
- Known edge case: a path-like token such as `path/i.e/x` outside code
matches. It doesn't occur in the corpus.

Checks:

- `vale --output=line docs/`: 0 `Coder.LatinAbbreviations` findings.
- `go run ./scripts/styleclaims` passes.
- The pre-commit-light hook passes on both commits.

</details>

*Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on
behalf of @nickvigilante.*
2026-10-23 22:27:18 -07:00
Nick Vigilante 9edb2e388d feat: enable Coder.USSpelling Vale rule (#30790)
Depends on #30782.

Adds `Coder.USSpelling` at `warning` severity.
The rule flags an `-ise` family (`organise`, `initialise`,
`authorisation`) and a list of British spellings (`behaviour`,
`labelled`, `cancelled`, `analogue`, `whilst`, and others) and suggests
the US form.
It covers `docs/**` except `docs/.style/style-guide/**` and the
generated `docs/reference/{api,cli}/*.md` pages.

Baseline: 13 findings before cleanup, 0 after.
The first commit fixes 11 of them: 10 in hand-written pages and 1 in the
Prometheus metrics table, which comes from metric help text.
Two findings sit in generated reference pages, which `.vale.ini`
excludes for this rule: the CLI alias `favourite` and `amongst` in a Go
comment from a vendored dependency (the DERP map schema).
The metric help text comes from `querymetrics.go`, so the fix lands
there and in `generated_metrics` and `prometheus.md`.

Known false positive: Vale doesn't skip bold text, so a UI label in bold
that keeps British spelling is flagged.
The rule comment and the guide footer say to use a code span for such a
label.

Linear: DOCS-1280

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

- **Rule type**: `substitution`, so each message names the US form.
The `-ise` family can't name a specific replacement, so it suggests "the
-ize form".
- **`cancelled`**: the guide's "Use US spelling" section lists
`canceled` and `canceling`.
The rule flags the double-l verb forms and leaves `cancellation` alone,
which Merriam-Webster spells with one `l`.
- **Exceptions**: Vale applies an exception to the matched word, so each
is anchored with `^` and `$` and case-insensitive.
The list covers `-wise` words and stems for `advise`, `advertise`,
`exercise`, `promise`, `premise`, `compromise`, `surprise`, `comprise`,
`concise`, `precise`, `revise`, `supervise`, `televise`, `devise`,
`improvise`, `franchise`, `merchandise`, `disguise`, `despise`,
`paradise`, `cruise`, `noise`, `raise`, `rise`, `wise`, and others, each
with the endings `e`, `es`, `ed`, `ing`, `er`, and `ers`.
  The `mise` tool is excepted by name.
- **Extra British spellings** beyond the guide table: other doubled-`l`
verbs (`signalled`, `levelled`), `metre`, `litre`, `fibre`, `theatre`,
`calibre`, `offence`, `pretence`, `analyse`, `judgement`,
`acknowledgement`, `ageing`, `artefact`, `sceptic`, `aluminium`,
`practise`, `enrol`, `fulfil`, `instil`, `skilful`.
  None appears in the corpus today.
- **Generated pages**: excluded for `docs/reference/{api,cli}/*.md`, as
`Coder.UnitSpacing` does.
Changing the `favourite` alias would change CLI behavior, and the
`amongst` comment isn't ours to edit.
- **Prometheus doc**: edited by hand with matching table padding because
`go run ./scripts/metricsdocgen` already rewrites the whole table on the
base branch, independent of this change.

Test cases, run with `vale --config` against fixtures that are not
committed, in LF and CRLF:

- Positive: `organise`, `initialise`, `authorise`, `customisation`,
`authorisation`, `organisations`, `Organised`, `initialising`,
`recogniser`, `customisable`, every explicit list entry, and capitalized
forms.
- Negative: `advise`, `exercise`, `otherwise`, `Enterprise`, `premise`,
`compromise`, `promise`, `surprise`, `precise`, `concise`, `expertise`,
`revising`, `supervising`, `improvising`, `raise`, `noise`, `cruise`,
`franchise`, `merchandise`, `disguise`, `despise`, `paradise`,
`appraise`, `sunrise`, `arise`, `liaise`, `clockwise`, `cancellation`,
`canceled`, `mise`.
- Skipped: words in code spans and fenced code blocks, such as
`cancelled`.
- LF and CRLF results are identical.

Checks: `vale --output=line docs/` reports 0 `Coder.USSpelling`
findings, `make lint/style-claims` passes, and the pre-commit hooks pass
on both commits.

</details>

*Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on
behalf of @nickvigilante.*
2026-10-23 22:18:30 -07:00
Nick Vigilante 58d19d78c5 feat: enable Coder.Please Vale rule (#30789)
Depends on #30782.

Adds `Coder.Please`, a Vale rule that enforces [Leave out
"please"](https://github.com/coder/coder/blob/main/docs/.style/style-guide/voice-and-tone.md#leave-out-please).

- Flags `\bplease\b`, ignoring case.
- Severity: `warning`. Scope: `docs/**` except
`docs/.style/style-guide/**`.
- Baseline: 31 findings in 24 pages (23 hand-written plus the generated
configuration reference), 0 after cleanup.
- Code spans and fenced code blocks are skipped by Vale, so quoted
product text such as `Please try again later` stays untouched, as the
guide asks.

## Commits

1. `docs: leave "please" out of instructions`: rewrites each use as a
direct imperative and keeps the meaning.
   It also fixes the one generated page that had a finding.
`docs/admin/setup/configuration-reference.md` comes from the telemetry
group description in `codersdk/deployment.go`, so the cleanup edits that
source and the golden files (`cli/testdata/coder_server_--help.golden`,
`cli/testdata/server-config.yaml.golden`,
`enterprise/cli/testdata/coder_server_--help.golden`) regenerated with
`go test -update`.
2. `feat(docs/.style): enable Coder.Please Vale rule`: adds the rule,
flips the footer to enforced, adds the checks-table row, and updates the
coverage counts.

No `.vale.ini` change is needed, and no generated page is excluded.

Linear: DOCS-1281

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

- An `existence` rule with one `\bplease\b` token. Word boundaries keep
`pleasant` and `displeasing` out.
- `warning` rather than `error`, because a quoted product message can
legitimately contain the word outside code font.
- Generated pages: fixed in Go source instead of excluded, because only
one string was affected and the text reads better without it.
- URL query strings such as `body=please+enter+your+request+here` aren't
flagged, because Vale skips link destinations.
- The README sentence about rows, checks, and sections moves from 7, 10,
and 9 to 8, 11, and 10 for the new row.

Test cases (fixtures under `/tmp/please-test/`, not committed), run with
LF and CRLF line endings, 6 findings each:

- Flagged: sentence-initial `Please`, trailing `, please.`, `PLEASE`, a
blockquote, a list item, a heading.
- Not flagged: a code span containing `Please try again later`, a fenced
code block containing `Please install curl`, `pleasant`, `displeasing`.

Checks:

- `vale --output=line docs/` reports 0 `Coder.Please` findings.
- `go run ./scripts/styleclaims` passes.
- The pre-commit hooks pass on both commits (gen, `lint/go`, `lint/ts`,
markdown, emdash, style-claims, typos).
- `go test ./cli -run 'Test(CommandHelp|ServerYAML)'` and `go test
./enterprise/cli -run TestEnterpriseCommandHelp` pass with the updated
golden files.

</details>

*Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on
behalf of @nickvigilante.*
2026-10-23 21:18:34 -07:00
coder[bot]andNick Vigilante 78aa570078 feat(docs): enable Coder.CheckOut Vale rule (#31185)
> [!NOTE]
> Recreated from #30793 under coder[bot] by Superblink, at the request
of @nickvigilante, so he can review and merge it. An AI agent wrote the
original, which was opened from his account. The diff is identical to
#30793, squashed onto current `main`. Superblink reviewed it and ran
Vale over `docs/` before opening this PR (no new warnings or errors).
#30793 should be closed in favor of this one.
> Stack: based on #31184 (#31180 → #31181 → #31182 → #31183 → #31184 →
#31185). The diff matches #30793 except for the counters in
`docs/.style/style-guide/README.md`, which build on the PRs below this
one. `make lint/style-claims` passes at every level.

Builds on #30782, which is merged; the branch now merges `main`.

Adds `Coder.CheckOut`, a Vale rule that enforces [Refer to or visit, not
see or check
out](https://github.com/coder/coder/blob/main/docs/.style/style-guide/word-choice.md#refer-to-or-visit-not-see-or-check-out).
It flips only `Coder.CheckOut` in the footer; `Coder.SeeAlternatives`
stays planned.

- Flags "check out" and its inflections (`checks out`, `checked out`,
`checking out`) when used to point the reader at a page or site.
- Severity: `warning`. Scope: `docs/**` except
`docs/.style/style-guide/**`.
- Baseline: 11 findings in 10 pages, 0 after cleanup. One of them
(`docs/ai-coder/agent-firewall/index.md`) landed on `main` after the
branch was cut.
- Cleanup rewrites each to "refer to" (docs destinations) or "visit"
(external destinations).
- The Git sense is allowed and isn't flagged. Examples: "check out the
branch", `git checkout`, "a source checkout".
- Generated pages: no findings, so no `.vale.ini` change and no Go
source change.

Commits:

1. `docs(docs): refer to or visit instead of "check out"`
2. `feat(docs/.style): enable Coder.CheckOut Vale rule`

Linear: DOCS-1260

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

- Vale's `existence` rule can't do this. RE2 has no lookahead, so the
rule can't say "check out, unless a Git object follows". A token that
includes the following words also fails: Vale can't locate a match that
spans link text (`check out [Dev Containers]` renders without the
bracket), and it silently drops the finding. Those link-follows cases
are the main true positives.
- The rule is therefore `extends: script` (Tengo, supported by the
pinned Vale 3.7.1) with `scope: text`. It finds each "check out" and
reports only those two words. It skips the match when one of the next 3
words is a Git object, or when "and" follows directly.
- Git objects skipped: branch, repo, repository, code, source, commit,
tag, PR, pull request, fork, clone, worktree, file, revision, ref,
master, main, trunk, submodule, sha, changes, release, version, folder,
directory, dotfiles. A hyphenated name such as `code-marketplace` isn't
a Git object.
- The one-word "checkout" is never flagged. In this corpus it's a Git
noun or command (`git checkout`, "source checkout") or the
`actions/checkout` action. The brief mentions "checkout" as a possible
verb, but I found no verb use, so I left it out rather than guess.
- `warning`, because the rule can't tell the senses apart from text
alone.

Test cases (fixtures under `/tmp/checkout-test/`, not committed), run
with LF and CRLF line endings:

- Flagged (8 each): link follows ("Check out [Dev Containers
integration]"), "check out our [module registry]", "check out
HashiCorp's [Getting Started Guides]", "Checking out the [Quickstart]",
"checked out" in a blockquote, "Checks out" in a list item, a heading
("Check out more"), a hard-wrapped "check out the\n[envbox docs]".
- Not flagged (0 each): "check out the branch", "the repository", "the
code", "a commit", "the tag", "the PR", "the pull request", "check out
and install a dotfiles repository", "source checkout", "Git checkout",
`git checkout main`, a `git checkout -b` fenced block, "Checkout
repository" in a list item, "the checkout action", "check outputs",
"check output".

Known gaps:

- False negative: a cross-reference that names a Git word right after
the verb, such as "check out our code samples".
- False positive risk: a Git sense with an object the list doesn't name.

Checks:

- `vale --output=line docs/` reports 0 `Coder.CheckOut` findings.
- `go run ./scripts/styleclaims` passes.
- The pre-commit-light hook passes on both commits.

</details>

*Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on
behalf of @nickvigilante.*

Created on behalf of @nickvigilante

---------

Co-authored-by: Nick Vigilante <nick.vigilante@coder.com>
2026-10-23 16:44:35 +00:00
coder[bot]andNick Vigilante 635a1a8a5f feat(docs): enable Coder.ImperativeNegation Vale rule (#31184)
> [!NOTE]
> Recreated from #30784 under coder[bot] by Superblink, at the request
of @nickvigilante, so he can review and merge it. An AI agent wrote the
original, which was opened from his account. The diff is identical to
#30784, squashed onto current `main`. Superblink reviewed it and ran
Vale over `docs/` before opening this PR (no new warnings or errors).
#30784 should be closed in favor of this one.
> Stack: based on #31183 (#31180 → #31181 → #31182 → #31183 → #31184 →
#31185). The diff matches #30784 except for the counters in
`docs/.style/style-guide/README.md`, which build on the PRs below this
one. `make lint/style-claims` passes at every level.

Depends on #30782.

Adds `Coder.ImperativeNegation`, a Vale rule that flags `don't` where it
opens an imperative and suggests `do not`.
It enforces [Spell out negative
instructions](https://github.com/coder/coder/blob/main/docs/.style/style-guide/voice-and-tone.md#spell-out-negative-instructions).

- Severity: `warning`.
- Scope: `docs/**` except `docs/.style/style-guide/**`, which
demonstrates the violations on purpose.
- Baseline: 14 findings in 9 files.
  The cleanup commit fixes all of them, so the rule ships at zero.
I also fixed one imperative the rule can't see (`**Link to their docs**,
don't duplicate` in `content-guidelines.md`).
- Generated reference pages: no findings, so no exclusion.
- Known gap: an imperative after a bare comma goes unreported.
Declaratives such as `Headings are sentence case, don't lead` share that
shape.

Linear: DOCS-1262

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

- Boundary pattern, not a verb list. The rule matches `don't` (straight
or curly apostrophe) only after a paragraph start (`\A`), a sentence
end, a colon, a semicolon, or `, and`.
- Comma case. A bare `, don't` produced false positives (`Headings are
sentence case, don't lead`, `events..., such as updates, don't reach
clients`).
The rule instead requires a comma that closes an opening
`If`/`When`/`Before`/`After`/`Unless`/`Once`/`While`/`Until` clause with
no other comma in it.
- `\A` instead of `^`. `^` also matches at a hard-wrapped line start,
which flagged `usually\ndon't.` in `managing-templates/index.md`.
- Bold lead-ins (`**Note:** Don't`) work because Vale strips markup
before matching. Code spans are skipped.
- Table cells and blockquotes are in scope. One table cell and three
blockquote or list lines needed cleanup.
- `Don't know where to start?` is an elliptical question, so it became
`Not sure where to start?`.
- Only `don't` is in scope. `can't` and `won't` are rarely imperative.
- Link uses the GitHub blob form that the existing rules use.
- Enable commit also updates the checks table, the coverage counts
(Voice and tone 0/4 to 1/3, total 9 to 10 tool-checked and 33 to 32
planned), and the "What the tooling checks" counts.

Tests (fixtures in `/tmp`, not committed), each run with LF and CRLF
files:

- Flagged: paragraph-initial `Don't`, `Run it. Don't`, `, and don't`,
curly `If..., don’t`, `; don't`, `**Note:** Don't`, `: don't`, list
item, table cell, blockquote.
- Not flagged: `You don't need`, `Tools that don't`, `Coder won't push`,
`Headings are sentence case, don't lead`, `If X is blocked, Coder
doesn't..., so events, such as updates, don't reach`, a hard-wrapped
line starting with `don't`, and `` `don't` `` in a code span.
- `vale --output=line docs/`: 0 `Coder.ImperativeNegation` findings
outside the style guide.
- `go run ./scripts/styleclaims`, `make lint/emdash`, and the pre-commit
hook (markdown, typos, style-claims) pass.

</details>

*Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on
behalf of @nickvigilante.*

Created on behalf of @nickvigilante

Co-authored-by: Nick Vigilante <nick.vigilante@coder.com>
2026-10-23 16:36:44 +00:00
c4d76a4009 feat: add skill action and automatic-use settings (#30882)
Adds two per-skill settings that the project skills UI will expose next:

- `action` marks a project skill to show as an action button above
project chat composers. A `skills_action_project_only` check keeps it to
project skills; the personal and organization routes reject `action`
with 400.
- `model_invocable` (default true, every stored source) controls
automatic use. When it's false the skill is left out of
`<available-skills>` and `read_skill` reports it as not found, but a
structured skill invocation (a chip from the `/` menu or an action)
still loads it, as long as the skill is enabled and the chat owner can
read it. Workspace skills always count as model-invocable.

Migration 000625 adds both columns with defaults, so existing skills
keep today's behavior. The list, get, insert and update queries,
`codersdk.SkillMetadata` and the create/update requests carry both
fields, and the audit table tracks them.
`coderd/x/chatd/ARCHITECTURE.md` gets TODO notes for the author.

**NOTE**: the migration adds two columns with constant defaults and a
CHECK constraint to `skills`.

Stack (merge top to bottom):
- #30826
- #30827
- #30838
- #30840
- #30854
- #30855
- #30856
- #30861
- #30880
- #30881
- #30882 👈
- #30884
- #31122
- #31126

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
2026-10-23 19:32:08 +07:00
Ethan 9b8d880d63 fix: exempt service accounts from user dormancy (#30824)
Closes CODAGT-1344

The Slack bot for Coder Agents (CODAGT-1098) runs inside coderd and acts
as a service account that an admin picks. It creates chats and sends
messages as that account through Go calls, not HTTP requests. Two
dormancy rules break it:

1. **New service accounts start dormant.** The CLI and the web "Create
user" page send no status, and `InsertUser` falls back to `dormant`. So
the bot's account is dormant from the start.
2. **Accounts go dormant after 90 days without a "last seen" update.**
Only the API key middleware updates `last_seen_at`, and only on HTTP
requests. The bot never sends any, so its account goes dormant on day
90, even if people use the bot every day.

A chat owner must be active, so once the bot's account is dormant, every
Slack mention fails. Any other in-process integration that acts as a
service account has the same problem.

Dormancy does nothing useful for service accounts:

- It exists to free license seats, and service accounts never take a
license seat (#24401, #27279).
- It isn't a lock. Any API request activates a dormant account again.
- System users already skip the dormancy job for the same reason.

So this PR:

- creates service accounts as active when the request doesn't set a
status,
- rejects an explicit dormant status for a service account with a 400,
- skips service accounts in the dormancy job, the same way it already
skips system users.

Side effects: a service account that nobody uses for 90 days now stays
active. That has no effect on license seats. If the account has ever
sent traffic through AI Gateway, it also keeps its AI Governance seat
until an admin suspends or deletes it. That matters less than it sounds:
AI Governance is now included with Premium rather than sold per seat
(#27545), so the seat only counts on a license that still has an AI
Governance seat limit, and there it only feeds the seat-limit warning.
The dormancy job also no longer writes "marked dormant" audit entries
for service accounts.

I've left existing dormant service accounts alone rather than adding a
migration. An admin can activate one, and any API request from it
activates it too.

---

_This PR description was written by Coder Agents._
2026-10-23 12:53:40 +11:00
Nick Vigilante 6e51c66a97 docs: give every table header cell text and fail lint on empty ones (#30879)
## Summary

axe reports `empty-table-header` on 116 generated CLI reference pages
and several hand-written pages: a header cell with no text is announced
by screen readers as an unnamed column. This PR gives every table header
cell in `docs/` text, and adds a lint check so empty header cells can't
come back.

## How to review this PR

- `docs/reference/cli/`: 116 files, these all generate identically, so I
would only spot check 2-3 of them and skip the rest
- `docs/*` outside of `docs/reference/cli/`: 6 files, normal review of
these
- `scripts`: 5 files, code review of the Bash and Go files to make sure
we're properly inserting headers into each table

## What changed

**Generator.** `scripts/clidocgen` wrote an empty header row (`| | |`)
over each option's metadata table (Type, Environment, YAML, Default). It
now writes `| Property | Value |`. Subcommand tables already had `Name |
Purpose` and are unchanged. Regenerated with `make
docs/reference/cli/index.md`: 116 files under `docs/reference/cli/`
change. The header rows change, and the body rows of each option table
are re-padded to the wider first column; the content is otherwise
identical. Every option on those 116 pages now shows a visible `Property
| Value` header row above Type, Environment, YAML, and Default, so this
is a visual change on the docs site as well as a screen reader one. The
CLI's own `--help` output doesn't use this template, so it's unchanged.

**Audit logs.** `docs/admin/security/audit-logs.md` already has `Field |
Tracked` headers on `main` (the generator writes them), so there was
nothing to change there; the live-site finding predates that.

**Hand-written tables.**
- `docs/admin/networking/port-forwarding.md`: the CORS matrix had three
empty spanning corner cells. The corner now reads `From user` and `From
workspace` (spanning the three row-header columns, beside the Alice/Bob
and Workspace rows) and `To user`, `To workspace`, `To app` (over the
three row-header columns). The grid is still 3 header rows by 7 columns.
The From cells have `scope="row"` and the other header-row cells
`scope="col"`, so the From labels don't become column headers for the
body's label columns; the body's user, workspace, and app labels are
`<th scope="row">`; and a `<caption>` says columns are the origin and
rows the destination.
- `groups-roles.md`, `airgap.md`, `scale-testing.md`,
`workspace-tags.md`: these four corner cells are already filled by
#30873. The new check would fail CI without them, so this PR carries the
same four lines, byte-identical to #30873 (`Permission`, `Component`,
`Scenario`, `Input`), so whichever PR merges second rebases without
conflict. If #30873 merges first, these hunks drop out.

**New check.** `scripts/docshtmlcheck` (`make lint/docs-html`, part of
`make lint`) now also reports `empty-table-header`. I put it there
because that checker already parses every Markdown file under `docs/`,
generated pages included, with goldmark and tokenizes raw HTML with
`golang.org/x/net/html`, and it already runs in CI. A markdownlint
custom rule would have needed a new JS rule and HTML parsing there.
- Markdown pipe tables: the header row, via goldmark's GFM table
extension.
- Raw HTML tables: every `<th>`, tracked across HTML blocks, with
entities decoded and whitespace trimmed, so `<th></th>`,
`<th>&nbsp;</th>`, and `<th><br></th>` are all reported. Markdown
between the HTML blocks of an open `<th>` counts as its text. Tables in
code blocks are ignored.
- Output: `docs/x.md:29: empty-table-header: header cell 1 has no text
(table's first header "Auditor")`, plus a summary footer.
- The tokenizer loop moved out of `scanNode` into a shared
`tokenizeSegments` helper so both checks use it; `scanNode`'s behavior
is unchanged.
- The style guide's checks table gets one row; the README for the
checker describes the rule.

## Testing

- Tests first: `TestCheckTables` (now 22 cases) and
`TestRunEmptyTableHeader` failed against a stub, then pass. The existing
`docshtmlcheck` tests pass unchanged.
- `go run ./scripts/docshtmlcheck` on `main` reports 1,561 empty header
cells (116 CLI pages, port-forwarding, and the four #30873 tables); on
this branch it reports none.
- `go test ./scripts/docshtmlcheck/ ./scripts/clidocgen/
./scripts/docgenenv/`, golangci-lint on the changed packages, `make
lint/docs-html lint/docs-manifest lint/docs-gen-filter lint/emdash`,
`pnpm run check-docs`, and Vale on the changed hand-written pages all
pass.
- `make gen` couldn't run to completion locally (no `protoc-gen-go`);
CI's gen check covers it. The CLI pages were regenerated with the repo's
own target.

Review feedback applied in cfd29a2160 (entities decoded in Markdown
text, image alt text and autolinks count as text), 709a58f603 (per-kind
counts, finding order, CLI generator note), 8e61ff3afa (CORS matrix
scopes and caption), and b807bcbbc7 and 2871f89bdf (style guide rule
section, `make lint/docs-html` in the checks table, coverage counts).

Linear: DOCS-1308

---

🤖 Built with AI assistance.
2026-10-21 10:58:04 -07:00
Nick Vigilante fda1ed5dcd docs: give screenshots their own alt text and fill empty table headers (#30873)
## Summary

An axe sweep of every page on https://coder.com/beta-docs
(coder/docs-engine#224) found two content-side problems. Nine
screenshots have alt text identical to the italic caption right after
them, so screen readers read the same words twice (axe
`image-redundant-alt`). Four hand-written tables have an empty top-left
header cell, which leaves their row-label column without a name (axe
`empty-table-header`). This fixes both. These are content fixes on
`main` only; earlier release lines keep the old text.

## Findings

| Rule | Pages | Cause | Fixed where |
| --- | --- | --- | --- |
| image-redundant-alt | 4 | Alt text repeats the caption | This PR |
| empty-table-header | 4 hand-written | Empty corner header cell | This
PR |
| empty-table-header | 105 CLI reference pages, `audit-logs.md` |
Generated tables with empty headers | Not here: needs a generator change
|
| empty-table-header | `admin/networking/port-forwarding.md` | Spanning
corner cells in a raw HTML matrix | Not here: needs a rework of that
table |
| heading-order | `remote-desktops.md` | `<div class="tab">` typo |
Separate PR |
| link-name, scrollable-region-focusable, aria-valid-attr-value, label |
many | Engine | coder/docs-engine #220, #217, #224 |

## Fix

Each of the nine screenshots gets alt text that describes what it shows
(for example, "Preset dropdown with Ruby Development added between Full
Stack and Web Development"), and keeps its caption. The corner cells
become "Permission" (Groups and roles), "Component" (air-gapped
comparison), "Scenario" (scale-testing workloads) and "Input" (workspace
tags). Tables were re-padded with `markdown-table-formatter`.

## QA

1. Open each production page below. Expected: the screenshots and tables
look the same as before, except the four tables now show a word in their
top-left header cell.
2. In Chrome DevTools (Elements) or Firefox's Inspector, select a
screenshot on the Add a language page. Expected: its `alt` differs from
the italic caption under it.

## Pages to compare

| What to check | Production | Preview |
| --- | --- | --- |
| Screenshot alt text vs caption |
https://coder.com/beta-docs/@main/get-started/customize-your-template/add-a-language/
| This PR's GitHub preview:
https://github.com/coder/coder/blob/vigilante/docs-a11y-fixes/docs/get-started/customize-your-template/add-a-language.md
|
| Roles table corner cell |
https://coder.com/beta-docs/@main/admin/users/groups-roles/ |
https://github.com/coder/coder/blob/vigilante/docs-a11y-fixes/docs/admin/users/groups-roles.md
|
| Scale-testing table corner cell |
https://coder.com/beta-docs/@main/install/validate/scale-testing/ |
https://github.com/coder/coder/blob/vigilante/docs-a11y-fixes/docs/install/validate/scale-testing.md
|

## Testing

`markdownlint-cli2` and `markdown-table-formatter` over the eight
changed files: 0 errors. Re-running the sweep after merge should drop
`image-redundant-alt` and the four tables' `empty-table-header` findings
from `@main`.

## Upstream

No: these are Coder content fixes, not Fumadocs bugs.

Linear: [DOCS-1303](https://linear.app/coder/issue/DOCS-1303)

---

🤖 Built with AI assistance.
2026-10-21 10:28:45 -07:00