mirror of
https://github.com/coder/coder.git
synced 2026-11-22 19:39:23 +08:00
5dde49dffbd02a0adbdefabecedb247cfc8cf5da
734
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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) | ||
|
|
fdcc847ce2 | chore: bump bundled terraform to 1.16.2 (#29331) | ||
|
|
46c904d181 |
fix: show estimated context usage after compaction (#28984)
After compaction, the context gauge showed the unused-chat placeholder until the next response. It now shows a clearly labeled estimate based on the compacted summary, keeps that estimate after reload, and uses the selected chat model’s context limit. The next response replaces it with measured usage. The estimate stays separate from provider-reported token accounting. Remote dogfood UAT passed the core workflow on cb18cbdac596231acf821cd612c5a8c5d1db1c7b. It has not been repeated on the current head, |
||
|
|
5354a9fae0 |
ci: collect embedded postgres logs on Windows and macOS (#29280)
Completes PostgreSQL log capture for the `pg-*` CI jobs by covering the Windows and macOS runners, which use embedded PostgreSQL (`scripts/embedded-pg/main.go`) instead of the Docker container used on Linux. This enables PostgreSQL's own `logging_collector` via `ALTER SYSTEM` (applied on the restart the script already performs), so the server persists logs to `<data>/log/postgresql.log`. The composite action then uploads that directory as a `postgres-logs-<job>-<os>` artifact on failure. <details> <summary>Notes</summary> - Default log verbosity is kept (no `log_statement=all`); the suite creates thousands of databases, matching the Linux jobs which set `TEST_POSTGRES_LOG_STATEMENT=none`. - Only `test-go-pg` exercises the embedded path (macOS/Windows). `test-go-pg-17` and `test-go-race-pg` are Linux-only, so the new step is a no-op there. - The Linux side of this (`docker logs` upload) is in #29217; this PR is independent and adds distinct steps. </details> <sub>Opened by Coder Agents on behalf of @spikecurtis.</sub> |
||
|
|
680b2f59cd |
refactor: remove obsolete chatd code and tests (#29228)
Chatd still carries an unreachable interruption flush path, unused state and options, an uncalled workspace MCP cache invalidation callback, and a stream-buffer-drop counter that production never increments. Remove these paths and their dedicated assertions, and update the generated metrics inventory and documentation. Consolidate duplicate publication and rollback tests and move fixture writers and test-only inspection helpers into test files. Retain the interruption persistence, state-machine matrix, legacy message format, and provider compatibility coverage. |
||
|
|
c26a6b86a9 |
chore: replace dev.coder.com with dogfood.cdr.dev (#29250)
The dogfood deployment moved to `dogfood.cdr.dev`. Update the Vite and Storybook dev server `allowedHosts`, the dogfood template AI gateway URLs and boundary allowlist, and internal comments and workflow notes that refer to the deployment. Customer-facing docs, illustrative examples, test fixtures, mocks, and Helm golden files are left unchanged. Generated by Coder Agents on behalf of @f0ssel. |
||
|
|
e8682044cf |
fix: price Copilot utility model calls at zero (#29226)
Add zero-price entries for Copilot’s GPT-4o mini, GPT-4o, and GPT-4.1, based on GitHub’s [utility-model documentation](https://docs.github.com/en/copilot/concepts/models/utility-models#list-of-utility-models). Keep GPT-5.4 nano’s existing rates: background utility calls are unbilled, but GitHub also publishes [Copilot prices specifically for GPT-5.4 nano’s billable usage](https://docs.github.com/en/copilot/reference/copilot-billing/models-and-pricing#openai). AI Gateway cannot distinguish utility calls from billable usage by model ID, so we retain Nano’s published rates. This overestimates costs for its unbilled utility calls. No existing model prices are changed. > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
b3f43513a8 |
fix: add OpenAI Daybreak alias pricing (#29218)
Add pricing for `gpt-daybreak-blue-latest` (alias of `gpt-5.6-sol`) and `gpt-daybreak-red-latest` (alias of `gpt-5.6-cyber`), as documented on [OpenAI’s pricing page](https://developers.openai.com/api/docs/pricing#cyber-models). Blue copies models.dev pricing; Red uses OpenAI’s published rates because Cyber is missing from models.dev. Comments link to the source and note that alias targets can change. Only these two price entries are added. > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
9cd38b5373 |
feat!: remove the Tasks API from coderd and codersdk (#28789)
Removes the Tasks API and task orchestration from coderd and codersdk: the `/api/v2/tasks` handlers, task middleware and search filters, task name generation, autobuild pause/resume logic, task notification enqueues, telemetry, and the codersdk task types. Regenerates apidoc, the API reference docs, and `typesGenerated.ts`. **Breaking change:** the Tasks API is removed; requests to `/api/v2/tasks` fail. Tasks was deprecated in v2.34. **Stack context:** Coder Tasks removal stack (CODAGT-642): #28743 frontend → #28788 CLI → #28789 API → #28790 provisioner → #29084 notifications → #29085 build reasons → #29086 tables → #28750 permissions. The last four PRs replace the single data-drop migration that used to live in #28750; each carries one concern and its own migration number. **Why:** with the UI (#28743) and CLI (#28788) gone, this deletes the server surface. Database tables, RBAC, and notification templates stay until the top of the stack so every layer builds and migrates independently. **What to scrutinize:** - The `enable-ai-tasks` option is removed outright (review feedback): configs still carrying `enableAITasks` fail to parse until the key is deleted. - provisionerdserver now writes `HasAITask: false` on template/build flags; the column and these lines are dropped in #29085. - `codersdk.ResourceTypeTask` stays so audit logs recorded before the removal keep rendering. **Validation:** `go build ./...`, `go vet ./...`, `go test ./codersdk/...`, site biome and tsc, CLI goldens regenerated, pre-commit hooks. **Size:** +242/-10,792 over 76 files; additions are regenerated docs/goldens and test fixture updates. > Created by Xum (AI agent) on behalf of @ibetitsmike. |
||
|
|
d0de33cdf1 |
chore: remove the Coder Tasks CLI and task automation (#28788)
Removes every in-repo Tasks client: the `coder exp tasks` CLI command family, the tasks scaletest runner, and the task-driven triage automation (`traiage.yaml`, `code-review.yaml`, `classify-issue-severity.yml`, `scripts/traiage.sh`). Triage runs through `triage-via-chat-api.yaml` and coder/create-agent-chat-action instead. **Stack context:** Coder Tasks removal stack (CODAGT-642): #28743 frontend → #28788 CLI → #28789 API → #28790 provisioner → #29084 notifications and usage → #29085 build reasons → #29086 tables → #28750 permissions. The last four PRs replace the single data-drop migration that used to live in #28750; each carries one concern and a focused migration test. **Why:** clients come off before the API they call. After this layer nothing in the repo invokes the Tasks API outside coderd itself. **What to scrutinize:** all but three files are whole-file deletions. `triage-via-chat-api.yaml` gets a comment fix. `NavbarView.tsx` and its stories carry two small repairs to the frontend layer below (unused `user` prop, stale `TasksFilter` story wiring) so the stack lints clean from this layer up; they rebase away if folded into #28743. **Validation:** `go build ./...`, `go test ./cli -run TestCommandHelp`, site tsc, pre-commit hooks (gen, fmt, lint). **Size:** +4/-6,938 over 42 files; effectively pure deletion, so it reads much faster than the line count suggests. > Created by Xum (AI agent) on behalf of @ibetitsmike. |
||
|
|
3ed8548e78 |
fix: unblock AI price book refresh for gpt-6-astra and qwen3.8-max (#29170)
The weekly `aigateway-prices-refresh` job [failed](https://github.com/coder/coder/actions/runs/34458761592) because two upstream-guard assertions in the generator tripped: models.dev now lists OpenAI's `gpt-6-astra` (so its `overrides.jq` injection must be dropped), and the curated OpenRouter `qwen/qwen3.8-max` identifier was renamed upstream to `qwen/qwen3.8-max-0902`. This removes the `gpt-6-astra` injection, repoints the qwen curation entry to `qwen/qwen3.8-max-0902` (with a `displayName` override to keep the clean "Qwen3.8 Max" label in the UI), and regenerates `prices.json` and `knownModelsGenerated.json`. Note: because the artifacts regenerate from live models.dev, this diff also carries unrelated upstream drift, the same content the scheduled refresh PR would produce. > [!NOTE] > Generated with Coder Agents on behalf of @ssncferreira. |
||
|
|
b23d73d501 |
docs: retire the generated feature stage lists (#29113)
## Problem `docs/install/releases/feature-stages.md` advertised two generated lists, and neither one earned its place: - **Available early access features** rendered "Currently no experimental features are available." The generator read `ExperimentsSafe`, which is empty, while `ExperimentsKnown` in `codersdk/deployment.go` defines fourteen experiments. The page told readers no experimental features existed, which is false. - **Available beta features** rendered a table built from `state: beta` nodes in `docs/manifest.json`. It is only as accurate as those flags, which are easy to forget when a feature graduates. Both are drift surfaces that promise a completeness the docs cannot maintain. ## Change Retire the indexes rather than repair them: - Delete `scripts/release/docs_update_feature_stages.sh`. - Remove both generated sections from `feature-stages.md`, along with their `BEGIN`/`END` markers and `DO NOT EDIT` banners. - Drop the `docs/install/releases/feature-stages.md` Makefile target and its two generated-files-list entries, so the page is no longer treated as generated. The page keeps everything that describes the stages themselves: the stage comparison table, the early access / beta / GA guidance, and the `--experiments` enabling instructions. Nothing else links to the removed anchors. ## Verification - `make gen` leaves no unstaged changes beyond the three intended edits. - `pnpm run lint-docs` passes with 0 errors; `markdown-table-formatter` reports no formatting to apply. - `grep` confirms no remaining references to the deleted script, and no inbound links to `#available-beta-features` or `#available-early-access-features`. ## Context Supersedes #28949, which took the opposite approach and generated the experiments list from `ExperimentsKnown`. Following discussion with David, the decision is not to advertise either list. <details> <summary>Decision log</summary> **Why not fix the experiments list instead?** That was #28949: a new `scripts/experimentsdocgen` generator plus a committed `docs/experiments.json`, generating the table from `ExperimentsKnown` with descriptions parsed out of the constants' comments. It worked, but it made the docs responsible for tracking an internal, unstable surface. Experiments are by definition subject to removal or rename without notice, and several of the constant comments are developer notes rather than user-facing prose. **Why remove the beta table too?** The original ask covered the experiments list. The beta table shares the same failure mode: it is a completeness claim maintained by proxy, through `state` flags in `docs/manifest.json`, with nothing that fails when a feature ships to GA and the flag is not updated. Deleting the script removes both, and David confirmed retiring both lists. **Why remove the Makefile target rather than leave a no-op?** With no generated regions left in the file, keeping the target would mean the `make -B gen` unstaged-files check still guards a page nothing generates. Removing it lets the page be edited as ordinary prose. **What was deliberately left alone.** The `state: beta` flags in `docs/manifest.json` stay: they drive badges elsewhere in the docs and are not part of this change. `ExperimentsSafe` and `ExperimentsKnown` in `codersdk` are untouched. The feature-stage definitions and the `--experiments` instructions stay, since readers still need to know what the stages mean and how to opt in, and that content does not go stale as features move between stages. </details> I have read the AI Contribution guidelines. --- Linear: [DOCS-878](https://linear.app/codercom/issue/DOCS-878/remove-the-feature-stages-generator-script-and-retire-the-generated) 🤖 Generated with Coder Agents on behalf of @nickvigilante. <details> <summary>CI note: unrelated flakes on the first run</summary> The initial run of `test-go-pg-17` failed in `cli` and `coderd`: - `TestSSH_OneShotCommandMode/{ClosesStdinOnEOF,DoesNotRequestPTY,PropagatesExitCode,RequestsPTYWithFlag}` - `TestWorkspaceUpdateAutostart/{DST_start,friday_to_monday,monday_to_tuesday}` - `TestWorkspaceFilterManual/FilterQueryHasAgentTimeout` - The `cli` package then hit `panic: test timed out after 25m0s`. This PR changes no Go code and no CI configuration; the diff is one deleted shell script, one Markdown page, and the Makefile wiring between them. Re-running the failed jobs turned everything green with no code changes. </details> |
||
|
|
257c6f1dca |
refactor: move shared AI model UI into modules/aiModels (#29040)
> 🤖 Refactoring with Cursor.
AI settings was importing model form fields, ModelSelector, and
ProviderIcon from AgentsPage. Those now live in
`site/src/modules/aiModels`.
No user-facing behavior change.
- Move ProviderIcon, ModelSelector, and the model admin form fields into
`modules/aiModels`
- Point AgentsPage and AI settings at the new paths
- Drop the leftover ChatModelAdminPanel ProviderIcon duplicate and the
knownModels barrel
- Update the known-models catalog generator paths
|
||
|
|
9cd66d3773 | feat: add GPT-6 Astra to the known models catalog, price book, and chatd (#28955) | ||
|
|
a8f7591627 | chore: add Gemini 3.8 Flash to the known models catalog and price book (#28909) | ||
|
|
805b47aa00 |
chore: make pre-commit hook checks opt-in (#28895)
The pre-commit hook currently runs `make pre-commit` or `make pre-commit-light` on every commit for everyone who has the repository hooks installed. This makes it opt-in, mirroring how `scripts/githooks/pre-push` already works: checks run only when `git config coder.pre-commit true` is set or the workspace owner is on the hook's allowlist, and `git config coder.pre-commit false` opts out explicitly. By default the hook prints a one-line skip message and exits 0. Hook installation (`core.hooksPath`) and the linked-worktree hooksPath shield are unchanged, so `post-checkout` and `pre-push` keep working as before. `.claude/docs/WORKFLOWS.md` and `docs/about/contributing/CONTRIBUTING.md` describe the new opt-in. > Xum (an AI coding agent) authored this PR on behalf of @ibetitsmike. |
||
|
|
560ef00c15 |
chore: add Claude Fable 5.1 and other new models to the known models catalog (#28887)
Add the models that landed on models.dev since the August curation pass to the Agents-page known models list, so they appear as suggestions when an admin adds a chat model in `/agents` settings. | Model | Providers | |---|---| | Claude Fable 5.1 | anthropic, azure, bedrock (plus `global.` alias), openrouter, vercel | | Claude Opus 5 | anthropic (already curated on the other providers) | | Gemini 3.7 Flash | google | | GLM 5.3 | openrouter, vercel | Fable 5.1 and Opus 5 use `reasoningEffort: high` like their curated siblings, and new entries sort ahead of the models they supersede. `knownModelsGenerated.json` and `coderd/aibridge/prices/data/prices.json` are both regenerated with `make gen/aibridge-prices` from the same models.dev snapshot; the `prices.json` changes are upstream drift since the last weekly refresh. Left out pending a decision: azure now lists `claude-mythos-5` upstream but it is not curated for azure here, and `copilot` has no curation entries at all. > Xum opened this PR on behalf of @ibetitsmike. |
||
|
|
8bf271c503 |
feat: add Prometheus metrics for the usage publisher (#28368)
The Tallyman usage publisher (`enterprise/coderd/usage/publisher.go`)
had no metrics; failures were only visible in logs and the
`usage_events.failure_message` column.
This adds five metrics under `coderd_usage_events_*`:
| Metric | Type | Meaning |
|---|---|---|
| `publish_results_total{result, event_type}` | counter | Per-event
outcomes from real Tallyman responses (`accepted`,
`rejected_temporarily`, `rejected_permanently`; events missing from the
response count as temporary) |
| `publish_send_errors_total` | counter | Ingest requests that failed
entirely (HTTP error, non-200, decode error), one per request |
| `pending` | gauge | Unpublished events still inside the 30-day
publishing window |
| `pending_oldest_age_seconds` | gauge | Age of the oldest pending event
(0 when none) |
| `expired` | gauge | Unpublished events older than 30 days that will
never be published |
Send errors and per-event results never double-count: when a request
fails, the publisher fakes an all-temporarily-rejected response for the
DB update, but only `publish_send_errors_total` increments, so
`publish_results_total` reflects only real Tallyman verdicts.
The gauges are backed by a new read-only `GetUsageEventsStats` query
(authorized as `ActionRead` on `ResourceUsageEvent`) and refreshed from
the publish loop after each attempt, so they update roughly every 17
minutes.
Metrics are created with `promauto.With(reg)` where the registerer
defaults to nil, so existing callers and tests need no changes;
`enterprise/cli/server.go` wires in the deployment's
`PrometheusRegistry` via the new `PublisherWithPrometheusRegisterer`
option.
Closes
https://linear.app/codercom/issue/CODAGT-833/e3-prometheus-metrics-for-the-usage-publisher
---------
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
|
||
|
|
351bb14032 |
feat: mount chat API routes under /api/v2 (#28496)
## Stack context This is the base of a 3-PR stack promoting the chat API from `/api/experimental` to `/api/v2`: server compatibility mounts (this PR), codersdk promotion (#28497), and frontend path updates (#28498). ## Summary Double-mount the stable chat and MCP handlers under `/api/v2` while retaining the existing experimental routes for the one-release compatibility window decided in CODAGT-921. CODAGT-922 tracks removing the compatibility mounts. The shared route builders preserve existing authentication and middleware behavior. Experiment-gated, debug, tombstone, and legacy default-organization model routes remain experimental-only. Signed file URLs, external OAuth callback URLs, and mixed-version replica relays also remain on the experimental prefix during the transition. Update Swagger and the generated API reference for the promoted routes, including the workspace lookup and a runnable raw-body chat file upload example. Retain internal endpoints outside the published reference, share chat-file rate limits across both prefixes, enable CORS for the v2 MCP routes, and cover dual mounts plus exclusions with compatibility tests. Remote dogfood UAT passed for the promoted chat, model, MCP, and file flows. > [!NOTE] > Xum acted on Mike's behalf in this pull request. <!-- xum-attribution: model=claude-fable-5 thinking=high --> |
||
|
|
9e8075db0f |
fix: prevent markdown injection in notifications (#28340)
First of two PRs. Notification title and body templates are Markdown authored by Coder, but the label values interpolated into them are user-controlled and were substituted through `text/template`, which does no escaping. Those values arrive from user profile fields and from OIDC/GitHub name claims. This PR: - Neutralizes Markdown structure in label, data, and `UserName` values before they reach the template. Applied in `notifier.prepare`, so already-queued messages are covered and the stored payload keeps its original values for webhook consumers. Nested `.Data` map keys are escaped too: one shipped template prints a key, and those keys are Terraform resource addresses. - Narrows the notification Markdown grammar to what templates actually use. `CommonExtensions` enabled Tables, DefinitionLists and MathJax, each openable from a value and used by no template. Autolink stays off so a URL in a value cannot become an anchor. - Enables `html.Safelink`, restricting generated hrefs to safe schemes, and guards the panic it exposes: `parser.IsSafeURL` slices a destination before bounds-checking it, so `[docs]()` crashed both renderers. - Folds line breaks out of the `Subject:` header and encodes it, fixing a pre-existing RFC 2047 violation for non-ASCII subjects, a forged encoded-word that let a value choose the displayed subject, and headers running past RFC 5322's 998-octet line limit. Escaping is narrow on purpose, split by where each character carries meaning: - `` \[]()!<` `` everywhere. Backtick is in this group because a fenced block's info string is an HTML sink: gomarkdown writes it into `class="language-..."` unescaped, and `SkipHTML` does not apply to a `CodeBlock` node, so a value that closes the attribute and the tag injects live markup. - `#-+.>|` only in leading position, so values like `bobby-workspace` and `1.5` are untouched. - `=`, `~` and `:` are not escapable by both renderers, so the preceding line break is folded instead. `:` opens a definition list and a GFM table delimiter row that escaping `|` cannot reach. A value's *first* line has no preceding break to fold, so a real tilde fence or `===` underline is escaped there instead, accepting a visible backslash: an unterminated `~~~` at the start of a title otherwise renders the Subject, `<title>` and heading empty. - Leading indentation is truncated to three spaces. Four open an indented code block and a space has no escape. - Emphasis characters are left alone. Escaping `_` corrupts label values such as `user_override` that body templates compare with `eq`, which silently drops content from the rendered email. One golden file changes: the resource replacements `body_markdown` now reads `docker_container\[0\]`, from the map-key escaping above. Every other golden is byte-identical. **One known residual**, pinned by a test that fails if it closes: CommonMark does not process escapes inside a code span, so where a template wraps a value in one, as the workspace out-of-disk body does, the escaper's own backslashes reach the reader. That depends on where the value lands rather than what it contains, which a pre-render escaper cannot see. This narrows the class rather than closing it. **#28397 completes the fix and is stacked on this branch. This PR should not merge without it.** Escaping here cannot reach the SMTP HTML template's sinks, by design rather than by oversight: the subject is produced by `PlaintextFromMarkdown`, which strips exactly the backslashes added here, and `html.gotmpl` then interpolated the result through `text/template`. On this branch alone, a label value still reaches the Subject, `<title>` and `<h1>` as live markup. #28397 escapes at those sinks with `| html`, which is the only place the information needed to escape correctly exists. |
||
|
|
042421694f |
fix: surface duplicate AI provider hostname as warning, not error (#28208)
Two live `ai_providers` rows can share the same `base_url` hostname.
This is an intended configuration (AIGOV-97): the direct routing path
(`/api/v2/ai-gateway/{name}/...`) routes by provider name and fully
supports it. Only the MITM proxy path (`aibridgeproxyd`) cannot
disambiguate, because its `nameByHost` map is 1:1.
`classifyProviderRow` marked the second provider as
`ProviderStatusError`, which surfaced as a misleading log warning and a
`status=error` Prometheus label. The provider is not actually broken; it
is fully routable via the direct path. The error was only visible in
server logs and Prometheus, not in the API or UI.
This change:
- Extracts `BaseURLHostname` into `coderd/aibridged` and eliminates
three duplicate implementations (proxy classifier, chatprovider, and the
API layer now uses it for status checks).
- Downgrades the proxy classifier from `ProviderStatusError` to a new
`ProviderStatusProxyExcluded` status. The provider is not broken; it is
just not reachable via the MITM proxy path.
- Adds `Status *AIProviderStatus` to `codersdk.AIProvider` with
`Warnings []string`, matching the `WorkspaceProxy` precedent.
- Populates warnings on create, update, GET, and list when a provider's
hostname collides with another enabled provider.
- Adds an integration test proving that a duplicate provider is routable
via the direct path but not via the proxy path.
Refs AIGOV-596
Generated by Coder Agents
https://github.com/user-attachments/assets/bf323837-5121-4d1b-ab19-593f1d32374e
|
||
|
|
211f490910 |
refactor: share the AI Gateway price book contract (#28310)
Follow-up to the review discussion on the price book refresh automation: https://github.com/coder/coder/pull/28146#discussion_r3806439966 ## Problem The price seed row struct was duplicated three times, so a JSON tag change had to be repeated in each copy: - `scripts/aibridgepricesgen.priceRow` - `scripts/aibridgepricesdiff.priceRow` - `coderd/aibridge/prices.seedRow` The `(provider, model)` key and its parsing were duplicated too. ## Change Add `coderd/aibridge/prices/pricebook` holding the shared contract: `Row`, `Key`, `Row.Key()`, and `Parse`. The package depends only on the standard library, so the scripts can import it without pulling in the database layer that `coderd/aibridge/prices` brings. Consumer-specific behaviour stays where it is: upstream conversion and validation in the generator, comparison and Markdown rendering in the diff tool, DB seeding and runtime lookup in the seeder. The batch SQL upsert still extracts JSON fields by name, so it remains a separate contract boundary. The note about keeping it in sync now lives on the shared `Row`. No generated artifacts change; the serialized schema is identical. --- <sub>Opened by Coder Agents on behalf of @evgeniy-scherbina.</sub> |
||
|
|
05699c4d55 |
feat: automate weekly AI model price book refresh (#28146)
Example of generated PR: https://github.com/coder/coder/pull/28228 ## Summary The price book is regenerated by hand with `make gen/aibridge-prices`, so keeping it current depends on someone remembering to run it. Newly launched models stay unpriced and changed prices stay stale until the next manual run. This adds a weekly workflow that regenerates both artifacts from live [models.dev](https://models.dev) data and opens a pull request when the output changes. For scale, a run against `main` today produced 32 models added, 11 removed, and 43 repriced. ## What it does - Runs every Thursday at 09:00 UTC, plus `workflow_dispatch`. Exits without opening anything when regeneration produces no diff. - Reuses one branch and one pull request, force-pushing each week, so at most one refresh PR is open and it always carries the newest snapshot. - Ships `prices.json` and `knownModelsGenerated.json` together, since both come from a single upstream snapshot. - Never merges automatically. Prices are customer-visible cost numbers, so every change goes through human review. - Announces failures in Slack. The generator fails by design when upstream drops a model pinned in `overrides.jq` or curated in `curation.json`, and a silently red weekly cron would defeat the point. `scripts/aibridgepricesdiff` renders the PR body summary: counts, then the models added, removed, and repriced. Exact figures stay in the diff rather than being restated in the body. It is deterministic and unit tested rather than AI-generated, so the model lists cannot drift from the file. `CODEOWNERS` covers the two generated artifacts, which are exactly the files a refresh PR touches. ## Verification Ran on this branch via a temporary `push` trigger, since `schedule` and `workflow_dispatch` only fire from the default branch. Confirmed end to end: mise and pnpm setup, generation from live models.dev, change detection, summary and body assembly, commit under the bot identity, branch creation, force-push on the second run, and Slack delivery. `gh pr create` and `gh pr edit` remain unverified: both runs hit `HTTP 503` from `api.github.com/graphql` during a GitHub major outage. The push path itself succeeded, so the credential and permissions are proven. Also verified locally: `go test ./scripts/aibridgepricesdiff/`, `make lint/actions/actionlint`, `make lint/actions/zizmor`, and `make pre-commit`. ## Notes - The PR is opened with `secrets.CDRCI_GITHUB_TOKEN`. PRs opened with the default `GITHUB_TOKEN` do not trigger workflow runs, which would leave the refresh without CI signal on a file that feeds cost calculation. - Requires the `AIGATEWAY_PRICES_SLACK_WEBHOOK` repository secret. The notification step fails loudly if it is unset, since by then the refresh has already failed and nobody would be told. - The workflow installs pnpm dependencies because catalog generation formats its output with biome; without `site/node_modules` the formatting step silently no-ops and an unformatted file would be committed. - A refresh that lands after a release branch is cut can reach that release through the existing cherry-pick label, so no separate release-cut trigger is included. The label is not applied automatically; that stays a reviewer decision. - Identifiers keep the `aibridge` spelling where they name real paths and make targets (`coderd/aibridge/prices`, `make gen/aibridge-prices`, `scripts/aibridgepricesgen`). The workflow itself is named `aigateway-prices-refresh`, and prose says AI Gateway per the style guide. - The issue also asked for code owners on the generator. Only the generated artifacts are owned here, since those are the files a refresh PR touches. Ownership of `curation.json` and `overrides.jq` can be added separately if human edits to them should request review. <details> <summary>Implementation plan and decision log</summary> ### Goal Refresh `make gen/aibridge-prices` output on a schedule and open a human-reviewed PR when it changes, so releases never ship a stale price book. ### Schedule Weekly, Thursdays 09:00 UTC, leaving Thursday, Friday, and Monday for review before Tuesday releases. A monthly run was considered first. Release ships Tuesday morning and the freeze is the last Tuesday before EOM, so a monthly run on the 19th or 20th collapses to 1-2 usable business days in roughly 10 of 132 months: February, when the release Tuesday is the 22nd and the run day falls on a weekend. Measured across 2026-2036: | Cron day | Worst case usable business days | Months with 2 or fewer | Median | |---|---|---|---| | 20th | 1 | 10 | 6 | | 19th | 1 | 10 | 6 | | 16th | 3 | 0 | 6 | | Weekly Thursday | n/a, always a full week | 0 | n/a | The median is 6 days for every candidate, so moving to weekly costs nothing and removes the bad tail. The shipped book is never more than 7 days stale. ### Branch strategy One fixed branch, force-pushed, rather than a new branch and PR per run. `prices.json` is a full regeneration from the current upstream snapshot, not an incremental patch, so two open refresh PRs are the same file at two points in time and the older one is strictly wrong. A single PR makes merging a stale snapshot impossible, keeps reviewer load at one PR, and avoids a full CI run per week per stale PR. ### Summary generation Deterministic Go tool, not an AI summary. An LLM summarizing a JSON diff can drop or invent a row, and would be non-reproducible run to run. A jq implementation was considered and rejected as effectively untestable. The body lists which models moved; the diff in the Files tab remains the source of truth for figures. An earlier version rendered full price tables with percentage deltas. That duplicated the diff, so it was reduced to model lists. ### Token `secrets.CDRCI_GITHUB_TOKEN`, the cdrci machine user already used for bot-authored PRs in `release.yaml` and cited for exactly this reason in the commented-out `update-flake` job in `ci.yaml`. A dedicated GitHub App scoped to this repo would be tighter, but needs org admin to create. ### Commit identity `github-actions[bot]` with its numeric noreply address, matching `backport.yaml` and `cherry-pick.yaml`. An invented address would leave refresh commits with an unlinked author. ### Alerting A dedicated webhook secret rather than reusing `CI_FAILURE_SLACK_WEBHOOK`. The repo already splits alerting per domain (docs, security, dependabot each have their own webhook), and the CI-failure channel carries a user mention plus `vars.BLINK_CI_FAILURE_PROMPT` that feeds an automated triage flow this payload does not belong in. GitHub's built-in email notification was considered and rejected as the primary channel: for scheduled workflows it goes to a single user, the one who last modified the cron syntax, and cannot be routed to a team. ### Out of scope Triggering a refresh when a release branch is cut. The existing cherry-pick label already gets a late refresh into a release, so a separate mechanism is unnecessary. </details> --- Closes [AIGOV-578](https://linear.app/codercom/issue/AIGOV-578/automate-updates-to-the-shipped-ai-model-price-book). Authored by Coder Agents on behalf of @evgeniy-scherbina. |
||
|
|
166d92ba73 |
fix: bound request body size on JSON API endpoints (#28168)
## Summary `httpapi.Read` decoded request bodies with no size limit, so a single request could allocate memory without bound. This adds a 4 MiB default ceiling, leaves the endpoints that legitimately need more explicitly exempted, and counts the rejections so a limit set too tight is visible. This is the first of three PRs split out of #28048, covering the endpoints that answer in `codersdk.Response` shape. The OAuth2 decode paths (RFC 6749, RFC 7591) and the SCIM ones (RFC 7644) answer in their own error shapes and follow in separate PRs, along with the lint rule that pins the invariant. Closes PLAT-463. Remediates SEC-416 (CWE-770, CVSS 7.5) and SEC-392. ## Problem `httpapi.Read` calls `json.NewDecoder(r.Body).Decode(value)` with no ceiling, and no middleware in the chain bounds body size. The exposure is pre-authentication: login, OTP, and first-user creation all read a body before any authorization decision is reached. The existing rate limiter bounds request *rate*, which is orthogonal to the memory a single admitted request may consume. ## Fix `Read` is split into `Read` and `ReadLimit`. `ReadLimit` wraps `r.Body` in an `http.MaxBytesReader` and keeps the existing decode and validate logic; `Read` delegates to it with a new `DefaultMaxRequestBodyBytes` of 4 MiB, which covers the 124 remaining non-test callers at a single site. `http.MaxBytesReader` composes as tightest-wins, so the handlers that pre-wrapped their own bodies pass their limit to `ReadLimit` rather than wrapping, and each keeps its previous ceiling byte for byte. That matters most for the bulk secrets import at `8 * MaxSecretsFileBytes`: an unconditional wrap inside `Read` would have silently halved it to the default. `TestImportUserSecretsBodyLargerThanDefaultLimit` is the regression guard for that specific failure, and `TestMaxBytesReaderNesting` pins the composition behavior the whole requirement rests on. Every rejection site calls `httpapi.RecordRequestBodyLimit`, which names the limit that tripped on the request's existing log line and marks the request so `coderd_api_requests_too_large_total{reason="request_body"}` counts body rejections apart from the 413s coderd answers for other causes, such as agent log storage overflow. A limit set too tight for a legitimate payload therefore surfaces without waiting for a user report. The limit is a constant rather than a deployment option: an operator raising it to unblock something would reopen the vulnerability as configuration, where a security scan will not find it. A legitimate 413 is answered with a targeted `ReadLimit` on that endpoint. ## Behavior change `POST /api/v2/files` now answers 413 rather than 400 when a request body exceeds `HTTPFileMaxBytes`. It installed that bound already but reported the rejection as a read failure, which leaked the stdlib `http: request body too large` string through `Detail` and kept the largest limit in the tree off the metric. The separate 413 for an oversized expanded archive is unchanged. The task log snapshot endpoint now answers 413 rather than 400 when its 64 KiB cap is exceeded. Routing it through `ReadLimit` also changes its decode-failure message from "Failed to decode request payload." to "Request body must be valid JSON.", which is what every other endpoint answers. Its tests are updated to match both. `coderd_api_requests_too_large_total` is new, so there is no existing query to migrate. It counts the 413s coderd answers, labeled `method`, `path`, and `reason`. `reason="request_body"` is a rejection by one of the limits above; `reason="other"` is a 413 that has nothing to do with body size, such as agent log storage overflow. ## Reading this The commits are ordered to be read in sequence. Commits 1 and 2 are the security fix; commits 3 to 5 are the observability consequences, and commit 3 is the one that touches dashboards. Commit 7 documents the limit on the REST API reference index. Commits 6 and 8 add and revert an exhaustive `@Failure 413` annotation pass, which buried the fix under its regenerated swagger, and cancel out. |
||
|
|
7724ee281a |
feat: defer MCP tool schemas behind a find_tools search (#28225)
## Summary When the `mcp-tool-search` experiment is enabled, chatd stops inlining connected MCP tool schemas into every generation. It instead exposes a built-in `find_tools` tool whose description carries a compact catalog of the deferred tools, and only ships full JSON schemas for tools the model has activated by searching or by calling them directly. Closes [CODAGT-760](https://linear.app/coder/issue/CODAGT-760). ## Problem Tool-heavy agent configurations (GitHub, Linear, Notion, and dev-tooling MCP servers) inline over 100k tokens of tool schema definitions into every generation. Initial uncached requests reached ~216k tokens with time-to-first-token close to nine minutes, while the model typically invokes only a handful of tools per turn. ## How it works - `decideMCPToolSearch` defers external and workspace `.mcp.json` MCP tools whenever the experiment is enabled. Native, dynamic, provider, skill, and transport tools are never deferred. - `find_tools` embeds a server-grouped catalog in its tool description (degrading to names-only, then counts-only, then a constant-size summary past a context-scaled size cap) and scores keyword matches across tool names, descriptions, parameter schemas, and server metadata. Queries can scope to one server with a `server:` prefix, and exact `names` arguments always activate. - Activation state is ephemeral: it is re-derived each generation from surviving chat history (`find_tools` results and direct calls to deferred tools), so activations naturally lapse when compaction summarizes them away. Aggregate activated schema weight is capped at 10% of the context window, shedding the least recently activated schemas first; `find_tools` shares that budget across parallel calls in one step. No new persistence. - Deferred tools stay registered for execution, so the model can call a cataloged tool directly without searching first; the schema is activated for subsequent steps. - Fail-open: the experiment being disabled, an empty candidate set, or an MCP tool named `find_tools` all disable deferral, leaving today's behavior byte-identical on the wire. - Prometheus counters/histograms track `find_tools` calls, matches, activations, and deferred token weight. - The conversation timeline renders `find_tools` calls with a collapsed search summary and expandable match list, falling back to the generic renderer on malformed payloads. ## Validation - Unit tests for the catalog, matcher, experiment-gated decision, and activation derivation; end-to-end chatd generation tests covering search-then-call, direct-call activation, experiment-off wire parity, compaction lapse, and subagent tool gating. - Storybook interaction tests for the timeline rendering and malformed-payload fallback. - Remote dogfood UAT on dev.coder.com passed: deferral with a real MCP server and Anthropic model, direct calls without prior search, activation persistence across turns, experiment-off parity, and clean UI/console. > Disclosure: Mux (AI agent) authored this PR on Mike's behalf. |
||
|
|
119f2b1dd9 |
feat: limit concurrent chat agents with pooled admission (#27902)
Limits concurrent chat generation on capped deployments to 5 root chats and 10 delegated subagent chats. The pools are deployment-wide and independent, so delegated work can continue while root capacity is full. The default caps live in AGPL code. Enterprise contributes only a licensing unlock, so unlicensed deployments stay capped and cannot fail open. Licensed deployments are uncapped while Agent Hours usage stays below an explicit hard limit. Deployments without a hard limit remain uncapped, and reaching the Agent Hours allocation only triggers warnings. Admission happens before a worker takes chat ownership. Capped deployments serialize admission across replicas with a transaction-scoped advisory lock and derive active and queued state from current ownership plus fresh runner heartbeats, rather than persisted queue markers or per-replica state. The acquisition query returns a bounded, pool-interleaved candidate set instead of ranking the whole backlog; a migration replaces the acquisition index with a pool-aware one. Refused chats stay running but unowned, and interrupt requests bypass admission so users can stop queued or over-cap chats. The single-chat API derives `queued_for_capacity` from live pool state; list endpoints do not report it. The UI polls that value every 5 seconds while a chat is running and shows a callout when the chat is waiting for capacity. Updates the administrator documentation and deployment-wide Prometheus gauges for active and queued agents. Replica-level values must be aggregated with `max`, not `sum`. > Mux updated this PR on Mike's behalf. |