Commit Graph
2936 Commits
Author SHA1 Message Date
Thomas Kosiewski 60cc826f2b feat: sign forwarded MCP identity headers (#29669) 2026-09-22 11:11:08 +02:00
Michael Suchacz af0ef00f91 feat: add owner_id to CreateChatRequest to create chats for another user (#29581)
Owners and owner-level service accounts can now start a Coder Agents
chat on behalf of another user by setting `owner_id` on `POST
/api/v2/chats`. The field is optional and defaults to the caller, so
existing clients are unaffected. A delegated owner must be an active,
non-system member of the requested organization; anything else returns
400 `Chat owner must be an active member of the organization.` once the
caller has passed the authorization gates below.

A chat runs entirely with its owner's credentials (synthetic API key,
workspace access, OIDC and provider tokens), so creating one for someone
else is acting as that user. On top of org-scoped `chat:create` for the
owner, the caller must hold the authority to create API keys for that
user, which is what the token endpoint demands to mint their session.
Org admins therefore cannot use it; site owners and owner-role service
accounts can. For the same reason the workspace binding, model config,
and MCP server IDs are validated as the owner rather than the caller,
and the owner must themselves hold `chat:create` (organization service
accounts do not). The initial user message is attributed to the caller
through `chatd.CreateOptions.CreatedBy`.

An earlier revision of this PR exposed the same behavior as `POST
/api/v2/users/{user}/chats`; that route and
`codersdk.Client.CreateUserChat` were removed in `62a8be3dd32` in favor
of the request field. An explicit zero `owner_id` is rejected with 400
rather than silently defaulting to the caller. Coverage lives in
`TestPostChats_OwnerID`.

<details>
<summary>Review record (path-based revision, gates unchanged)</summary>

- Two-axis code review (Standards, Spec) plus a simplicity audit ran as
Xum sub-agents on `1f3189898f0`. The Spec axis found the workspace
binding was authorized as the caller, fixed in `363d45281d8` with
red-green coverage in `WorkspaceNotAccessibleToOwner`. The additional
API-key gate and the `CreatedBy` attribution go beyond the workspaces
pattern and were kept deliberately for the reasons above.
- Codex review on `363d45281d8`: one P2, suspended, dormant, or system
users could be targeted and would get a chat that can never run because
AI Bridge refuses to authorize them. Fixed in `c065437e359` with
`OwnerSuspended` (red on the old head); thread replied to and resolved.
- Codex review on `c065437e359`: one P2, an explicit or
personal-override model config the caller can read but the owner cannot
was accepted and chatd would silently fall back to the default model at
run time. Fixed in `aa88b608182` by resolving the model config and MCP
server IDs under the owner's context, with
`ModelConfigNotAccessibleToOwner` (red on the old head); thread replied
to and resolved.
- Codex review on `aa88b608182`: one P2, an organization service account
(which deliberately holds no chat permissions) could be targeted because
the chat permission check ran as the caller. Fixed in `a6fe8075c30` by
also requiring the owner subject to hold `chat:create`, with
`OwnerWithoutChatPermission` (red on the old head); thread replied to
and resolved.
- Codex review on `a6fe8075c30`: one P2, the active/non-system check was
skipped when the caller could not read the owner's user object. Fixed in
`0dd8bb4dd44` by moving the check behind the authorization gates with a
system-restricted lookup; thread replied to and resolved. In
`62a8be3dd32` that lookup became a single `OrganizationMembers` query,
which also covers membership and excludes system and deleted users.
- Codex review on `62a8be3dd32` (the `owner_id` revision): two P2s. An
explicit zero `owner_id` was treated as omitted and created the chat for
the caller; fixed in `f54b4f33d36` with a 400 and `OwnerIDNil` (red on
the old head). Creation and the read-back still ran as the caller while
the preflight ran as the owner; fixed in the same commit by passing
`ownerCtx` to `CreateChat`, `GetChatByID`, title generation, and the
file-metadata fetch. That second scenario is unreachable today (only the
built-in `owner` role holds `api_key:create` for others, and site-wide
custom roles are refused by both the API and dbauthz), so it has no
dedicated red test. Both threads replied to and resolved.
</details>

<details>
<summary>Remote UAT record (path-based revision)</summary>

Remote UAT on dogfood (chat `d7442df3-693f-4403-805f-2de52f7bdbed`, Xum
sub-agent as critical runner) tested head `21ed6b389cc`, the last
path-based revision. Licensed dev server, real Haiku 4.5 model, 77
logged API requests, 23 inspected screenshots. Endorsed verdict:
**PASS**. Site owner creates a chat for member X: X sees it, gets real
answers to the admin prompt and to follow-ups, and state survives reload
and mid-response refresh. The creating admin gets `403 Only the chat
owner may send messages.` and a read-only view; an unrelated member gets
404. Org admin, member, user-admin, and template-admin callers get 403;
owner-role service account 201. Suspended, dormant, and service-account
targets 400; owner-inaccessible workspace, model config, or MCP server
400; 300 KiB body 413. The `owner_id` revision changes only how the
owner is supplied and the non-member response (400 instead of 404); the
authorization and eligibility gates it exercised are unchanged and
covered by `TestPostChats_OwnerID`.

Non-blocking findings for the author's judgment, none of them
regressions of this PR:
1. X's UI shows no author on the admin-written first message and offers
X "Edit" on it; `created_by` carries the admin but the frontend does not
surface it.
2. A site owner who is not a member of the organization can still create
a chat for its members (201), while a self-owned `POST /chats` returns
403 for the same organization; same asymmetry as `postUserWorkspaces`.
3. The creating admin can archive, rename, and interrupt X's chat
although it cannot message it (pre-existing chat authz).
4. Owner-inaccessible model config or MCP server is reported as "not
found or disabled" with no hint that the owner, not the caller, lacks
access.
5. Dormant (never logged in) targets are refused because AI Bridge
rejects non-active users; a new hire cannot be given a chat until first
login.
6. The endpoint docs list only 201 and 413.
</details>

> Xum (an AI agent) acted on behalf of @ibetitsmike for this PR.
2026-09-21 20:49:10 +02:00
Michael Suchacz 988520477e feat!: remove the experimental chat API mounts after the transition window (#29548)
Remove the `/api/experimental` duplicates of the promoted chat API.
#28496 double-mounted the chat, organization chat and MCP server, member
model-override, AI provider key, and MCP OAuth2 disconnect routes under
both prefixes for the one-release compatibility window decided in
CODAGT-921; that window closed with v2.37.0, so these routes now answer
only on `/api/v2`. The change also deletes what existed only for the
dual mount: the `chatAPIPrefix` plumbing, the shared cross-prefix files
rate limiter (`RateLimitByAPICompatibilityEndpoint`), the 410 tombstones
for the legacy `chats/providers` and `chats/user-provider-configs`
collections with their `ExperimentalClient` SDK methods, and the
`/providers` and `/user-provider-configs` 404 reservations on `/api/v2`.
Signed chat file download URLs now point at `/api/v2`.

Routes that were never promoted stay on `/api/experimental`: the
experiment-gated `chats/config/advisor` and
`chats/config/computer-use-provider`, `chats/{chat}/stream/desktop`,
`chats/{chat}/debug/runs`, and the MCP OAuth2 callback, whose path is
pinned as a registered redirect URI with external providers. The
frontend already calls `/api/v2` for every promoted route, so only
`typesGenerated.ts` changes. Because the experimental mount no longer
reserves the removed collection segments, requests such as `GET
/api/experimental/chats/models` now fall into the `{chat}` wildcard and
return 400 instead of 404; the experimental prefix carries no stability
guarantee and the compatibility window is over, so no new reservations
were added.

`coderd/x/chatd/ARCHITECTURE.md` now describes the single `/api/v2`
mount and the remaining experimental routes, and its endpoint headings
use the `/api/v2` paths.

Closes CODAGT-922
(https://linear.app/codercom/issue/CODAGT-922/remove-experimental-chats-api-paths-after-transition-window).
Refs #28496.

## Delivery record

- Remote dogfood UAT (Coder Agents chat
https://dogfood.cdr.dev/agents/c016b549-201a-4eca-a50f-3c0b7c339db6):
verdict PASS on b008976a4dfba3524b220ca846ea3c3492e9cc9c. The branch was
since rebased onto main (which had a duplicate migration 000596 until
#29568) and gained one docs-only commit
(`coderd/x/chatd/ARCHITECTURE.md` only); the current head 666332f579
carries the same code diff, so the tested branch code is unchanged.
Covered the Agents UI end to end on `/api/v2` (chat, streaming reply,
reload mid-stream, file upload and download, debug runs panel), the
admin AI settings pages with persisted saves, 45 curl route checks
across both prefixes, websocket handshakes, the frozen MCP callback
redirect URI, and the files rate limiter. One low-severity note: the
400-versus-404 behavior for removed experimental collection paths
described above.
- Codex review on b008976a4d (draft marked ready): no findings. Codex
review on the current head 666332f579 (requested via `@codex review`):
one P1 thread asking for TODO markers instead of the direct
`ARCHITECTURE.md` edit; replied and resolved because the PR author
reviewed the earlier TODO markers and directed this replacement text. No
unresolved threads. CI is green on 666332f579 (run 35376339802;
`test-go-pg-17` passed on rerun after a Docker Hub timeout in
`TestSSH_Container/OK`).

> [!NOTE]
> Xum acted on @ibetitsmike's behalf in this pull request.
2026-09-21 17:42:31 +02:00
Jake Howell 9a65e8f0e5 chore(docs): update ws-proxy-picker.png (#29651)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Replaces `ws-proxy-picker.png` with a 896px preview of the current
Workspace Proxies settings page
(`UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyView`), using the
same `MockWorkspaceProxies` fixture data as its Storybook story. The old
image showed the previous admin Deployment layout with a separate URL
column, badge-style statuses, and full sidebar chrome.

Image-only change; no docs text or paths were modified. Referenced once,
from `docs/admin/networking/workspace-proxies.md` under "Selecting a
proxy".

| Old | New |
|---|---|
| <img width="448" alt="ws-proxy-picker (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/admin/networking/workspace-proxies/ws-proxy-picker.png"
/> | <img width="448" alt="ws-proxy-picker (new)"
src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-ws-proxy-picker/docs/images/admin/networking/workspace-proxies/ws-proxy-picker.png"
/> |

<details>
<summary>Verification</summary>

- Header text, "View docs" link, and the Proxy / Status / Latency
columns match `WorkspaceProxyView.tsx`; URL-as-subtitle, dot-style
status indicators, `N ms` / "Not available" latency, and the Errors /
Warnings blocks match `WorkspaceProxyRow.tsx`.
- Fixture data only (`dev.coder.com`, `*.fly.dev.coder.com`,
`127.0.0.1:3001`), identical to the old image. No real deployment URLs
or users.

</details>
2026-09-22 01:19:09 +10:00
Jake Howell 113667470d chore(docs): update autostart.png and autostop.png (#29650)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Replaces the autostart and autostop screenshots under
`docs/images/workspaces/` with previews of the current workspace
schedule form. The old images showed the previous MUI-based form
(different toggle and input styling, Sunday-first day order).

Image-only change; no docs text or paths were modified. Both are
referenced from `docs/user-guides/workspace-scheduling.md`.

| Old | New |
|---|---|
| <img width="448" alt="autostart (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/workspaces/autostart.png"
/> | <img width="448" alt="autostart (new)"
src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-workspaces-autostartstop/docs/images/workspaces/autostart.png"
/> |
| <img width="448" alt="autostop (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/workspaces/autostop.png"
/> | <img width="448" alt="autostop (new)"
src="https://raw.githubusercontent.com/coder/coder/refs/heads/jakehwll/docs-workspaces-autostartstop/docs/images/workspaces/autostop.png"
/> |

<details>
<summary>Verification</summary>

- Labels match
`site/src/pages/WorkspaceSettingsPage/WorkspaceSchedulePage/WorkspaceScheduleForm.tsx`:
"Enable Autostart", "Start time", "Timezone", "Days of Week" with Mon
through Sun ordering, "Enable Autostop", "Time until shutdown (hours)",
and the `ttlShutdownAt` helper text.
- No user names, emails, or deployment URLs visible.

</details>
2026-09-21 14:50:10 +00:00
Jake Howell f3cfd8bddc chore(docs): remove unused images (#29647)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Removes 73 files (72 PNGs and 1 MP4, about 12 MiB) under `docs/images/`
that nothing references anymore. Most are older screenshots superseded
when docs were reorganized and new images were added at new paths (for
example `guides/using-organizations/` vs the current
`admin/users/organizations/`), leaving the originals orphaned.

Pure deletion, no markdown or manifest changes. This covers every
unreferenced raster asset under `docs/images/`. 22 unreferenced SVGs
remain (`icons/*.svg`, `google-cloud.svg`, `oidc-sequence-diagram.svg`)
and are out of scope here; `icons/` is consumed via `manifest.json`
`icon_path` entries rather than markdown, so those warrant a separate
look.

<details>
<summary>Verification</summary>

- Searched the whole repo (not just `docs/`) for every deleted file by
full path, docs-relative path, and basename (case-insensitive): zero
references. All basename hits resolve to different, still-present files
that share a name at another path.
- `docs/manifest.json`, root `README.md`, `site/`, and `offlinedocs/`
were included in the search.
- GitHub code search across the `coder` org for links to the deleted
directories (this repo uses
`raw.githubusercontent.com/coder/coder/.../docs/images/...` URLs for
media, so external consumers are possible): no live consumers. The only
hits are a vendored docs snapshot in `coder/coder-k8s` under
`.mux/skills/coder-docs/references/`, which is stale by design.
- CI: `check-docs` (linkspector), `lint-docs`, and `offlinedocs` pass.

</details>
2026-09-22 00:40:06 +10:00
Jake Howell 84f790bd32 chore(docs): new notifications images (#29649)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Replaces the two notification preference screenshots under
`docs/images/admin/monitoring/notifications/` with Figma-exported
previews in the same 896px style as #29455 and #29648, reflecting the
current UI. The old shots predated the Events / Settings /
Troubleshooting tabs on the admin page and the AI Cost Control and Chat
event groups, and the old user-preferences shot included a real user's
name and email in the sidebar.

Image-only change; no docs text or paths were modified. Both are
referenced from `docs/admin/monitoring/notifications/index.md`. Files
are 25-60% smaller.

| Old | New |
|---|---|
| <img width="448" alt="notification-admin-prefs (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/admin/monitoring/notifications/notification-admin-prefs.png"
/> | <img width="448" alt="notification-admin-prefs (new)"
src="https://raw.githubusercontent.com/coder/coder/12b31d278358d2f0a6af1028792b72b366e8e1d4/docs/images/admin/monitoring/notifications/notification-admin-prefs.png"
/> |
| <img width="448" alt="user-notification-preferences (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/admin/monitoring/notifications/user-notification-preferences.png"
/> | <img width="448" alt="user-notification-preferences (new)"
src="https://raw.githubusercontent.com/coder/coder/12b31d278358d2f0a6af1028792b72b366e8e1d4/docs/images/admin/monitoring/notifications/user-notification-preferences.png"
/> |

<details>
<summary>Verification</summary>

- Page copy and tabs match
`site/src/pages/DeploymentSettingsPage/NotificationsPage/NotificationsPage.tsx`
and
`site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.tsx`.
- Event groups and template names (AI Cost Control Admin Events, AI Cost
Control Events, Chat Events, Missing AI Model Prices, User
Approaching/Reached AI Budget Limit, AI Budget Limit Reached, AI Budget
Warning) match the notification template migrations.
- The user-preferences image still shows a per-template delivery method
icon on the right, which the docs text above it refers to.
- No user names, emails, or deployment URLs visible.

</details>
2026-09-22 00:22:47 +10:00
Jake Howell 57e8fd14b2 chore(docs): new licensing images (#29648)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Replaces the three screenshots under `docs/images/admin/licenses/` with
Figma-exported previews in the same 896px style as #29455, reflecting
the current Licenses UI. The old `licenses-screen.png` predated the
Products / Add-ons license card (Coder Workspaces, Coder Agents, AI
Governance).

Image-only change; no docs text or paths were modified. Referenced from
`docs/admin/licensing/index.md` and `docs/tutorials/faqs.md`. Files are
40-60% smaller and no longer carry EXIF metadata.

| Old | New |
|---|---|
| <img width="448" alt="licenses-screen (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/admin/licenses/licenses-screen.png"
/> | <img width="448" alt="licenses-screen (new)"
src="https://raw.githubusercontent.com/coder/coder/1a18a0ee925d12cecfb1e2cee5e37b22602a3629/docs/images/admin/licenses/licenses-screen.png"
/> |
| <img width="448" alt="licenses-nolicense (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/admin/licenses/licenses-nolicense.png"
/> | <img width="448" alt="licenses-nolicense (new)"
src="https://raw.githubusercontent.com/coder/coder/1a18a0ee925d12cecfb1e2cee5e37b22602a3629/docs/images/admin/licenses/licenses-nolicense.png"
/> |
| <img width="448" alt="add-license-ui (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/admin/licenses/add-license-ui.png"
/> | <img width="448" alt="add-license-ui (new)"
src="https://raw.githubusercontent.com/coder/coder/1a18a0ee925d12cecfb1e2cee5e37b22602a3629/docs/images/admin/licenses/add-license-ui.png"
/> |

<details>
<summary>Verification</summary>

- Every visible label in the new images maps to a current string in
`site/src/pages/DeploymentSettingsPage/LicensesSettingsPage/`
(`LicenseCard.tsx`, `LicensesSettingsPageView.tsx`,
`AddNewLicensePageView.tsx`, `CoderWorkspacesProductCard.tsx`,
`CoderAgentsProductCard.tsx`).
- Mock license data only: license #26, 64/100 seats, valid August 27,
2024 to August 27, 2027. No license key, deployment ID, or email
visible.
- Dimensions 896x512 / 896x352 / 896x512, matching the
`docs/images/screenshots/` convention from #29455.

</details>
2026-09-22 00:21:59 +10:00
Michael Suchacz 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.
2026-09-21 15:58:18 +02:00
Spike Curtis 29ae50d9c9 feat: accept include_related query param on get workspace by ID (#29539)
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)).
Follows #28639, which added the `wsrelated` package and parser.

Wires the `include_related` query parameter into `GET
/api/v2/workspaces/{workspace}`, the first endpoint to accept it. When
present, the value is parsed with `wsrelated.Parse` and the resulting
selection is threaded into `workspaceData`, so only the requested
related data is queried. Omitting the parameter is backward compatible
and returns everything (`wsrelated.All`). An invalid value returns
`400`.

Because related data can now be omitted, the handler no longer assumes
the build and template are present: it uses zero values when they are
absent, and only enforces the template read-authorization check (`403`)
when the template was actually requested.

### Partial-build conversion

`convertWorkspaceBuilds` now tolerates a build whose provisioner job or
template version was deliberately omitted from the selection, so
selections such as `latest_build` (build only) or
`latest_build.resources.*` (resources without the job) convert correctly
instead of erroring. The omitted fields are left zero (empty `Job`,
empty `TemplateVersionName`). Resources are keyed by the build's `JobID`
rather than the fetched job row, so they load independently of whether
the job is selected. The integrity error is preserved for full-data
callers: when a job or template version is requested but missing,
conversion still fails. The selection config (`wsrelated.LatestBuild`)
is threaded into `convertWorkspaceBuilds` to distinguish "not requested"
from "missing".

Only this endpoint is wired; the other endpoints that produce
`codersdk.Workspace` objects, and the codersdk client functions, come in
later PRs.

---

*Generated by Coder Agents on behalf of @spikecurtis.*
2026-09-21 10:50:01 +02:00
Susana Ferreira 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.
2026-09-21 09:33:33 +01:00
Michael Suchacz 53ad29512d fix: route chat quickgen side calls through the title generation model (#29622)
Chat sublabels were falling back to "Finished latest turn" for most
turns on some models. On dogfood, 95% of Claude Fable 5.1 chats over the
last 7 days showed the fallback (341/357) while Opus 4.8 sat at 3%. The
end-of-turn status label and the whole-chat summary were generated on
the chat's own model, and Anthropic rejects the forced tool call that
Fantasy's object generation relies on with `400 tool_choice: type "tool"
and "any" are not supported for this model.` on every `claude-fable-5-1`
request (about 3k such 400s in 7 days). OpenAI-compatible reasoning
models such as solstice-1 fail the same call differently, answering with
text at the 64-token cap. Title generation kept working because it
already resolves a dedicated model: the organization `title_generation`
override (Haiku 4.5 on dogfood), then a preferred small model, then the
chat model. The failures were only visible at Debug level.

Route every quickgen side call (turn status label, chat summary,
automatic and manual title) through one shared resolver,
`resolveQuickgenModel`, with that same order: `title_generation`
override, then an enabled preferred small model, then the chat's model
as a last resort. The preferred-model match now also accepts dated
snapshot IDs such as `claude-haiku-4-5-20251001`, which is how admins
commonly configure Haiku. Candidate failures for labels, summaries, and
titles are logged at Warn with provider and model. The admin settings
copy and the models doc now say that the title generation override also
governs status labels and summaries.

Known tradeoff: when the resolved quickgen model itself is unusable at
call time (for example an invalid provider key on the small model), the
side calls fail and the generic label is shown; there is deliberately no
second call on the chat's model.

Refs
https://linear.app/codercom/issue/CODAGT-1077/fix-agent-turn-status-label-generation-failures

## Delivery record

- Remote dogfood UAT, Coder Agents chat
https://dogfood.cdr.dev/agents/87bab92b-bd54-4d5c-aba2-8147eaedfa49
(real Anthropic and OpenAI models through the dev AI gateway, UI driven
through Playwright). Round 1 on b4cc6fc336: FAIL, a dated Haiku config
(`claude-haiku-4-5-20251001`) did not match the preferred-model list, so
labels still fell back to Fable; fixed in cb5f0e0eaf. Round 2 on
cb5f0e0eaf: PASS (override set, override cleared with the dated Haiku
config, single-model fallback, auto and manual titles, summary
regeneration, Warn logging, plus edge cases). Later heads add only UI
copy, docs, and a Storybook play-function cleanup on top of the
UAT-tested SHA and were not re-exercised remotely.
- Codex review: pass 1 on 0ec37f6492 raised one P1 (assertions inside a
Storybook play function), fixed in 409eac5211 and the thread resolved;
pass 2 on 409eac5211: "Didn't find any major issues", zero unresolved
threads. CI green on 409eac5211.

> Xum (an AI coding agent) authored this PR on behalf of @ibetitsmike.
2026-09-20 23:18:12 +02:00
Ehab Younes 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
2026-09-19 00:32:51 +02:00
Michael Suchacz cc8c76651e fix: use workspaces when chat capabilities are insufficient (#29579)
Chatd's guidance discouraged workspace creation even when the chat
lacked the tools or context needed to finish a request. Make a suitable
workspace the fallback when missing tools, skills, MCPs, or context
block progress, while preferring existing capabilities when sufficient.

Align the system prompt, workspace awareness, planning guidance, tool
description, regression tests, and user documentation. Preserve
template-selection guardrails and delegated-agent restrictions.

**Open review finding:** workspace readiness can precede initial
MCP/context discovery. The wording now acknowledges this limitation; a
runtime synchronization fix is pending a scope decision.

<details>
<summary>Implementation and verification context</summary>

- Coding requests authorize necessary workspace setup without a separate
workspace request; self-contained examples remain workspace-free when
existing capabilities suffice.
- Detached root chats create a workspace; attached stopped workspaces
use start_workspace. Persisted awareness describes the initial state
rather than claiming the chat remains detached.
- Delegated chats report workspace needs to their parent. Provisioning
does not unlock workspace MCP tools in Plan Mode.
- Use actually exposed capabilities; do not assume readiness means all
skills, MCP tools, and context have loaded, or recreate workspaces to
retry discovery.
- Prompt, workspace-creation, template-selection, setup-failure, Plan
Mode MCP boundary, and API prompt-composition tests pass. The creation
E2E now verifies published instructions, skills, and MCP tools appear in
request two with no extra user turn; repeated and race runs pass. This
does not establish live-model compliance or discovery readiness.
- Full make pre-commit passes, including generation, formatting, lint,
and the slim build. All CI checks pass on f4f61333ce (23 passed, 8
skipped), and Codex reports no major issues on that commit.
- Codex review iterations corrected prompt/tool conflicts. The alleged
immutable-per-turn tool catalog was disproved by the per-task generation
lifecycle. The narrower initial-discovery race remains open: no existing
chatd-visible signal distinguishes pending discovery from completed
empty or failed discovery.

</details>

Generated by Coder Agents on behalf of @ibetitsmike.
2026-09-18 17:47:53 -04:00
Bobby Ho 55da502938 feat: allow admins to configure an OAuth2 app's scope allowlist (#29313)
Add backend support for scope allowlists on admin-created OAuth2 apps, previously available only through DCR.

- Add optional, space-separated `scope` to create/update requests and return canonicalized, deduplicated scopes in app responses.
- On create, omitted or empty `scope` means unrestricted. On update, `scope` replaces the allowlist; omission preserves it, and an empty string clears it to unrestricted.
- Keep scope enforcement unchanged. Add tests for scope round-trips, DCR canonicalization parity, and authorization narrowing.
- Include generated SDK and docs updates. The UI scope picker follows in a separate PR.

Part of [PLAT-475](https://linear.app/codercom/issue/PLAT-475).
2026-09-18 11:58:49 -07:00
McKayla はな 66a433985e feat: add user workspace search filter (#29442) 2026-09-18 12:57:21 -06:00
McKayla はな 8e159a8053 chore: remove stale TODO shims and dead code (#29252) 2026-09-18 10:27:26 -06:00
Paweł Banaszewski c47eb47393 feat: add stateless AI Gateway proxy mode (#29349)
Adds proxy mode to the AI Gateway. No AI provider is supported in this
mode yet.
2026-09-18 16:47:16 +02:00
Susana Ferreira c8b22a9d80 feat: add filters to the AI spend CSV endpoint (#29414)
## Description

Update the existing CSV export endpoint and SDK to accept user,
effective group, provider name, and model filters.

## Changes

- Pass the requested filters to the database query.
- Validate filters alongside the existing time window.
- Continue downloading all matching rows without pagination.

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-09-18 15:26:24 +01:00
Cian Johnston 19076beb8d feat: attribute AI Gateway usage to workspaces (#29235)
- Adds nullable `workspace_id` to AI Gateway interceptions without a
foreign key or index.
- Derives direct attribution from strictly parsed server-minted workspace
session-token names, excluding user-created tokens and validating the
embedded owner.
- Derives delegated Coder Agents attribution from the persisted chat
workspace ID.
- Records `workspace_id` through the additive v1.3 gateway protocol and
structured interception logs.
- Exposes attribution in session details through
`interception_attributions`, including tool-less interceptions and null
values for unknown attribution.

Closes AIGOV-637

Generated by Coder Agents.
2026-09-18 15:22:02 +01:00
Spike Curtis aae145bdc9 feat: make NATS pubsub opt-out via no_nats_pubsub experiment (#29283)
Makes the embedded NATS pubsub an opt-out feature instead of opt-in. The
`nats_pubsub` experiment is removed and replaced with a `no_nats_pubsub`
experiment, so NATS pubsub is now the default and can be disabled to
fall back to PostgreSQL pubsub.

NATS clustering requires this replica's routable address, resolved into
`clusterHost` from either `--cluster-host` (`CODER_CLUSTER_HOST`) or the
DERP relay URL. When neither is set (allowed when DERP is disabled on
the primary), NATS cannot form a cluster, so startup logs a big error
and falls back to PostgreSQL pubsub. The NATS cluster CA is only
minted/rotated when NATS clustering is actually active (experiment not
set and a cluster host is present).

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

- `codersdk/deployment.go`: removed `ExperimentNATSPubsub`
(`nats_pubsub`), added `ExperimentNoNATSPubsub` (`no_nats_pubsub`,
display name "No NATS Pubsub").
- `cli/server.go`: NATS is used by default unless `no_nats_pubsub` is
enabled; if `clusterHost` is empty, log an error and keep the PostgreSQL
pubsub.
- `coderd/coderd.go`: gate NATS CA minting/rotation on
`!ExperimentNoNATSPubsub && ClusterHost != ""` (i.e. only when NATS
clustering is active).
- `enterprise/coderd/licenses.go`: updated a stale comment.
- `enterprise/coderd/coderd_test.go`: `TestMultiReplica_NATSPubsubPeers`
no longer sets the removed experiment.
- Regenerated `coderd/apidoc/docs.go`, `coderd/apidoc/swagger.json`,
`docs/reference/api/schemas.md`, `site/src/api/typesGenerated.ts`.

</details>

---
*This PR was generated by Coder Agents on behalf of @spikecurtis.*
2026-09-18 12:58:06 +00:00
Jakub DomerackiandMcKayla はな 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>
2026-09-18 09:55:21 +02:00
Jakub Domeracki 0ea777a341 chore: remove dogfood template provisioning from CI (#29400)
Removes the remains of the dogfood template provisioning pipeline from
this repository. Template versions for the dogfood deployment are now
pushed from the infrastructure repository, so this repo no longer needs
Coder admin or template API-key secrets.

## Changes

- Delete `dogfood/main.tf`, the `coderd_template` root module used only
by the removed `deploy_template` job
- Refresh comments and a docs reference that pointed at the removed
pipeline

The `deploy_template` job removal itself moved to #29468, where it is
required to keep CI green. This branch predates that, so its diff still
contains the same deletion; merge #29468 first and the overlap resolves
cleanly.

Image builds and publishing (`codercom/oss-dogfood`,
`codercom/oss-dogfood-vscode-coder`) are unchanged.

## Follow-up

These repository secrets and variables become unused and can be
deleted/rotated: `CODER_SESSION_TOKEN`, `CODER_TEMPLATE_NAME`,
`CODER_DOGFOOD_ANTHROPIC_API_KEY`, `CODER_DOGFOOD_OPENAI_API_KEY`, and
the GCP workload identity provider/service account used for the
Terraform state bucket.

---

Generated by Coder Agents on behalf of @jdomeracki-coder.
2026-09-18 09:19:08 +02:00
Ethan 77479408b4 feat: make the Coder Agents stream silence timeout configurable (#29394)
The `chatloop` stream silence guard cancels and retries a model attempt
after `10m` of silence, and it was hard-coded. It's armed before the
request opens, so it also bounds time to first token, and slow local
models (e.g. `llama-server` on a large prompt) can spend longer than
that on prompt processing alone, meaning every attempt just gets
cancelled and retried.

This PR adds `--chat-stream-silence-timeout` /
`CODER_CHAT_STREAM_SILENCE_TIMEOUT` (default `10m`) and passes it to
both the main loop and the advisor. Setting it to `0` disables the guard
entirely, and anything above `24h` is rejected, which also keeps the
watchdog arithmetic below from overflowing.

Whilst doing this I ran into the runner's `15m` task watchdog, which
kept counting during an open stream. That silently cancelled any healthy
stream longer than `15m`, and would've stopped a silence timeout above
`15m` from ever firing. To fix, the silence guard now kicks the watchdog
out to `max(15m, silence + 5m)` whenever it arms or sees a part. Silent
streams still fail through the guard, healthy streams can run for as
long as they like, and hang detection is unchanged everywhere else. With
the guard disabled there's nothing to kick against, so arming it just
stops the watchdog for the rest of the attempt. That does mean the DB
write after the stream isn't bounded either when `0` is set; I think
that's fine for an opt-in setting, and a user can still stop the chat
from the UI if it wedges there.

I did consider removing the guard entirely, but the provider HTTP
clients have no timeout, so a provider that holds the connection open
would only ever be caught as a generic task hang, which is what #25782
was fixing.
2026-09-18 15:24:15 +10:00
blinkagent[bot] 24a96d4798 feat: make the parameter compatibility mode banner actionable (#29456) 2026-09-17 18:27:32 -06:00
Ben Potter dde8069ade docs(docs/tutorials/reverse-proxy-caddy.md): clarify the Caddy on-demand TLS ask endpoint (#29269)
The Caddy reverse-proxy tutorial's `on_demand_tls` example told readers
to leave `ask http://example.com` unchanged, warning that changing it
could break cert issuance. That's backwards: Caddy calls the `ask` URL
with the requested hostname as a `domain` query parameter and treats any
`2xx` response as approval to issue a certificate. `example.com` returns
`200` for any request, so the documented config approved certificate
issuance for any hostname, letting an attacker exhaust the deployment's
Let's Encrypt rate limit for the whole domain.

Replaces the "DO NOT CHANGE" warning with guidance to point `ask` at a
real, self-hosted validation endpoint, and links to [the
discussion](https://github.com/coder/coder/discussions/29079#discussioncomment-18462842)
that reported this for a reference implementation.

Reported in https://github.com/coder/coder/discussions/29079

> This PR was created with AI assistance (Coder Agents).
2026-09-17 18:32:18 -05:00
Steven Masley a90ad83af3 feat!: add a hidden flag to disable dynamic parameter closure evaluation (#29356)
**What changed**
Dynamic parameter rendering now evaluates only the coder parameter blocks and what they reference. Other root-module resources are skipped. Parameter, preset, and tag values are unchanged; optimizing rendering on large templates.

**How to revert**
Set `CODER_DYNAMIC_PARAMETERS_FULL_EVALUATION=true` (or `--dynamic-parameters-full-evaluation`) on `coder server` to restore full evaluation. The flag is hidden and needs no restart of workspaces. If you need it, please [open an issue](https://github.com/coder/coder/issues/new) with the template so we can fix the root cause.

**Troubleshooting**
Symptoms would be a parameter default, option list, preset value, or workspace tag that shows as unknown or empty after upgrading, when it was populated before. Confirm by setting the flag above; if the value comes back, report it. Templates written in `.tf.json` are not affected (they always use full evaluation).

**Why**
Rendering re-ran the entire template graph on every parameter change in the workspace form, which dominated latency on large templates. Resources a workspace would create cannot feed a parameter, so evaluating them is wasted work. The optimization lives in coder/preview#226 (coder/trivy#74); this PR adds the deployment-level escape hatch.

---

- `CODER_DYNAMIC_PARAMETERS_FULL_EVALUATION` / `--dynamic-parameters-full-evaluation` (hidden, default `false`) on `DeploymentValues`.
- `dynamicparameters.PreviewOptions(dv)` maps it to `preview.OptionFullEvaluation()`; `dynamicparameters.WithPreviewOptions` threads it through the loader to `preview.Preview`.
- Wired at the three render paths that hold deployment values: the template version tags extractor, the dynamic parameters websocket, and `wsbuilder` builds created from `coderd` (which call `.DeploymentValues(...)`).

Not covered: the autobuild lifecycle executor and the enterprise prebuilds reconciler construct `wsbuilder` without deployment values, so builds started from those paths use preview's default regardless of the flag. Those only re-render for builds, not the keystroke websocket path the optimization targets.

Prepared with Coder Agents assistance.
2026-09-17 14:33:37 -05:00
Jake Howell d5abef32af docs: update various previews in images/screenshots/ (#29455)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.

Refreshes stale screenshots in `docs/images/screenshots/` so the docs
reflect the current UI.

Image-only change; no docs text or paths were modified. Referenced from
`docs/about/screenshots.md`, `docs/get-started/index.md`,
`docs/install/index.md`, `docs/install/cli.md`, and
`docs/tutorials/template-from-scratch.md`, among others.

| Old | New |
|---|---|
| <img width="480" alt="coder-login (old)"
src="https://github.com/user-attachments/assets/eca9016a-36ab-4bcb-8c90-1d13410c3d20"
/> | <img width="896" alt="coder-login (new)"
src="https://github.com/user-attachments/assets/f54a08a8-62ed-45f4-9e52-e8cbe0f8faa4"
/> |
| <img width="1000" alt="template-insights (old)"
src="https://github.com/user-attachments/assets/b42b055a-e92d-459f-9d7f-e852d43c0b41"
/> | <img width="896" alt="template-insights (new)"
src="https://github.com/user-attachments/assets/42c9a84b-2a45-496b-95e5-374b23dd08c9"
/> |
| <img width="980" alt="terraform (old)"
src="https://github.com/user-attachments/assets/0030c532-4e96-4962-a655-c80c6ba65f84"
/> | <img width="896" alt="terraform (new)"
src="https://github.com/user-attachments/assets/69cd238f-ec3d-404c-840e-c9e090d0e4bb"
/> |
| <img width="791" alt="welcome-create-admin-user (old)"
src="https://github.com/user-attachments/assets/1e81911e-3bbb-4a27-b756-a8351b6610f4"
/> | <img width="896" alt="welcome-create-admin-user (new)"
src="https://github.com/user-attachments/assets/561d6157-c695-48be-adce-da12929e1e8f"
/> |
| <img width="980" alt="workspace-running-with-topbar (old)"
src="https://github.com/user-attachments/assets/2a73a405-2b93-4c83-9357-1b94da9edde0"
/> | <img width="896" height="512" alt="workspace-running-with-topbar"
src="https://github.com/user-attachments/assets/0b61ccc7-7d1b-4883-9c2c-1d0ea7d2c10b"
/> |
| <img width="1000" alt="workspaces-listing (old)"
src="https://github.com/user-attachments/assets/62a2456d-178e-4e17-b6a8-1c4fde2e23b8"
/> | <img width="896" alt="workspaces-listing (new)"
src="https://github.com/user-attachments/assets/d19bd0a0-3ba7-41de-b253-c49fcd62addc"
/> |
2026-09-18 01:31:46 +10:00
Jake Howell dd4f5ae48a fix: load AI Gateway session provider filter without AIProvider read (#28966)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

The Provider filter on `/ai-gateway` called the owner-only
provider-config API (`GET /api/v2/ai/providers`). Site auditors can read
sessions but not that config, so the dropdown was empty, and typing
`provider_name:…` failed the whole sessions list because search looked
up the name with the same permission.

- Add `GET /api/v2/ai-gateway/providers`, returning display metadata
only (`name`, `type`, `display_name`, `icon`) from `ai_providers`,
including disabled and soft-deleted rows that past sessions still
reference. When a name was reused, the live row wins.
- Authorize it in `dbauthz` on `aibridge_interception` read rather than
`ai_provider` read, so owners and auditors get labels and icons without
access to configuration. Members get 404.
- Match `provider_name` as a plain string in session search instead of
looking up `ai_providers`. Unknown names return an empty page, not a
validation error.
- Point the Provider dropdown at the new endpoint; filter by name, show
`display_name`, and render the icon from `type`/`icon`.

The endpoint reads the small `ai_providers` table instead of grouping
`aibridge_interceptions`, so it needs no new index and does not inherit
the scan cost noted for the models/clients lists. It is registered only
under `/ai-gateway`, not the legacy `/aibridge` alias.
2026-09-17 15:29:21 +00:00
Paweł Banaszewski 263f2c207e feat: register AI Gateway proxy experiment and share provider helpers (#29347)
- Add `ai-gateway-reverse-proxy` experiment and update generated API
types and documentation. The experiment has no runtime effect yet.
- Extract shared (will be used by next PRs in stack) provider routing
and key-pool enumeration helpers.
- Log unsupported routes at Debug level.
2026-09-17 10:27:48 +02:00
Michael Suchacz 9d97337277 feat: list organization AI spend by user (#29129)
Third of a four-PR stack that reworks the AI spend page onto the
released organization spend export, `GET
/api/v2/organizations/{organization}/ai/spend/export`, and a sibling
per-user endpoint, `GET
/api/v2/organizations/{organization}/ai/spend/users`, instead of the
deployment-wide `/api/v2/ai-gateway/spend/*` endpoints this stack
previously proposed. Every PR in the stack was rewritten in place from
current main; the head branch name predates the rework. The export's
accounting rules are unchanged: token usage by `created_at` in
`[period_start, period_end)`, attributed to the organization through the
effective budget group, so the page reconciles with the CSV and with
daily budget accounting.

Adds `GET /api/v2/organizations/{organization}/ai/spend/users`, a
paginated per-user report beside the CSV export. It accepts the export's
period parameters and the optional `provider_name`, `model`, and
`client` filters (`client` matches after `COALESCE(client, 'Unknown')`,
as the AI Gateway sessions listing does), and it authorizes identically
through `ResourceGroupMember` in the organization. The response is
`OrganizationAISpendReport`: the applied period bounds,
`retention_start` when retention is enabled (so the page can bound its
date picker), the user count, a `totals` object over every matching
user, and one page of users (`limit` default 10, max 100; `offset` >=
0), each with cost, unpriced usage count, providers, and clients. Each
user row also lists the sorted distinct models they spent through
(e73049f, added on request after the review round).

The period rules (provided together, at most 31 days, within retention,
default narrowed to retention) are shared with the export through the
caller's query parser. As a result the export now rejects unknown query
parameters whether or not a period is given; previously the
excess-parameter check only ran in the explicit-period branch. The
export's parameters and output are otherwise unchanged; the CSV itself
is not filterable.

The JSON rows are per user while the CSV keeps its user x group x
provider x model grain. That is deliberate: the page is the only JSON
consumer, and an explicit `group_by` can be added later without changing
this contract. A page past the last user still carries the window
totals, read from the first page.

Query cost, measured on PostgreSQL 13 with 400k token usages and 200k
interceptions across 4 organizations (31-day window of about 52k usages
for the target organization): `ListOrganizationAISpendUsers` 128 ms
unfiltered and 68 ms filtered by provider. Token usage is read through
the existing partial index on `(effective_group_id, created_at)`; no new
index is needed. The provider and client aggregates were added after
this measurement.

Tests cover pagination validation (including the export rejecting page
parameters), report contents and filters against the CSV, retention
narrowing and rejection, retention disabled, and the role matrix (Owner,
User Admin, Auditor, Org Admin, Org User Admin OK; member 403; other
organization 404).

Previous revisions served this report from the export endpoint through
`Accept` negotiation and also added the dimension filters to the CSV
export (#29220, #29224); the separate endpoint replaces the former, and
the CSV filters were dropped because the page does not use them.

> Xum prepared this PR on behalf of @ibetitsmike.

Codex on e73049f: P2 on the moving `now - retention` lower bound for
clients that echo the default window while paging. Declined: it is the
released CSV export's contract, the report echoes `retention_start`, and
the page never echoes the default window; the handler and tests now use
`OrganizationAISpendPage` (8cdc127).
2026-09-17 04:32:16 +00:00
Michael Suchacz 6c7f6b855b feat: add openai_config.reasoning_model override and bump fantasy (#29230)
## Why

The coder/fantasy fork classifies OpenAI reasoning models by name. The
pinned version did not know `gpt-6-astra`, so the Responses client
omitted the `reasoning` parameter (the reasoning effort picker did
nothing) and forwarded `temperature` (quickgen title calls got HTTP 400
`Unsupported parameter: 'temperature'` and retried). Every new model
generation would need a fork release to fix this. Admins need a switch
in the model config instead.

## What

- Bump `charm.land/fantasy` to coder/fantasy `a511353f83eb`, the
`coder_2_33` commit that squash-merged coder/fantasy#57 (the pin also
carries coder/fantasy#58, Gemini media tool results): gpt-6 and later
generations are recognized as reasoning models, and the provider gains
`WithReasoningModelFunc` to override the classification.
- New tri-state `openai_config.reasoning_model` on
`ChatModelCallConfig`: unset keeps fantasy's name heuristics, `true`
forces reasoning-model handling (effort and summary sent,
temperature/top_p dropped), `false` forces plain sampling. It is applied
once at client construction next to `use_responses_api`. The generated
model editor shows it for `openai` and `bedrock` providers, since
Bedrock Mantle also serves OpenAI-format models; it is ignored for
Anthropic models on Bedrock.
- Remove the `IsGPT6Astra` transport fallback in
`chatopenai.UsesResponsesAPI`; the bumped SDK recognizes gpt-6 itself
(`IsGPT6Astra` stays for the effort clamp).
- Regenerated API docs, swagger, TypeScript types, and the model options
schema; ARCHITECTURE.md documents the flag.

## Validation

- New tests: `TestChatModelCallConfig_ReasoningModelRoundTrip`,
`TestModelFromConfig_OpenAIReasoningModelOverride` (request body has
`reasoning` and no `temperature` when forced on an unknown model; forced
off on gpt-5 drops `reasoning` and keeps `temperature`; unset
unchanged), `TestAIGatewayModelBedrockReasoningModelOverride` (Bedrock
provider path), `TestIsZeroChatModelCallConfigReasoningModel`, and
form-logic cases serializing the field for openai and bedrock.
Red-green: removing the constructor wiring fails the request-body
assertions.
- `go test ./coderd/x/chatd/... -count=1` (full), `go test
./codersdk/... -run ChatModel`, `go test ./coderd/ -run
'ChatModel|Chats'`, `golangci-lint run ./coderd/x/chatd/...
./codersdk/... ./coderd/` (0 issues), `make gen` (stable on rerun),
Vitest for `src/modules/aiModels` and `src/api/chatModelOptions` (174
tests), Biome, `tsc --noEmit`, `make pre-commit`.
- Remote dogfood UAT (Coder Agents) exercised the editor and chat on the
dev AI gateway: the switch shows for OpenAI and Bedrock providers only,
persists true/false/unset, and `gpt-daybreak-blue-latest` (an alias the
SDK does not recognize) sends `reasoning` without `temperature` when
forced on and gets OpenAI's temperature 400 when off or unset. UAT also
found the new switch colliding with `Use Responses API` at 375px;
tri-state switches now take the full row below `sm`. One open
observation for follow-up: in Coder chats on `gpt-6-astra` the upstream
stream carried no reasoning-summary events even though
`reasoning.summary=detailed` was sent, while the same model returns
summaries to a standalone fantasy client; not attributed to this change.
- Merged `origin/main` (`eceae296e8d`; the only conflict was the
ARCHITECTURE.md TODO block, resolved by keeping main's
transport-selection prose and adding a TODO for the GPT-6 Astra sentence
this PR makes stale) and moved the pin (`553bfb86bf5`). On that head:
`go build ./...`, `go vet ./coderd/x/chatd/... ./codersdk/`, `go test
./coderd/x/chatd/ -run
'ReasoningModel|TestAIGateway|Bedrock|ChatModelCallConfig|Quickgen|Transport'`,
`go test ./coderd/x/chatd/chatopenai/...
./coderd/x/chatd/chatprovider/... ./coderd/x/chatd/chatdebug/...`, `go
test ./codersdk/ -run 'ChatModel|Reasoning'`, and the pre-commit hook on
both commits. The `providers/openai` tree at `a511353f83eb` is
byte-identical to the previously pinned PR head `f5b3f253c112`.
- The local `pre-push` hook fails in this checkout only on unrelated
tests (umask-dependent `TestGetModulesArchive`, two untouched site
tests), so the push bypassed it; CI is the gate. For the pin-bump push
the hook ran once in full (31,276 tests passed; the only 2 failures were
`TestGetModulesArchive`, proven to be this checkout's 0600 file modes:
passes after normalizing modes and on an untouched `origin/main`
worktree) and was then opted out for this worktree per Mike's
instruction.

coder/fantasy#57 is merged (`a511353f83eb` on `coder_2_33`) and the pin
points at it. Related: #29229 (Bedrock `reasoning_summary` coercion).

> Xum acted on behalf of @ibetitsmike for this PR.
2026-09-16 20:09:34 +00:00
Bobby Ho feca38ec74 fix: bound OAuth2 request bodies and report the rejection per RFC (#28175)
- Enforce a 4 MiB body limit on `/oauth2/tokens` and `/oauth2/revoke` before parsing, replacing Go’s 10 MiB default. Oversized bodies now return `413 invalid_request` instead of misleading missing-`client_id` errors.
- Preserve `/oauth2/register`’s existing body limit while returning protocol-specific `413 invalid_request` errors rather than `codersdk.Response`.
- Include JSON decoder details in registration’s malformed-body `400` responses and add raw-body tests to verify the error shape.
2026-09-16 11:36:45 -07:00
Ahson Shaikh c61ca62d64 docs: add Easypanel to alternate install methods (#29345)
Hi — this is Ahson Shaikh, DevOps Engineer at Easypanel.
[Easypanel](https://easypanel.io) is a self-hosted Docker deployment
platform, and Coder has a one-click deployment template on Easypanel:
https://easypanel.io/templates/coder

Per @nickvigilante's suggestion, moved this from docs/install/docker.md
to the community installation methods list
(docs/install/other/index.md), matching the existing
Railway/Render/Heroku row style.

Here's Coder running after a one-click deploy via the Easypanel template
- this is the Easypanel panel view, not Coder's own UI:

![Coder running in the Easypanel
panel](https://raw.githubusercontent.com/Ahson-Shaikh/coder/add-easypanel-deploy-docs/.github/easypanel-deploy-screenshot.png)
2026-09-16 15:33:34 +00:00
Ethan 3787528621 fix: accept SVG chat attachments as download-only files (#29330)
Closes
https://linear.app/codercom/issue/CODAGT-1032/allow-svg-uploads-without-inline-rendering

SVG uploads to the agents chat were rejected with `Unsupported file
type`, as was SVG markup pasted as text. Pastes are wrapped as a
`text/plain` file, `ClassifyStoredMediaType` relabels the bytes
`image/svg+xml`, and `IsCompatibleUploadMediaType` didn't allow that
refinement.

This PR adds `image/svg+xml` to `codersdk.AllChatAttachmentMediaTypes`
and treats it like we already treat PDF: storable, but served with
`Content-Disposition: attachment` and never rendered inline, since SVG
can carry script. The model receives the source as inlined text rather
than an image part. No provider accepts SVG as a native part, so
`AcceptsFilePartMediaType` returns false for it up front; the Google
branch would otherwise accept it.

Whilst here, I've collapsed the three hand-synced lists of text types
the model can read (`isInlinableTextMediaType`, the `text/plain`
refinement switch, and `IsSyntheticPaste`) into
`chatfiles.IsTextAttachmentMediaType`. On the frontend, the
`startsWith("image/")` checks go through `isRasterImageMediaType`, so
SVG gets a file card instead of an `<img>`, thumbnail, or resize.

Dropping an unsupported file onto the composer now shows a toast naming
the rejected files instead of silently ignoring them.

Supersedes #26969.
2026-09-16 12:15:14 +10:00
Bobby Ho 86e43de5f6 fix!: authenticate confidential clients at OAuth2 token revocation (#29208)
- Require confidential-client authentication for OAuth2 token revocation, preventing revocation with only a token and public `client_id`.
- Accept `client_secret` via form fields or HTTP Basic; reject conflicting credentials.
- **Breaking:** Missing or invalid secrets now return 401 `invalid_client` without revoking tokens. `codersdk.RevokeOAuth2Token` requires a `clientSecret` argument (empty for public clients).
- Preserve public-client behavior and existing token ownership checks.
- Add revocation documentation and regression tests for authentication failures, HTTP Basic, and session preservation.

Completes SEC-348. Closes PLAT-507 (CDR-59).
2026-09-15 17:24:43 -07:00
Bobby Ho 800629caee fix: authenticate confidential clients on the OAuth2 refresh grant (#29207)
Require confidential clients to authenticate before validating OAuth2 refresh tokens, preventing token refresh using only a stolen refresh token and public client_id. Breaking: Missing or invalid client secrets now return 401 invalid_client without consuming the refresh token or revealing its validity; public clients are unaffected. Add regression tests, authentication-failure logging without sensitive request data, and documentation for the behavior change. Closes PLAT-506 (GHSA-whr4-xxrp-33vc);
2026-09-15 16:18:07 -07:00
Cedric FitzgeraldandCedric Fitzgerald f94cf30dd9 docs: Update AI Gateway Claude Code docs for persistent env vars (#29315)
<!--

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

-->

This small PR updates the [AI Gateway Claude
Code](https://coder.com/docs/v2.37/ai-coder/ai-gateway/clients/claude-code)
docs page with explicit instructions for how to configure Claude Code to
use Coder AI Gateway persistently. These instructions also apply to the
other connection methods outlined on the page (BYOK and subscription
plan).

This implementation can also apply to organizations leveraging
`managed-settings.json` via the Anthropic Enterprise configuration.

---------

Co-authored-by: Cedric Fitzgerald <7490790+cjfit@users.noreply.github.com>
2026-09-15 15:12:05 -07:00
Bobby Ho 070a91c1d9 feat: hide client secrets for public OAuth2 clients (#29312)
Fix the OAuth2 app edit page for public clients by replacing the secrets table and “Generate secret” button with an explanation and skipping secrets requests, including on initial load. Expose client_type in OAuth2 app API responses and regenerate TypeScript types and API docs. Confidential client behavior remains unchanged. Fixes PLAT-504.
2026-09-15 16:40:36 +00:00
Bobby Ho a031db82de docs: replace the oauth2 experiment with CODER_OAUTH2_PROVIDER_ENABLE (#29268)
docs: update OAuth2 provider documentation for GA

- Replace the `oauth2` experiment with `CODER_OAUTH2_PROVIDER_ENABLE` in the provider, MCP server, and feature-stage docs. Remove experimental wording, document CLI/env/YAML/Helm configuration, and update 404 troubleshooting. MCP still requires `CODER_EXPERIMENTS=mcp-server-http`.
- Include a 2.38 release-note draft: the provider is GA but disabled by default. Deployments using `CODER_EXPERIMENTS=oauth2` must set `CODER_OAUTH2_PROVIDER_ENABLE=true` to avoid OAuth2 endpoint 404s after upgrading. The environment variable can be set before upgrading; older binaries reject the new CLI flag and YAML key. For Helm, use `coder.env`, not `coder.commandArgs`.
- Existing applications, secrets, and user authorizations are preserved and resume when enabled. Previously issued access tokens remain valid until expiry.

Docs only; completes [PLAT-492](https://linear.app/codercom/issue/PLAT-492). Stacked on #29267.
2026-09-15 09:15:19 -07:00
Atif Ali fdcc847ce2 chore: bump bundled terraform to 1.16.2 (#29331) 2026-09-15 06:15:48 +00:00
Bobby Ho f5be7ae660 feat: remove the oauth2 experiment in favor of CODER_OAUTH2_PROVIDER_ENABLE (#29257)
Third of five for PLAT-492. Removes the oauth2 experiment entirely; CODER_EXPERIMENTS=oauth2 is now treated as an unknown experiment and nothing depends on it.

Stacked on #29251. No migration.
Removes ExperimentOAuth2 and its generated/API references.
Removed outright per review, consistent with experiments having no compatibility guarantee.
Migration guidance is covered by the startup logging in #29267 and docs/release notes in #29268, both pointing to CODER_OAUTH2_PROVIDER_ENABLE.
Existing unknown-experiment handling and tests already cover leftover oauth2 values.
After this merges, main is safe to cut a release from.
2026-09-14 14:10:05 -07:00
Michael Suchacz f46ff158c5 feat!: remove the Coder Tasks RBAC resource, scopes and permissions (#28750)
Removes the `task` RBAC resource, its five `task:*` API key scopes, and
every persisted reference to them. Custom role permission arrays drop
their `task` entries; API keys and OAuth2 codes and tokens lose task
scopes, and task-only ones are revoked; OAuth2 apps whose scope list
named only task scopes get a whitespace-only scope so they stay
restricted instead of reading as unconfigured; then `api_key_scope` is
recreated without the task values. Generated RBAC, SDK, site and API doc
artifacts are regenerated. The `resource_type` enum keeps `task` so
historical audit log rows remain queryable.

**Breaking change:** migration 000595 revokes task-only keys and grants.
The down migration restores the enum values only.

**Review changes:** the api_keys scope cleanup deletes any key left
without a non-task scope (redundant EXISTS dropped), the allow-list
comment states the real reason (`allow_list` cannot be empty), and the
migration test keeps each fixture next to its expected post-migration
value. Renumbered from 000594 to 000595.

**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.

> Created by Xum (AI agent) on behalf of @ibetitsmike.


## Delivery record

**Status (2026-09-11 16:30Z): not merged; awaiting re-review.** Head
`80ee30141ee81287a03de3f46407f6a421387778` on `main`.

**Review history relevant to this diff:** 10 completed Codex code
reviews on the monolithic diff (2026-08-28 to 2026-09-01) plus
spikecurtis CHANGES_REQUESTED (2026-09-04, asked for the split),
spikecurtis COMMENTED 2026-09-08 (three findings on the migration and
test, all applied and resolved) and spikecurtis COMMENTED 2026-09-11
([r3990045458](https://github.com/coder/coder/pull/28750#discussion_r3990045458),
[r3990067224](https://github.com/coder/coder/pull/28750#discussion_r3990067224),
both applied in `80ee30141ee` and resolved). The review budget is
exhausted, so no further discretionary review or final advisory was
commissioned; a fresh independent final advisory for the final diff does
not exist and remains a documented gap. The reviewer's own re-review is
the remaining gate.

**Findings and dispositions on the current head:**
- OAuth-linked API key fixtures were confusing (deletion came from the
token trigger, not the migration): removed from `keys`; the grants loop
creates its backing api_keys row inline and asserts only code/token
rows.
- Missing cases: added `multi-task-scopes-key`, `multi-task-allows-key`,
and `task-only-key` (only task scopes and only task allows, deleted).
- Earlier round: redundant EXISTS on the api_keys scope DELETE dropped;
allow-list comment corrected (`allow_list` cannot be empty); test
restructured as before/after tables; renumbered to 000595.

**Test evidence for `80ee30141ee`:**
`TestMigration000595RemoveTaskPermissions` passes (up, down, re-up);
red-green: removing the token DELETE and UPDATE from the migration fails
the test at the grants/tokens assertion, file restored byte-identically.
Full repository pre-push hook passed before the push (`test` 97s,
`test-js` 45s, site build; `pre-push passed (143s)`). Note: this
workspace runs a service on loopback:3000, jsdom's default origin, which
made `test-js` fail on unmocked inbox requests for any commit; the hook
run used an `LD_PRELOAD` shim that only makes `connect()` to
loopback:3000 return `ECONNREFUSED`, matching CI, with no change to
sources, tests, config, or the host. Exact-head CI: run
[34622204759](https://github.com/coder/coder/actions/runs/34622204759)
in progress at the time of writing.

**Deferred:** `AI Documentation Check` failures on this stack come from
the dormant `doc-check-pr-*` workspace (CODAGT-1025), not code.
2026-09-14 20:15:13 +02:00
Bobby Ho 1cc73bc43f feat: add the CODER_OAUTH2_PROVIDER_ENABLE deployment flag (#29248)
First of five PRs for PLAT-492, adding the opt-in CODER_OAUTH2_PROVIDER_ENABLE flag for the OAuth 2.1 provider. It defaults to false and is not enforced yet, so there is no behavior change.

Adds the CLI/env/YAML flag and exposes oauth2_provider in build info.
Enables it by default in tests to prepare for route gating.
Updates tests, golden files, and frontend fixtures.
Follow-ups will gate routes/UI, retire the experiment, add startup logging, and update docs.
2026-09-14 08:31:26 -07:00
Matt VollmerandNick Vigilante 3857bc5f98 docs: add Agent Relay for Claude Code (#29174)
**Do not merge before Sept 14**

Adds a peer page to docs/ai-coder/agent-relay/cursor.md documenting
Agent Relay support for Claude Code (Anthropic's self-hosted
environments model for claude.ai/code and Claude Desktop sessions).

---
This PR was created by Coder Agents on behalf of @mattvollmer.

---------

Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
2026-09-14 10:42:39 -04:00
Matt Vollmer 93b5aae7ad docs: reorder diagram and update workflow section (#29247)
## Summary

- Moved the existing architecture diagram (`agent-relay-stack.png`) to
right after the intro paragraph.
- Added a new workflow diagram (`agent-relay-workflow.png`) in place of
it under the "How Agent Relay works" section.
- Renamed the "What Agent Relay does" section heading to "How Agent
Relay works".

---
*This PR was created by a Coder Agent on behalf of @mattvollmer.*
2026-09-14 10:40:27 -04:00
Cian Johnston 2cf819bfca feat: add break-glass user email update (#29256)
Adds an owner-only experimental API and hidden CLI command for
break-glass user email corrections.

The operation verifies the existing email, updates it transactionally,
clears outstanding password-reset state, revokes the target user's Coder
sessions and API tokens, and records successful and failed authenticated
attempts in the audit log. External-auth links remain unchanged.

Generated by Coder Agents.
2026-09-14 14:33:36 +01:00
Michael Suchacz 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.
2026-09-14 10:51:22 +02:00
Susana Ferreira fb88643999 fix: allow Copilot BYOK passthrough (#28723)
## Description

Copilot is always BYOK, so requests use the end user's provider
credential rather than a shared centralized credential. Restricting
Copilot passthrough to an explicit route allowlist does not provide the
same security benefit as it does for centralized providers and causes
new Copilot endpoints to fail until they are added manually.

Allow all non-bridged Copilot routes to pass through to the configured
upstream. More specific bridged inference routes continue to take
precedence.

## Changes

- Replace the Copilot passthrough allowlist with a catch-all route.
- Clarify that providers using centralized credentials should restrict
passthrough routes to known-safe operations.
- Cover known and unknown Copilot passthrough routes.
- Verify bridged routes take precedence over the passthrough catch-all.

Related to https://github.com/coder/coder/pull/28494
Related to [internal Slack
thread](https://codercom.slack.com/archives/C014JH42DBJ/p1787574835172749).

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-09-14 09:47:26 +01:00
Steven Masley 940f988cfb feat: add deployment-level option to disable Terraform module caching (#29187)
<!-- Generated by Coder Agents on behalf of @Emyrk. -->

<img width="762" height="239" alt="Screenshot From 2026-09-11 17-09-41"
src="https://github.com/user-attachments/assets/9f31fd1e-4cb2-47ab-8d37-4073df9f0a7c"
/>


Closes #22834.

Adds `CODER_PROVISIONER_DISABLE_MODULE_CACHE` so an admin can disable
Terraform module caching for every template at once instead of toggling
~100 templates by hand.

- The deployment setting wins. Templates cannot opt back in, and the
per-template toggle becomes read-only while the deployment setting is
on.
- Modules stay cached at template import, so dynamic parameter rendering
still resolves module-defined parameters. Only the workspace build is
denied the cached files.
- Templates report `module_cache_disabled_by_deployment`, and template
settings shows why the checkbox is locked.

<details><summary>Agent context</summary>

Decisions taken with @Emyrk before implementing:

1. **Precedence.** `deployment || template`, no per-template override,
so no migration and no nullable column. The rule lives in one place,
`codersdk.ModuleCacheDisabled`.
2. **Import-time caching untouched.** `dynamicparameters/render.go`
overlays `cached_module_files` at `.terraform/modules` to render
module-defined parameters. Skipping the cache there would reproduce the
`Module not loaded. Did you run terraform init?` failure reported by a
customer, so the deployment setting only affects what `AcquireJob` hands
the provisioner.
3. **Write path.** A PATCH carrying `disable_module_cache` is discarded
while the deployment setting is on, rather than persisted. Persisting it
would silently keep templates opted out after the deployment setting is
removed.
4. **API shape.** `disable_module_cache` keeps its meaning (this
template's stored value) and the new read-only
`module_cache_disabled_by_deployment` reports the deployment state.
Reading the effective value from `/deployment/config` was rejected
because template admins may lack deployment-config read permission.
5. **Naming.** `CODER_PROVISIONER_DISABLE_MODULE_CACHE` over the issue's
`CODER_DISABLE_TERRAFORM_MODULE_CACHE`, to match the provisioning option
group.

Note: `InsertTemplateParams` has no `disable_module_cache` binding, so
new templates always store `false`. With deployment precedence they
still behave as opted out, so the create path needed no change.

Out of scope and tracked elsewhere: the `coderd_template` Terraform
provider attribute (separate repo) and backporting the per-template
toggle to `release/2.30`.

</details>

---

<sub>Coder Agents on behalf of @Emyrk.</sub>
2026-09-11 18:13:16 -05:00