mirror of
https://github.com/coder/coder.git
synced 2026-11-21 18:58:17 +08:00
90948802e2439d2641f392e6229dd058a1dcafe3
759
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f923f4a525 |
chore!: remove the chat automations experiment (#30412)
Removes the experimental Chat Automations feature (`chat-automations` experiment) from main. This reverts the 16-PR stack that added it and adds two forward migrations that undo its schema and credential changes.
> [!WARNING]
> **Upgrade consequences**
>
> - **Automation data is deleted.** Migration 000615 drops the `chat_automations` table and deletes every queued message an automation delivered. Chats, their messages and ordinary queued messages stay. Messages lose their automation provenance (`automation_id`, `input_id`).
> - **Automation-only credentials are revoked.** Migration 000616 deletes API keys, OAuth2 codes and OAuth2 tokens whose only scopes (or allow-list entries) were `chat_automation:*`. Mixed credentials keep their other scopes. Custom roles lose their `chat_automation` permissions. OAuth2 apps that allowed only `chat_automation` scopes get the whitespace allowlist that grants nothing, as in 000595.
> - **A coordinated restart is required.** Stop all old replicas before the new version runs the migrations. Old replicas read the dropped table and columns, so a rolling deploy is not supported.
> - **Remove `--chat-max-automations-per-owner` before upgrading.** The flag, the YAML key `chat.maxAutomationsPerOwner` and the env var `CODER_CHAT_MAX_AUTOMATIONS_PER_OWNER` are removed. A deployment that still sets the flag or the YAML key will not start (`unknown flag` / `unknown option`). The env var is ignored. This includes dogfood. No release or tag contains the flag.
> - **Down migrations restore the schema only.** 000616 down and 000615 down recreate the 000611 schema with empty tables. They do not restore deleted automations, webhook secrets, provenance, queued deliveries, revoked credentials, stripped permissions or the deleted experiment rule.
## What is removed
- The `chat-automations` experiment and its stored runtime rule (`experiment_rule:chat-automations`).
- The `--chat-max-automations-per-owner` deployment option.
- The `chat_automation` RBAC resource, its member and chatd grants, and the `chat_automation:*` API key scopes.
- The automation sqlc queries, dbauthz wrappers and audit table entries.
- The management routes under `/api/experimental/organizations/{organization}/chat-automations`, and the webhook route `POST /api/experimental/chat-automations/{automation}/events` with its rate limiter.
- The chatd management service, webhook publish, schedule loop, the `manage_automations` tool, and the chatstate admission seam and queue promotion guard that only automations used.
- The Agents Automations page, editor, nav entry, chat labels, the Manage automations toggle and the API client.
- The `archived:any` chat search value that the automations "View chats" dialog added.
- `docs/ai-coder/agents/automations.md`, its manifest entry, the glossary entry and the related rows.
Reverted PRs: #30085, #30096, #30112, #30117, #30127, #30134, #30160, #30166, #30167, #30171, #30187, #30207, #30214, #30217, #30219, #30220.
## What stays, and why
- Migrations 000609, 000610 and 000611, their fixture, and the #30297 lock fix with `migration000609_test.go` stay unchanged. Deployments such as dogfood already ran them.
- New migration **000615** reverses the schema changes of 000609 and 000611 against the current schema. It uses the same short-wait lock-and-retry block as 000609, and it rebuilds `chats_expanded` from main's current definition minus the two automation columns. New migration **000616** follows the 000595 Tasks removal for credentials and recreates `api_key_scope` without the five `chat_automation:*` values. It keeps the `chat_project_memory:*` values from 000612.
- The `chat_automation` value stays in the `resource_type` enum, and `codersdk.ResourceTypeChatAutomation` stays. Old audit log rows stay readable, as with `task` after the Tasks removal.
- The 000615 delete fires the existing queue-version trigger, so `queue_version` moves to `snapshot_version` for each affected chat. `snapshot_version` is not bumped: the coordinated restart restarts every stream loop from an empty state, and the site does not read the version fields.
- `coderd/x/chatd/ARCHITECTURE.md` drops the sections the stack added and gets back its pre-stack wording, merged with the later main edits to the same file.
## Notes for reviewers
- #30379 (chat project page) merged while this PR was in progress. It passed `manageAutomationsEnabled` in `AgentCreatePage.test.tsx` and listed an `automations` route in `AgentsPageLayout.test.tsx`. Later main commits also added automation props in `ConversationTimeline.test.tsx` and `ConversationTimelineWorkingBlocks.stories.tsx`. This PR removes all of them.
- Remaining `automation` matches under `coderd`, `codersdk`, `enterprise`, `site/src` and `docs` are intended:
- migrations 000609 to 000611, their fixture and `migration000609_test.go`;
- the new 000615 and 000616 migrations and `migration000615_test.go`;
- the `chat_automation` resource type in `dump.sql`, `models.go`, `codersdk/audit.go`, the generated API docs, `swagger.json` and `typesGenerated.ts`;
- unrelated uses of the word "automation" (docs, `chatlabels_test.go`, `ratelimit.go`, `autostop.go`, `subagent_catalog.go`, `WorkspaceSharingSection.tsx`, `AgentChatPage.stories.tsx`).
Remote UAT on an isolated dev deployment passed. It upgraded a populated pre-removal database, then checked chats, queued messages, tokens, the 404 routes, the removed page and nav entry, and the experiments list.
---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_

|
||
|
|
35b3052ea8 |
ci(scripts/docsredirectscheck): reject redirects an earlier rule swallows (#30383)
## Summary
Redirects apply in file order and the first match wins, so rules have to
run from most specific to least.
Nothing enforced that, so a wildcard placed above a narrower rule inside
its subtree silently swallowed it.
## Problem
Given these two rules in that order, the second never applies:
```json
[
{ "source": "/docs/retired/:section(.*)", "destination": "/docs/reference/:section" },
{ "source": "/docs/retired/foo", "destination": "/docs/about" }
]
```
A reader asking for `/docs/retired/foo` is sent to `/docs/reference/foo`
instead of `/docs/about`.
If `/docs/reference/foo` happens to exist, every existing check passes:
the destination resolves, there is no duplicate source, no chain, and no
loop.
The rule is simply dead, and the only symptom is readers landing on the
wrong page.
`docs/redirects.json` is empty today, so this adds the guard before the
file gets its first wildcard rather than after.
## Fix
Compare each rule against the ones before it and fail when an earlier
source matches every URL a later source would.
Coverage is decided on path boundaries, not string prefixes, so
`/docs/retired/:path*` does not cover `/docs/retired-too/page`.
Two cases stay legal on purpose:
- An exact rule above a wildcard on the same prefix, which claims the
bare prefix and leaves the subtree to the wildcard.
- A regex wildcard above an exact rule on its bare prefix, since
`/:name(.*)` never matches the prefix itself.
Rules that share a source are still reported as duplicates, not as
unreachable, so one mistake produces one message.
## Changes
- `rules.go`: add `pattern.covers` and `checkOrder`, called from
`checkAcrossRules`.
- `README.md`: document the ordering requirement and the new failure.
- `main_test.go`: 11 cases covering each pattern pairing, both
orderings, the path-boundary case, reporting once against the first
coverer, and the duplicate interaction.
## Testing
- `go test ./scripts/docsredirectscheck/` passes;
`TestCheckRedirectsOrder` runs all 11 subtests.
- `make lint/docs-redirects` passes against the committed
`docs/redirects.json`.
- `gofmt -l` and `go vet` are clean on the package.
- Ran the binary against the example above: it fails with
`unreachable: rule [0] (source "/docs/retired/:section(.*)") comes first
and matches every URL this rule would; order rules from most specific to
least`,
exits 1, and passes with exit 0 once the two rules are swapped.
<details>
<summary>Why this check, and what it is a prerequisite for</summary>
`docs/redirects.json` is validated in CI and triggers a docs rebuild,
but no site reads it yet.
The redirects actually served live in two other hand-maintained files:
`coder.com/redirects.json` (297 rules, 173 under `/docs`) and
`docs-engine`'s `apps/router/redirects.json` (221 rules).
The plan is to make `docs/redirects.json` the single authored source and
have docs-engine compile it per version, so `apps/router/redirects.json`
becomes generated output.
Classifying the router's 221 rules showed all of them are same-version
moves once the version prefix is stripped, and that expanding them into
this file's narrow grammar yields 279 authored rules.
That expansion is what makes this check necessary now.
Collapsing many exact rules into wildcards is an engine optimization,
and the authored file will carry both wildcards and exact rules in the
same subtree, which is exactly the shape that can silently swallow a
rule.
Adding the guard while the file is still empty means the migration
cannot introduce an unreachable rule without CI saying so.
</details>
---
Resolves DOCS-1188.
Opened by Coder Agents on behalf of @nickvigilante.
<details>
<summary>CI note: one unrelated flake</summary>
`test-go-pg (ubuntu-latest)` failed on `coderd/x/chatd
TestChatTurnStopsAtStepLimit/Default`.
This PR changes three files under `scripts/docsredirectscheck` and
nothing in `coderd/`, so the failure is unrelated to the diff.
`lint`, `gen`, `fmt`, `check-build`, `test-go-race-pg`, `test-go-pg-17`,
`test-e2e`, and `test-go-pg` on macOS and Windows all pass.
The first run of this PR also had `changes`, `cla`, and `release-labels`
cancelled rather than failed, all three at exactly 15m03s, which skipped
the Go jobs entirely. A `--failed` rerun produced the results above.
</details>
|
||
|
|
bcedc5d47e |
fix(scripts/docsgenfiltercheck): accept CRLF line endings in banner check (#30476)
`bodyOpensWithContentBanner` split pages on `\n` and compared lines exactly. On a Windows checkout with CRLF endings, the first line of `docs/reference/cli/index.md` is `---\r`, so the front matter was never recognized and `TestBodyOpensWithContentBanner` failed deterministically on `test-go-pg (windows-2022)`. Normalize CRLF to LF before parsing, and add CRLF table cases so the bug reproduces on Linux too. Fixes CLI-55. Failing run: https://github.com/coder/coder/actions/runs/37570448753 ## Testing - The new CRLF cases failed before the fix and pass after it. - `go test ./scripts/docsgenfiltercheck`, `GOOS=windows go vet`, `golangci-lint`, and the full pre-commit hook pass. <details> <summary>CI flake note</summary> The first `fmt` run failed while downloading Go modules (`proxy.golang.org` returned `stream error: ... INTERNAL_ERROR` for `testcontainers-go@v0.40.0`), which also failed `required`. This is a network error unrelated to the change. I re-ran the failed jobs. </details> --- _This PR was generated by Coder Agents on behalf of @nickvigilante._ |
||
|
|
d031680ff2 |
fix(scripts/metricsdocgen/scanner): normalize package keys to slash paths (#30360)
Fixes the Windows failures in `TestBuildPrefixIndex` and `TestExcluded` (ENG-3443). The scanner keyed package directories with `filepath.Dir`, which uses `\` on Windows, but compared them against keys derived from Go import paths and against `excludeDirs`, which always use `/`. Prefixes never reached imported packages, and excluded subtrees weren't skipped. Each parsed file now records its directory once in slash form (`packageDir`), and the `prefixIndex` doc states the key rule. `excluded` normalizes its input because `scanDirectory` passes it native `filepath.WalkDir` paths. Generated output on Linux is unchanged. PR CI only runs `./cli/... ./enterprise/cli/... ./agent/...` on Windows, so I dispatched [`nightly-gauntlet` on this branch](https://github.com/coder/coder/actions/runs/37316261411). On `windows-2022`, both `scripts/metricsdocgen` and `scripts/metricsdocgen/scanner` pass. That run tested `c5462169cd`. The only later commit drops an unused field and rewords comments, so the result still applies. <details> <summary>Unrelated failures in the gauntlet run</summary> The Windows job still fails on `TestWorkspaceToolsGolden`, `TestEditMessageCancelsToolCallsOnAgent`, and `TestTools/WorkspaceExecute`. These fail the same way in [main's 2026-10-05 nightly](https://github.com/coder/coder/actions/runs/37262889155), together with the scanner failures this PR fixes. `TestAcquirer_MatchTags` also failed once, in provisioner code that this PR doesn't touch. </details> --- 🤖 Generated by Coder Agents on behalf of @nickvigilante. |
||
|
|
28cf704f27 |
chore: update references to the relocated install docs paths (#30380)
The Install docs moved into the five-phase spine in #29304, but several references outside `docs/` still point at the pre-move URLs. `docs/redirects.json` is empty, so those URLs 404 rather than forwarding. The release note generators are the user-visible ones: every generated release note links `coder.com/docs/install/releases` and `coder.com/docs/install/upgrade`. | Reference | Was | Now | |---|---|---| | Release schedule links in release notes | `/docs/install/releases` | `/docs/reference/releases` | | Upgrade link in release notes | `/docs/install/upgrade` | `/docs/install/operate/upgrade` | | README sizing link | `/docs/admin/infrastructure/validated-architectures` | `/docs/install/plan/sizing` | | Provisioner tag table comments | `docs/admin/provisioners/index.md` | `docs/install/operate/provisioners/index.md` | | FAQ provenance comment | `docs/admin/licensing/index.md` | `docs/install/prepare/licensing.md` | | ESR 2.24-2.29 upgrade table | `/docs/admin/provisioners` | `/docs/install/operate/provisioners` | | Helm provisioner README, `NOTES.txt`, and `values.yaml` | `/docs/admin/provisioners` | `/docs/install/operate/provisioners` | | Helm Coder chart README | `/docs/install/kubernetes` | `/docs/install/server/kubernetes` | | `workspace-tags` example README | `/docs/admin/provisioners#external-provisioners` | `/docs/install/operate/provisioners#types-of-provisioners` | | `kubernetes-envbox` example README | `/docs/admin/infrastructure/architecture#agents` | `/docs/install/plan/architecture#agents` | `scripts/releaser/docs.go` was already updated in #29304; this covers what that pass missed. Two notes on anchors: - The `#external-provisioners` anchor was already dead before #29304, so it now points at `#types-of-provisioners`, the section covering external, organization-scoped, and user-scoped provisioners. - Every other anchor was verified to still exist on its new page. One link left alone: `provisionerd/provisionerd.go` references `docs/admin/provisioners.md` through a pinned-commit GitHub permalink, which still resolves and shouldn't be rewritten. ## Verification - `go test ./scripts/release/...` passes, including the release note golden strings. - `go build ./scripts/releaser/` succeeds. - `make pre-commit` passes. - Markdown table padding reflowed with `markdown-table-formatter`; `markdownlint` reports no new findings. <sub>Opened by Coder Agents on behalf of @nickvigilante.</sub> |
||
|
|
b9c0853473 |
ci: skip the gen job for docs-only PRs that cannot change its output (#30164)
The CI `gen` job ran `make -j -B gen` on every PR, so a docs-only PR
spent about 160 seconds of an 8-core runner (12 recent runs: 154 to 170
seconds) confirming that nothing changed.
This PR skips the job for docs-only PRs that touch none of the docs
paths `make gen` reads or rewrites.
Replaying every commit on `main` since 2026-08-01 through the new
filter, 96 of 116 docs-only commits (83%) would skip.
- A new `docs-gen` paths filter lists `docs/manifest.json`,
`docs/reference/api/**`, `docs/reference/cli/**`, and the three
generated admin pages.
`gen` now needs `changes` and runs unless the PR is docs-only with no
`docs-gen` or workflow match.
Push, release-branch `create`, and `workflow_dispatch` runs always
regenerate. Non-release `create` events now skip `gen`, like every other
job that needs `changes`.
- `lint/docs-gen-filter` (`scripts/docsgenfiltercheck`, run by `make
lint`) treats as generated every file in `GEN_FILES`, plus every tracked
Markdown page whose body opens with the shared
`docgenenv.GeneratedContentBanner`. It fails when a generated file
matches the `docs` filter but not `docs-gen`, or when a `docs-gen`
pattern matches no tracked file.
This keeps the filter from drifting when someone adds a generator.
## Why skipping is safe
- No generator reads docs prose. Makefile rules and generators only
touch `docs/manifest.json` and the generated pages under `docs/`;
`examplegen` embeds only `examples/templates`, and no golden-file test
reads `docs/`.
- `dorny/paths-filter` matches a renamed file on both its old and new
paths (`src/main.ts` at the pinned SHA), so moving a generated page out
of `docs/reference/cli/` still runs `gen`.
- If `changes` fails, `gen` is skipped and `required` fails on the
`changes` result, so a failed classification never counts as an
exemption.
Docs-only PRs that edit `docs/manifest.json` (usually a new page) or a
generated page still run the full job, because the generators rewrite
those files.
DOCS-1142 tracks a lighter path for those PRs and for fresh-worktree
rebuilds: render the docs from the committed `swagger.json` and sidebar
fragments instead of running swag or building the CLI.
That work depends on DOCS-1131, which rewrites the same Makefile rules.
Refs DOCS-1141
<details>
<summary>Measurements, options considered, and validation</summary>
**Local profile (not changed by this PR).**
In a warm worktree, editing a docs page or `manifest.json` and running
`make -j gen` rebuilds nothing (0.9 seconds).
In a fresh worktree with a warm Go cache on 12 cores, `make -j
docs/manifest.json` took 40 seconds and `make -j gen` took 46 seconds.
The time went to `_gen/bin/clidocgen` (26 seconds), swag in
`coderd/apidoc/.gen` (18 seconds), and the database codegen chain, which
needs PostgreSQL.
Checkout mtimes are arbitrary and `coderd/apidoc/.gen` is untracked, so
all of that reruns once.
`clidocgen` runs twice per `make gen`, but each run takes about 1
second, so merging the runs isn't worth it.
**Options considered.**
1. Skip `gen` by path for docs-only PRs (this PR). Low risk, independent
of DOCS-1131.
2. A light CI job that runs only the docs generators, skipping heavy
prerequisites with `make -o`. Rejected: CI would keep a second
dependency list that can drift from the Makefile.
3. Content-hash stamps for swag. A committed stamp would conflict on
nearly every backend PR, and an untracked one doesn't help fresh
worktrees. Deferred to DOCS-1142.
4. Split swag from the API Markdown rendering now. It conflicts with
DOCS-1131. Deferred to DOCS-1142.
**Filter validation** (the workflow's own filters with `picomatch@2`,
`dot: true`, the matcher `paths-filter` uses):
| Change | `gen` |
| --- | --- |
| Prose page, image, root `README.md`, style guide, `.claude/docs` |
skips |
| New page plus `docs/manifest.json` | runs |
| Edit, delete, or rename out of `docs/reference/cli/**` or
`docs/reference/api/**` | runs |
| Audit log, Prometheus, or configuration reference page | runs |
| Mixed code and docs, `Makefile`, generator script, `offlinedocs` |
runs |
| Workflow change | runs |
| Docs-only `push`, release `create`, `workflow_dispatch` | runs |
Running `make lint/docs-gen-filter` against edited copies of the
workflow fails, as it should, in each of these cases:
`docs/reference/cli/**` narrowed to `docs/reference/cli/*.md` (137
nested pages), `docs/reference/api/**` narrowed to `*.json` (31 pages
plus the stale pattern), the configuration reference entry removed, a
mistyped admin page path, and the unsupported patterns
`docs/reference/**.md` and `docs/reference/*/**`.
</details>
<details>
<summary>CI flake unrelated to this PR</summary>
`test-js` failed once, on the second push, in
`src/pages/AISettingsPage/SpendPage/SpendPage.test.tsx` ("applies and
clears the 'provider_name' filter and resets pagination"). The same test
failed on `main` in run 36649227804. This PR changes nothing under
`site/`, and `test-js` passed on every later push.
</details>
---
_Generated by Coder Agents on behalf of @nickvigilante._
<details>
<summary>CI flake note</summary>
`test-go-pg (ubuntu-latest)` failed once on `ff25eba` because the runner
ran out of disk (`No space left on device`) before the tests reported
results.
This PR doesn't change Go code under test. The rerun passed.
</details>
|
||
|
|
fcbf45c571 |
docs: render audit log resources as one table per resource (#29797)
## Summary The audit logs page now lists each tracked resource in its own section with a simple two-column table, replacing the nested HTML tables that rendered poorly and overflowed on phones. ## Before and after Before, the generated block was a single Markdown table with a malformed `|<b>Resource</b>||` header. Each row held the resource name and its actions in one cell, then split a raw HTML `<table>` of fields across the remaining cells. The result rendered unevenly across renderers, was far wider than the page on mobile, and was hard to navigate with a screen reader. After, each resource gets an `###` heading under **Tracked Events**, which also gives it a linkable anchor. Below the heading, an `Actions:` line lists the audited actions as inline code, followed by a two-column Field and Tracked table with `Yes` or `No` values. Every table uses the same fixed column widths (Field 75%, Tracked 25%), so the Tracked column lines up across all resources. Two narrow columns fit at phone width without horizontal scrolling. Resources with no mapped actions skip the `Actions:` line instead of rendering an empty one. Resource ordering is unchanged. ## Changes - `scripts/auditdocgen/main.go` writes one section per resource. Each fields table is a small HTML table with `width` attributes, because Markdown tables size columns to their content and cannot align across tables. GitHub and the docs site sanitizer both keep `width` but strip inline `style` and `<colgroup>`. - The generator no longer panics when its start marker is the last thing in the file. - New `scripts/auditdocgen/main_test.go` covers section output, marker handling, and idempotent regeneration. - `docs/admin/security/audit-logs.md` is regenerated, and the intro sentence above the block now explains the actions line and the Tracked column. ## How it was regenerated `make docs/admin/security/audit-logs.md`, which builds the generator and runs `markdownlint-cli2 --fix` and `markdown-table-formatter` over the output. Running it a second time produces no diff. ## Testing - `go test ./scripts/auditdocgen/...` passes. - `pnpm exec markdownlint-cli2 docs/admin/security/audit-logs.md` reports 0 errors. Linear: https://linear.app/codercom/issue/DOCS-894 --- 🤖 Built with AI assistance. |
||
|
|
12caf883fc |
test(scripts/docgenenv): match missing include by fs.ErrNotExist (#30285)
## Summary `TestBuildManifestErrors/IncludeMissingFile` fails deterministically on Windows because it matches the POSIX error text `no such file or directory`. Windows reports the same condition as `The system cannot find the file specified.` This asserts `fs.ErrNotExist` in the error chain instead, plus the included file name. Fixes [ENG-3439](https://linear.app/codercom/issue/ENG-3439). ## Changes - Add an optional `wantErrIs` field to the `TestBuildManifestErrors` table, checked with `require.ErrorIs`. - `IncludeMissingFile` now expects `fs.ErrNotExist` and the text `nope.yml` (not `ref/nope.yml`, since Windows renders the path with escaped backslashes). No production code changes: `DecodeSourceFile` already wraps the `os.ReadFile` error with `%w`, and `errors.Join` preserves it. ## Testing - `go test ./scripts/docgenenv/... -count=1` passes on Linux. - `GOOS=windows go test -c ./scripts/docgenenv` compiles. - `golangci-lint run ./scripts/docgenenv/...` reports 0 issues; pre-commit hook passed. - Not run on Windows locally; the `test-go-pg (windows-2022)` job is the real check. --- _Generated by Coder Agents on behalf of @nickvigilante._ |
||
|
|
bb58916e6c |
ci: validate docs/redirects.json (#30209)
Adds `docsredirectscheck`, a lint for `docs/redirects.json`, the list of
redirects the documentation website applies for pages that have moved or
been removed. It runs as `make lint/docs-redirects`, part of `make lint`
and `make lint-light`, so a bad redirect is caught in the pull request
that adds it. The file does not exist yet, and the check passes while it
is absent, so this can merge before or after the file does.
## What it checks
It fails on:
- a file that is not a JSON array of well-formed rules (`source`,
`destination`, optional boolean `permanent`, no unknown fields);
- syntax outside the supported subset: a source under `/docs/`, written
as an exact path, a trailing `/:name*`, or a trailing `/:name(.*)`, with
no version segment such as `/@main`;
- an internal destination that is not a page in `docs/manifest.json`, or
a pattern destination that points into a section with no pages or uses a
parameter the source does not define;
- a source that matches a live page, which would hide it;
- duplicate sources, chains (a destination that is another rule's
source), and loops.
It warns, and never fails, when a pull request removes routes from
`docs/manifest.json` while `docs/redirects.json` is unchanged and does
not already cover them. Pages are sometimes removed on purpose. The
comparison is by route rather than by file, so a rename that keeps its
URL (for example `admin/foo/index.md` to `admin/foo.md`) does not warn.
In GitHub Actions the warning is an annotation on the manifest. The base
is the first parent of the PR merge commit, the same approach
`scripts/check_emdash.sh` uses, and the warning is skipped with a note
when it is not available.
Routes are derived from `docs/manifest.json` the way the docs website
derives them, including its plain-suffix stripping of `README.md`,
`index.md`, and `.md`, so the check and the site agree about which pages
exist. `scripts/docsredirectscheck/README.md` documents the rule format
and the limits.
## Testing
- 128 Go tests pass under Go 1.26.5: route derivation, every failing and
passing rule shape, the absent-file pass, exit codes, and the warning
logic through a fake git reader.
- I checked that the tests can fail by breaking the code 16 ways (for
example dropping the `index.md` suffix, disabling the shadow check,
reporting loops twice). All 16 were caught. That run found one gap, a
missing test for "redirects file changed", which is now covered.
- Ran against the repository's real `docs/manifest.json`: passes with no
redirects file, and a file with one of each failure class reports every
problem with the rule index, the source, and how to fix it.
- Ran the warning against real git history: it warns for an older base,
stays silent at `HEAD`, and skips with a note for an unknown revision.
- Lint: `golangci-lint` v2.0.2 built with Go 1.26.5 against the
repository config reports 0 issues. `paralleltestctx`, `intxcheck`,
`typos` 1.46.1, `gofumpt` and `gci` (through `make fmt/go`), and `go
vet` pass.
CI: `lint` (which runs this check), `fmt`, `title`, and the Go and
end-to-end test jobs pass. The `gen` job, and so `required`, fails on
this branch for a reason this PR does not touch: `main` is failing it
too. `docs/manifest/generated/cli.json` has not been regenerated for the
`coder sharing` commands that landed in the latest commit on `main`. It
should clear once `main` is fixed and merged into this branch.
Not run locally: the full `make lint` and `make pre-commit`. The local
hooks are opt-in and were off. The annotation output has been exercised
by unit tests and a local run with `GITHUB_ACTIONS=true`, but not yet on
a real pull request merge commit; this PR does not change the manifest,
so it will not exercise it either. No workflow change is needed, because
the `lint` job already runs `make lint` for any change that is not
offlinedocs-only.
---
🤖 Built with AI assistance.
|
||
|
|
9316d67440 |
feat: add chat automations management API behind chat-automations (#30112)
Adds the management API for chat automations under
`/api/experimental/organizations/{organization}/chat-automations`,
behind the new user-scoped `chat-automations` experiment. This is the
first of two PRs for RFC step 3; nothing publishes automation messages
yet.
- **Experiment:** `chat-automations` is in `ExperimentsKnown`,
`ExperimentsUserScoped`, and the ruleguard list in `scripts/rules.go`.
Every route asks `chatd.AutomationsEnabled(ctx, api.ExperimentEvaluator,
callerID)`, which fails closed on a missing subject or evaluator; the
routes stay mounted and return 404 when the experiment is off for the
caller, so a runtime rule for one user applies on the next request
without a restart. There is no `/api/v2` alias.
- **Routes:** list, create (201), get, `PATCH`, delete (204), with
Swagger annotations and audit entries. List returns the automations in
the organization the caller can read (members see their own,
organization admins see all).
- **Service** (`coderd/x/chatd/automations.go`): create validates kind
and target shape, a non-empty prompt, a five-field cron and IANA time
zone, model access, and that an `existing_chat` target is a root chat of
the owner in the same organization. It defaults `when_busy` to `skip`
for schedules and `queue` for webhooks and computes the first schedule
cursor. `PATCH` runs the same per-field validation on each changed
field, rejects `kind` and `target_mode`, bumps `schedule_revision` on
prompt, cron, or time zone changes, and recomputes the cursor on cron or
time zone changes.
- **Owner-only:** only the owner can `PATCH` an automation, even with
organization-admin or site-owner roles (403); admins can list, read, and
delete.
- **Secrets:** a webhook's secret (`coder_automation_` prefix) is
returned once in the create response. Only its SHA-256 is stored, and it
appears in no list, get, audit, or log output.
- **Cap:** new option `--chat-max-automations-per-owner` (default 50)
caps automations per owner across all organizations; creating one more
returns 409. Creates serialize on a per-owner advisory lock.
- **Cron:** `cron.Standard(spec, timeZone)` accepts any standard
five-field expression (the existing `Weekly` rejects day-of-month and
month restrictions). Responses include the next five run times of an
enabled schedule.
PR 3b (stacked on this one) adds disable and re-enable with the queue
cutoff, makes delete run disable first, and adds secret rotation and the
schedule preview route. Until then, the queue promotion guard from
#30096 discards queued rows whose automation was deleted.
Dogfood UAT ran on a real dev instance and passed:
create/list/get/patch/delete via curl, owner-only 403s for an
organization admin and the site owner, the cap (including concurrent
creates and cross-organization counting), a runtime rule turning the
experiment off for one user without a restart, and `/api/v2` 404s.
Part of CODAGT-1209 (PR 3b closes it)
Part of CODAGT-1135
Refs CODAGT-1217
Stack: PR 3 of the Automations for Coder Agents stack, on top of #30096
(which is on top of #30085).
> This PR was written by an AI agent (xum) and reviewed by the agent's
own test audit and UAT. A human has not reviewed it yet.
---
_Generated with [`xum`](https://github.com/coder/xum) • Model:
`anthropic:claude-opus-5-5` • Thinking: `high`_
---------
Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
||
|
|
2e0f97e5de |
feat: add type and secret status to the configuration reference (DOCS-896) (#29310)
## Summary The generated configuration reference told a reader how to set each deployment option but not what the option accepts. Every entry carried the environment variable, CLI flag, YAML key, and default, while serpent's value type stayed in the source. A reader could not tell a `duration` from an `int`, or discover an enum's accepted values, without following the flag link into the CLI reference. - **Type** is now rendered for all 200 options from the serpent value. Enums expand into their choices (`- Type: `enum`, one of `password`, `awsiamrds``) rather than printing serpent's escaped `enum[a\|b]` spelling, which is meant for its own table output. - **Secrets** are now marked. The nine options carrying the `secret` annotation that `codersdk.IsSecretDeploymentOption` reads are deliberately excluded from YAML, so the page now says where to set them instead of leaving the omission unexplained. ## Correction to the issue DOCS-896 claimed the page showed a YAML key for secret options. It does not: all nine secret options have an empty `YAML` field, so the generator already omitted that bullet. The real gap was that nothing explained *why* the YAML key is missing. The page header and the per-option marker now cover it. ## Verification - `go test ./scripts/configdocgen` passes, with new cases for the enum-choice parsing, plain and nil value types, and the secret marker rendering exactly once for the annotated option. - Regenerated page has 200 `- Type:` lines for 200 rendered options and 9 secret markers. - `make lint/emdash`, markdownlint, `markdown-table-formatter`, and Vale are clean on the regenerated page. `golangci-lint` clean on the package. Full `make pre-commit` passed. <details> <summary>Local pre-push note</summary> The repository pre-push hook runs the full Go suite locally. In this workspace it segfaults the `make` process outright, and an isolated `make test` run produces ~1,000 failures unrelated to this change (embedded NATS servers failing to start within 10s, chatd state-machine tests), which reproduce independently of this diff. I verified the change with `go build ./...`, the package tests above, and the full pre-commit suite instead, and disabled the hook for this worktree only using its documented `git config coder.pre-push` knob, restoring the setting immediately after the push. No `--no-verify`. CI is the authority on the full suite here. </details> --- Generated with Coder Agents on behalf of @nickvigilante. Linear: [DOCS-896](https://linear.app/codercom/issue/DOCS-896/configdocgen-render-option-type-and-secret-status) |
||
|
|
4a184ca54a |
feat: add generated API key scopes reference (DOCS-135) (#29307)
## Summary Coder validates every requested API key scope against a curated public catalog in `coderd/rbac`, but the docs never listed it. Readers had to infer the requestable set from the `codersdk.APIKeyScope` enum, which is a superset that includes internal scopes a token cannot carry. This adds `scripts/scopesdocgen`, which renders `docs/reference/api-key-scopes.md` from `rbac.ExternalScopeNames` and the policy definitions behind it: - built-in scopes (`coder:all`, `coder:application_connect`) - composite `coder:*` scopes, each with the permissions it expands to - low-level `resource:action` scopes, with the action descriptions the policy declares - the deprecated `all` / `application_connect` aliases and their canonical spellings The generator is wired into `make gen`, so CI fails when the scope catalog and the page drift apart. ## Also in this change - `coderd/apikey.go`: the unrequestable-scope `400` detail pointed at `admin/users/sessions-tokens#api-key-scopes`, which only ever held a partial list. It now points at the generated reference. - `docs/admin/users/sessions-tokens.md`: the partial enumeration and the "read the schema, but not all of it applies" caveat are replaced with a link to the reference. The how-to content stays. ## Verification - `go test ./scripts/scopesdocgen` covers the sentence formatting, the scope partitioning, and a guard that every name in `rbac.ExternalScopeNames()` appears on the rendered page. - `go test ./coderd -run 'TestTokenScoped|TestCreateTokenScopes|TestExternalScopesAreStorable|TestTokenLegacySingularScopeCompat'` passes, confirming the page's claims about the default scope and the rejection of internal scopes. - `make lint/emdash`, `make lint/docs-html`, `make lint/check-scopes`, `pnpm run check-docs`, and Vale on the changed pages are clean. Full `make pre-commit` passed. <details> <summary>Context and scope decisions</summary> Part of the DOCS Automated reference documentation project, which tracks generating reference pages from product source of truth instead of maintaining them by hand. DOCS-135 is the first item: it was filed as "wire up the existing generator," but `scripts/apikeyscopesgen` emits Go (`codersdk/apikey_scopes_gen.go`), not documentation, so there was no generator output to surface and this adds one. Decisions made while implementing: - **Placement.** `docs/reference/api-key-scopes.md`, as a direct child of Reference rather than inside `docs/reference/api/`, because that directory is owned by the swagger generator. - **Page shape.** Follows the `scripts/docgenenv` convention for generated reference pages: the generated marker and page metadata in front matter, the generated-content banner in the body, and sections starting at level two because the front-matter title renders as the page heading. - **Public scopes only.** The page lists what `rbac.IsExternalScope` accepts. Internal `resource:action` pairs are deliberately excluded, which is the distinction the old schema link failed to make. - **Acronym handling.** Policy action descriptions are lowercase source strings (`"ssh into a given workspace"`). The generator restores the casing of a small set of leading acronyms rather than editing the RBAC package, so the change stays inside the docs pipeline. Sibling backlog items turned out to be already delivered and are being rescoped separately: `metricsdocgen` and `auditdocgen` already write into their docs pages, and `scripts/configdocgen` already generates the configuration reference. </details> --- Generated with Coder Agents on behalf of @nickvigilante. Linear: [DOCS-135](https://linear.app/codercom/issue/DOCS-135/wave-1-wire-up-api-key-scopes-reference-to-docs) ## Product UI impact, please read This PR corrects three RBAC action description strings in `coderd/rbac/policy/policy.go`: | Action | Before | After | |---|---|---| | `workspace:start` | allows starting a workspace | start a workspace | | `workspace:stop` | allows stopping a workspace | stop a workspace | | `api_key:update` | update an api key, eg expires | update an api key, for example its expiry | These were internal-facing until this PR, which is what made them worth fixing: the new reference page renders them verbatim to operators, and "eg expires" is not decodable by a reader without codebase context. **They are not docs-only.** `make gen` propagates them to `coderd/rbac/object_gen.go` and `site/src/api/rbacresourcesGenerated.ts`, and `CreateEditRolePageView.tsx` renders the description next to each action in the custom roles editor. So this changes admin UI copy, and `CreateEditRolePageView.stories.tsx` means Pixel may now report a genuine snapshot diff on that component rather than the pre-existing failure noted below. The new wording matches the convention the rest of the table already follows (`ssh into a given workspace`, `create an AI Gateway key`), so this makes the UI more internally consistent, not less. Flagging it explicitly because a docs PR changing product copy deserves an owner's eyes rather than a silent merge. Happy to split it out if RBAC or frontend would rather own it, with the caveat that the reference page would then publish `eg expires` in the meantime. <details> <summary>CI note: Storybook / Pixel failure</summary> The `Storybook` check fails at its `Snapshot` step, and `Pixel / Review` reports `build failed` with no snapshots processed. **Updated:** this note originally said the branch touched no files under `site/`. That is no longer true. Correcting the RBAC policy description strings (CRF-24) required `make gen`, which regenerated `site/src/api/rbacresourcesGenerated.ts` alongside `coderd/rbac/object_gen.go`. That file is a generated string table with no rendered component behind it, so it still cannot account for a Storybook snapshot or Pixel build failure, but the original justification no longer holds and is replaced by this one. The failure predates that change: it was present when the branch genuinely had no `site/` diff. Every other check passes. </details> |
||
|
|
149366a459 |
feat: validate documented experiment keys (DOCS-139) (#29316)
## Summary
The docs name specific experiment keys wherever an individual
experimental feature is documented, and nothing verifies those keys
still exist in the code.
When an experiment is renamed or graduated, the enablement example keeps
telling operators to set a key the server no longer accepts.
This adds `scripts/checkexperimentkeys`, which fails when a key named in
`docs/**` is absent from `codersdk.ExperimentsKnown`, and wires it into
`make lint` as `lint/check-experiment-keys`.
**The data flows one way.**
The check reads keys the docs already name and validates them against
code.
It does not generate a page, add a manifest route, or write any key into
`docs/`.
That is deliberate: #29113 retired the generated feature-stage lists
because the team decided not to advertise which features are currently
experimental or beta.
A guard against stale keys is compatible with that decision; an index is
not.
The five key references the check currently guards are the per-feature
ones that decision left in place: `chat-advisor`,
`chat-virtual-desktop`, `auto-fill-parameters`, `agent-lifecycle-hooks`,
and `mcp-server-http`.
### Recognition rules
Only explicit enablement forms are matched: `--experiments=<key-list>`
and `CODER_EXPERIMENTS=<key-list>`, including every key in a
comma-separated list.
Values may be single- or double-quoted.
Explicit shell line continuations are joined before matching, preserving
the first physical line for a finding.
Bare identifiers in prose are ignored on purpose.
A check that guesses at prose produces false positives, and a check with
false positives gets deleted by the first person it blocks.
`*`, `feature1`, `feature2`, and angle-bracketed values are recognized
placeholders.
The recognized forms are documented in the script's README.
Known gap: the space-separated `--experiments <key>` form is not
matched.
No prose uses it today, so this is latent rather than broken, and
closing it is a small follow-up if the form reappears.
### Also fixed
`ExperimentMCPToolSearch` had no case in `DisplayName()`, so it rendered
as a title-cased guess in the product UI as well as anywhere else
display names surface.
`TestExperimentDisplayNames` now pins the display name of every known
experiment against an expected map, with a length assertion, so a new
experiment cannot silently fall back to the title-cased key.
## Verification
- `go test ./scripts/checkexperimentkeys ./codersdk` passes.
Coverage includes known and unknown keys, quoted values, shell
continuations, placeholders, multi-key lists, bare-prose exclusion, and
failure-output formatting.
- `golangci-lint run ./scripts/checkexperimentkeys/... ./codersdk/...`
reports 0 issues.
- `make lint/check-experiment-keys` is clean against current `docs/`.
- Negative control: a fixture containing
`CODER_EXPERIMENTS=not-a-real-key` exits 1 with the expected finding.
- The full `pre-commit` hook passes, including
`lint/check-experiment-keys` inside aggregate `make lint`.
<details>
<summary>History: the deferred lint wiring, now resolved</summary>
This PR previously landed the tool and a standalone `make` target while
leaving the one-line addition to aggregate `make lint` for a follow-up,
and stayed draft, because three documented `oauth2` keys were stale and
owned by another PR:
- `docs/admin/integrations/oauth2-provider.md:34`
- `docs/ai-coder/mcp-server.md:108`
- `docs/ai-coder/mcp-server.md:114`
#29268 merged on 2026-09-15 and removed all three in favor of
`CODER_OAUTH2_PROVIDER_ENABLE`.
The branch is rebased onto that, the check is green against `main`, the
wiring is folded into this PR, and the merge-order constraint recorded
as CRF-5 no longer applies.
The rebase also collided with `DisplayName()`, which gained new cases on
`main`.
Resolved in favor of `main`'s switch rather than this branch's earlier
map refactor, keeping the production diff to the one missing case and
moving the exhaustiveness expectations into the test.
</details>
<details>
<summary>Why this replaced a generated reference page</summary>
DOCS-139 originally asked for a generated
`docs/reference/experiments.md` listing every key in `ExperimentsKnown`.
That was built and opened as #29311, then closed without merging.
Commit
|
||
|
|
72e31ffb4c |
fix: prevent Prometheus metrics reference drift (#29314)
## Summary The Prometheus metrics reference merged scanner output with a hand-maintained file, and changes to the hand-maintained half could not fail CI. 66 of the 76 static families had no scanner coverage: four files sat in a skip list pending `WrapRegistererWithPrefix` support, and the `aibridge/` tree was outside the scan roots entirely. Rename or add a metric in any of them and `make gen` regenerated the page unchanged, so `check_unstaged.sh` passed while the published table quietly went wrong. The scanner now resolves the prefixes a registerer applies: - Indexes `WrapRegistererWithPrefix` and `NewMetricAliasRegisterer` call sites, resolving the prefix from a string literal or an imported constant. - Maps that prefix to the package whose constructor receives the wrapped registerer, covering the two shapes the codebase uses: a constructor that **forwards** its registerer to another package (`aibridge.NewMetrics` to `aibridge/metrics.NewMetrics`), and a collector **registered directly** against the wrapped registerer (`gatewayRegisterer.MustRegister(keypool.NewStateCollector(...))`). - Indexes only the canonical prefix of an alias registerer. The legacy `coder_aibridged_` and `coder_aibridgeproxyd_` aliases are deprecated per AIGOV-447 and should not be taught in the reference. With prefixes resolved: skip list deleted, `aibridge` added to the scan roots, and all 29 `coder_ai_gateway_*` families removed from the static file, which now holds only genuine externals (`go_*`, `process_*`, and metrics built dynamically). `enterprise/scaletest/agentfake` is excluded deliberately: its fake-agent metrics are not part of a deployment's surface, so documenting them would send operators looking for series they will never see. **Also fixes two extraction and merge gaps.** Label lists written as `append(baseLabels, "status", "route")` now resolve, and any unresolvable element returns no labels rather than a partial list. Static runtime-label overrides now replace generated labels only: generated name, type, and HELP remain authoritative. ## Verification The prefix-scanning refactor itself preserves the existing AI Gateway rows. However, the page is **not byte-identical** to `main` because this round fixes two already-published stale HELP strings. Its SHA-256 changes from `7ced1e7e9f2d4caf5e3b5e484ef4af14f955b8b4cd1a14fe81360bbdd49bb150` to `a68774275a3b21d5bae65024cc8ee65b52c51e52786c9aea45e3981e4e7f1643`. | Metric | Before | After | | --- | --- | --- | | `coderd_agentstats_connection_median_latency_seconds` | The median agent connection latency | The median agent connection latency in seconds | | `coderd_agentstats_startup_script_seconds` | The number of seconds the startup script took to execute. | Amount of time taken to run the startup script in seconds. | - `go test ./scripts/metricsdocgen/...` covers prefix resolution from a literal and imported constant, alias-registerer argument selection, collector registration, forwarder propagation, scan-to-emit prefix application, all-or-nothing label extraction, static-label merging, and the exclusion predicate. - `golangci-lint run ./scripts/metricsdocgen/...` and full `make pre-commit` pass. ## What this does not fix Ten metrics are still skipped for having no `HELP` text, with a warning to stderr rather than an error. Making that fatal means writing accurate descriptions for ten metrics in the agent and SSH server packages, which is a behavioral claim I would rather not guess at. Follow-up filed as DOCS-906. The scanner still uses package-level syntactic prefix inference. Broader validation of prefix scan roots, mixed registration within a package, and parameter-passed registerers belongs in DOCS-908 rather than this focused drift fix. <details> <summary>Local pre-push note</summary> The pre-push hook cannot run in this workspace: GNU Make 4.4.1 segfaults on the repo's `.SHELLFLAGS = $@ -ceu` configuration for a target named `test`, tracked in DOCS-903 with a minimal reproduction. I verified with the package tests, `golangci-lint`, and full pre-commit, and disabled the hook for this worktree only through its documented `git config coder.pre-push` knob, restoring it right after the push. No `--no-verify`. </details> --- Generated with Coder Agents on behalf of @nickvigilante. Linear: [DOCS-897](https://linear.app/codercom/issue/DOCS-897/metricsdocgen-static-metrics-file-can-go-stale-without-failing-ci) |
||
|
|
35abc22fa9 |
fix(scripts/aibridgepricesgen): drop claude-sonnet-5-5 bare ID injection (#30229)
The scheduled `aigateway-prices-refresh` workflow fails ([run](https://github.com/coder/coder/actions/runs/36840685231)) with `anthropic.claude-sonnet-5-5 now present upstream; drop the injection`. #30159 added an `overrides.jq` injection for the Bedrock ID `anthropic.claude-sonnet-5-5`, copied from `global.anthropic.claude-sonnet-5-5`, because models.dev only listed the global profile at the time. A few hours later, models.dev added the bare ID itself ([sst/models.dev#8417](https://github.com/sst/models.dev/pull/8417)) with the same pricing and limits, so the guard now fails the refresh. This removes the injection. `prices.json` is unchanged: the existing `anthropic.claude-sonnet-5-5` row now comes from upstream with the same values. Other upstream data drift is left to the workflow's own refresh PR. After merge, `aigateway-prices-refresh` will be rerun manually on `main` to open the refresh PR. > [!NOTE] > Created by Coder Agents on behalf of @ssncferreira. |
||
|
|
f1ed84ffab |
docs: author the sidebar in per-section YAML compiled to manifest.json (#30165)
## Summary The docs sidebar is now written as YAML files under `docs/manifest/`, one route and its direct children per file, and a new tool, `scripts/docsmanifestgen`, compiles them into `docs/manifest.json`. Moving two top-level sections is now a 2-line change in `docs/manifest/index.yml` instead of a diff of hundreds of lines in a 2,600-line JSON file. The compiled `docs/manifest.json` is byte-identical to `main`, so coder.com, docs-preview, deploy-docs, and offlinedocs need no changes. Refs [DOCS-1131](https://linear.app/codercom/issue/DOCS-1131/author-the-docs-sidebar-in-per-section-yaml-compiled-to) ## Changes - **Sources:** `docs/manifest/index.yml` holds `versions` and the section files in sidebar order. Each section file (`about.yml`, `admin.yml`, and so on) holds one top-level route. - **One level per file:** a file holds one route and its direct children. A child with children of its own, or with `children_from`, lives in its own file in a directory named after the parent file, and the parent lists it as `- include: admin/users.yml`. For example, `get-started.yml` includes `get-started/customize-your-template.yml`, which lists that page's children. The 8 section files split into 53 source files. - **`scripts/docsmanifestgen`:** `build` compiles the sources into `docs/manifest.json`, `fmt` formats them, and `check` validates them. - Keys must be known (a typo like `titel:` fails with a line number) and appear in a fixed order in both the YAML and the JSON. - Every `path` must exist, and every file under `docs/manifest/` must be referenced from `index.yml`, an `include`, or a `children_from`. - A grandchild in the same file fails with a message to move the child into its own file, and an `include` entry can't set other keys or name a file that is already used. - A comment on the same line as a `title` or `description` is rejected, because an unquoted ` #` would silently cut off the value. - **Generated fragments:** `clidocgen` and `apidocgen` no longer rewrite the manifest. They write the Command Line and REST API children to `docs/manifest/generated/*.json`, which the sources pull in with `children_from`. The tool accepts fragments as YAML or JSON. - The hand-written REST API descriptions and states moved into the YAML, attached to generated routes by title. A YAML entry that matches no generated route, or disagrees with one, fails the build instead of being dropped silently. - **Shared code:** loading, validation, and fragment merging live in `scripts/docgenenv/sources.go`, so the generators and the tool share one loader. `docgenenv.Route` gains YAML tags and the source-only `ChildrenFrom` and `Include` fields (`json:"-"`). `LoadManifest` is removed because nothing reads the compiled JSON anymore. - **Makefile:** - `docs/manifest.json` is built from the sources and fragments, which replaces the `_gen/manifest-staging.json` handoff. - Each fragment has its own rule, and the fragments are added to the `.PRECIOUS`, `GEN_FILES`, and `gen/mark-fresh` lists. - `DOCS_MANIFEST_SOURCES` finds the source files recursively. - New targets: `fmt/docs-manifest` (part of `fmt`), `lint/docs-manifest` (part of `lint`), and `gen/docs-manifest`, the quick path after a sidebar-only edit that skips regenerating the CLI and API fragments. - **`.gitattributes`:** marks `docs/manifest.json` and `docs/manifest/generated/*` as generated so GitHub collapses them in diffs. - **Guidance:** the content guidelines, the style guide, `DOCS_STYLE_GUIDE.md`, the `write-docs` and `doc-check` skills, `docs/README.md`, and `docs/tutorials/example-guide.md` now point to the YAML sources instead of `docs/manifest.json`. ## Testing - Split today's `docs/manifest.json` into the sources, rebuilt it, and confirmed the output is byte-identical to `main`. After splitting the sources to one level per file, the rebuilt `docs/manifest.json` and a fresh `clidocgen` CLI fragment were still byte-identical, and `LoadManifestSources` still finds the REST API and Command Line routes through their includes. After rebasing onto `main`, both commits rebuild `main`'s `docs/manifest.json` byte for byte. - Hand-edited `docs/manifest.json` and a YAML source, then rebuilt: the YAML change persisted and the JSON edit was overwritten. CI's `make -B gen` plus `check_unstaged.sh` fails on a committed hand edit to the JSON. - Deleted both fragments and ran `make docs/manifest.json` in a fresh worktree, which regenerated them through swag and `clidocgen`. `docs/manifest.json`, the fragments, and every generated CLI and API page had no diff. - Swapped User Guides and Administration in `index.yml`: 2 changed lines in the source, 166 generated lines in `docs/manifest.json`. Swapping back restored the file exactly. - `go test` for `scripts/docgenenv`, `scripts/docsmanifestgen`, `scripts/clidocgen`, and `scripts/apidocgen/postprocess`. The new tests cover merging, includes, every validation error, idempotent formatting that keeps comments, and a check that the key order matches the struct field order. - `golangci-lint` on the changed packages, and the full `make pre-commit` hook (gen, fmt, lint including `lint/docs-manifest`, and the slim build). ## Notes - Open PRs that edit `docs/manifest.json` will need to redo their sidebar changes in the YAML sources after this merges. - #30161 (merged) stopped escaping `&`, `<`, and `>` in `docs/manifest.json`. This PR carries that over: all manifest JSON escaping is in `docgenenv.MarshalJSON`, which sets `enc.SetEscapeHTML(false)`, and `Manifest.Marshal` from #30161 is gone because the generators no longer write the manifest. - #30129 (merged) flattened `admin/external-auth/index.md` and `ai-coder/agents/tools/index.md` to single files, and the YAML sources use the new paths. - The CLI index and REST API page front matter still update only on a full `make gen` when their sidebar metadata changes, as it did before. That gap and the overall cost of `make gen` are tracked in [DOCS-1141](https://linear.app/codercom/issue/DOCS-1141/reduce-the-compute-cost-of-make-gen). <details> <summary>Decision log</summary> ### Goal Make the sidebar easy to reorder and hard to break, with strict key order and YAML sources, while keeping `docs/manifest.json` as the file downstream systems read. ### Jsonnet vs. a custom tool Jsonnet was evaluated first and rejected, based on tests against go-jsonnet v0.22.0: - Jsonnet always sorts object keys alphabetically, and there's no option to keep them in order (`preserve_order` isn't a parameter of `manifestJsonEx` or `objectFieldsEx`). Passing today's manifest through Jsonnet and then biome changed 2,114 of 2,478 lines. - Unknown keys pass through silently, so a `titel:` typo ends up in the output. - The sources would be `.jsonnet` files, not YAML. Reading YAML takes `std.parseYaml(importstr ...)`, and the keys still come out sorted. - Restoring key order would need a Go step after Jsonnet anyway, and that step is most of this tool. Decoding YAML into Go structs with yaml.v3 (already a dependency) gives key order from the struct, rejects unknown keys, keeps comments, and reproduced the current manifest byte for byte. ### Design choices - **Ordered by `index.yml`:** reordering sections touches only the index. - **One route and its direct children per file:** every file stays short and flat, so a subsection can be found, reviewed, and moved as one file. Files nest by parent file name rather than by docs path, so the directory tree matches the sidebar tree. Include paths are relative to `docs/manifest/`, like `children_from`, so every reference to a file is spelled the same way. A child with `children_from` also gets its own file, so the rule has no exceptions. - **Generated subtrees in their own fragments:** the generators can't safely rewrite hand-edited YAML, so they own separate files. Hand-written metadata for generated routes lives in the YAML, attached by title, so descriptions never live in a generated file. - **Key order enforced in both sources and output:** `fmt` rewrites the sources, `check` fails on unformatted sources, and the output order comes from the `docgenenv.Route` field order. - **`&` left unescaped:** the output matches `main` after #30161, which stopped escaping `&` downstream. - **`gen/docs-manifest` separate from `fmt`:** keeping manifest assembly out of `fmt` means `make -j gen fmt` never has two jobs writing `docs/manifest.json` at once. - **YAML pitfalls:** unquoted `no` and `123` stay strings because the fields are typed as strings, an unquoted `: ` is a parse error, and the silent ` #` truncation is rejected by the comment check. ### Out of scope - Replacing `&` with "and" in titles (a style question). - Reducing the cost of `make gen` (DOCS-1141). </details> --- _This PR was generated by Coder Agents on behalf of @nickvigilante._ |
||
|
|
0ce91ffc18 |
fix: stop escaping ampersands in docs manifest titles (#30161)
Closes DOCS-1139.
Go's `json.MarshalIndent` escapes `&`, `<` and `>` for HTML safety, so
both docs generators wrote titles like "Licensing & usage" into
`docs/manifest.json` as `Licensing & usage`. The two forms decode
identically (the offline docs site reads the file with `JSON.parse`),
but the escaped form reads like a bug in review, and a hand-typed `&`
flipped back on the next `make gen`.
Add `Manifest.Marshal` in `scripts/docgenenv`, which disables HTML
escaping, and use it from `clidocgen` and `apidocgen/postprocess`. The
two titles in `docs/manifest.json` that still carried the escape are
updated to match. A unit test covers the unescaped output and the round
trip through `LoadManifest`.
Testing: `go test ./scripts/docgenenv ./scripts/clidocgen
./scripts/apidocgen/...` passes. I ran `clidocgen -manifest-only`
against a copy of the manifest and confirmed the output has no escapes
and parses to the same content as the committed file. I did not run the
full `make docs/manifest.json` (it needs the site dependencies and
Biome), so the committed file keeps its existing Biome formatting.
cc @ianjevans for awareness.
---
🤖 Built with AI assistance.
|
||
|
|
fc0af7fbd8 |
feat: open a chat_turn span per prompt (#29771)
**TL;DR:** Wraps each prompt in a `chat_turn` root span with every lifecycle stage parented under it. The span records one outcome per turn (`completed`, `interrupted`, `error`, `abandoned`), and the new `coderd_chatd_turn_outcomes_total` counter counts those outcomes. Turns stay correct when tasks are canceled, replaced, or retried. Each prompt runs inside a `chat_turn` root span owned by the runner (`runnerTurnSpan`). The generation step, prepare, MCP connect, stream, TTFT, provider attempt, commit, thinking, tool call, compaction, and retry backoff stages are parented under it, activating the stages from #29770. `chat_turn` spans are standalone roots: the turn runs on a worker, often on another replica, and no trace context is persisted. **Lifecycle** - **Start.** Each generation loop iteration calls `Ensure`, which opens the turn if none is open and returns a `turnToken`. The span is backdated to the trigger: the latest of the last user prompt, a dynamic tool's result message after it, and a pending compaction request. An `acquisition` stage covers trigger to pickup. - **Stale trigger / takeover.** A trigger at or before the previous anchor opens the turn at now with no `acquisition` and counts `stale_anchor`. A runner that took the chat over from an owner with a stale heartbeat (`TakenOver`, from acquisition) opens its first turn at now with no `acquisition`, so the dead owner's run is not reported as pickup delay. - **Newer prompt.** `Ensure` on the current turn with a newer trigger closes it and opens a new one. The closed turn is `abandoned` unless the task that ran it records an outcome before releasing it. - **Finish.** After `FinishTurn` or `EnterRequiresAction` commits, the step calls `Complete`; `Settle` closes the span after the step's own stage ends, so the finishing step is inside the turn. A chat waiting in `requires_action` is outside any turn; the generation resumed by its tool results opens a new one. - **Emission.** Closing a turn fixes its end time; its span is emitted once every task that joined it (`Ensure` takes the task ID) has called `Release`, which `runTask` does after the task returns. A finishing task whose `FinishTurn` promoted a queued prompt therefore still counts its turn as `completed` even when the promoted task's `Ensure` runs before its `Complete`. `End` at runner exit emits whatever is left. - **Failure.** A step that commits `FinishError`, or fails closed, invalidates the turn as `error` after the commit. Errors the task runner retries, including task timeouts, keep the same turn open; an expected, non-retryable exit records no outcome and leaves the turn open until the interrupt task, a newer prompt, or runner exit closes it. A canceled generation task records no outcome and cannot obtain a turn token, so a replaced task never touches its successor's turn. - **Interrupt.** The interrupt task marks the open turn `interrupted` before `FinishInterruption` commits and closes it after. Only a stop (by the user or a parent agent) is `interrupted`; it ends with unset span status, since error status is reserved for `error` turns. runner shutdown, loss of ownership, and message edits close the turn as `abandoned` with unset status. - **Promotion.** Every promoting transition (`FinishTurn`, `FinishInterruption`, a send to an errored chat, `PromoteQueued`) returns the promoted message's queued time in its result, and one `recordQueueWait` helper records a standalone `queue_wait` to the promotion. The promoted turn opens at the promotion time. `chat_turn` is observed on `coderd_chatd_stage_duration_seconds` only for completed turns, so the histogram is completed-turn latency; every turn still emits its span. `coderd_chatd_turn_outcomes_total{outcome, chat_kind}` counts every closed turn exactly once (`completed`, `interrupted`, `error`, `abandoned`), matching the span's `turn_outcome`, under the `chat-stage-metrics` experiment. Turn time accounting is in draft #29772. **Stages and identity** - `tool_call` is a live stage around each local tool call in `chatloop`; the tool runs on its context, and it ends errored only when the tool fails to execute. Calls that never run (inactive, unknown, or rejected by policy) record no stage. - `mcp_connect` carries connected and failed server counts and ends errored only when servers were configured and none connected. - The compaction stage carries the model that runs the summary. - `withStageIdentity` puts scope and chat kind on the turn context. Detached background work runs in `background` scope as its own trace roots. - The `advisor` tool's nested model call appears only as its enclosing `tool_call`. ARCHITECTURE.md gains a "Lifecycle tracing" section. <details> <summary>Review decisions</summary> - Turn identity stays timestamp-based with targeted fixes (clamped acquisition, rotation on a newer trigger, invalidate after commit, fail-closed invalidation, settle closing invalidated turns) plus a takeover flag; keying turns on message IDs would not detect takeover and cannot express interrupted/abandoned outcomes. - Outcome classification: the interrupt task owns `interrupted`, and cancellation or a fence mismatch alone never records an outcome, so shutdown, ownership loss, and edits are `abandoned`. Only `error` turns set error span status. Remaining ordering races between a step and an interrupt are documented as known limitations in ARCHITECTURE.md. - Turns are emitted after the tasks that ran them return, not when they close, so an outcome a replaced task records while unwinding reaches its own turn; the successor task is not delayed. Chosen over an after-commit, pre-publish hook on `ChatMachine.Update`, which would fix only the `FinishTurn` ordering. - `requires_action` ends the turn rather than pausing it, so `chat_turn` measures chatd time; a prompt with client tools counts as several turns. - Promoted turns anchor at promotion time and `queue_wait` is always standalone, so `chat_turn` never includes time spent queued behind another turn. - The former `capacity_wait` stage (#29805) was dropped: it was a per-worker lower bound, excluded from accounting, and needed its own SQL and bookkeeping. #29805's remaining helpers are folded into this PR. </details> Supersedes #28972, #28973, and #29805. 🤖 This PR was generated by Coder Agents on behalf of @jscottmiller. |
||
|
|
e988ddb11d |
feat: trace chatd provider stages and count only output parts as first token (#29770)
**TL;DR:** Traces the model provider call: a `stream` stage, a nested `time_to_first_token` stage, and one `provider_attempt` per HTTP round trip, labelled with provider type and model. Behavior change: `coderd_chatd_ttft_seconds` now counts only a real output part as the first token, so error, warning, and finish parts no longer count. Instruments the provider call. **Stream and time to first token.** `GenerateAssistant` records a `stream` stage from stream open to close and a nested `time_to_first_token` stage. The TTFT window closes once, on the first streamed output part: any part other than warnings, finish, or error, including start markers such as `text_start`. A closed window observes the stage and the pre-existing `coderd_chatd_ttft_seconds` with the same elapsed time. A failed open, an error part, or a release without an output part ends the TTFT span with the error (a silence timeout is classified as such) and observes nothing. The `stream` span ends once, with the error `GenerateAssistant` returns, so content-filter and no-output attempts end errored. Failed `stream` windows are observed like successful ones. The attempt is released before the stream span ends, so the TTFT window always falls inside its stream. The compaction summary stream passes a nil tracer, so it records neither. Without #29771, production emits only `provider_attempt`; #29771 passes the tracer to `GenerateAssistant`. **Provider attempts.** The provider HTTP transport is wrapped in `stageSpanRoundTripper`, which emits one `provider_attempt` stage per round trip, so retries each get a span. The span closes on response headers; a status >= 400 marks it errored without changing what the client sees. `resolveModelCall` resolves the `StageModel` (wire provider, configured `provider_type`, model, effective reasoning effort) and threads it to the transport, so span attributes and labels match the call. `provider_type` is read from `ai_providers.type`, so types outside the fantasy set (copilot) keep their configured name. `chatd.New` builds the tracer with the server clock. **Behavior change to `coderd_chatd_ttft_seconds`:** only an output part counts as a first token. Error parts no longer close the window as a success, and warnings and finish parts are skipped; the help text says so. `StageSpan.End` returns the span's elapsed window, which `ttft_seconds` observes. Callers pass `Stages` and `StageModel` through `GenerateAssistantOptions`; a nil tracer discards (TTFT still records `ttft_seconds`). `Server` gains the `stages` tracer and a `TracerProvider` option, wired from `coderd`. <details> <summary>Review decisions</summary> - Start markers close the TTFT window: they are the first sign the model is producing output, and waiting for a delta would fold hidden reasoning time into TTFT. - Failed `stream` and `provider_attempt` windows are observed: that time was spent. TTFT is the exception because a first token that never arrived has no duration. - `http_host` was dropped from `provider_attempt`; every request goes through the local AI Gateway transport, so it was constant. - The advisor tool's nested model call is intentionally not instrumented as `stream`/TTFT. </details> Supersedes #28970 and #28971. 🤖 This PR was generated by Coder Agents on behalf of @jscottmiller. |
||
|
|
7a9442014e |
feat: add chatd lifecycle stage tracer (#29769)
**TL;DR:** Adds a stage tracer that turns each chat lifecycle stage into
both an OpenTelemetry span and a Prometheus histogram observation, so
traces and metrics always agree. The metrics are only registered with
the `chat-stage-metrics` experiment. Nothing calls the tracer until the
next PRs.
Adds `chatloop.StageTracer`, which emits each chat lifecycle stage as an
OpenTelemetry span and a `coderd_chatd_stage_duration_seconds{stage,
scope, chat_kind}` observation from one `End` call, so trace and metric
durations cannot disagree. The provider-bound stages (`stream`,
`provider_attempt`) are also observed on
`coderd_chatd_model_stage_duration_seconds{stage, provider_type,
chat_kind, model}`, the only family carrying `provider_type` and
`model`, and only for turn-scoped stages. Time to first token per model
stays on the existing `coderd_chatd_ttft_seconds`. Nothing calls the
tracer yet; the next PRs instrument the provider call and the runner.
- The families are registered only when the `chat-stage-metrics`
experiment is enabled (safe and known, so
`--experiments=chat-stage-metrics` or `--experiments=*` turns it on).
Spans are emitted regardless. `NewMetrics` leaves the families off;
`chatd.New` opts in from the experiment, and a test asserts the
experiment decides whether they reach the server's registry.
- `Stage`, `Scope`, `ChatKind`, and `StageAnomaly` are typed string
constants. `scope` separates latency attributable to a prompt (`turn`)
from detached `background` work; `chat_kind` is `root` or `subagent`,
empty without a known chat.
- `StageModel` carries the wire `provider`, `provider_type`, `model`,
and `reasoning_effort`. All are span attributes; only `provider_type`
and `model` are metric labels, on the model family. No family carries an
organization label.
- Observed stages: `chat_turn`, `queue_wait`, `acquisition`,
`mcp_connect`, `stream`, `time_to_first_token`, `provider_attempt`,
`tool_call`, `commit`, `retry_backoff`. `generation_step`, `prepare`,
`thinking`, and `compaction` are span-only. A test keeps the stage sets
and help text consistent.
- API: `Start` / `StartRootAt` for live spans (span timestamps come from
the tracer clock), `Record` for stages reconstructed from timestamps
(the scope comes from the context). `End` is idempotent;
`EndWithoutObservation` ends the span without a sample. A nil tracer,
provider, or metrics discards.
- `coderd_chatd_stage_anomalies_total{reason}` counts observations
dropped, adjusted, or inconsistent (`negative_elapsed`,
`inverted_window`, `missing_timestamp`, `future_start`, `stale_anchor`).
Span-only stages never feed it.
- Buckets are 12 round edges (`0.1 0.25 0.5 1 2.5 5 10 30 60 300 1800
3600`).
- Moves the body of the `for` loop in `StartGeneration` into
`runGenerationStep` so the step has a function boundary for a deferred
stage end. Control flow and error wrapping are unchanged.
<details>
<summary>Series cost (approximate, whole stack)</summary>
A histogram label set is 12 edges + `+Inf` + `_sum` + `_count`: 15
series. Per replica, each `chat_kind` costs about 150 stage series and 4
turn outcome counters; each `(chat_kind, model)` costs 30 (2 stages x
15). Both chat kinds on `M` models: about `308 + 60*M` per replica, plus
background-scope stage series.
Dogfood `main`, 3 replicas: ~3.4k `coderd_*` series per replica (~10.1k
total).
| Models used per replica | Added series (3 replicas) | vs. baseline |
|---:|---:|---:|
| 1 | ~1.1k | +11% |
| 5 | ~1.8k | +18% |
| 10 | ~2.7k | +27% |
| 35 | ~7.2k | +72% |
Most deployments run four or fewer models, so a typical replica adds
roughly 370 to 550 series. The experimental turn accounting in #29772
would add 88 more per replica (11 categories x 4 outcomes x 2 chat
kinds). Series appear lazily and do not grow with organizations.
</details>
<details>
<summary>Review decisions</summary>
- Experiment gate only; no deployment flag or metric levels. If the
experiment graduates, the families become always on like the other chatd
families; a flag is added then only if dogfood shows a cardinality
problem.
- Organization is on neither metrics nor spans, and `effort` is
span-only; `provider_type` (configured type), not the wire `provider`,
is the model-family label.
- `time_to_first_token` is not on the model family; per-model TTFT is
`ttft_seconds`, which observes the same measured window.
- The model family records only turn-scoped stages.
- Nil guards are kept so a nil or zero tracer is always safe to call.
- HTTP attribute keys stay snake_case like the rest of the chatd span
attributes.
</details>
Supersedes #28968 and #28969.
🤖 This PR was generated by Coder Agents on behalf of @jscottmiller.
|
||
|
|
1e9dd0abbc |
feat: add Claude Sonnet 5.5 and GPT-6.1 Sol to Agents and AI Gateway (#30159)
Add Claude Sonnet 5.5 and GPT-6.1 Sol to the Agents known models
catalog, so they appear as suggestions when an admin adds a chat model,
and regenerate the AI Gateway price book from models.dev.
| Model | Added to |
|---|---|
| Claude Sonnet 5.5 | anthropic (`reasoningEffort: high`), azure,
bedrock (`global.anthropic.claude-sonnet-5-5`), openrouter, vercel |
| GPT-6.1 Sol | openai (`reasoningEffort: medium`), azure, openrouter,
vercel |
**Bedrock.** bedrock-runtime serves Sonnet 5.5 only through its global
inference profile, so the catalog curates the `global.` ID without a
bare alias: fantasy's Bedrock client prefixes a bare `anthropic.*` ID
with a regional profile (`us.`, `eu.`, `apac.`) that this model lacks.
bedrock-mantle takes the bare ID and the gateway looks prices up by
exact provider and model, so `overrides.jq` injects the bare ID as a
copy of the global price entry. The two GPT Daybreak alias injections
are gone: models.dev now lists both aliases, and their guards error out
once it does.
**Reasoning effort.** Sonnet 5.5 rejects the `thinking: {"type":
"disabled"}` that fantasy sends for effort `none`, and GPT-6.1 Sol
rejects `none` outright, both with HTTP 400. `applyReasoningEffort` now
maps `none` to `low` for Sonnet 5.5 on the Anthropic and Bedrock
providers, next to the Opus 5.5 clamp, and maps `none` and `minimal` to
`low` for GPT-6.1 Sol on OpenAI and Azure through a new
`chatopenai.IsGPT61Sol`, next to the GPT-6 Astra clamp. GPT-6 Sol
accepts `none` and stays unclamped; the test pins that. AI Gateway's
Bedrock adaptive-thinking allowlist already matched Sonnet 5.5 through
its `anthropic.claude-sonnet-5` substring; a table case now covers it.
**Price book drift.** `prices.json` includes every model of its 8
providers, so the regeneration also brings in upstream changes since the
last refresh: 28 new entries (such as Grok 4.7 on Bedrock and Mistral
Large 2512 on OpenRouter), 7 entries models.dev delisted (mostly free
variants on OpenRouter and Vercel), and 49 price changes (39 OpenRouter,
10 Vercel). Other uncurated upstream models, such as `-pro` and `-fast`
variants and `openai.*` on Bedrock, stay out of the catalog, matching
how earlier releases were curated.
The Reasoning effort section of `coderd/x/chatd/ARCHITECTURE.md`
documents only the GPT-6 Astra clamp and should gain Sonnet 5.5 and
GPT-6.1 Sol. That doc edit is left to a human author.
Validation: regenerating from a fresh models.dev fetch reproduces both
generated files byte for byte. Go tests pass for
`scripts/aibridgepricesgen`, `coderd/aibridge/prices`,
`coderd/x/chatd/chatprovider`, `coderd/x/chatd/chatopenai`, and
`aibridge/intercept/messages`. Removing either clamp with `go test
-overlay` fails the new cases on exactly the Sonnet 5.5 and GPT-6.1 Sol
inputs. Vitest passes for `src/modules/aiModels` (176 tests) and the
Models and Coder Agents settings pages (24 tests). The pre-commit hook
passed; local pre-push checks were skipped, so CI is the first full run.
Review record: no reviews yet. No remote UAT was run; the tested head is
`78abe17e69d`.
> Xum opened this PR on behalf of @ibetitsmike.
|
||
|
|
34db9ca638 |
feat: price AI Gateway token usage by provider model (#30090)
## Description When the requested model has no price, price AI Gateway token usage by the model the provider reports instead of leaving it unpriced. This covers providers that resolve an alias to a specific model, such as `codex-auto-review` served as `gpt-5.6-luna`. Stacked on #30086, which records the provider model. Closes https://linear.app/codercom/issue/AIGOV-650 ## Changes - Look up the price for the requested model first, then the provider model, preferring a custom price over the price book for each model. - Store the provider model and the model used for pricing (`priced_model`) on each token usage. - Add a `provider_model` label to `unpriced_token_usage_records_total`. - Document the lookup order and the new metric label. > [!NOTE] > Generated by Claude Code on behalf of @ssncferreira. |
||
|
|
bcb981b839 |
chore: bump github.com/coder/boundary to v0.11.0 (#30083)
Bumps `github.com/coder/boundary` from v0.10.0 to [v0.11.0](https://github.com/coder/boundary/releases/tag/v0.11.0). No transitive dependency changes. boundary v0.11.0 wraps the `--session-id-inject-target` format and example in backticks, so: - The `coder agent-firewall` help golden and `docs/reference/cli/agent-firewall.md` are regenerated. - The temporary `<host>`/`<glob>` entry for that page in `scripts/docshtmlcheck`'s `allowedUnknownTags` is now stale (the linter's self-clearing guard fails on it), so it is removed. The allowlist is now passed into `filterAllowed`/`reportFindings` so the tests use their own fixture instead of depending on the real, now-empty map. > Generated by Coder Agents on behalf of @SasSwart. |
||
|
|
9aa7130e01 |
feat: evaluate experiment rules per user in discovery and chatd (#29964)
Slice 3 of 4 for runtime experiment rules: evaluate stored rules per user in discovery, the frontend experiments query, and the pilot `mcp-tool-search` gate in chatd. There is still no way to edit rules through the product; that comes in slice 4. With no rules stored and a healthy database, backend decisions match today. This PR deliberately changes three things: 1. **Fail closed on rule reads.** If the rules read fails, `mcp-tool-search` is off, even when it is enabled at startup. 2. **Frontend freshness.** The experiments query now refetches. 3. **Caching.** `/api/v2/experiments` and rendered HTML are sent with `Cache-Control: no-store`. Static assets keep their long-lived caching. ## What's in it - **coderd** builds `api.ExperimentEvaluator` from `experiments.NewDBStore` plus the startup `--experiments` list. - **Discovery:** `GET /api/v2/experiments` and the `<meta property="experiments">` tag both use `EnabledExperiments(ctx, caller)`. - **chatd:** `mcp-tool-search` is now user-scoped. `chatd.Config.ExperimentEvaluator` is required, so `chatd.New` returns an error without it. `prepareGeneration` decides once per turn for the chat owner (`chat.OwnerID`); child chats inherit the owner. - **Ruleguard** (`userScopedExperimentStaticCheck` in `scripts/rules.go`): rejects static `Experiments.Enabled(...)` and `httpmw.RequireExperiment*(...)` checks of user-scoped experiments in server packages. A codersdk test keeps its list equal to `codersdk.ExperimentsUserScoped`. - **Frontend:** the experiments query is keyed by user ID and seeded from the meta tag only when the embedded user matches. It is stale 60 s after page load and refetches on mount, window focus and reconnect. Logout also clears the experiments metadata. The dashboard keeps the last loaded list when a background refetch fails, instead of replacing the page with an error. - **Once per turn:** chatd decides `mcp-tool-search` on a turn's first step and reuses that decision for the turn's later steps, so a rule change applies from the next turn and never withdraws a `find_tools` call the model already made. The decision lives on the chat runner, keyed by the turn's prompt row, like the stop-nudge tracker. A runner handoff in the middle of a turn evaluates again. - **Reference audit:** the only non-test server check of `mcp-tool-search` is in `generation_preparer.go`, and it now goes through the evaluator. ## Testing - **Go:** per-user results and `no-store` on `/api/v2/experiments`; the per-user meta tag and the HTML cache headers in `site`; group and org conditions end to end in enterprise; chatd owner eligibility, on → off → on across turns including a child chat, and a failed rules read. - **Vitest:** user-keyed seeding, staleness from page load after a remount, refetch on focus, logout clearing, and the dashboard surviving a failed refetch. Remote dogfood UAT through Coder Agents passed on a licensed test deployment: - per-user discovery in both the API and the meta tag; - widening a rule, and turning it off, with no restart; - `off` beating a startup default, and `inherit` restoring it; - fail closed on malformed JSON and on an unknown mode, with no condition text in the logs; - the `no-store` headers; - real-model chatd enforcement: `find_tools` offered on turn 1, gone after `off`, back on turn 3. That round tested `b57207d4ee`. The later commits change only tests, and a follow-up round will cover the final head. **For the author:** `coderd/x/chatd/ARCHITECTURE.md`'s list of the runner's local state doesn't mention the per-turn trackers (debug turn, session start, stop nudges, and now this experiment decision). I did not edit that document. **Known behavior:** a broken rule logs one error line per evaluation (per request or turn), with only the experiment, revision, category and position. ## Stack 1. #29869: evaluator library 2. #29898: storage and audit types 3. **This PR:** enforcement and discovery 4. Control plane (experimental API, `coder exp experiment-rules` CLI, docs) > [!NOTE] > This PR was written by an AI agent (Xum). --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ --------- Signed-off-by: Thomas Kosiewski <tk@coder.com> |
||
|
|
d40e24cf7d |
docs: nest the CLI reference by subcommand (#29956)
## Summary Nests the CLI reference by subcommand so the Command Line sidebar collapses from 156 flat entries to 49 top-level verbs. Each page's URL follows the invocation, its page title is the full command as inline code, and its sidebar label is only its own verb as inline code. | | Before | After | | --- | --- | --- | | File | `docs/reference/cli/oauth2-provider_dcr_disable.md` | `docs/reference/cli/oauth2-provider/dcr/disable.md` | | URL | `/reference/cli/oauth2-provider_dcr_disable` | `/reference/cli/oauth2-provider/dcr/disable` | | Page title (front matter) | `oauth2-provider dcr disable` | `` `coder oauth2-provider dcr disable` `` | | Sidebar label (manifest) | `oauth2-provider dcr disable` | `` `disable` `` | Resolves DOCS-140 (coder/coder half). Also fixes the Makefile part of DOCS-1073 / DOCS-912, which this change depends on. ## Changes - `scripts/clidocgen`: pages nest by command path. A command with visible subcommands becomes its directory's `index.md`, so `oauth2-provider/index.md` and `oauth2-provider/dcr/index.md` sit above `oauth2-provider/dcr/disable.md`. Subcommand table links are relative to the parent page. - `scripts/clidocgen`: the manifest "Command Line" section is built from the command tree (nested, sorted by name, hidden commands skipped) instead of a flat list. The redundant `coder` child that pointed back at `reference/cli/index.md` is gone. - `Makefile`: the CLI rule now replaces `docs/reference/cli/` wholesale, so stale pages get removed. The manifest rule now runs `clidocgen -manifest-only` on top of the API staging manifest, so the CLI nav is generated instead of edited by hand. As a result, the nine pages that had no nav entry (`ai-gateway*`, `secret enable/disable`, `server fix-oidc-links`) now have one. - `scripts/configdocgen` and 48 prose pages: links point at the new paths (for example `reference/cli/server.md` is now `reference/cli/server/index.md`). ## How to review/QA this PR - `docs/reference/cli/**/*` (approximately 190 pages): Each of these pages are generated automatically. Some pages appear deleted, and some pages appear new. Every deleted page corresponds to a new page somewhere else, so no information is being deleted. The docs in this section should adhere to the following, so a test in the build preview for each of these items should be satisfactory: - [ ] Each subcommand of a command gets nested as a child instead of being displayed as a flat list. - [ ] Each parent command is stored in an `index.md` file. - [ ] The title of each page inside the page should now feature the full `coder XYZ` command. - [ ] The title of each page inside the page should now be formatted as inline code. - [ ] The title of each page in the sidebar should be the most granular subcommand of the whole command string (if the page's title is `coder ai-gateway keys create`, the sidebar label is `create`). - [ ] The title of each page in the sidebar should now be formatted as inline code. - [ ] The page slug for each page is now the most granular subcommand. - [ ] All links now point to the correct page. - `docs/manifest.json`: The changes here reflect the updated structure of the `docs/reference/cli` section. - `docs/**/*.md` outside of `docs/reference/cli/**/*` (approximately 50 pages): The extent of the changes in these pages are just updating the paths to point to the new page locations. - [ ] The links on the page all point to the correct new path in `docs/reference/cli`. - `scripts/clidocgen` (4 files): This is the Go code responsible for generating everything inside of `docs/reference/cli/**/*`. A typical code review here should be satisfactory. - `scripts/configdocgen` (2 files): these two files just have updates to the raw `.md` path used by `docs/admin/setup/configuration-reference.md` and updates the tests to reflect that. - `Makefile`: This updates the `make` targets for generating the CLI docs to fit the new structure. ## Merge ordering Without the renderer PRs deployed, both docs sites show literal backticks in titles and sidebar labels. Without the redirects, the old flat URLs return 404. 1. Deploy before merging this PR: coder/docs-engine#176 (beta-docs renders these titles as inline code) and coder/coder.com#1111 (classic docs renders them as inline code). Both are safe to ship first, because titles without backticks render as before. 2. Merge this PR. 3. Merge coder/coder.com#1112 (redirects from the old flat URLs) only once this content reaches the mainline release branch that serves unversioned `/docs`. ## Testing - `go test ./scripts/clidocgen/ ./scripts/configdocgen/ ./scripts/docshtmlcheck/`: pass. New tests cover page paths, subcommand links, the nested manifest, and front matter quoting. - `make docs/reference/cli/index.md docs/manifest.json docs/admin/setup/configuration-reference.md`, then a forced rerun: the second run produced no diff. - Checked the manifest: all 164 CLI entries resolve to a file, no page is missing a nav entry, and everything outside "Command Line" is byte-identical. - Relative `.md` links across `docs/`: 0 broken, same as `main`. - `make pre-commit` and `make pre-push`: pass. On earlier pre-push attempts, different unrelated vitest files timed out under host load. Those files pass when run alone, and the final push passed with `PARALLEL_JOBS=1`. <details> <summary>Implementation plan and decision log</summary> **Goal (from DOCS-140 and the requester):** URLs follow the command hierarchy. Pages are titled with the full command, and sidebar entries with the last verb only. Both are formatted as inline code. **Contract with the renderers:** a title wrapped entirely in one pair of backticks (``^`[^`]+`$``) renders as inline code. Plain-text consumers (`<title>`, meta, search, llms corpus) strip the backticks. Page title comes from front matter `title`, and the sidebar label from the manifest node `title`. **Decisions** - A parent command is `dir/index.md` rather than a sibling `dir.md`. The root CLI page is already `index.md`, and both docs-engine and the legacy coder.com renderer map `x/index.md` to `/x`. - The manifest is built from the command tree, not from the written files, so ordering is deterministic and the nesting matches the pages exactly. - The manifest discard bug (DOCS-1073 item 1) is fixed here, because without that fix the generated nested manifest would never reach the tree. DOCS-1073 items 2 through 4 (a prose fix and a hidden-command policy) are out of scope. - `-manifest-only` keeps the existing parallel `make gen` layout: the API rule still owns `_gen/manifest-staging.json`, and CLI regeneration doesn't retrigger swag. - The renderer and redirect work lives in the companion PRs in coder/docs-engine and coder/coder.com. It is linked above and not duplicated here. </details> --- > [!NOTE] > Generated by Coder Agents on behalf of @nickvigilante. |
||
|
|
5dde49dffb |
feat: add chat workspace file upload endpoint (#27079)
## What
Adds `POST /api/v2/chats/{chat}/workspace-files`, which streams the
request body to the chat's bound workspace agent and returns the final
path/name/size, plus the `workspace-file-reference` message part type
that carries the uploaded file's metadata through chat messages:
- `coderd/exp_chats.go`: owner-only middleware (chat RBAC update +
reject archived), workspace exec authorization (403/409 like the
existing chat exec paths), agent selection (prefer the chat's bound
agent, else deterministic `agentselect.FindChatAgent`, without
persisting a binding), 30s dial timeout, chat/ancestor tracking headers
on the agent connection, and agent error passthrough (agent HTTP status
preserved, 502 with a generic detail for transport failures; the real
error is logged). Deleted and non-running workspaces get a specific 409
("Workspace is stopped. Start the workspace before uploading files.")
before agent lookup. Each failed upload logs one structured warning, and
`coderd_chat_workspace_upload_total{status}` counts outcomes. The route
shares the files rate limit and documents its 429.
- Input validation: client-supplied `workspace-file-reference` parts
must point inside `/.coder/chats/<chat-id>/files/` with a matching
basename, non-negative size, and a `workspace_file_workspace_id` equal
to the chat's currently bound workspace (the upload response echoes it
as `workspace_id`). References uploaded before a workspace rebind are
rejected instead of silently sending the agent an unreadable path. The
file name must already be in sanitized form
(`SanitizeWorkspaceUploadName(name) == name`), and the cleaned path and
base media type are what gets persisted; message edits share the same
validation. Parts are rejected on chat creation (no chat ID exists yet).
- `coderd/x/chatd/chatprompt`: references render into the prompt as text
only, `[workspace file: <name> (<size>) at <path>]`; file bytes never
reach the LLM. Title derivation (`TitleText`) uses the bare file name,
so fallback titles carry no internal marker.
- `codersdk`: part-type constants/fields,
`ChatMessageWorkspaceFileReference` builder, and
`Client.UploadChatWorkspaceFile` (RFC 5987 filename in
`Content-Disposition`).
No DB migration: parts persist as JSON in `chat_messages.content`.
## Why
Bridges chat and the workspace filesystem for CODAGT-211: users drop a
file in chat, the bytes land where the agent's tools can operate on
them, and the model learns the path from the reference part.
## How tested
- `go test ./coderd -run 'WorkspaceFile|ChatInput|UploadChat'` including
an integration test that runs a real in-memory agent, uploads through
the coderd route, verifies bytes on disk, and exercises collision
suffixes.
- `go test ./codersdk ./coderd/x/chatd/...`, `make gen`
(swagger/types/docs), `make lint`.
- Rebased onto main 2026-09-21: the chat API moved from
`/api/experimental` to `/api/v2`, so the route is registered in
`coderd/chat_routes.go` and the SDK method lives on `codersdk.Client`.
## Follow-ups
- The files rate limit counts requests, not bytes or concurrency;
whether this route should use a per-user concurrency cap instead, and
whether the new-chat page should keep partial successes on a 429, is
still open
([CODAGT-1171](https://linear.app/codercom/issue/CODAGT-1171)).
Part of CODAGT-211. Stack: agent API -> coderd endpoint (this PR) -> UI.
> This PR was authored by Mux (AI) working on Mike's behalf.
|
||
|
|
5e12a74f38 | fix: run the test recipe under MAKE_TIMED instead of skipping it (#29849) | ||
|
|
9700db5b53 |
chore: update low-risk dependencies (#29860)
## Summary Updates pinned dependency overrides across three independent pnpm installs: | File | Package | From | To | |------|---------|------|----| | `package.json` (root) | brace-expansion | 1.1.16 | 1.1.18 | | `offlinedocs/package.json` | brace-expansion | 1.1.16 | 1.1.18 | | `scripts/apidocgen/package.json` | form-data | 4.0.4 | 4.0.6 | All pinned via `pnpm.overrides`; each `pnpm-lock.yaml` is regenerated to match. There is no `pnpm-workspace.yaml`, so root, `offlinedocs/`, and `scripts/apidocgen/` are separate installs and each bump is isolated to its own tooling. ## Testing Run locally per install: **Root** - `pnpm install` — resolves/locks `brace-expansion@1.1.18`; no stale references - `pnpm run check-docs` (markdownlint + table formatter, uses js-yaml) — 505 files, 0 errors - `quicktype` JSON→TS + `biome --version` — pass **offlinedocs** - `pnpm install` — resolves/locks `brace-expansion@1.1.18`; no stale references - `pnpm run lint:types` / `format:check` / `build` — pass, 453 pages built **scripts/apidocgen** - `pnpm install` — resolves/locks `form-data@4.0.6`; no stale references - `widdershins --version` + full render of `coderd/apidoc/swagger.json` (exercises form-data) — rendered successfully No behavioral changes; dependency version bumps only. |
||
|
|
3d30e201b5 |
docs: move contributor guides out of the published docs into the repo (#29751)
## Merge order Merge first; then republish the docs; then coder/coder.com#1100 (the redirects). ## Summary The nine pages under `docs/about/contributing/` are for people working in this repository, not for Coder users or administrators, so they leave the published documentation. The repository becomes their canonical home. Until now the root `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md` were two-line stubs that only linked to the docs site, so contributors on GitHub were bounced out to read them. A companion PR in `coder/coder.com` adds redirects from every retired `/docs/about/contributing/*` URL to the new GitHub location. It must merge only after this PR has merged and the docs have republished. ## Changes | Old path | New path | | -- | -- | | `docs/about/contributing/CONTRIBUTING.md` | `CONTRIBUTING.md` (replaces the stub) | | `docs/about/contributing/CODE_OF_CONDUCT.md` | `CODE_OF_CONDUCT.md` (replaces the stub) | | `docs/about/contributing/SECURITY.md` | deleted; the root `SECURITY.md` already holds the policy | | `docs/about/contributing/AI_CONTRIBUTING.md` | `contributing/AI_CONTRIBUTING.md` | | `docs/about/contributing/backend.md` | `contributing/backend.md` | | `docs/about/contributing/frontend.md` | `contributing/frontend.md` | | `docs/about/contributing/modules.md` | `contributing/modules.md` | | `docs/about/contributing/templates.md` | `contributing/templates.md` | | `docs/about/contributing/documentation.md` | `contributing/documentation.md` (see note below) | For every moved file: the docs front matter is stripped and its `title` becomes the H1, relative links are rewritten for the new depth (`../../../foo` becomes `./foo` at the root and `../foo` under `contributing/`; the two links into `docs/admin/` become `../docs/admin/...`), and the docs-only `<div class="tabs">` wrapper in `CONTRIBUTING.md` is removed. `CONTRIBUTING.md` gains a short intro that links the code of conduct, the security policy and the area guides, since GitHub only auto-surfaces the root files. `docs/manifest.json` loses the About → Contributing group and `docs/images/icons/contributing.svg`, which only that group used. Inbound references updated: - `README.md`: contribution guide link now points at `CONTRIBUTING.md` on GitHub. - `docs/tutorials/example-guide.md` and `docs/install/releases/feature-stages.md`: link to `contributing/documentation.md` on GitHub, since a docs page cannot link to a repo-only file. - `docs/.style/style-guide/README.md`: the "Relationship to" section names the new location. - `scripts/docshtmlcheck/main.go`: both the package comment and the user-facing error string name `contributing/documentation.md`. - `scripts/docshtmlcheck/README.md`: relative link to the new location. - `coderd/database/migrations/migrate_test.go`: `t.Log` link now points at `contributing/backend.md#database-fixtures-for-testing-migrations`. - `.github/pull_request_template.md`: AI contribution guidelines link. - `.github/workflows/contrib.yaml`: commit-message guidelines link in the PR title check. - `.github/workflows/test-docs-preview-mapper.sh`: the mapper test case that used `docs/about/contributing/CONTRIBUTING.md` now uses `docs/admin/security/audit-logs.md`. - `.claude/docs/{ARCHITECTURE,PR_STYLE_GUIDE,WORKFLOWS,DOCS_STYLE_GUIDE}.md`: links to `CONTRIBUTING.md`. `git grep about/contributing` is empty after this change. `CODEOWNERS` had no entry for the old paths. Note on `documentation.md`: it is docs-authoring guidance and is parked in `contributing/` for now. Folding it into `docs/.style/` is tracked separately and is deliberately not attempted here. ## Testing - `go run ./scripts/docshtmlcheck` over `docs/`, and again over `contributing/`, `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md`: clean. - `go vet ./scripts/docshtmlcheck/...` and `go test ./scripts/docshtmlcheck/...`: 47 tests pass. - `go vet ./coderd/database/migrations/...`: clean. `go test` for that package fails to link on this machine (`tailscale.com/tstime/mono: invalid reference to runtime.nanotime1`) identically on unmodified `main`, so it is a local toolchain issue and not exercised here; the change is a string in a `t.Log`. - `pnpm check-docs` (markdownlint-cli2 and markdown-table-formatter over `docs/`, `.claude/docs/`, root `*.md`): 495 files, 0 errors. The same two tools over `contributing/*.md`: 0 errors. - Every relative link in the eight moved files resolves to an existing path (scripted check). - `bash .github/workflows/test-docs-preview-mapper.sh`: the changed `assert_maps_to` case passes; the six `resolve_ref`/`pages_for_image` failures it reports are identical on unmodified `main` on macOS. Linear: [DOCS-975](https://linear.app/codercom/issue/DOCS-975) --- 🤖 Built with AI assistance. |
||
|
|
d7b6528d7e |
docs: cap the config reference TOC and drop the Dangerous emoji (#29857)
## Merge order Standalone; no dependency on the other DOCS-977 PR (task-list checkboxes). ## Summary Tracy and Ian flagged the mixed checkbox/emoji styling in the docs (Slack thread linked from DOCS-977), including the `⚠️ Dangerous` heading that `scripts/configdocgen` generates from `codersdk.DeploymentValues`. The generated configuration reference also has around 130 `h3` headings, which makes its "On this page" list unreadable. This PR changes only the generator, `scripts/configdocgen`, and regenerates `docs/admin/setup/configuration-reference.md` from it. ## Design or Fix - Emit `toc_depth: 2` frontmatter at the top of the generated page, before the `<!-- DO NOT EDIT -->` comment. docs-engine's sync (`packages/docs-build/src/sync.ts`) reads a page's own frontmatter before stripping it, so this caps the on-page TOC at h2 without any docs-engine change. - Strip any leading emoji or symbol from generated section headings (`stripLeadingSymbol`), so the Dangerous heading reads "Dangerous" instead of "⚠️ Dangerous". `sectionRank`'s "Dangerous last" ordering still keys off the raw serpent group name, so ordering is unaffected. - Render a GitHub `[!CAUTION]` alert directly under the Dangerous heading, using the group's own codersdk description when it has one, otherwise a short fallback ("These options can break your deployment or weaken its security..."). The `⚠️ Dangerous` group name in `codersdk/deployment.go` is unchanged, because the CLI and other output use it. ## Testing - `go test ./scripts/configdocgen/...` — 45 passed (7 new/updated cases: `TestStripLeadingSymbol`, `TestRenderDangerousWithDescription`, and updated `TestRenderPipeline` assertions for the stripped heading, the Caution alert, and its position between the heading and the first option). - `go vet ./scripts/configdocgen/...` and `gofmt -l scripts/configdocgen/*.go` — clean. - `make docs/admin/setup/configuration-reference.md` — regenerated the page (never hand-edited); this also runs `markdownlint-cli2 --fix` and `markdown-table-formatter` as part of the make target, both clean. - `go run ./scripts/docshtmlcheck` — clean. - Verified with a small Node script against docs-engine's built `parseFrontmatter`/`extractTitle` (from `packages/docs-transforms/dist/transform.js`, at the commit that introduced `toc_depth` support) that a page shaped like the regenerated one — `toc_depth: 2` frontmatter followed by the `<!-- DO NOT EDIT -->` comment and then the `# Configuration reference` H1 — parses `toc_depth: 2` and the title correctly. ## QA Confirmed via the docs-engine sync parser directly (see Testing) that `toc_depth: 2` is picked up correctly from this file shape. I did not spin up docs-engine's dev server against this worktree: my local docs-engine checkout is behind `origin/main` by several commits including the one that added `toc_depth` support, so a faithful local preview would first need a docs-engine rebuild against `origin/main`. Given the direct parser verification above already confirms the mechanism, I judged the full dev-server rebuild too heavy for the marginal confidence gained and skipped it. Expected rendering, based on the diff and docs-engine's documented `toc_depth` behavior: - The "On this page" TOC lists only h2 sections (General, Dangerous, and the rest), not the ~130 option h3s. - The Dangerous section renders as a plain "Dangerous" heading, followed immediately by a Caution callout, with no emoji. ## Upstream No. This is Coder product documentation generation (`codersdk`-driven), not a Fumadocs engine change. Linear: [DOCS-977](https://linear.app/codercom/issue/DOCS-977/docs-replace-emoji-checkboxes-and-emoji-headings-with-one-icon-style) --- 🤖 Built with AI assistance. |
||
|
|
d5a6047879 |
docs: restructure Install into the five phase deployment spine (#29304)
Restructures the Install section into the five-phase deployment spine, so the reading order matches the order a deployment actually happens: **plan, prepare, install, validate, operate.** Today the first thing a reader sees is a shell command, and architecture and sizing sit downstream in Administration, after the point where they would have been useful. Resolves [DOCS-869](https://linear.app/codercom/issue/DOCS-869). Part of [DOCS-685](https://linear.app/codercom/issue/DOCS-685) and [DOCS-738](https://linear.app/codercom/issue/DOCS-738). > [!IMPORTANT] > **Stacked on [#28960](https://github.com/coder/coder/pull/28960)** (DOCS-871, terminology). Base is that branch, not `main`. Retarget to `main` after it merges. > > **Paired with coder/coder.com [#1077](https://github.com/coder/coder.com/pull/1077)**, which must merge **first**. Without it, every inbound link to a moved page 404s in the gap. ## Deliberately mechanical No prose changes. The only edits inside moved pages are relative link and image path repairs, so the diff reads as renames. That is the point: this is the highest link-breakage change in the project, and it should be reviewable as such. The prose work is [DOCS-868](https://linear.app/codercom/issue/DOCS-868) (phase overview, architecture rewrite, sizing split, actor table) and [DOCS-872](https://linear.app/codercom/issue/DOCS-872) (new pages). ## The new spine ```text Install and deploy Coder /install ├── Coder CLI [unchanged, retired by DOCS-870] ├── 1. Plan your deployment │ ├── Architecture and components [from admin/infrastructure] │ └── Coder Validated Architecture [from admin/infrastructure] │ └── 1k / 2k / 3k / 10k users ├── 2. Prepare prerequisites │ ├── Licensing [from admin/licensing] │ ├── Air-gapped deployments [from install/airgap] │ └── Mirror images and registries [from install/registry-mirror-artifactory] ├── 3. Install the control plane │ ├── Docker / Kubernetes / Rancher / OpenShift │ ├── Cloud marketplace and VM images │ └── Unofficial install methods ├── 4. Validate your deployment │ └── Scale testing [from admin/infrastructure] │ ├── Scale test utility │ └── Scaling best practices └── 5. Operate and maintain ├── External provisioners [from admin/provisioners] ├── Upgrading (+ best practices, ESR guides) └── Uninstall ``` Leaving Install: release channels become `reference/releases`, feature stages become `reference/feature-stages`. `docs/admin/infrastructure/` is gone entirely, which is what DOCS-738 recommended. ## Numbers - 31 pages moved, all as `git mv` renames. - 1 page deleted: `admin/infrastructure/index.md`, whose content was a one-line section blurb. - 5 new placeholder index pages, one per phase, each a sentence of orientation plus `<children></children>`. The nav schema requires a path on every entry, so a phase cannot exist without one. - 265 relative links and asset paths repaired across 57 files. - `docs/manifest.json` restructured. Entry count goes 460 to 464: plus 5 stubs, minus the deleted Infrastructure entry. ## Reviewer attention, please **The redirects PR repairs 19 existing redirects, not just adds new ones.** This was the surprise. `redirects.json` already had entries whose *destinations* pointed at pages this PR moves, so they would have started redirecting to 404s. Examples: `/docs/architecture/architecture`, `/docs/admin/architectures`, `/docs/scaling/scale-testing`, `/docs/licensing`, `/docs/enterprise`, `/docs/install/offline`, `/docs/platforms`, `/docs/install/1-click`, `/docs/admin/upgrade`, `/docs/install/cloud/ec2`, and both `feature-stages` aliases. All 19 are fixed in the paired PR. **This PR touches `scripts/`, so it is not docs-only.** Two release tools write to paths that moved and would have broken silently at release time: - `scripts/update-release-calendar.sh`: `DOCS_FILE` now points at `docs/reference/releases.md`. - `scripts/releaser/docs.go`: `releasesFile`, and also `kubernetesFile` and `rancherFile`, which pointed at `docs/install/kubernetes.md` and `docs/install/rancher.md`. <details> <summary>Deliberate scope decisions</summary> - **Self-managed vs cloud grouping is flattened.** The reconciled IA nested platform pages under a "Self-managed platforms" parent. That would need two more placeholder index pages for groups with no content yet, so the platform pages sit directly under Phase 3 and the grouping lands with the DOCS-868 prose. - **Release-notes URLs left alone.** `scripts/releaser/release.go` and `scripts/release/generate_release_notes.sh` embed `https://coder.com/docs/install/releases` and `/docs/install/upgrade` in release-note templates. The redirects cover them, and changing the strings would require updating Go test fixtures in `scripts/release/main_internal_test.go`. Better as its own change. - **In-product doc links left alone.** Several `site/src` pages link to `coder.com/docs/admin/provisioners` and similar. Those are absolute URLs, so the redirects cover them. Updating them is a frontend change that would pull frontend review into a docs restructure. - **`admin/security/audit-logs.md` line 237** is hand-written prose below the generated table, and its `../licensing/index.md` link had to move with the licensing page. Verified `make gen` does not revert it. - **`reference/feature-stages.md`** has generated blocks whose relative links changed depth with the move. The generator named in its own marker comment (`scripts/release/docs_update_feature_stages.sh`) no longer exists in the repo, so those links were repaired by hand and the file is effectively hand-maintained. Worth its own issue. - **`install/cli.md` keeps its nav slot** here. DOCS-870 retires it. </details> ## Verification | Check | Result | |---|---| | Broken relative link scan | 0 in `install/`, `admin/`, `reference/`. 21 remain, all pre-existing illustrative examples in `docs/.style/style-guide/**` and one malformed URL in `docs/README.md` | | `make gen` | clean, manifest not clobbered, phase structure intact | | `make lint/markdown` | pass, 508 files, 0 errors | | `make lint/emdash` | pass | | `make lint/docs-html` | pass | | `make lint/prose` | pass, 1 intentional demo error, no new findings | | `make pre-commit` | pass, including `lint/go`, `lint/ts`, `lint/shellcheck`, and a slim build | | Manifest audit | every path resolves to a file on disk; entry-by-entry diff shows only the expected moves | Generated with Coder Agents on behalf of @nickvigilante. <details> <summary>CI note: doc-check failure is infrastructure, not this PR</summary> `Analyze PR for Documentation Updates Needed` fails before it reviews anything: the Coder account behind `agents-chat-action` returns `User is not active (status = "suspended")`. It isn't a required check. `check-docs` (linkspector) and every other check pass on `58ed9e3e4b`. _CI note added by Coder Agents on behalf of @nickvigilante._ </details> |
||
|
|
eb893f536d | docs: move section page to index.md (#29858) | ||
|
|
bacb4fc6ed |
feat: expose per-app session counts (#29351)
Track individual applications across deployment statistics, Prometheus, telemetry, and the dashboard instead of exposing only fixed family totals. Preserve existing fields and gauges so current consumers can migrate without breaking. - Add per-app counts with normalized identifiers and registry-backed display names, families, and bundled icons. Unrecognized apps retain their identifiers. - Limit each statistics report to 64 distinct app names, combining excess names into an explicit overflow bucket. - Group dashboard connections by family, including an Other category, with alphabetical per-app tooltips and distinct loading and empty states. - Export app-keyed Prometheus counts separately from current family metadata, allowing queries to enrich historical counts without rewriting stored samples. - Document family queries with unknown fallback, deployment isolation, and replica handling, alongside collection behavior and migration guidance. - Include per-app counts in telemetry, update API schemas and documentation, and add regression coverage across collection, metrics, and dashboard behavior. Closes #27411 |
||
|
|
5b5432ce73 |
feat: add GPT-6 Sol, GPT-6 Luna, and Claude Opus 5.5 to Agents and AI Gateway (#29762)
Add the models released on 2026-09-22 (GPT-6 Sol, GPT-6 Luna, and Claude
Opus 5.5) plus Grok 4.7 to the Agents known models catalog, so they
appear as suggestions when an admin adds a chat model in `/agents`
settings, and pick up their prices in the AI Gateway price book. chatd
and AI Gateway's Bedrock path also stop producing Opus 5.5 thinking
shapes it rejects.
| Model | Added to |
|---|---|
| GPT-6 Sol, GPT-6 Luna | openai, azure, openrouter, vercel |
| Claude Opus 5.5 | anthropic, azure, bedrock (plus `global.` alias),
openrouter, vercel |
| Grok 4.7 | openrouter (`x-ai/grok-4.7`), vercel (`spacexai/grok-4.7`)
|
| Qwen3.8 Max | vercel (`alibaba/qwen3.8-max-0902`; already curated on
openrouter) |
Every model is already on models.dev, so `overrides.jq` is unchanged.
Sol and Luna use `reasoningEffort: medium` like GPT-6 Astra and the
GPT-5.6 models. Opus 5.5 uses `high` like every other Opus, Fable, and
Mythos entry, and joins the Anthropic thinking-mode pin in
`knownModelsGenerated.test.ts`. Anthropic documents `medium` as the Opus
5.5 default, but the catalog value seeds both the default and the max
effort in the admin form (`applyKnownModelDefaults.ts`), so `medium`
would also stop users from picking `high`. Gateway entries follow the
existing convention of no reasoning default and upstream display names;
Qwen3.8 Max reuses its openrouter display name. New entries sort ahead
of the models they supersede.
**chatd.** Opus 5.5 always runs adaptive thinking and rejects `thinking:
{"type": "disabled"}` with HTTP 400. The pinned fantasy fork sends
exactly that for the `none` effort on Claude 5+ models (it exempts only
Mythos and Fable), and the effort picker offers `none` whenever a model
config sets a max effort. `applyReasoningEffort` now maps `none` to
`low` for Opus 5.5 on the Anthropic and Bedrock providers, next to the
existing GPT-6 Astra clamp. The new `ClampsNoneForClaudeOpus55` subtest
fails without the fix. The Reasoning effort section of
`coderd/x/chatd/ARCHITECTURE.md` documents the Astra clamp and should
gain a line for this one; that doc edit is left to a human author.
**AI Gateway on Bedrock.** Opus 5.5 also rejects `thinking: {"type":
"enabled", "budget_tokens": N}`. On the Bedrock InvokeModel path,
`augmentRequestForBedrockInvokeModel` in
`aibridge/intercept/messages/base.go` rewrote adaptive thinking into
that legacy shape for every model outside its adaptive-only allowlist.
`bedrockModelRequiresAdaptiveThinking` now includes Opus 5.5, so
adaptive requests pass through, legacy requests (Claude Code falls back
to them behind the gateway) convert to adaptive, and
`output_config.effort` is kept. `output_config.format` is still
stripped, as for the other adaptive-only models; before this change the
whole `output_config` was dropped. Two new
`TestAugmentRequestForBedrock_AdaptiveThinking` cases fail without the
fix.
Deliberately not added: the `-pro` (openrouter) and `-fast` (vercel)
variants, matching how Astra and the GPT-5.6 models are curated;
`openai.*` models on Bedrock; regional Bedrock profiles; `~` rolling
aliases; `copilot`; `azure/grok-4.6`, which models.dev lists without
pricing; vendors not curated on the gateways (Xiaomi MiMo V2.6, Nex
N2.5, and others); and variants of curated models (GLM 5.3 FlashX,
Qwen3.8 Omni Flash). All of these that have prices are still in the
price book.
Known gaps, unchanged by this PR:
- The price book stores one flat price per model, so the long-context
tier for Sol and Luna (above 272K input tokens) is not applied, as for
Astra.
- The Bedrock adaptive-only allowlist still lacks the already curated
Opus 5, Fable 5, and Fable 5.1, plus Mythos 5 and 5.1, which also reject
`budget_tokens`, so their adaptive requests still take the legacy
conversion. They predate this PR and need the same allowlist entry.
- AI Gateway forwards a client's explicit `thinking: {"type":
"disabled"}` unchanged on every path, so Opus 5.5 answers it with its
documented 400, as the direct API does.
`knownModelsGenerated.json` and
`coderd/aibridge/prices/data/prices.json` are regenerated with `make
gen/aibridge-prices` from one models.dev snapshot. Besides the rows
above, both carry the upstream drift the weekly scheduled refresh would
produce. The catalog has nine repriced gateway rows, including vercel
`openai/gpt-5.6-sol`, which moves from $2/$10 to $4/$20 per 1M
input/output tokens and now matches OpenAI's direct price. `prices.json`
gains 41 rows (26 for the models above across every listed provider, 15
for other new upstream models), drops 4 that upstream delisted, and
reprices 30.
Validation: `go test ./scripts/aibridgepricesgen/...
./coderd/aibridge/prices/... ./coderd/x/chatd/chatprovider/...
./aibridge/...`, `pnpm test src/modules/aiModels/` (176 tests),
`golangci-lint` on `chatprovider` and `aibridge/intercept/messages`, and
`biome check` on `knownModels/` pass.
Review log (4 completed review passes):
- Codex round 1 on `03decfde855`: two P1 findings. Bedrock adaptive
thinking for Opus 5.5 was confirmed by a failing test and fixed. The
request to add a TODO to `coderd/x/chatd/ARCHITECTURE.md` was declined;
the chatd paragraph above flags that section for a human.
- Codex round 2 on `0156b3e5997`: one P2 finding, that the chatd clamp
misses opaque Bedrock application inference profile ARNs and fantasy
then sends disabled thinking. Refuted: fantasy omits the thinking field
when it cannot parse a Claude version from the model ID, so Opus 5.5
keeps its default adaptive thinking.
- Codex round 3 on `0156b3e5997`: two P1 findings. The claim that
`minimal` reaches Opus 5.5 verbatim was refuted: fantasy normalizes it
to `low`. The request to rewrite a client's explicit `disabled` thinking
for Opus 5.5 on Bedrock was declined: the gateway forwards it unchanged
on every path, before and after this PR (see Known gaps).
- Codex round 4 on `0156b3e5997`: no findings ("Didn't find any major
issues").
> Xum opened this PR on behalf of @ibetitsmike.
|
||
|
|
83bef8a12d | fix: consolidate pg and nats pubsub metrics generation into one (#26843) | ||
|
|
ccffab23a0 |
feat: fail CI when the style guide claims enforcement it doesn't have (#29299)
## Summary PR 1 corrected 9 annotations that claimed enforcement the config doesn't provide. This adds the check that keeps them correct, because the same drift will recur: annotations are prose, `.vale.ini` is config, and nothing tied them together. `scripts/styleclaims` reconciles three sources and fails `make lint`. It also runs in `lint-light`, so the fast pre-commit hook covers docs-only changes: the checker's inputs all live under `docs/.style/`, and leaving it out would let this drift land through the hook that docs changes actually use. It is the only `lint-light` entry that compiles Go, which costs one small build on first run and nothing after. What it reports: 1. `.vale.ini` plus `docs/.style/styles/Coder/`, which is the truth. 2. The per-rule annotations in the style guide subpages. 3. The two coverage tables on the style guide landing page. ### What it reports | Finding | Example it would have caught | |---|---| | A `Coder.*` rule cited as active with no rule file | `Coder.FirstPersonSingular`, `Coder.FirstPersonPlural` | | A third-party rule cited as active while `BasedOnStyles = Coder` | the 8 `Google.*` citations | | A rule file that no section cites as active | a rule landing without the section the per-rule PR pattern requires | | Checks-table severity, scope, or membership drift | a rule re-scoped in `.vale.ini` without updating the table | | Coverage-count drift | the per-section and total rows | ### Also in this PR - One annotation reworded so each planned citation is marked individually (`Google.Gender` and `Google.GenderBias`). A trailing `(both planned)` covering several citations isn't machine-readable, and the checker depends on that precision. - The annotation format documented in `scripts/styleclaims/README.md`, with the per-rule PR pattern in `docs/.style/README.md` pointing at it. - `make lint/prose` prints a coverage pointer after running, so the advisory result doesn't read as a pass. ## Verification - `go test ./scripts/styleclaims/` covers the parser and each finding class, including the mixed `scripts/check_emdash.sh` plus `Coder.EmDash` (planned) annotation and the "rule mentioned but not claimed" case that `Google.Passive` represents. - `go run ./scripts/styleclaims` is clean on the branch. - Regression check: reverting `Coder.FirstPersonSingular` to its pre-PR-1 wording reproduces 3 findings (the false claim plus the 2 count rows). Restoring it returns to clean. - `golangci-lint run scripts/styleclaims/...` reports 0 issues; `gofmt` clean. - `make lint/markdown`, `make lint/emdash` clean. <details> <summary>Design notes</summary> ### Why Go, not bash `scripts/` is mostly bash, but this parses Markdown tables and multi-line annotations, which bash does badly. `scripts/docshtmlcheck` sets the precedent for a Go checker invoked from a lint target, so this follows its layout: `main.go`, `main_test.go`, `README.md`, and a `go run ./scripts/...` target. ### Why not generate the tables Considered and rejected. Generation and checking need the same parse, so once the checker exists the table's correctness is guaranteed either way. Generation would only save a one-row edit in a PR that already edits the guide by doctrine, at the cost of a generated block inside prose contributors are invited to edit. The checker also catches a case generation can't: a rule enabled in `.vale.ini` with no style guide section at all. ### Parsing tradeoff The checker reads prose annotations, so it depends on their format staying regular: start with a recognized keyword, and mark each planned citation individually. That regularity is enforced by the checker itself, which is the point, but it does mean an author who invents a new annotation phrasing gets a failure rather than silent acceptance. If that proves annoying in practice, the fallback is a small YAML manifest of rule status that both the tables and the checker read. I'd rather not add that until the prose form actually hurts. ### Scope validation Scope cells are checked against `.vale.ini` section globs: every glob that sets a rule to `YES` must appear in the cell, and a rule with no `NO` toggle must claim `docs/**`. That's how the `OneSentencePerLine` row stays honest about running on contributor docs only. </details> --- Linear: [DOCS-887](https://linear.app/codercom/issue/DOCS-887/make-clear-that-vale-passing-is-not-style-guide-conformance) 🤖 Generated with Coder Agents on behalf of @nickvigilante. |
||
|
|
96e97a4061 |
chore: bump alpine from 31b6477 to 294b683 in /scripts (#29707)
Bumps alpine from `31b6477` to `294b683`. [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
06d421fbcf |
chore: vendor the @shadcn/react message-scroller source (#29473)
The agent chat transcript scrolls through `@shadcn/react`'s MessageScroller, and its scroll defects have to be fixed in the package. The package ships only minified dist, so the fix would be an unreviewable patch against minified code, and 0.3.1 still has the identical defect, so an upgrade buys nothing. This vendors the readable upstream source (`@shadcn/react@0.3.0`, commit `b1c580c63`, MIT) under `site/src/vendor/` and drops the npm dependency. It is a pure move with no behavior change; the fix itself follows in #29354. Each file header pins the upstream tree, and any deviation from upstream must be marked `LOCAL CHANGE`. |
||
|
|
2bf0f567d8 |
feat: add OpenAI Pro reasoning mode to chat model configs (#29584)
Adds `provider_options.openai.reasoning_mode` (`pro`) to chat model configs so admins can turn on OpenAI's Pro reasoning mode for a model, alongside the other OpenAI request options on the model form such as `service_tier`. The field is offered for any model on an OpenAI provider; the field description says Pro is supported from the GPT-5.6 Sol generation and that requests fail when Pro is set on a model that does not support it. There is deliberately no supported-model list anywhere: a newly released model that supports Pro works with no code change, and OpenAI rejects the request when the model does not. Validation rejects only values other than `pro`, non-OpenAI providers, and configs that explicitly force plain sampling (`reasoning_model=false`) or Chat Completions (`use_responses_api=false`), including partial updates that move a configured model onto such a provider or transport. A configured mode implies the Responses API and reasoning-model treatment when `openai_config` leaves those unset (`chatprovider.effectiveOpenAIConfig`), so an alias the pinned SDK has never seen, such as `gpt-daybreak-blue-latest`, still gets `effort` and `summary` and drops `temperature`. The same effective config feeds the client options and the recorded transport, so the two cannot disagree. The pinned fantasy OpenAI provider options do not carry `reasoning.mode`, so the mode is applied as a client-scoped `openai-go` request option when the model client is built rather than per call. The SDK merges pre-serialization `WithJSONSet` overlays by top-level key, so the key is escaped (`reasoning\.mode`) to add `mode` to the existing `reasoning` object instead of replacing `effort` and `summary`. `TestResolveModelCallReasoningModeWire` pins the resulting request body for streaming and non-streaming calls and checks that the fixed computer-use model does not inherit the mode; AI Gateway forwarding of the `reasoning` object is covered in `aibridge`. Because the option is bound to the model client, every call made through a Pro model config carries it, including title generation and quick generation when those fall back to the chat's model; deployments that want cheaper auxiliary calls should point the title generation override at another model. Frontend: the field renders through the existing schema-driven provider options with no hand-written field logic. Two generic changes: `visible_for_providers` is now honored for provider fields the way it already was for general fields (render and payload), so the OpenAI-scoped select does not appear or serialize for Azure, which shares the OpenAI field group; and the add/update model save toasts now carry the server's error detail, so a rejected combination such as Pro with Use Responses API at Off tells the admin which field to change. Docs: `docs/ai-coder/agents/models.md` gains a Reasoning Mode row in the OpenAI provider-specific options table (from the documentation check comment https://github.com/coder/coder/pull/29584#issuecomment-5752457808), and its Azure note now says Azure OpenAI lacks that one option. Not changed: `coderd/x/chatd/ARCHITECTURE.md`. Its OpenAI transport selection table needs a `reasoning_mode` row (client-applied, neither transport) to match `TestProviderOptionsTransportParity`; left for the human author. <details> <summary>Delivery record</summary> - Local validation on every pushed head: targeted Go tests (chatopenai, chatprovider, chatd wire test, aibridge integration test, coderd DB tests for persistence, invalid input, and partial updates), red/green on the wire test (injection removed, and unescaped key), Vitest (`modelConfigFormLogic`, `ModelForm`), Storybook tests for `ModelFormProviderConfig`, biome, tsc, oxlint, golangci-lint on touched packages, pre-commit hook. - Codex round 1 on `e7dbaefeafc`: 3 findings (Storybook assertions, ARCHITECTURE.md TODO, `gpt-daybreak-blue-latest` alias). Disposition: assertions moved to Vitest and alias accepted in `8fccf111111`; ARCHITECTURE.md left untouched by author instruction. Threads replied to and resolved. - Codex round 2 on `8fccf111111`: 1 finding (fixture naming, FE9), renamed in `23449e92317`. Round 3 on `23449e92317`: 1 finding (fixture location, FE9), moved to `testHelpers/chatModels.ts` in `c3bd5aa370f`. Round 4 on `c3bd5aa370f`: "Didn't find any major issues" (https://github.com/coder/coder/pull/29584#issuecomment-5735119236). All threads resolved. - Remote UAT round 1 (chat https://dogfood.cdr.dev/agents/f5ed1d16-be1d-4d39-952b-126a6a829ef1) exercised `e7dbaefeafc`: endorsed PASS. Real `gpt-5.6-sol` turns showed `"mode": "pro"` / `"standard"` / no key in the Debug tab with effort and summary intact; 14 POST and 6 PATCH rejections captured; UI select visibility, persistence, reload, and clearing verified. Low, non-blocking notes: the `gpt-5.6` alias revert in the model identifier field is pre-existing; Pro is dropped silently when a model or transport change makes it unsupported; Pro applies to auxiliary calls (see above). - Remote UAT round 2 on `c3bd5aa370f` (same chat, alias and core re-verify): core PASS, alias FAIL. With `gpt-daybreak-blue-latest` the request carried `{"mode": "pro"}` without the configured effort and summary and kept sending `temperature` (provider 400 then retry on quick generation and title calls), because the SDK does not classify the alias as a reasoning model. Fixed in `d4c338de767`: a configured mode now implies a reasoning model unless `openai_config.reasoning_model` is set, and a mode on a config that forces plain sampling is rejected. Alias UI/API behavior, rejections, and known-model Pro/Default turns all passed on `c3bd5aa370f`. - Codex round 5 on `d4c338de767`: "Didn't find any major issues" (https://github.com/coder/coder/pull/29584#issuecomment-5736190356). Zero unresolved threads. CI green on `d4c338de767`. - Remote UAT round 3 on `d4c338de767` (same chat): endorsed PASS. Alias runs are single-attempt 200s with `{"effort", "summary", "mode": "pro"}` and no `temperature` (quick generation and title calls no longer retry); `reasoning_model=false` plus a mode is rejected by POST and PATCH with the stored config unchanged; the Reasoning Model override at Off hides the select and drops the mode on save; `gpt-5.6-sol` Pro turn unchanged. Remaining low notes, none introduced here: rejection detail for a non-OpenAI provider names the model rather than the provider; Pro is dropped silently when an override makes it unsupported; `PATCH model_config` replaces the whole object (pre-existing on main). - coder-frontend-review on `d4c338de767` (8 role reviewers, 3 passes): 13 failing checkpoints, chiefly a TS mirror of the Go model regex, the `json_name === "reasoning_mode"` gate duplicated in the render filter and payload builder, a defaulted `model` parameter, and comment and type nits. Fixed in `554c90d5fd9`: the pattern and provider scope are generated onto the field schema, one predicate is shared by both call sites, `buildModelConfigFromForm(provider, model, form)` requires the model, and the ModelForm test also asserts the select disappears for an unsupported model. Red/green: stripping `supported_models` or `visible_for_providers` from the generated schema fails 21 and 1 Vitest cases respectively. Declined with rationale: RO4 (move the fixture to `ModelsPage/testFixtures.ts`; FE9 in `FRONTEND_PATTERNS.md` names `testHelpers/chatModels.ts`, and Codex round 3 required it) and a DF5 nit to gate on the committed identifier and warn when a saved mode is dropped (behavior change, separate follow-up). Final pass: all checkpoints PASS or N/A. - Remote UAT round 4 on `554c90d5fd9` (same chat, focused regression after the frontend-review refactor): endorsed PASS. All six claims held (Pro round trip with effort and tier intact; unsupported identifiers hide the select and a save drops the stale mode while keeping the other options; Azure never shows or saves it; the alias shows it only with the Responses override On; Reasoning Model Off hides it and drops it; three real `gpt-5.6-sol` Pro turns were single-attempt 200s with `{"effort","summary","mode":"pro"}` and no `temperature`). Probes aimed at the refactor also passed: `gpt-5X6-sol` is rejected (dot escaping survived the JSON round trip), whitespace-padded identifiers still match, the other 11 OpenAI fields and the Anthropic section still render. Remaining low notes are carried over from round 3 plus one naming note ("Reasoning Mode" versus "Reasoning Model"). The final head `abb58df77d8` differs from `554c90d5fd9` only in `ModelForm.test.tsx`, so it ships the same production code. - Codex round 6 on `554c90d5fd9`: 1 finding (https://github.com/coder/coder/pull/29584#pullrequestreview-5260492465): the two `toBeInTheDocument` assertions added in the frontend-review round violate FE1. Confirmed against `site/AGENTS.md`; removed in `abb58df77d8` (test-only, 7 deletions; the payload assertion keeps the behavior coverage and the `ProviderConfigOpenAI` story captures the hidden state). Thread replied to and resolved. - Codex round 7 on `abb58df77d8`: "Didn't find any major issues" (https://github.com/coder/coder/pull/29584#issuecomment-5749626071). Zero unresolved threads. CI green on `abb58df77d8` (23 success, 8 skipped, `required` pass). - Design change on `e99152e5c57` (owner direction: no model gating; "none or pro" for any model; tooltip states the GPT-5.6 Sol constraint and that requests fail on unsupported models). Removed `codersdk.ChatModelReasoningModeModels`, the generated `supported_models`, `isFieldApplicableToModel`, the `gpt-daybreak-blue-latest` special case, and the `standard` enum value; `ValidateReasoningMode(provider, config)` no longer takes the model; `effectiveOpenAIConfig` makes a mode imply Responses and reasoning-model treatment. PR footprint went from +1130/-22 to +769/-18. Local validation: `go test` for chatopenai, chatprovider, chatd wire test, and the coderd API tests (persistence now covers `gpt-5.6-sol`, `gpt-4o`, `gpt-daybreak-blue-latest`, `gpt-7-nova`; invalid input now rejects `standard`), golangci-lint on touched packages, Vitest (187 tests across `modules/aiModels` and `ModelsPage`), biome, tsc, pre-commit hook. - coder-frontend-review on `e99152e5c57` (8 roles, 1 pass plus a TS and CD confirmation pass): 9 failing checkpoints (SD4, CD1, CD3, CD4, TS3, TS7 x2, RO3, RO5, TN4, DF5). Fixed in `e06bfbe4299`: the ModelForm test edits `mockGPT5` so its provider matches the selected provider state, types the update mock like the sibling story, and drops an unused route; the story spreads `mockGPT5` with a saved mode instead of a dedicated shared fixture (`MockGPT56Pro` removed, `testHelpers/chatModels.ts` back to base); a `ProviderConfigAzure` story captures the panel without `reasoning_mode`; comment nits. Left as a nit with justification: RO3 (the one-line `!hidden && isFieldVisibleForProvider` predicate now appears in both `getVisibleProviderFields` and `getVisibleGeneralFields`; hoisting a helper for two call sites is not worth it). Confirmation pass: TS all PASS; CD flagged one wording nit, fixed before commit. - CI green on `e06bfbe4299` (23 success, 8 skipped, `required` pass). - Codex round 8 on `e06bfbe4299`: 1 P2 finding (https://github.com/coder/coder/pull/29584#discussion_r4057659673): the form still offers Pro with Use Responses API or Reasoning Model at Off, a combination the server rejects, and the failure was not actionable. Disposition: the select stays visible by owner direction (no client-side gating of this field beyond the provider scope; an explicit rejection is preferred over the earlier silent drop), and `e2b43c3aee7` makes the add/update save toasts show the server detail so the admin sees which field to change. Thread replied to and resolved; zero unresolved threads. - Remote UAT round 5 on `e06bfbe4299` (same chat): endorsed PASS with two UI issues to land before release. All seven probes passed: the select offers only Default and Pro for `gpt-5.6-sol` and `gpt-4o` with the tooltip text verbatim; Pro saves on `gpt-4o` and the real turn fails visibly with the provider's "reasoning.mode is not supported with this model" after a single 400 attempt, and works again once Pro is cleared; `gpt-daybreak-blue-latest` with Pro and no overrides is a single 200 to `/v1/responses` with `{effort, summary, mode: "pro"}` and no `temperature`; the `gpt-5.6-sol` Pro turn is unchanged; POST and PATCH reject `standard`, `PRO`, empty, Responses Off, Reasoning Model Off, and Azure, openai-compat, and Anthropic providers with the stored config unchanged, while a model-only PATCH to `gpt-4o` now succeeds; the Azure form shows no Reasoning Mode; the alias with an explicit Responses override still works. Reservations: (1) medium, the UI conflict path only showed "Invalid model config." without the detail (fixed in `e2b43c3aee7`, not yet UAT-exercised); (2) low-medium, a dev-DB row still holding `standard` from round 2 renders an empty red select whose message is the whole field description plus "has an invalid value." and blocks saving unrelated fields (pre-existing generic behavior of `yupTestForField` using the description as the label; no released data can hold `standard`, so no migration); (3) low, no hint next to older identifiers (documented design); (4) low, a chat on such a stored row fails with a generic headline (pre-existing). - Final head `e2b43c3aee7` differs from `e06bfbe4299` only in the two save-toast handlers (`AddModelPage.tsx`, `UpdateModelPage.tsx`, 8 insertions). CI is green on `e2b43c3aee7` (skipped=8, success=23, `required` success). Codex has not run on `e2b43c3aee7`. - Remote UAT round 6 on `e2b43c3aee7` (same chat, https://dogfood.cdr.dev/agents/f5ed1d16-be1d-4d39-952b-126a6a829ef1, settled 2026-09-20T19:02Z): endorsed PASS on the exact final head. Build proven by `/api/v2/buildinfo` (`v2.37.2-devel+e2b43c3aee`, `external_url` at the full SHA) and the UI badge. The round 5 toast issue is resolved: Add and Update saves with Pro plus Use Responses API Off or Reasoning Model Off show "Invalid model config." with the server detail as the description, one 400 each, nothing stored. Compact regression of every round 5 probe held (dropdown and tooltip; Pro on `gpt-4o` fails visibly with the provider's `reasoning.mode is not supported with this model` and works after clearing; alias with and without the Responses override and `gpt-5.6-sol` all send `{effort, summary, mode: "pro"}` with no `temperature` in a single 200; POST and PATCH rejection matrices with stored config unchanged; Azure form without the field). Legacy `standard` row: fails closed on chat, and re-picking Pro or Default saves. Remaining notes, none blocking: the malformed validation copy for an invalid stored enum (pre-existing `yupTestForField` label choice, dev-DB rows only), Pro offered for models that cannot accept it (documented design), and a pre-existing `quickgen` status quirk on `gpt-4o` unrelated to this field. Secret scan clean. - Final head `4f3c6106dfe` adds one docs-only commit on top of `e2b43c3aee7` (`docs/ai-coder/agents/models.md`, 9 insertions, 8 deletions, no code). Remote UAT round 6 exercised `e2b43c3aee7`; the docs commit is not UAT-relevant. Validated with `markdown-table-formatter`, `markdownlint-cli2`, and the pre-commit hook (`fmt/markdown`, `lint/markdown`, `lint/emdash`, `lint/typos`). CI is green on `4f3c6106dfe` (success=24, skipped=7, `required` success) and the documentation check re-run marked its item addressed (https://github.com/coder/coder/pull/29584#issuecomment-5752457808). - Review tally for this PR: Codex 8 completed rounds; coder-frontend-review 34 role passes (24 on `d4c338de767`, 10 on `e99152e5c57`); remote UAT 5 rounds; no human review yet. This is far past the six-review guardrail, so no further Codex or agent review has been requested. Whether to spend another Codex pass on `e2b43c3aee7` is an owner decision; human review is still required before merge. </details> > Xum acted on behalf of @ibetitsmike. |
||
|
|
9a29aab2ee |
feat: add include_related option to client.Workspace in codersdk (#29540)
Part of the lite `codersdk.Workspace` work ([GRU-82](https://linear.app/codercom/issue/GRU-82), [RFC](https://app.notion.com/p/coderhq/Lite-Workspace-API-Requests-3aad579be5928060b5e7cc65c539717f)). Stacked on #29539, which wired `include_related` into `GET /api/v2/workspaces/{workspace}`. Adds `include_related` support to the `codersdk` client, expressed with the typed selection tree so only supported selections are representable: - Moves the `wsrelated` package from `coderd/` to `codersdk/` so both the server and the client can share `wsrelated.Config`. `coderd` already depends on `codersdk`, so this only changes import paths on the server side. - Adds `Config.QueryParam`, which encodes a selection into the `include_related` value: the dotted path of each selected node that has no selected descendants. Selecting a node implies its ancestors, so `Parse` round-trips the result back into an equal `Config` (covered by a round-trip test). - `WorkspaceOptions` gains `IncludeRelated *wsrelated.Config`. A nil value omits the parameter (server returns everything, unchanged); a non-nil value is encoded via `QueryParam`, and a zero `Config` loads only the workspace. - `Client.Workspace` now accepts optional `WorkspaceOptions`, backward compatible with existing `client.Workspace(ctx, id)` calls. ### Testing - `codersdk` internal test asserts `WorkspaceOptions.asRequestOption` sets `include_related` from the selection, following the existing `WorkspaceFilter` test pattern rather than spinning up a server. - `wsrelated` tests cover `QueryParam` output and a `Parse`/`QueryParam` round trip. `make gen` regenerated the `WorkspaceOptions` TypeScript type. Because the wire representation of `include_related` is a comma-separated string, `scripts/apitypings` maps `wsrelated.Config` to `string` in TypeScript, so `include_related?: string` rather than a nested object the frontend cannot serialize. `api.getWorkspace` already forwards `WorkspaceOptions` as query params, and a frontend test in `api.test.ts` confirms `include_related` is sent through. --- *Generated by Coder Agents on behalf of @spikecurtis.* |
||
|
|
839be9dc7b |
feat: generate AI Gateway metrics (#29184)
## Description Generate AI Gateway metrics from source instead of maintaining their definitions manually in the static metrics file. Existing metrics are preserved and 29 AI Gateway metrics are now generated automatically. Timing comparison against #29183, using medians of five runs: - Scanner: **0.276s before → 0.279s after**. - `make scripts/metricsdocgen/generated_metrics`: **1.171s before → 1.187s after**. - Full stack compared with main: scanner **0.270s → 0.279s** and forced `make` **1.203s → 1.187s**. ## Changes - Scan `aibridge/` and the previously excluded AI Gateway metric files using the directory-prefix mappings. - Extract labels built with `append(baseLabels, ...)`. - Remove the 29 verified AI Gateway definitions from the static file and retain other static metrics and override behavior. - Document the manual prefix mapping maintenance requirements. Closes https://linear.app/codercom/issue/AIGOV-561 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
1590f6ccad |
feat: map metric prefixes by directory (#29183)
## Description Apply registration prefixes using four explicit directory mappings instead of tracing registerers across function calls. Metric definitions remain automatically extracted, while prefixes are maintained manually. Generated metrics and the final documentation are unchanged. Timing comparison against main, using medians of five runs: - Scanner: **0.270s before → 0.276s after**. - `make scripts/metricsdocgen/generated_metrics`: **1.203s before → 1.171s after**. ## Changes - Keep four directory mappings and their lookup alongside the scanner configuration. - Apply the longest matching directory rule, including subdirectories. - Explain when mappings need updating and add a TODO for automatic prefix discovery. Refs https://linear.app/codercom/issue/AIGOV-561 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
9974294ca9 |
feat: report arbitrary workspace agent session types (#28338)
Report session counts as a dynamic app-name map from the agent, the SSH CLI, and the workspace usage API, so a new IDE flows end to end without a schema, proto, or server change. - Report through `Stats.session_counts` on Agent API v2.11. Older agents keep reporting through the deprecated count fields. - Accept arbitrary names from `coder ssh --usage-app` and the workspace usage API. A name the registry does not recognize keeps its identity and is attributed to the `unknown` family. - Add reconnecting PTY counts to the map without overwriting the counts SSH reported. - Normalize and merge names before applying the deterministic 64-name cap, ordered by known apps, then count, then name. Overflow sums into `unknown`, and non-positive counts cannot cancel valid activity. - Strip control characters, treat whitespace-only HTTP app names as absent, and require the exact environment variable prefix when you extract an SSH session type. - Count overflow entries in `coderd_agentstats_session_counts_overflow_total` and keep raw payloads out of logs. - Change the usage API's `app_name` to a string, and update the SDK types and API reference. closes #27410 |
||
|
|
ceed0df682 |
chore: add DeepSeek V4.1 Flash and other missed models to the known models catalog (#29585)
Add the models that landed on models.dev since the September 4 curation pass (#28955), plus cross-provider gaps where a model was curated on one provider but not on the others that serve it, so they appear as suggestions when an admin adds a chat model in `/agents` settings. | Model | Added to | |---|---| | GPT-6 Astra | azure, openrouter, vercel (already curated on openai) | | Claude Mythos 5.1 | anthropic. Not on models.dev, so injected in `overrides.jq` as a copy of `claude-fable-5-1`, mirroring the existing `claude-mythos-5` injection. Anthropic's pricing page lists Mythos 5.1 at the same rates as Fable 5.1, including the reduced cache-read rate. | | DeepSeek V4.1 Flash | openrouter, vercel | | Gemini 3.8 / 3.7 / 3.6 Flash | openrouter, vercel (no Google models were curated on either gateway) | | Gemini 3.1 Pro Preview, Gemini Flash-Lite Latest, Gemini 3.5 Flash Lite | google (the catalog had no Pro or Lite tier) | | Claude Mythos 5 | azure (left pending in #28887) | | Claude Opus 4.7 | azure, bedrock (plus `global.` alias), openrouter, vercel | | GPT-5.5, GPT-5.4 mini | openrouter, vercel | | GPT-5.4, GPT-5.4 mini, GPT-5.3 Codex | azure | | Grok 4.6, Qwen3.8 Flash, GLM 5.3 Flash, MiniMax M3, Kimi K2.7 Code | openrouter, vercel | Mythos 5.1 uses `reasoningEffort: high` like Fable 5.1 and is added to the Anthropic thinking-mode pin in `knownModelsGenerated.test.ts`. Gateway entries follow the existing convention: no reasoning default and upstream display names. New entries sort ahead of the models they supersede. Deliberately not added: `openai.*` models on Bedrock (chatd's Bedrock provider wraps the Anthropic client, so they cannot be used from Coder Agents), models.dev's `~`-prefixed rolling aliases on OpenRouter, and `copilot` (unsupported in chatd). `knownModelsGenerated.json` and `coderd/aibridge/prices/data/prices.json` are regenerated with `make gen/aibridge-prices` from the same models.dev snapshot. Apart from the `claude-mythos-5-1` row, the `prices.json` changes are upstream drift since the last weekly refresh, the same content the scheduled refresh PR would produce. Validation: `go test ./scripts/aibridgepricesgen/... ./coderd/aibridge/prices/...` and `pnpm test src/modules/aiModels/` (174 tests) pass. > Xum opened this PR on behalf of @ibetitsmike. |
||
|
|
8339cea84b |
fix(scripts/migrate-test): correct direction in migration mismatch hint (#29572)
`make test-migrations` migrates from the current ref (the release branch) to `origin/main`. When it fails, the hint told you every migration in `main` must exist in the release branch, which is backwards. The check actually requires that every migration in the release branch also exists in `main` with the same number. Swaps the version arguments so the hint describes the real requirement. --- Generated by Coder Agents on behalf of @f0ssel. |
||
|
|
f0dc1ddf8e |
chore: bump alpine from 3.24.1 to 3.24.2 in /scripts (#29530)
> [!WARNING] > Cooldown could not be applied because no publication date was available from the registry. > Bumps alpine from 3.24.1 to 3.24.2. [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
95a3f01ecc |
chore: remove the migrated dogfood template sources (#29469)
Deletes the dogfood template sources that were migrated to the infrastructure repository, leaving only the image build inputs in this repo. Stacked on #29400 (which removes the `deploy_template` job and `dogfood/main.tf`); depends on coder/dogfood#551 being applied first. #29468 stacks on top of this branch. ## Changes - Delete `dogfood/coder/main.tf`, `dogfood/coder-envbuilder/`, `dogfood/vscode-coder/main.tf`, and the template READMEs and guide - Delete `dogfood/coder/devcontainer.json`: its only reader was the retired `coder-envbuilder` template, and it referenced a `Dockerfile` removed in #24267 - Add `dogfood/README.md` documenting what remains here and where template changes go - Drop the now-empty dependabot entries (`/dogfood/coder-envbuilder` docker, `dogfood/*/` terraform) Kept: `dogfood/coder/ubuntu-22.04/`, `dogfood/coder/ubuntu-26.04/`, `dogfood/coder/Makefile`, and `dogfood/vscode-coder/Dockerfile`. Image builds, tags, and `scripts/dogfood/*` are unchanged; the contract with the templates is the published Docker tag. Checks: `actionlint`, `shellcheck`, `compute-base-sha.sh`/`compute-final-sha.sh` still resolve, docs lint and `make lint/emdash` clean. --- Generated by Coder Agents on behalf of @jdomeracki-coder. --------- Co-authored-by: McKayla はな <kayla@tree.camp> |
||
|
|
86a050de43 |
fix(scripts/releaser): scope breaking-change check to commits since previous release (#29487)
The patch-release breaking-change check in `./scripts/release.sh` queried every merged PR labeled `release/breaking` against the release branch with no range filter, so breaking changes shipped in earlier patches were reported again on every subsequent patch release. Both the `!` title marker and the `release/breaking` label are now evaluated only over `prevVersion..HEAD`, using the same PR metadata lookup the release notes already use (`ghBuildPRMetadataMap` + `categorizeCommit`). The now-unused `ghListPRsWithLabel` is removed and the metadata fetch-with-fallback is extracted into `loadPRMetadata` so both call sites share it. The GPG signing prompt was already removed on `main` in #27422, so this PR only covers the breaking-change check. Backporting to `release/2.34` and `release/2.35` needs both #27422 and this PR; `release/2.36` only needs this PR. Supersedes #27065. --- Generated by Coder Agents on behalf of @f0ssel. |
||
|
|
26e4429362 |
test: fold near-identical test bodies into tables across eight packages (#29463)
Folds groups of near-identical test bodies (same parent, same parallel flag, differing only in inputs and expected values) into table-driven tests in eight packages: `coderd/templatebuilder`, `scripts/develop`, `agent/agentfiles`, `coderd/x/chatd/chatloop`, `coderd/x/chatd/chatdebug`, `enterprise/aibridgeproxyd`, `cli`, and `coderd/database/db2sdk`. One commit per package. Every case keeps its previous subtest name, `t.Parallel()` placement is unchanged, and the set of `=== RUN` names is identical except where standalone `TestX_Y` funcs became `TestX/Y` subtests (chatloop: 9 funcs into `TestExecuteLocalTools_BatchRuntime`; chatdebug: 15 funcs into two tables). Members whose bodies differ in more than data stayed as they were (listed per package in the commit messages). In `agent/agentfiles` the four `TestFuzzyReplace_*` funcs were already tables, so the shared request plumbing was hoisted into one helper instead of merging the funcs and losing their per-rule docs. Net -1035 lines across 9 test files; runtime is unchanged (all sub-100ms unit tests). | Package | Diff | Funcs removed | Subtests | RUN lines | |---|---|---|---|---| | coderd/templatebuilder | +237 / -291 | 0 | 31 -> 31 | 33 -> 33 | | scripts/develop | +194 / -246 | 0 | 27 -> 27 | 28 -> 28 | | agent/agentfiles | +117 / -260 | 0 | unchanged | 58 -> 58 | | coderd/x/chatd/chatloop | +224 / -306 | 9 | 3 -> 12 | 14 -> 15 | | coderd/x/chatd/chatdebug | +251 / -537 | 13 | 0 -> 15 | 42 -> 44 | | enterprise/aibridgeproxyd | +287 / -419 | 0 | 31 -> 31 | 32 -> 32 | | cli | +143 / -326 | 0 | 15 -> 15 | 16 -> 16 | | coderd/database/db2sdk | +130 / -233 | 0 | 9 -> 9 | 10 -> 10 | ## Validation - Per package: `go test -count=1 -tags=testsmallbatch -parallel=8 ./<pkg>/ -run <regex> -v` before and after, with the `=== RUN` name sets diffed - `go test -race -count=2 -shuffle=on` on each converted test: pass - `golangci-lint run ./<pkg>/...` with a fresh cache: 0 issues in all eight packages - Repository pre-commit hook (including lint/go) passed on every commit Part of the test-suite speedup series (see #29457); independent of the other PRs. ## Remote validation Remote run on a dogfood workspace (separate compute), chat https://dogfood.cdr.dev/agents/5bbe73d0-866a-4841-9cc3-c5e5b4d97e44, tested head `d7c55d6b0e8` against base `9d973372774`: all eight packages pass on the head and under `-race -count=3 -shuffle=on`; package times are sub-second on both sides (unchanged). `=== RUN` name sets: chatloop 15 to 16 lines with all nine `TestExecuteLocalTools_<X>` leaves surviving as `TestExecuteLocalTools_BatchRuntime/<X>`; chatdebug 42 to 44; `aibridgeproxyd` `TestNew` 32 to 32, byte-identical sorted list. One correction to the text above: seven chatdebug leaves are renamed, not preserved verbatim (`TestRecordingTransport_*UnknownLength*` became `TestRecordingTransport_UnknownLengthClose/<name without "UnknownLength">`), so `-run` filters keyed on those old names need updating. Endorsed verdict: PASS. > Xum (an AI agent) authored this PR on behalf of @ibetitsmike. |
||
|
|
bde4f68c65 | chore: remove ubuntu 22.04 image (#29255) |