mirror of
https://github.com/coder/coder.git
synced 2026-11-22 03:18:31 +08:00
feea5ab959f59cd2135443ed2a0c19bf7643db8f
3305
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7c7e2e73cf |
feat: honor disable-model-invocation in uploaded skill content (#31159)
Addresses @ethanndickson's [review comment on #30882](https://github.com/coder/coder/pull/30882#discussion_r4344815088): the same `SKILL.md` file could be manual-only in Claude Code and the project dialog but automatic in Coder, because the server and the browser each handled `disable-model-invocation` in their own way. The server now owns the key for personal, organization, and project skills: - When a create or update request leaves `model_invocable` unset, `disable-model-invocation: true` in the content turns automatic use off, and `false` turns it back on. The key is read with the function workspace skills use, so a file gets the same setting in both places. Only YAML booleans count, so a quoted `"true"` is ignored. - An explicit `model_invocable` in the request always wins. - New content without the key leaves the setting unchanged, so editing text never turns it back on. - Content is stored as uploaded. Every API response returns content whose key agrees with `model_invocable`: when the stored file says otherwise, the server replaces the value of the key or adds the key before the first one, and leaves every other byte alone. - **Download** and **Export all** save the content the API returns, so the browser no longer edits the file. `withDisabledModelInvocation` is removed. - An upload is rejected with a 400 when the key holds a value the server can't replace with a boolean, such as a list. A later change to `model_invocable` can then always reach the file. Two edges: - Adding the key makes the returned file about 30 bytes larger, so a file at the 64 KB upload limit can be too large to upload again. - A skill stored before the upload check with a value the server can't replace is returned as stored. Workspace skills already honor the key since #31147. #31160, the frontend PR on top of this one, adds the switch to the personal and organization skill editors. > Generated by an agent on behalf of the user --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com> |
||
|
|
d1a58b9f5d |
feat: add script to check for title case (#21484)
Historically, much of the UI used title case. This PR adds a lint check
that reports title case UI text so it can be converted to sentence case,
and converts the existing text.
- `site/scripts/check-sentence-case.mjs` runs as `pnpm
lint:sentence-case` and is part of `pnpm lint`. It reads JSX text and
string/template literals from the TypeScript AST and skips literals that
are code rather than UI text (imports, types, property names, tagged
templates, values of JSX attributes that are not displayed such as
`className` or `style`, and operands of `===`/`case` comparisons). JSX
text across inline elements and conditional JSX is checked as one
phrase. `--fix` lowercases the reported words. The checker is a
heuristic: it is not meant to model every code shape, so use a
`sentence-case-expect` comment where it guesses wrong.
- Proper nouns (Coder products, role names, third-party products,
protocols, font names) live in `PROPER_NOUNS`. For other deliberate
exceptions, a `sentence-case-expect` comment on the line above
suppresses the report and fails when that line no longer needs it.
- Existing UI text is converted to sentence case, and tests that assert
on it are updated.
- Deployment option lookups (`useDeploymentOptions`) now use CLI flags
instead of display names, so they do not depend on UI wording.
## Performance
`pnpm lint:sentence-case` takes **1.6 s** and is 2% to 4.5% of `pnpm
lint`. Measured on
|
||
|
|
935e0b5735 |
fix(site): migrate template filters to FilterCombobox (#31781)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Replace the legacy template filter controls with the shared `FilterCombobox` on both the Templates page and AI Settings → Templates, matching the workspace filtering UI. - Combine author, organization, deprecated, and compatibility-mode filters in one input with removable chips while retaining URL-backed filter queries. - Keep `author:me` available to users without permission to list other users, without fetching the user list. - Update the compatibility-mode documentation and Storybook stories for the new controls. <img width="538" height="312" alt="image" src="https://github.com/user-attachments/assets/c7b541eb-0f4e-4456-b31c-70dd85cfe0e9" /> |
||
|
|
e0b74e6817 |
docs: add Migrate to Coder section and Microsoft Dev Box migration guide (#31979)
> [!NOTE] > Coder Agents generated this PR. Adds a "Migrate to Coder" group to the docs sidebar with a short index page, and a guide for teams moving from Microsoft Dev Box to Coder. - `docs/install/plan/migrate.md` (new): says who the guides are for and lists them. - `docs/install/plan/migrate/dev-box.md` (new): who it's for, what carries over, a concept-mapping table, 11 numbered migration steps, and **Learn more**. The steps cover the inventory, the control plane, Entra ID (OIDC), templates on Azure (image, network, persistence, access, quotas), customizations and dotfiles, Git auth and secrets, RDP, editors, schedules and hibernation, Intune, and the pilot and cut-over. Each step links to existing Coder docs instead of repeating them. - `docs/install/plan/migrate/ona.md` (moved from `migrate-from-ona.md`): relative links only, plus a redirect from `install/plan/migrate-from-ona` in `docs/redirects.json`. - `docs/manifest/install/plan/migrate.yml` (new) and `docs/manifest/install/plan.yml`: the new group, with the Ona guide under it. This follows the existing `upgrade.md` plus `upgrade/` layout. `docs/manifest.json` is regenerated. Microsoft retirement dates come from Microsoft's own [Dev Box retirement guide](https://learn.microsoft.com/azure/dev-box/dev-box-retirement-guide): the closing-down period started September 14, 2026, and the service retires September 18, 2028. ### Follow-ups outside this PR - **Starter template is broken today.** The registry `azure-windows` template pins `windows-rdp` at `~> 1.0`, which now resolves to 1.4.0. That version requires `agent_name`, so `terraform plan` fails with `agent_name must be set when enable_native_rdp is true.` The copy in `examples/templates/azure-windows/main.tf` also passes `resource_id = null`, which 1.4.0 rejects at `terraform init`. The guide tells readers to set `agent_name = "main"` until both templates are fixed. - **Activity detection docs.** `docs/workspaces/workspace-scheduling.md` and `docs/templates/managing-templates/schedule.md` say only some session types count as activity, but the code counts any connection through the agent (`agent/agent.go` `Collect`, `coderd/workspacestats/reporter.go`). The guide follows the code. Those pages need a separate fix, and an SME should confirm RDP end to end. - **Comparison page.** The coder.com comparison page compares Coder with Windows 365 and VDI, not Dev Box, and still says Dev Box is in "maintenance mode". The guide no longer links to it, so DOCS-1414's comparison-link item waits until the page is corrected. <details> <summary>Reusable outline for future migration guides (DOCS-1414)</summary> The repo has no place for page templates, so the outline lives here. ```md --- title: Migrate from <Platform> to Coder --- <1 to 2 sentences: who it's for (persona and current setup) and the outcome.> <Optional: dated facts about the platform, citing the vendor's own announcement.> ## Before you begin <Access, licenses (mark Premium), cloud permissions.> ## What carries over <Architecture difference in 2 to 3 sentences. "You can keep" list, then "You rebuild" list.> ## Concept mapping | <Platform> (link to the vendor's docs for each concept) | Coder (link to Coder docs) | ## Step 1: Inventory your <Platform> resources ## Step 2: Deploy the Coder control plane ## Step 3: Connect your identity provider ## Step 4: Replace <environment definition> with templates ## Step N: Bring your devcontainer.json (Codespaces, Ona, DevPod) ## Step N: Configure Git authentication and secrets ## Step N: Set up editors (and remote desktops, if relevant) ## Step N: Speed up workspace startup (prebuilt workspaces) ## Step N: Replace schedules and cost controls ## Step N: Move agent workloads ## Step N: Pilot and cut over <One neutral link to the coder.com comparison page, if one exists and is current.> ## Learn more ``` Rules: facts only, with no scoring or positioning language. Check every mapping row against the vendor's current public docs and record the date checked in the PR. Link to Coder docs rather than repeating them. Mark Premium features inline. </details> ### Verified against Microsoft docs checked November 5 and November 10, 2026, in the MicrosoftDocs/azure-docs source (`articles/dev-box/`) and on learn.microsoft.com: - `dev-box-retirement-guide.md` (dates, workload deletion) - `overview-what-is-microsoft-dev-box.md`, `concept-dev-box-architecture.md` (dev centers, projects, pools, definitions, network connections, Microsoft-hosted network, Intune enrollment, Entra join, Windows 10 and 11 client editions) - `how-to-manage-dev-box-pools.md` (local admin or standard user setting) - `concept-what-are-dev-box-customizations.md`, `how-to-configure-team-customizations.md`, `how-to-configure-user-customizations.md` (WinGet, PowerShell, Git-Clone tasks, Key Vault secrets) - `how-to-configure-azure-compute-gallery.md` - `how-to-configure-stop-schedule.md` (one stop time per pool), `how-to-configure-stop-on-disconnect.md`, `how-to-configure-dev-box-hibernation.md`, `how-to-auto-delete-dev-box.md`, `tutorial-dev-box-limits.md` (maximum dev boxes per developer) - `concept-dev-box-role-based-access-control.md`, `how-to-install-dev-box-cli.md`, `how-to-set-up-dev-tunnels.md`, `quickstart-create-dev-box.md`, `how-to-enable-single-sign-on.md` - Intune [supported operating systems](https://learn.microsoft.com/intune/fundamentals/ref-supported-platforms) (Windows client editions, no Windows Server) Coder side: - Registry `azure-windows` template (`main.tf`, `README.md`) and `examples/templates/azure-windows/`: azurerm resources, Windows Server 2022 image, one resource group, virtual network, and storage account per workspace, VM deleted on stop, persistent `F:` disk, `windows-rdp` module, generated admin password shown in metadata, no Entra join, no `daily_cost` - Registry `windows-rdp` module at `release/coder/windows-rdp/v1.4.0`: **Web RDP** (subdomain app) and **RDP Desktop** (Coder Desktop) apps, `agent_name` validation, Devolutions Gateway install from PowerShell Gallery on every start. Reproduced the plan failure with Terraform 1.17.1. - Registry `dotfiles` module: Bash script only - `cli/dotfiles.go`, `cli/dotfiles_windows.go` (`install.ps1`, `bootstrap.ps1`, `setup.ps1`, run with PowerShell, cloned with Git) - `enterprise/coderd/workspacequota.go` (build denied when consumed plus cost exceeds budget), `docs/admin/users/quotas.md` - `coderd/schedule/autostop.go` (autostop requirement stops at the start of quiet hours), `docs/reference/cli/server/index.md` (`CODER_QUIET_HOURS_DEFAULT_SCHEDULE`, `CODER_ALLOW_CUSTOM_QUIET_HOURS`) - `docs/workspaces/workspace-access/remote-desktops.md`, `docs/admin/networking/index.md` (agents must reach the access URL) - `docs/admin/users/oidc-auth/microsoft.md`, `docs/admin/users/idp-sync.md`, `docs/admin/users/organizations.md`, `docs/admin/users/groups-roles.md`, `docs/templates/template-permissions.md` (Premium markers, organization roles) - `coderd/workspacestats/reporter.go`, `coderd/agentapi/stats.go`, `agent/agent.go` (any connection through the agent extends the autostop deadline) - `docs/admin/external-auth.md` (Azure DevOps via Entra ID), `docs/admin/security/secrets.md` - `agent/usershell/usershell_windows.go` (scripts run with PowerShell on Windows) - No hibernation feature exists in the Coder codebase. Checks run: `make gen/docs-manifest`, `make pre-commit-light` (markdownlint, `lint/emdash`, `lint/docs-redirects`, typos), Vale (0 alerts on the new pages), `lint/docs-html`, `lint/docs-manifest`, `docsredirectscheck -base origin/main -branch main`, a check that all 159 relative links and anchors in the three pages resolve, and a `doc-check` self-review. ### Open questions for the reviewer - **Intune and Entra join:** the guide says Coder doesn't enroll workspaces in Intune, that Intune needs a Windows client image, and links Microsoft's Entra VM sign-in docs. Should a separate guide cover setting up Intune with Coder? - **Windows client editions:** the guide tells readers to check Microsoft licensing before using Windows 10 or 11 images on Azure VMs. It makes no licensing claim itself. - **Windows support in registry modules:** the guide now says the `dotfiles` module is Bash only. Whether `git-clone` and other modules work on Windows is unverified. Closes DOCS-1414, Closes DOCS-1416 Supersedes #31807, reopened under a human author for attribution. --------- Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com> Co-authored-by: Ian Evans <5760366+ianjevans@users.noreply.github.com> |
||
|
|
ed9e9a84ec |
docs: add sandbox agents guide and startup time tips (#32280)
Adds a "Sandbox agents" guide under Extending templates, and adds startup time tips from the [Improving Coder Workspace Startup Times](https://www.youtube.com/watch?v=-xcVJQWVCxs) livestream to the speed-up templates guide. **Sandbox agents** (`docs/templates/extending-templates/sandbox-agents.md`) is organized around three traits: kernel, network, and secrets isolation, plus fast startup. Each trait has a short methods table with tradeoffs, plus examples and references. - Starts with the coder-labs registry templates (agent-sandbox, Plain Sandbox, OpenShell) that implement all three, and calls out [agent-sandbox](https://agent-sandbox.sigs.k8s.io/). - Explains what the sandbox covers for CLI Agents, Coder Agents, and Agent Relay. - Shows how to define sandbox profiles as immutable parameters with one preset each, and how to control which profile an agent gets. - Kernel: gVisor, Kata, and EKS Nitro Sandboxes (`isolated-sandbox` RuntimeClass in EKS Auto Mode). - Network: separate proxy Pod vs. sidecar, example rules using an internal GitHub and artifact store, and a cloud firewall layer (AWS Network Firewall, Route 53 Resolver DNS Firewall) that also limits DNS. - Secrets: `api_key_scope = "no_user_data"`, a scoped AI Gateway token (skipped for prebuilds, optional `lifetime`), per-workspace EKS Pod Identity, and just-in-time credentials from Vault. **Speed up templates** (`docs/workspaces/speed-up-templates.md`) gets new sections for pre-warming Kubernetes nodes (with GKE, EKS, and AKS alternatives), building tools into the image, prebuilt workspaces (including one preset for each configuration), and skipping the Kubernetes rollout wait (with coder-logstream-kube to surface Pods that can't start). It links the [fast-workspaces-lab](https://github.com/coder-contrib/fast-workspaces-lab) repo for the sample base image, node schedule, and prebuild templates. **Agent Firewall** gets a notice on its index page and in the glossary that it is being phased out, pointing to the sandbox guide. The sandbox guide doesn't mention Agent Firewall. Two diagrams in the speed-up templates guide come from the talk's slide deck, cropped to the diagram. Notes for reviewers: - The scoped AI Gateway token (`user:read_personal`) isn't tied to a workspace, so with several organizations, AI Gateway uses the user's effective group for budgets. The page doesn't mention this. - The Nitro (coder/registry#1253) and Cilium (coder/registry#1254) registry templates are still open, so they aren't linked yet. <details> <summary>Decisions and checks</summary> - **Structure:** three traits, several ways to get each, and simple tradeoffs. - **Sysbox** is not listed as kernel isolation, because system calls still reach the node's kernel. - **Deployments** stay the recommendation over bare Pods, because `wait_for_rollout` and coder-logstream-kube cover the startup and error cases. - **Token lifetime** is left commented out in the example: Coder can't revoke the token at stop, and a lifetime shorter than autostop breaks running workspaces. - **Process logging** wording: the eBPF sidecar runs inside the sandbox with gVisor, Kata, or Nitro, so the page asks readers to test it. - **"CLI Agents"** is kept as the term for agents that run fully in the workspace. - **Verified in code:** - `mutable = false` is enforced on later builds (`coderd/dynamicparameters/resolver.go`). - Presets match by subset, also without a `preset_id` (`coderd/database/queries/prebuilds.sql`, `coderd/workspaces.go`). - `no_user_data` blocks the Git SSH key and external auth (`coderd/gitsshkey_test.go`, `coderd/externalauth_test.go`). - Token creation is rejected for the prebuilds system user (`coderd/apikey.go`), and the default token lifetime is 7 days (`codersdk/deployment.go`). - No Coder code sets `CODER_SESSION_TOKEN` in a workspace; registry modules such as `coder-login` do. - **Checks run:** `make lint/emdash`, `make lint/docs-html`, `make lint/docs-manifest`, markdownlint, markdown-table-formatter, Vale (0 errors), and the pre-commit hook. </details> 🤖 This PR was generated by Coder Agents on behalf of @bpmct. |
||
|
|
da64286fe3 |
docs: fix GerundHeading, Semicolons, and UnitSpacing findings (#31990)
Fixes the `warning`-level findings that the Vale findings spike review marked valid: - **`Coder.GerundHeading`**: `docs/.style/styles/Coder/README.md`, "Authoring a new rule" is now "Author a new rule". Nothing links to the old anchor. - **`Coder.Semicolons`**: `templates/extending-templates/docker-in-workspaces.md`. Each semicolon is now a sentence break, with the new sentence on its own line. - **`Coder.UnitSpacing`**: added ` ` between number and unit in `get-started/index.md` (10 minutes), `mcp-server.md` (5 minutes), `ai-governance/ai-gateway/setup.md` (60 days), and `reference/feature-stages.md` (60 seconds). These three rules now have 0 findings in `vale docs/`, and the changed files have no new findings from other rules. --- AI-generated by Superblink on behalf of @nickvigilante. Supersedes #31877, reopened under a human author for attribution. Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> |
||
|
|
3211ca066e |
feat: add organization unpriced AI models endpoint (#31753)
## Description
Adds the experimental `GET
/api/experimental/organizations/{organization}/ai/model-prices/unpriced`
endpoint behind the "N models not set up" warning on the organization AI
spend page
([Figma](https://www.figma.com/design/6TkixpkUIM5Qv6I7qhM3xZ/AI-Gov---user-spend?node-id=70-11964&t=KQwENGjcQvVT9qkh-4)).
It lists the models used in the period that still hold no price in the
organization, using the query from this stack.
## Changes
- Add the `organizationUnpricedAIModels` handler and
`ExperimentalClient.OrganizationUnpricedAIModels`:
- Reuses `aiSpendRetainedPeriod`, since token usage is subject to data
retention.
- Returns the applied period, `count`, and `models` (provider name,
display name, icon and type, model, token count), most unpriced tokens
first.
- Requires read on the organization's model prices (owners and
organization admins), so the UI only requests it for users who can set
prices.
- Add handler tests for the response, period validation, organization
scoping and role access.
Note: pagination will be added in a follow-up.
Closes AIGOV-730
> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
|
||
|
|
1f1aa6ae3c |
feat: add chat project template schema and queries (#32309)
Adds the database layer for attaching workspace templates to chat projects: the schema, the queries, their authorization, and the audit type. Nothing calls the new queries yet, and the existing create and update handlers pass the new parameters unset. The API, the limit's enforcement, and the agent tools follow in the PRs above. - Attachments live in a `chat_project_templates` table (`project_id`, `template_id`, `created_by`, `created_at`), deleted with the project or the template. `chat_projects` gains `limit_templates` (default `false`), `default_template_id`, `default_template_version_preset_id`, and `default_parameters jsonb`. A project stores a default preset or default parameter values, not both. - `InsertChatProjectTemplates` needs project `update` and `use` on every template. It skips templates that are already attached, and templates outside the project's organization, so an attachment never crosses organizations. `DeleteChatProjectTemplate` needs project `update` and template `read`, and clears the project's default when it detaches the default template. Both checks are in dbauthz. - `GetChatProjectTemplatesByProjectIDs` is authorized through the project, and leaves out deleted, deprecated, and agent-disabled templates. It does not check the caller's access to each template, so callers do that before they expose one. - `UpdateChatProjectByID` changes the template settings only when the request sets them, so an update that omits them cannot write back a stale snapshot. - `AuditableChatProjectTemplates` is the audit form of a project's attached templates, logged as a write to the project. The new `chat_projects` columns are tracked in the project's own audit diff, with the default parameter values masked because they may hold credentials. **NOTE**: the migration adds one table and four columns and changes no existing rows. Existing projects keep unlimited template access. Stack (merge top to bottom): - #32309 👈 - #30754 - #32310 - #30755 - #30756 - #30898 |
||
|
|
4866d0fb1f |
feat: add display names to project skill actions (#31747)
closes CODAGT-1506 Project skill action chips show the skill's slug (`deploy-bot`, `security-review`), because skill names must be kebab-case. This adds an optional display name that labels the chip instead. Project skills get a `display_name` column, set through `display_name` on the create and update requests. It is limited to project skills (the same rule as `action`), trimmed, single line, and at most 64 Unicode code points. The chip, its tooltip, and the "More" menu show the display name, sort by it, and fall back to the skill name when it is empty. When a display name is set, the tooltip and the menu item also show the `/name` slash command, so actions that share a display name stay distinguishable. Clicking an action still inserts `/name`, and the `/` menu is unchanged. The project skill editor shows a **Display name** field under **Show as action** only while that switch is on. Turning the switch off hides the field but keeps its value, and saves omit `display_name` while the action is off, so the stored value stays. The display name lives in the database rather than SKILL.md frontmatter, so downloading and re-importing a skill does not carry it. To share the code-point length check with the editor, `countCharacters` and `maxCharacters` move from `ChatProjectDialog.tsx` into `site/src/utils/formUtils.ts`. <img width="637" alt="Project skill editor with the Display name field under Show as action" src="https://raw.githubusercontent.com/coder/coder/assets/pr-skill-action-display-name/pr/edit.png" /> <img width="520" alt="Action chips labeled with display names, with the tooltip open" src="https://raw.githubusercontent.com/coder/coder/assets/pr-skill-action-display-name/pr/chips.png" /> Refs CODAGT-1506 |
||
|
|
4ac8f0a2aa |
docs: document how AI Gateway assigns a request's organization (#31925)
Documents how AI Gateway assigns every request to one organization, and how that organization now decides the effective group, budget, overrides, and spend. Adds a **Request organization** page and corrects pages that still described budget resolution as deployment-wide. Refs AIGOV-753. Describes behavior merged in #30902, #31118, #31119, #31120, #31121, #31583, and #31584. ## Changes - New page `docs/ai-governance/ai-gateway/request-organization.md` (sidebar, after Cost control): resolution order, the effective group fallback, rejected requests, what the organization controls, a multi-org worked example, reports that still resolve across all orgs, and the caveat for standalone gateways older than v2.40. - `cost-controls.md`: removes "the effective group is deployment-wide", scopes overrides and effective group resolution to the request's organization, and adds the reporting caveat. - `standalone.md`: older replicas check budgets across all organizations. - `coder-agents/platform-controls/{index,spend-management}.md`: these said an override beats every group budget, which is no longer true for chats in another organization. ## For reviewers - **Mismatch rejection is not documented.** The ticket and RFC describe rejecting a workspace/chat org mismatch. A chat can only bind a workspace in its own org (`coderd/exp_chats.go`), chatd requests resolve to the chat's org even with a workspace, and no client request can carry both inputs. The page says the two always agree instead. - **"v2.40" is inferred.** `release/2.39` is on aibridged API v1.5 and `main` is on v1.6, so v1.6 ships in v2.40. A 2.39.x backport would make this wrong. - **Custom prices.** The price lookup reads per-org prices, but no API or CLI can set them yet, so the page says custom prices apply in every org. This needs an update when per-org prices ship. - **Site-wide reports.** The avatar menu, Agents usage indicator, `GET /api/v2/users/{user}/ai/spend`, Members tab budget, Groups page combined limit, and `blocked_users` metric still resolve across all orgs (`TODO(AIGOV-527)`), so they can disagree with what was enforced. ## Release note draft ```markdown - AI Gateway budgets and spend follow the request's organization (#31119, #31120, #31121, #31583, #31584) > Every AI Gateway request now belongs to one organization: the workspace's organization for workspace session tokens, the chat's organization for Coder Agents, and otherwise the organization of the user's effective group. Budgets, user overrides, and spend apply within that organization only, instead of across all of the user's organizations. Users in one organization see no change. Users in several organizations can hit a smaller budget, or have no limit at all, in another organization's workspaces and chats. Requests are rejected when the user is no longer a member of the workspace's or chat's organization, or of any organization. > > Migration: Set budgets in every organization your users send AI requests from. Upgrade standalone AI Gateway replicas to v2.40. Older replicas keep checking budgets across all organizations until upgraded. ``` ## Validation `make pre-commit-light`, Vale on the changed files, and `make lint/docs-manifest` pass. A `doc-check` author self-check found 13 blocking findings, all fixed. Not applied: a suggested test pinning the site-wide spend endpoint (code change, out of scope for this docs PR). <details> <summary>Decision log and verified behavior</summary> Sources: AIGOV-753, epic AIGOV-749 and its delivered tickets (AIGOV-712 to 716), the canceled AIGOV-717, and the RFC "AI Gateway Model RBAC and Org-Scoping" (Phase 1). Verified against `main` (`a3aab79775`): | Claim | Evidence | |---|---| | Order: workspace session token, chat org, site-wide effective group | `coderd/aibridgedserver/orgresolver.go` `resolveOrganization` | | Workspace session token = `coder_workspace_owner.session_token` | `provisionerdserver.WorkspaceSessionTokenName`, `workspaceAttribution` (API tokens excluded) | | Rejections return `403 unauthorized` | `coderd/aibridged/http.go` IsAuthorized failure path | | Rejected: deleted workspace, not a member of the workspace/chat org or org deleted, no live org | `orgresolver.go` `ErrUnknownWorkspace`, `ErrUnknownOrganizationMember`, `ErrNoOrganization` | | Chat request takes chat org even with a workspace | `enterprise/aibridged_integration_test.go` "delegated organization with workspace" | | With an org, only that org's groups, override, and Everyone group count | `coderd/aibridge/budget/budget.go`, #31119 | | Fallback with no budgets: default org, then earliest membership | `GetUserEveryoneFallbackGroup` | | Budget counts only spend recorded against its group | `GetUserAISpendSince` keyed on `effective_group_id` | | Notifications use the per-request effective group | `coderd/aibridgedserver/notifications.go` | | Per-org prices not settable | `UpsertOrganizationAIProviderModelConfig` has no non-test caller | | v2.39 gateways: site-wide budget check, no org recorded | `release/2.39` `coderd/aibridged/http.go`, `aibridge/recorder/drpc_recorder.go` | Page vs. section: a dedicated explanation page, because `cost-controls.md` is already long and RFC Phases 3 and 4 (model RBAC, "require organization scope") will build on the same resolution rules. </details> --- *This PR was generated by Coder Agents on behalf of @SasSwart.* |
||
|
|
6e2ff20d00 | docs: document patch release and backport policy (#31993) | ||
|
|
3795d72713 |
fix: search AI Gateway models and clients by substring (#32159)
Closes AIGOV-801 Typing `hai` into the model filter on the AI Gateway sessions page shows the haiku models for a moment, then "No models found". Whilst the debounced request is pending, the menu filters the options it already has by a case-insensitive substring, but `GET /api/v2/ai-gateway/models` only matched a case-sensitive prefix, and Bedrock identifiers start with `anthropic.`. The client filter matched the same way, so it had the same problem. To fix, both endpoints now match a case-insensitive substring. This needed one change to the model menu. When the page loads with a model already in the filter, the menu used to look that model up on the server, by searching for its name and taking the first result. That's the same pattern as the user filter, where the lookup fetches the avatar, but a model option needs nothing from the server, so all it did was check that the model exists. With a substring search, the first result for `claude-3-5-sonnet-20241022` can be `anthropic.claude-3-5-sonnet-20241022-v2:0`, so the check would fail for a model that does exist. The menu now skips the lookup and just shows the model from the filter as selected. The only visible difference is that a model name in the URL that doesn't exist now shows as selected, instead of "All models". The client menu has the same lookup, which still works, as no client name contains another, so I've left it alone. The prefix match was added in #22230 (models) and #22694 (clients) so the queries could use the B-tree indexes. That only works on a C collation database, and only for models, as the clients query wraps the column in `COALESCE`. On an `en_US.utf8` database it's a plain filter either way. On a C collation database a model search with no matches does get slower, from instant to a few seconds with 5M synthetic rows, but I think that's worth it for a search that works. |
||
|
|
0be6e7a034 | feat: add a setting for web terminal font size (#32027) | ||
|
|
b0ae8adab5 |
feat(coderd): protect pending jobs only while the provisioner queue is moving (#32099)
Stops the pending job reaper from failing jobs in a queue that's still moving. This is an alternative to #31469 that came out of Steven's [review](https://github.com/coder/coder/pull/31469#pullrequestreview-5847958482) asking whether 2h is enough, and it builds on George's work there. A pending job past 30m is now only protected while a matching online provisioner is making progress, meaning it finished a job in the last 30m or is running one that's still being updated. A moving queue never gets reaped and a frozen one still does at 30m like today. There's no absolute cap. No migration since it uses the existing `provisioner_jobs_worker_id_organization_id_completed_at_idx`. One tradeoff is that a stuck build whose provisioner keeps heartbeating counts as progress, so if every matching provisioner is stuck like that, the queue waits until that build is canceled. Still a draft so we can talk it through with Spike and Steven. Part of CORE-586 --------- Co-authored-by: George Katsitadze <george.katsitadze@gmail.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> |
||
|
|
acafa545ad |
feat(site): show cited sources in the message action bar (#32148)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Move cited web pages from the separate source-pill row into a compact Sources control in the message action bar, alongside Copy and Attachments. Stacked site icons open a list of cited page titles and hosts, while each search row keeps the pages that search found. Non-HTTP(S) sources remain unlinked. Collect and deduplicate citations across each completed turn so they appear with its final assistant output, including when steps are collapsed. Add regression tests, Storybook coverage, and documentation for the control. <img width="762" height="458" alt="image" src="https://github.com/user-attachments/assets/0bc59d13-6f42-48a6-8c38-46922bbdca50" /> Refs CODAGT-1476. <details> <summary>Review follow-up</summary> Long source titles wrap, non-web URLs remain fully visible, and new-tab links have visual and accessible indicators. Opening Sources focuses the first web link, with dialog fallback when no link exists. The action bar wraps on narrow screens. Attachments and citations share turn splitting, host selection, and completion checks. Folded-block source lookup skips row slicing when a row has no citations. A synthetic 10,000-row helper benchmark improved from 23.9 ms to 5.2 ms (median); this is not an end-to-end rendering measurement. </details> |
||
|
|
96e91a4d6a | chore(docs): update release docs for v2.37.14 (#32250) | ||
|
|
0d53f090d0 | chore(docs): update release docs for v2.34.21 (#32249) | ||
|
|
75e2519022 | chore(docs): update release docs for v2.39.4 (#32246) | ||
|
|
5645e68015 | chore(docs): update release docs for v2.38.10 (#32247) | ||
|
|
e45fe9d8dc |
chore(docs): update release docs for v2.29.29 (#32248)
Automated docs update for v2.29.29 release. Created by `releasetui`. |
||
|
|
6f169d86a9 |
chore(docs): update release docs for v2.29.28 (#32234)
Automated docs update for v2.29.28 release. Created by `releasetui`. |
||
|
|
a921700974 | ci: report only wrong, missing, and broken findings in CI doc-check reviews (#32199) | ||
|
|
1baff57cb0 |
fix: resolve docs and code conflicts found in the main docs audit (#32158)
## Summary Addresses 106 of the 113 conflicts between the docs and the code that the November audit of `main` found: 102 are fixed and 4 have an interim docs fix. Every finding was re-checked against the code before it was fixed. Most fixes are docs-only. Three are small code fixes where the docs described the intended behavior and the code was wrong, each in its own commits so it can be split out. No change in this PR alters template build or agent behavior. ## Changes Fixes by area (finding counts): templates 28, install 13, integrations and monitoring 13, auth and security 12, networking 11, Coder Agents 9, AI governance 7, reference 7, workspaces 6. Code fixes. Each needs a look from the code owner. If an owner prefers not to take one, drop its commits and I will change the docs to describe the current behavior instead. | Commits | Change | Risk to check | |---------|--------|---------------| | `fix: keep built-in listener defaults in packaged coder.env`, and three follow-up commits | `coder.env` comments out `CODER_HTTP_ADDRESS=` and the three `CODER_TLS_*` lines, so an untouched package install listens on `127.0.0.1:3000` as the docs say. Only the `CODER_HTTP_ADDRESS=` line changed behavior. The TLS options default to empty, so commenting them out is for consistency. The Lima examples rewrite the commented line and fail if the line is not found. A test compares every option that the file sets against the built-in defaults. | The deb and RPM packages were not built or installed. Every released package through v2.39.0 ships the empty line, and upgrades keep an existing file (`config\|noreplace`), so the upgrade pages now say how to fix it. | | `fix(cli/clilog): accept log sinks that are all disabled`, and three follow-up commits | `--log-human=/dev/null` with no other log location no longer fails with "no loggers provided". It is the documented way to disable logging. An empty location still fails with that error when no other sink is set, as before. | Behavior change: with `/dev/null`, the server and the provisioner daemon can start with no log output. | | `fix(cli): detect CODER_PROC_PRIO_MGMT by presence`, and a comment follow-up | Log line only. With the variable set to an empty value, the agent now logs that process priority management is enabled, which is what `agentexec` already does. No detection or behavior change. | Low. | Two option descriptions in `codersdk/deployment.go` are corrected, with the CLI reference, configuration reference, and golden files regenerated: the default quiet hours schedule (the max deadline is the quiet hours window on the next day that the template's autostop requirement applies) and `--experiments` (`*` opts in to the experiments marked safe, also in `enterprise/cli/provisionerdaemonstart.go`). ### Code fixes that were reverted after review Two code fixes from the first version of this PR are reverted in the branch. The net diff has no change under `agent/` or `coderd/`. The docs now describe what the code does, and both issues stay open for the owner. - **`error` merge strategy for `coder_env` (DOCS-1669).** The fix made `merge_strategy = "error"` fail whenever a name was set twice, whatever the resource order. Existing template versions that pair an `error` entry with a later `replace` or `append` entry would start to fail every build after `terraform apply`. That is a breaking change that needs its own PR and release note. The fix and its tests are in `dff8e7c6ce` and can be cherry-picked. `environment-variables.md` now says the check runs only when the `error` resource is processed. - **Nice value before the capability drop (DOCS-1687).** The fix let `coder agent-exec` apply a negative nice value by calling `setpriority` before it drops effective capabilities. The current order is deliberate: with the fix, any local process could run the agent binary with `--coder-nice=-20` when the binary has the `CAP_SYS_NICE` file capability. `process-priority.md` now says a nice value below the agent's own is not applied, and no longer tells admins to grant `CAP_SYS_NICE`. ## Not included Seven findings are left out. - DOCS-1629: covered by #31639. - DOCS-1703 and DOCS-1724: covered by #31980. - DOCS-1584, DOCS-1683, DOCS-1685, DOCS-1686: each needs an owner decision, and no neutral docs wording exists until that decision is made. The validation comment on each issue names the decision. Four fixes are interim, so their issues stay open: - DOCS-1600: the AI Gateway pages now agree that the legacy metric names are deprecated and "will be removed in a future release". The code still emits them, and its TODO names v2.37, which has shipped. The owner still needs to set the removal release. - DOCS-1689: the page now says **New Template** opens the builder only for users with the Owner role, because the page gates on read access to the deployment config. Whether Template Admins should get the builder is still open. - DOCS-1669 and DOCS-1687: docs-only for now. Refer to [Code fixes that were reverted after review](#code-fixes-that-were-reverted-after-review). ## Review notes - Claims that describe product intent and need an owner's yes: the Premium qualifier on per-organization workspace sharing (the API route has no license check, the dashboard needs multiple organizations), `organization` port sharing in OSS, the telemetry field list, and the `1-5` cron range in the prebuilds schedule example. - Not run end to end: the PostgreSQL TLS procedure on a cluster, the OpenShift and air-gapped examples, the BSD `date` and `tar` forms on macOS, the Windows command on the multiple Kubernetes clusters page, and the keep-alive script in `docs/reference/index.md` (only its comparison logic was run, against sample values). Nothing was checked on a live deployment. - Likely merge conflicts with open PRs: #31990 (`mcp-server.md`, `feature-stages.md`, `docker-in-workspaces.md`), #31982 (`workspace-management.md`), #31980 (`health-check.md`), #31977 (`manage-provisioner-jobs.md`), #31869 (`airgap.md`), #30486 (`add-envbuilder.md`), and #31326 and #31531 (`codersdk/deployment.go` and generated files). ## Testing - `make pre-commit` (gen, fmt, lint, slim build), before the PR opened and again after the review changes. - `go test` for `./cli/clilog/...`, `./codersdk/`, `./cli/` (`TestServer`, `TestAgent`, and golden files), and `./enterprise/cli/` (provisioner, server, and help golden files). `./agent/agentexec/...` and `./coderd/provisionerdserver/...` pass after the reverts. Linux only. CI covers macOS and Windows. - The `coder.env` test fails against the file on `main` and passes against the new one. It reads the file with `godotenv`, which accepts CRLF line endings. - An empty `CODER_HTTP_ADDRESS=` was confirmed end to end with a full build of the server (output below). - The new `sed` and `grep` lines in the Lima examples were run with GNU tools against the old and the new form of `coder.env`. The Lima VMs were not started. - `--log-human=/dev/null` and `CODER_LOGGING_HUMAN=` were confirmed with the same build (output below). - `coder agent-exec --coder-nice=-5 -- echo` from a full build, as a non-root user: `coder-agent: failed to adjust niceness to -5 ...: permission denied` on stderr, the command output on stdout, exit code 0. - `postgres-ssl.md` rendered with the GitHub Markdown API: two ordered lists with three and five items, where `main` has six lists. - markdownlint, the table formatter, `make lint/emdash`, `make lint/docs-html`, `make lint/docs-manifest`, `make lint/docs-redirects`, `make lint/style-claims`, and Vale on the changed lines. - A doc-check self-review of the docs diff by four independent reviewers. It found six problems, which are fixed. The accuracy and coverage lenses ran on every area. The language and structure lenses ran in full on only part of the diff. <details> <summary>Test and terminal output for the code fixes (Linux)</summary> ```console $ go test ./codersdk/ -run TestPackagedCoderEnvKeepsDefaults -count=1 -v --- PASS: TestPackagedCoderEnvKeepsDefaults (0.00s) ok github.com/coder/coder/v2/codersdk 0.071s $ go test ./cli/clilog/ -run TestBuilder -count=1 -v --- PASS: TestBuilder (0.00s) --- PASS: TestBuilder/NoSinks (0.00s) --- PASS: TestBuilder/NoSinks/JSONDevNull (0.00s) --- PASS: TestBuilder/NoSinks/StackdriverDevNull (0.00s) --- PASS: TestBuilder/NoSinks/NoConfiguration (0.00s) --- PASS: TestBuilder/NoSinks/HumanDevNull (0.00s) --- PASS: TestBuilder/WithHuman (0.00s) --- PASS: TestBuilder/WithFilter (0.00s) --- PASS: TestBuilder/WithJSON (0.00s) --- PASS: TestBuilder/Verbose (0.00s) --- PASS: TestBuilder/FromDeploymentValues (0.01s) --- PASS: TestBuilder/FromDeploymentValues/Defaults (0.00s) --- PASS: TestBuilder/FromDeploymentValues/EmptyHumanEnv (0.00s) --- PASS: TestBuilder/FromDeploymentValues/Override (0.00s) ok github.com/coder/coder/v2/cli/clilog 0.171s $ TMPDIR=$HOME/.cache/agentexec-tmp go test ./agent/agentexec/... ./coderd/provisionerdserver/... -count=1 ok github.com/coder/coder/v2/agent/agentexec 4.236s ok github.com/coder/coder/v2/coderd/provisionerdserver 2.404s # Full build of the server (go build ./cmd/coder). An empty value stops it before it connects to the database. $ CODER_HTTP_ADDRESS= coder server --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable' Encountered an error running "coder server", see "coder server --help" for more information error: TLS is disabled. Enable with --tls-enable or specify a HTTP address # With the variable unset, the server passes that check and goes on to the database. $ coder server --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable' 2026-11-13 02:19:41.901 [warn] ping postgres: retrying error="dial tcp 127.0.0.1:1: connect: connection refused" try=11 Encountered an error running "coder server", see "coder server --help" for more information error: connect to postgres: connect to postgres: unable to connect after 11 tries; last error: dial tcp 127.0.0.1:1: connect: connection refused # An empty log location with no other sink still stops the server. $ CODER_LOGGING_HUMAN= coder server --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable' Encountered an error running "coder server", see "coder server --help" for more information error: make logger: no loggers provided, use /dev/null to disable logging # /dev/null passes the logger check. The server prints no log lines and goes on to the database. $ coder server --log-human=/dev/null --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable' Encountered an error running "coder server", see "coder server --help" for more information error: connect to postgres: connect to postgres: unable to connect after 11 tries; last error: dial tcp 127.0.0.1:1: connect: connection refused ``` </details> ## Linear Fixes DOCS-1583, DOCS-1585, DOCS-1586, DOCS-1587, DOCS-1588, DOCS-1589, DOCS-1590, DOCS-1591, DOCS-1592, DOCS-1593, DOCS-1594, DOCS-1595, DOCS-1596, DOCS-1597, DOCS-1598, DOCS-1599, DOCS-1601, DOCS-1602, DOCS-1603, DOCS-1604, DOCS-1605, DOCS-1606, DOCS-1607, DOCS-1608, DOCS-1609, DOCS-1614, DOCS-1618, DOCS-1619, DOCS-1620, DOCS-1624, DOCS-1635, DOCS-1639, DOCS-1644, DOCS-1651, DOCS-1652, DOCS-1653, DOCS-1654, DOCS-1655, DOCS-1656, DOCS-1657, DOCS-1658, DOCS-1659, DOCS-1660, DOCS-1661, DOCS-1662, DOCS-1663, DOCS-1664, DOCS-1665, DOCS-1666, DOCS-1667, DOCS-1668, DOCS-1670, DOCS-1671, DOCS-1672, DOCS-1673, DOCS-1674, DOCS-1675, DOCS-1676, DOCS-1677, DOCS-1678, DOCS-1679, DOCS-1680, DOCS-1681, DOCS-1682, DOCS-1684, DOCS-1688, DOCS-1690, DOCS-1691, DOCS-1692, DOCS-1693, DOCS-1694, DOCS-1695, DOCS-1696, DOCS-1697, DOCS-1698, DOCS-1699, DOCS-1700, DOCS-1701, DOCS-1702, DOCS-1704, DOCS-1705, DOCS-1706, DOCS-1707, DOCS-1708, DOCS-1709, DOCS-1710, DOCS-1711, DOCS-1712, DOCS-1713, DOCS-1714, DOCS-1715, DOCS-1716, DOCS-1717, DOCS-1718, DOCS-1719, DOCS-1720, DOCS-1721, DOCS-1722, DOCS-1723, DOCS-1725, DOCS-1726, DOCS-1727 Part of DOCS-1600, DOCS-1689, DOCS-1669, DOCS-1687 <details> <summary>Decision log</summary> ### Scope - One PR for all findings, as agreed with the reviewer. The code fixes are separate commits so an owner can ask for any of them to move to its own PR. Nothing in the PR is a breaking change, so the title has no `!`. - A finding was skipped only when an open PR already covers it, or when every available wording would assert an undecided product behavior. - Each validation comment on the Linear issues records the evidence, the corrections to the original finding, and what was not verified. ### Docs or code - The default was a docs-only fix that describes what the code does. - A code fix was chosen when the docs describe a behavior the code plainly intended and the code change is small and testable: the packaged env file, the log sink check, and the log line for the environment variable presence check. - The `error` merge strategy and the nice value ordering started as code fixes and went back to docs-only after review. The first breaks existing template versions. The second weakens a deliberate security ordering. - The SCIM `userName` finding (DOCS-1609) took the docs path. The handler is unchanged. ### Wording choices worth a second look - `feature-stages.md` says `--experiments=*` enables only the experiments marked safe, and points to the "Get safe experiments" API. It does not list the other experiments, because the list would drift and those experiments are hidden on purpose. The `--experiments` flag help now says the same. - `agent-metadata.md` replaces the writes-per-second formula with a description of the batcher (each server replica writes one statement every 5 seconds, or sooner at 500 entries). - `extending-templates/index.md` no longer calls `startup_script` deprecated. The provider documents it as an alias for a `coder_script`. - `postgres-ssl.md` separates client verification from server verification, so the server verification steps work alone. - `rpm.md`, `upgrade.md`, and the 2.29 to 2.34 ESR upgrade page explain the empty `CODER_HTTP_ADDRESS=` line that older packages shipped, because upgrades keep the old file. The behavior changed in v2.34.0 with the serpent upgrade in #24926. - The keep-alive script in `docs/reference/index.md` reads the current deadline and skips the request when it is already later. The comparison is on text, so it applies only when the API returns a UTC timestamp, which needs the database to use the UTC time zone. Otherwise the script sets the deadline on every pass, as it did before, and the page says so. - `external-auth.md` anchors the new GitHub Enterprise regex example. The older unanchored examples on that page and on `git-providers.md` are not changed here. ### Self-review findings that were rejected - "The builder opens for Template Admins": the Templates page needs a successful deployment config read, which the Template Admin role does not have. - "Organization Admins can set AI model prices": the price write authorizes against a site-level object, which organization-scoped grants do not match. - "The provisioner chart sets no default resources": `helm/libcoder/templates/_coder.yaml` applies 2000m and 4096Mi when `coder.resources` is empty. ### Automated review, round 1 The `coder-agents-review` app left 45 findings on `8853332`. Fixed: the two reverts above, the anchored regex, the `coder.env` follow-ups (Lima examples, upgrade notes, a comment in the file, and a test that covers every option in the file), the clilog change, the two option descriptions, and the docs findings (CORS behavior, token lifetime example, keep-alive script, agent metadata, refresh token errors, `switch` form type, `dbcrypt` skip list, and a stray line in a YAML example). Declined, with the reason on each thread: - Refactoring the `agentexec` logging and renaming its log field: not related to a docs conflict. - Rewording the "process priority management not enabled (linux-only)" log message: the docs quote the message, and the wording predates this PR. - Problems in code and docs that this PR does not change (the `Capabilities` subtest, the Helm values comment, the AWS provider path in `airgap.md`, and others in the review's out-of-scope list). ### Automated review, round 2 The app left 14 new findings on `04925bd`, and accepted the three declined threads on `cli/agent.go`. All 14 are fixed. The main one: the round 1 change that removed the "no loggers provided" error went too far, because an empty log location would then start a server with no logs. The error is back for every case except `/dev/null`. Reported by the app as out of scope and not changed: the swagger annotation for `GET /api/v2/experiments/available` declares an array, but the handler returns an object with a `safe` array. Three Storybook fixtures keep the old `--experiments` description. ### Automated review, round 3 The app confirmed that all round 2 findings are fixed, and left 10 small findings on `f55cb6d` (8 P4, 2 Nit). All are fixed: the TLS condition and the release range in the `coder.env` notes, one place for the `/dev/null` rule in `clilog`, two test cases, a clearer test failure, and the CPU example in `agent-metadata.md`. ### Automated review, rounds 4 and 5 Round 4 left one P4 on `8fffb38` (name the `--trace` option in the logging note), which is fixed. Round 5 on `2ce754e` reports no new findings and says every earlier finding is fixed or closed. The app did not post an approval: it leaves its out-of-scope items and the code fixes to a human reviewer. Two threads on `cli/agent.go` stay open on purpose for the code owner. ### Doc-check review The doc-check workflow left 12 comments on `2ce754e` (10 blocking, 2 suggestions). All are fixed in `c888885`: "refer to" or "visit" in place of "see" for cross-references on the lines this PR added, the **New template** label as the dashboard shows it, one instruction per step in the server verification procedure of `postgres-ssl.md`, and two wording changes in `process-priority.md`. The `CAP_SYS_NICE` sentence keeps a short reason, which differs from the suggested text. The `coder-agents-review` app then reviewed that commit (rounds 6 and 7). Round 6 left two P4 findings, fixed in `30b2c79`: the `failed to adjust niceness` message is described once, in the troubleshooting entry, with where it appears, and the client verification steps in `postgres-ssl.md` render as one numbered list. Round 7 reports no new findings. `2a6035c` then softens one sentence from that fix, because the agent logs the stderr of devcontainer CLI commands. The app was not run again on that commit. ### Adjacent gaps found and not fixed here - `add-envbuilder.md` has the same `zip` command that `template-from-scratch.md` had. - `template-from-scratch.md` leaves the reader in `build/` after `cd $_`, before a step that runs from `template-tour`. </details> --- _Generated by Coder Agents on behalf of @nickvigilante._ --------- Co-authored-by: Ben Potter <me@bpmct.net> |
||
|
|
bd268cb28d |
feat: add output formats to coder organizations members edit-roles (#30145)
Uses the `cliui` output helpers from #30508. `coder organizations members edit-roles` printed only `Member roles updated to [...]`, while `members list` supports `-o table|json` and `-c`. It now accepts `-o text|table|json` and `-c`. Table and JSON show the updated member using the `members list` row type and columns. **Behavior change:** Additive. Default text output is unchanged. The command now fetches the member after updating roles, on every invocation; if that read fails, it exits with an error even though the roles were already updated. <details> <summary>Decisions</summary> - The update endpoint doesn't return user data, so the member is re-read to build the table and JSON rows. </details> Closes [CLI-27](https://linear.app/codercom/issue/CLI-27) _This PR was generated by Coder Agents on behalf of @nickvigilante._ |
||
|
|
32e1f2502f |
feat: add JSON output to coder tokens create (#30135)
Uses the `cliui` output helpers from #30508. `coder tokens create` printed only the new token's secret, so scripts had to call `tokens view` afterwards to get the token's ID, expiry, and scopes. This adds `-o/--output` with `text` (default) and `json`. The JSON document contains the token's metadata from `APIKeyByID` plus the one-time `key`. **Behavior change:** Additive. The default output is still just the secret, so `$(coder tokens create ...)` keeps working. The command now makes one extra API call after creating the token; if it fails, the command prints a warning to stderr and still outputs the secret rather than exiting with an error. <details> <summary>Decisions</summary> - The metadata lookup uses the key ID parsed from the `<id>-<secret>` token, the same convention `tokens view` and `tokens remove` use. - A failed metadata lookup never fails the command, because the token already exists and the secret can't be shown again. </details> Closes [CLI-14](https://linear.app/codercom/issue/CLI-14) _This PR was generated by Coder Agents on behalf of @nickvigilante._ |
||
|
|
872105c4bb |
fix: bump bundled terraform to 1.17.2 (#32110)
Bumps the bundled Terraform from 1.17.1 to [1.17.2](https://github.com/hashicorp/terraform/releases/tag/v1.17.2) (released 2026-11-11). 1.17.2 pins `klauspost/compress` v1.20.2, which contains the fix for [GHSA-fpmh-frq8-7rj8](https://github.com/klauspost/compress/security/advisories/GHSA-fpmh-frq8-7rj8) / [GO-2026-6865](https://pkg.go.dev/vuln/GO-2026-6865) (panic in the zstd decoder on a crafted frame). 1.17.1 pins v1.19.1. Iron Bank reports GO-2026-6865 against `/opt/terraform/terraform` in `coder/coder-enterprise/coder-service-2:2.38.7` (High). The Iron Bank image takes its Terraform from the version coder bundles, so this bump is how that finding goes away. This is a patch bump, so `maxTerraformVersion` stays at 1.17.9. It does not change the Go toolchain Terraform is built with (still go1.26.10) or its `go-getter` pin (still v1.8.6). ## Changes Same file set as #30516: - `provisioner/terraform/install.go`: `TerraformVersion` - `install.sh`, `scripts/Dockerfile.base` - `mise.toml`, `mise.lock` (checksums from HashiCorp's `terraform_1.17.2_SHA256SUMS`) - `flake.nix` (fetchurl SRI hashes derived from the same SHA256SUMS) - `docs/install/prepare/airgap.md` - `provisioner/terraform/testdata/generation.sha1`: fixture fingerprint, regenerated with `generate.sh --if-needed`. No plan or state fixture changed. I checked the checksum conversion first by deriving the 1.17.1 values from `terraform_1.17.1_SHA256SUMS`; it reproduces every value currently in `flake.nix` and `mise.lock`. ## Verification ``` $ mise install terraform # mise.lock checksums verified against the download $ mise exec -- terraform version Terraform v1.17.2 on linux_amd64 $ ./provisioner/terraform/testdata/generate.sh --if-needed only generation.sha1 changed $ go test ./provisioner/terraform/ -run 'TestInstall|Version|Golden' -count=1 ok github.com/coder/coder/v2/provisioner/terraform (75 tests passed, 0 failed) ``` `flake.nix` was not evaluated with Nix; its hashes come from the same SHA256SUMS as `mise.lock`. ## AI disclosure Prepared with an AI coding agent on behalf of @droopy4096. The agent ran the verification above; a human review is still needed before merge. |
||
|
|
54fe847c6f |
chore: remove references to torn-down dev.coder.com instance (#31702)
The `dev.coder.com` instance has been torn down and now only redirects to another instance. Nothing in the repo calls it. Every reference was a test fixture, mock, story, Helm test input, docs example, or comment. Replace all occurrences with `coder.example.com` and update the comments that claimed the mocks were fetched from that instance. The Helm golden files were updated to match their inputs. Closes DOG-43 https://linear.app/codercom/issue/DOG-43/scan-codercoder-repo-for-remaining-references-to-devcodercom-and |
||
|
|
4f6a56427e |
feat: report pubsub health from the pubsub backend (#31621)
Fills in the `pubsub` section of the deployment health report on the server. Stacked on #31620. - New `pubsub.ReportingPubsub` interface: `Pubsub` plus `HealthReport(ctx) healthsdk.PubsubReport`. The `Pubsub` interface itself is unchanged. - The PostgreSQL, NATS and in-memory backends implement it. Each reports its backend name (`postgres`, `nats` or `memory`) and its connection state: - **PostgreSQL:** tracks the `pq` listener's connected state from its event callback. When it's not connected, the report has severity `warning` and `EPS01`. - **NATS:** warns with `EPS02` if the embedded server isn't `Running()`, and with `EPS01` for each publish or subscribe connection whose `Status()` isn't `CONNECTED`. - **In-memory:** always `ok`. - `coderd.Options.Pubsub` is now a `ReportingPubsub`. `ReplicaSyncPubsub` stays a plain `Pubsub`. - `coderd/healthcheck` has a new `Pubsub` check, which counts toward `healthy` and the overall severity like the other sections. `formatHealthcheck` applies the dismissed setting for it. - New health codes `EPS01` (not connected) and `EPS02` (embedded NATS server not running), documented in `docs/admin/monitoring/health-check.md`. - Test helpers follow the type change: `coderdtest.Options.Pubsub` and the pubsub returned by `dbtestutil.NewDB` are now `ReportingPubsub`, and a few test wrappers embed `ReportingPubsub` instead of `Pubsub`. <details> <summary>Decision log</summary> - `HealthReport` returns a `healthsdk.PubsubReport` rather than filling one in place. This matches the `healthcheck.Checker` methods. `ctx` is unused for now. - The healthcheck layer sets `Dismissed`, so backends don't need to know about health settings. - Problems are reported as warnings, not errors, so they show on the health page without marking the deployment unhealthy. Both backends reconnect on their own. - Postgres connection state comes from the listener event callback, not from `pq.Listener.Ping`, so the health check doesn't do database I/O. Closing the pubsub also marks it disconnected. - NATS `conn` gains `Status()`, which `*natsgo.Conn` already implements. The pools are immutable after construction, so `HealthReport` reads them without locking. - The docs say the pubsub section appears in the JSON response, because the health UI doesn't show it until a later PR in this stack. - psmock is not regenerated: none of its users pass it to coderd. </details> --- Generated by Coder Agents on behalf of @spikecurtis. |
||
|
|
2187ecd37e |
feat: add PubsubReport to healthsdk HealthcheckReport (#31620)
Adds pubsub to the deployment health report types in `healthsdk`:
- New top-level `pubsub` section (`PubsubReport`) in
`HealthcheckReport`. It embeds `BaseReport` and adds one field,
`backend` (string).
- New `HealthSectionPubsub` constant, added to `HealthSections` so the
section can be dismissed.
- `HealthcheckReport.Summarize` includes pubsub errors and warnings,
which `coder support bundle` prints.
This is the first PR in a stack for GRU-100. It only changes the SDK and
the files generated from it (Swagger, API docs, `typesGenerated.ts`),
plus the two frontend health mocks that need the new required field. The
server does not fill in this section yet. That comes in a follow-up PR.
<details>
<summary>Plan</summary>
- Add `PubsubReport { BaseReport; Backend string }` to
`codersdk/healthsdk`.
- Add `Pubsub PubsubReport \`json:"pubsub"\`` to `HealthcheckReport`.
- Add `HealthSectionPubsub` and include it in `HealthSections`.
- Include `Pubsub` in `HealthcheckReport.Summarize`, with test coverage.
- Regenerate TS types, Swagger and API docs.
- Follow-up PRs: populate the report in `coderd/healthcheck` (including
severity and dismissal handling) and update the health UI.
</details>
---
Generated by Coder Agents on behalf of @spikecurtis.
|
||
|
|
38e74c4506 |
feat: add agent-plugins experiment and Agent API v2.17 plugin messages (#29320)
Linear: [CODAGT-1101](https://linear.app/codercom/issue/CODAGT-1101/agent-plugins-read-only-support-behind-the-agent-plugins-experiment) **tl;dr:** Adds the `agent-plugins` experiment and the Agent API v2.17 messages that carry Agent Plugins data from the agent to coderd. First of eight stacked PRs adding read-only [Agent Plugins](https://agent-plugins.org/) v1.0.0 support. A plugin is a directory with a `plugin.json` manifest, skills under `skills/`, and an optional `mcp.json`. Across the stack, the agent discovers plugins in `plugins/` and `.agents/plugins/` under its scan roots (for example `~/.coder/plugins/<name>`), chatd lists their skills with plugin attribution, the agent runs the MCP servers of plugins in the workspace working directory, and the Agents page shows plugin attribution in the chat context. Hooks, commands, agents, install flows, and org-managed plugins are out of scope. Background: [research/agent-plugins-standard.md](https://github.com/coder/scott-misc/blob/main/research/agent-plugins-standard.md) (internal). This PR adds `codersdk.ExperimentAgentPlugins` and a `PluginBody` oneof variant on `ContextResource` (tag 18) that carries the validated manifest fields and nests the plugin's skills and MCP servers. `Manifest` gains `agent_plugins_enabled` (field 23), which coderd sets when the experiment is enabled; the agent discovers plugins only then. coderd stores each nested resource as its own row with the plugin's name in a new `plugin_name` column (migration 000642), which the hydrate, MCP sync, and re-pin queries copy. With the experiment off, `PushContextState` drops plugin resources and everything nested in them. Otherwise it rejects pushes with plugin names that fail `workspacesdk.ValidatePluginName` (the spec's name grammar, shared by agent and coderd), OK plugins without a name or with a duplicate name, a non-OK plugin that nests resources, nested entries of the wrong kind, plugin skill sources outside `<plugin source>/skills/`, and plugin MCP servers with an empty `server_name` or a source other than `<plugin name>/<server_name>`. Nested resources count toward the 1000-resource cap. Agents now dial v2.17, so a new agent needs a coderd that supports it, as with every Agent API minor. Turning the experiment off does not remove plugin data already pinned to existing chats. <!-- pr-map:start --> <details><summary>PR map</summary> `main..4b0cfc9657` | Category | Files | + | - | |---|---:|---:|---:| | prod (backend) | 15 | 342 | 78 | | test (backend) | 9 | 534 | 3 | | migrations | 2 | 14 | 0 | | generated (backend) | 7 | 1216 | 1027 | | generated (frontend) | 1 | 2 | 0 | | **Total** | 34 | 2108 | 1108 | 1. `coderd/agentapi/context.go` (+211/-51, API): drops plugin resources when the experiment is off; otherwise validates plugin names and nesting, and stores each nested skill and MCP server as its own row with the plugin's name. 2. `agent/proto/agent.proto` (+39/-9, API): `PluginBody` with nested `skills` and `mcp_servers`, and `Manifest.agent_plugins_enabled`. 3. `codersdk/workspacesdk/frontmatter.go` (+31/-0): `ValidatePluginName` and `MaxPluginNameLength` (manifest name grammar). 4. `coderd/database/queries/chats.sql`, `workspaceagentcontext.sql`, migration 000642 (+28/-7, DB): the `plugin_name` column on both context resource tables, copied by the hydrate, MCP sync, and re-pin queries. 5. `codersdk/agentsdk/agentsdk.go`, `agent/agent.go` (+18/-4, API): `Manifest.AgentPluginsEnabled` and `ConnectRPC217WithRole`; the agent dials v2.17. 6. `coderd/agentapi/api.go`, `manifest.go` (+4): the manifest flag follows the experiment. 7. `tailnet/proto/version.go` (+8/-1, API): Agent API v2.17. 8. `codersdk/deployment.go` (+4, API): the `agent-plugins` experiment. </details> <!-- pr-map:end --> --- This PR was generated by Coder Agents on behalf of @jscottmiller. Co-authored-by: Garrett Delfosse <delfossegarrett@gmail.com> |
||
|
|
d639ced1e0 |
fix: send only changed chat history over the stream (#29662)
A client could resume the chat stream only with after_id, a message ID. A message ID does not identify what a client has received. A reconnect could skip a message that another client sent, send no history_reset for an edit the client missed, or resend the whole history. A client can now resume with the chat's snapshot_version, which the newest messages page returns and the stream's events then include. The stream sends what changed at that version or later. For an edit it sends the ID of the edited message and the messages written since, not the whole history. A stream opened without snapshot_version sends the same events as before. A write outside a chat state transition does not increase snapshot_version, and a stream can miss it. The queries that only tests used for such writes are removed. When the stream cannot be set up, the server now returns 500 before the WebSocket upgrade. It used to upgrade and send an error event, which the web client shows as a chat error. The Tasks to Chats migration guide told clients to reconnect with after_id. It now describes snapshot_version. |
||
|
|
30abd0593c |
feat: add organization AI spend overview endpoint (#31709)
## Description
Adds the experimental `GET
/api/experimental/organizations/{organization}/ai/spend` endpoint that
backs the new Overview tab of the organization AI spend page ([Figma
design](https://www.figma.com/design/6TkixpkUIM5Qv6I7qhM3xZ/AI-Gov---user-spend?node-id=12-5152&t=YlCC7RGSMNrzMxVo-4)).
It returns the organization's spend summary, daily spend, and a page of
users with their per-group spend, using the queries from #31711.
## Changes
- Add the `organizationAISpend` handler and
`ExperimentalClient.OrganizationAISpend`:
- Reuses the period handling of `/ai/spend/users`: `period_start` and
`period_end` must be provided together and span at most 31 days, and the
default is the current budget period.
- Also requires both bounds at 00:00:00 UTC, since the daily spend
aggregate holds whole UTC days.
- Is not limited by the AI Gateway data retention window, since the
daily spend aggregate is not purged. `/ai/spend/users` and the export
keep the retention check, now in `aiSpendRetainedPeriod`.
- Returns `count`, `totals` (`spend_micros`, `median_spend_micros`),
`intervals` (daily spend, one interval per UTC day, zeros included), and
`users` (paginated with `limit`/`offset`, most spend first, with
per-group spend).
- Echoes the applied period, and reads every value in one read-only
repeatable-read transaction so the values agree.
- Extract `parseOrganizationAISpendPage`, shared with `/ai/spend/users`.
- Add handler tests.
Closes AIGOV-728
> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
|
||
|
|
13e673e9c2 |
ci: build docs PR previews on per-PR preview sites (#30698)
Docs previews at `coder.com/docs/@<branch>` share coder.com's origin and cookies with the real site. This publishes each pull request's docs as its own site on `docs.cdr-preview.dev`, a domain used only for previews (repository variable `DOCS_PREVIEW_DOMAIN`), and points the existing `docs-preview` comment's per-page links and checkboxes at it. ## URLs - `https://pr-<n>.docs.cdr-preview.dev`: the PR head, re-aliased on every build. A slower build of an older commit doesn't take it back. - `https://pr-<n>-<first 9 of sha>.docs.cdr-preview.dev`: one per built commit, listed newest first in a collapsible "Preview sites" list in the PR's docs preview comment, so reviewers can step through the branch. - Every URL is built from `vars.DOCS_PREVIEW_DOMAIN` (aliases, comment links, cleanup); nothing hard-codes the domain. Previews moved off `coderite.app`, which also hosts login-protected internal sites, so a preview page whose content any coder/coder writer controls would have been same-site with them. `cdr-preview.dev` hosts nothing else, and the docs previews sit under `docs.` so other preview kinds can get their own subdomain later. The jobs fail with a clear error if it is unset or a `vercel.app` name, because `*.vercel.app` names are first-come across all Vercel accounts and anyone could claim a preview's name before our deploy or after cleanup frees it. - Every preview carries the docs CSP and the other headers from docs-engine's `apps/offlinedocs/vercel.json`, plus `X-Robots-Tag: noindex`, which the deploy job prepends to the Build Output API `config.json` routes without touching the existing ones. - On merge or close, every deployment tagged `pr=<n>` and its aliases are deleted. A weekly groom (Mondays 07:23 UTC, also `workflow_dispatch`) deletes previews of any closed PR, in case a close event was missed. ## Who gets previews Only PRs from a branch in coder/coder, on every push that touches `docs/**`. Every job in the deploy workflow, and the close path of the cleanup, requires `github.event.pull_request.head.repo.full_name == github.repository`. Fork PRs get no preview for now. Building fork content in a `pull_request_target` run would share the base branch's Actions cache scope, so a fork could poison main's cache, and it would sit beside the private engine source. Fork previews come in a follow-up once the build runs in a no-network sandbox (or the public builder kit ships). That follow-up will gate on a maintainer stating the exact approved commit, not on a label, so a push after approval can't slip in. ## One comment, posted only after a deploy `docs-preview.yaml` is now a reusable workflow (`workflow_call` only). The deploy workflow's `comment` job calls it after `deploy` succeeds, so the per-page links never point at a preview that doesn't exist yet. I chose this over moving the per-page logic into the deploy job: the existing comment logic and its mapper test stay as they are, and only the trigger changes. Each PR gets at most one bot comment. The deploy job posts nothing; it passes the built commit (`short_sha`) to `docs-preview.yaml`, which adds a collapsible "Preview sites for each built commit" list to its comment, newest first, read back from the comment on each run and capped at 100. That comment is only posted when a non-generated page or an image changed: a PR that changes only `docs/reference/**` (generated CLI and API pages), or nothing previewable, gets no comment, and an earlier one is deleted. Engineers found the earlier two-comment version too noisy. If the comment is deleted that way and a later push brings it back, its commit list starts over; the earlier previews still exist until the PR closes. ## Three jobs, so PR content never runs beside a secret 1. `engine`: checks `DOCS_PREVIEW_DOMAIN` first, reads the docs-engine commit pinned in `docs/.engine-ref` (from the PR head, falling back to the base for a branch that predates the pin), mints a short-lived token from a GitHub App installed only on coder/docs-engine, downscoped to `contents: read` on that one repository, checks out with `persist-credentials: false`, and uploads a tarball plus its sha256 as a job output. Never touches PR content. 2. `build`: no secrets, `contents: read` only. Verifies the engine tarball against the digest, sparse-checks out the PR's `docs/`, refuses a `docs/` that is or contains a symbolic link (one could pull runner files, such as the private engine source, into a public preview), builds `apps/offlinedocs` with `DOCS_ROOT` as docs-engine's own `docs-pr-preview.yml` does, and uploads only the static `out/` export. 3. `deploy`: in the `docs-preview` environment with `VERCEL_PREVIEW_TOKEN`. Verifies the engine tarball against the digest again (a compromised build job could replace an artifact, but not a job output), refuses an export holding anything but regular files and directories, lays the static files out with the engine's `build:output` script, adds noindex, runs `vercel deploy --prebuilt` with meta `pr` and `sha`, and sets both aliases through the Vercel API. It holds only `pull-requests: read`, for the check that the PR head hasn't moved before re-aliasing; the `comment` job posts the comment. It runs the engine's trusted script rather than taking `config.json` from the build job, because a Build Output directory from another job could carry serverless functions or rewritten routes. `docs-pr-preview-cleanup.yaml` keeps `pull_request_target: closed` so a PR can't change its own cleanup; it checks out nothing and runs no PR content, only Vercel and GitHub API calls. Fork PRs have no previews, so their close is skipped. PR-chosen strings never reach a log line unfiltered: the comment workflow prints changed reference-page paths with every character outside a path allowlist as `?`, so a file name can't forge a `::` or `##[` workflow command, and the deploy job's errors name no path. ## Engine pin `docs/.engine-ref` now pins docs-engine `main` at `eadb477`, the engine `coder.com/docs` launched with on 2026-10-28 (was `e3c55c2`; an earlier revision of this PR pinned `5584d67`). The commands the workflow runs are unchanged between them. `e3c55c2` already had the `build:output` script, but the newer engine refuses a symlinked docs root, renders search hits without raw HTML, drops author-chosen heading ids that could break hydration, and pins Node 22.23.4, which the build and deploy jobs now use too. The commands the workflow runs (`pnpm turbo run build --filter=@coder/offlinedocs` and `apps/offlinedocs/scripts/build-output.mjs`) are unchanged at `5584d67`. The pin must be a commit on docs-engine `main`. The `engine` job checks docs-engine out with full history and fails before packing unless `git merge-base --is-ancestor "$REF" origin/main` passes. Once docs-engine is public, a commit pushed to any fork of it can be fetched by SHA through `coder/docs-engine`, so the 40-hex format check alone would let a PR build with unreviewed engine code. `test-docs-preview-mapper.sh` pins that the check runs in the `engine` job, before the pack step, against a full-history checkout. ## Before this can run Checked on 2026-11-12: IT registered `cdr-preview.dev` in Vercel on team `team_tGkWfhEGGelkkqUUm9nXq17r`, with Vercel nameservers, so `*.docs.cdr-preview.dev` needs no DNS or wildcard step. IT also set `docs.cdr-preview.dev` as the `coder-docs-pr-preview` project's own preview deployment suffix and removed `coderite.app` from it, so the project's generated deployment URLs land on the preview domain too, not on the team's `coderite.app` suffix; the first deploy will confirm that. The project has Vercel Authentication and password protection off. The secrets `DOCS_ENGINE_APP_ID` and `DOCS_ENGINE_APP_PRIVATE_KEY` exist. `DOCS_PREVIEW_DOMAIN` is set to `docs.cdr-preview.dev`. The `docs-preview` environment exists (created 2026-10-28) with no protection rules and no branch policy, and holds `VERCEL_PREVIEW_ORG_ID` and `VERCEL_PREVIEW_PROJECT_ID`, and `VERCEL_PREVIEW_TOKEN` was stored on 2026-11-12. - [ ] **GitHub App** (org owner; requested in DOCS-1739). Confirm the app behind `DOCS_ENGINE_APP_ID` is installed on coder/docs-engine only ("Only select repositories") with Repository permissions Contents: Read-only and Metadata: Read-only and nothing else, at https://github.com/organizations/coder/settings/installations. The workflow also downscopes each token to `contents: read` on docs-engine, so the installation is the outer bound. - [x] **Repository variable**, set on 2026-11-12. Set it at repository level, not on the environment, because the `engine` job and `docs-preview.yaml` run outside it: ```sh gh variable set DOCS_PREVIEW_DOMAIN -R coder/coder --body docs.cdr-preview.dev ``` - [x] **Vercel Authentication off** on `coder-docs-pr-preview` (`prj_RiVa1voPHmsfbEXkasFDXmYqAr0L`): checked on 2026-11-12, `ssoProtection` and `passwordProtection` both report `enabled: false`. - [x] **Preview domain** (IT): `cdr-preview.dev` registered with Vercel nameservers, and `docs.cdr-preview.dev` set as the project's preview deployment suffix. - [x] **Project-scoped Vercel token**, 90-day expiry (created 2026-11-12, expires about 2027-02-10; a rotation reminder is set for 2027-02-09). The three checks below returned `200`, `404` and `403`. Create it at https://vercel.com/account/settings/tokens, scoped to the `coder-docs-pr-preview` project only (`vercel tokens create --project` is refused for non-owners). Then check, with the new token in `$VERCEL_PREVIEW_TOKEN`, that it can list the project's deployments (`200`), reach the team-level alias API (`404`, not `403`), and cannot see the production `coder-docs` project (`403` or `404`, never `200`): ```sh curl -sS -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer $VERCEL_PREVIEW_TOKEN" \ "https://api.vercel.com/v6/deployments?teamId=team_tGkWfhEGGelkkqUUm9nXq17r&projectId=prj_RiVa1voPHmsfbEXkasFDXmYqAr0L&limit=1" curl -sS -o /dev/null -w '%{http_code}\n' -X DELETE -H "Authorization: Bearer $VERCEL_PREVIEW_TOKEN" \ "https://api.vercel.com/v2/aliases/pr-0.docs.cdr-preview.dev?teamId=team_tGkWfhEGGelkkqUUm9nXq17r" curl -sS -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer $VERCEL_PREVIEW_TOKEN" \ "https://api.vercel.com/v6/deployments?teamId=team_tGkWfhEGGelkkqUUm9nXq17r&projectId=prj_pC4y7hjUgcsYYNoSDL7pNJnafzh3&limit=1" ``` - [x] **`docs-preview` environment**: it exists with no branch policy (because `pull_request` runs on the merge ref) and its two variables are set. Only the token is left: ```sh gh secret set VERCEL_PREVIEW_TOKEN -R coder/coder --env docs-preview ``` `gh secret set` prompts for the token so it stays out of shell history. - [ ] **Security sign-off** (Lisa), on these points: - **Preview domain.** Previews now live on `docs.cdr-preview.dev`, which hosts nothing else, so they are no longer same-site with the login-protected sites on `coderite.app`. Previews are same-site with each other, so one PR's preview could set a cookie the others receive. Anything added to `cdr-preview.dev` later should stay outside `docs.` and not rely on cookies scoped to the parent domain. The docs CSP allows inline scripts, and any coder/coder writer controls a preview's content. - Any coder/coder writer can reach `VERCEL_PREVIEW_TOKEN` by editing the workflow on a branch, as with any secret a `pull_request` deploy uses. The token is scoped to the one preview project to bound that; required reviewers on the environment would close it, at the cost of an approval per preview. - The engine commit comes from the PR's `docs/.engine-ref`, so the engine code that lays out the export in the deploy job is PR-chosen, but only among commits on docs-engine `main`. It runs before, not in, the step that holds the token. - [ ] **Mark ready for review** once the items above are done and a docs push to this PR has produced a working preview. ## Testing `test-docs-preview-mapper.sh` checks that `docs-preview.yaml` reads the domain from `vars.DOCS_PREVIEW_DOMAIN`, builds links on `pr-<n>.<domain>` from the validated value with no `coder.com/docs/@` or `vercel.app` link, and runs only as a reusable workflow called after `deploy`. It also checks the per-commit list (this commit first, earlier ones carried, repeats and other PRs' lines dropped, capped at 100), that the list round-trips through the comment it renders without touching checkbox state, and that the deploy job posts no comment and passes its commit on. All 58 checks pass (run with GNU coreutils, sed, grep and awk on macOS); the new workflow check failed before the change. `actionlint` at the repo's pinned commit, with ShellCheck, reports nothing, and so does the repo's pinned zizmor 1.11.0 (`--strict-collection --persona=regular`). The noindex step was run against a `config.json` from docs-engine's real `build-output.mjs`: the route count went from 11 to 12 with the CSP route intact. With the variable, environment and token in place, the `engine` and `build` jobs pass on this PR, including the check that the pinned engine commit is on docs-engine `main`. The first deploy failed at `vercel pull` with "Could not retrieve Project Settings": Vercel CLI 59.3.0 looks up the token's team (403 for a project-scoped token) and gives up, although the token reads the project (200). Run locally with the same token, 65.11.0 skips that lookup and pulls the settings, so the workflow now pins 65.11.0, the newest release more than a week old. The deploy, alias and cleanup calls have not completed in CI yet. --- 🤖 Built with AI assistance. |
||
|
|
b9741840eb |
docs: update Agent Relay docs for v0.16.0 (#32094)
Brings the Agent Relay docs up to v0.16.0, per Atif's request for a pass against the new release. Of the seven PRs in v0.16.0, only [agent-relay#155](https://github.com/coder/agent-relay/pull/155) changes behavior users see. `main` already described most of it ahead of the release (#31896) as "newer than v0.15.0". This PR fills the remaining gaps: - `setup.md`, `troubleshooting.md`: "newer than v0.15.0" becomes "v0.16.0 and later". Both pages now say Claude Code skips its one retry when the failure comes later than `dispatch_deadline` after the build was created. - `setup.md` **Workspace lifecycle**: a row for failed or timed-out startup scripts, and a note that these don't wait for the startup grace. - `configuration.md` `--reap-startup-grace`: the "fails after this grace" bullet notes the faster startup-script failure. - `claude-code.md` **Build budget**: when a build succeeds but the runner never starts, Anthropic retries only on the session's first delivery and only within `dispatch_deadline`. Otherwise the session fails. In v0.15.0 that nack was always retryable. Verification notes (agent-relay `v0.15.0...v0.16.0`): - `serviceclaudecoderunners/reap.go`: for a `pending` runner, `retryable = !redelivered(attempt) && (dispatchDeadline == 0 || obs.Age < dispatchDeadline)`. `obs.Age` counts from the latest build's creation, not from the work order's issue. - `workspacereaper/reaper.go` `confirmStartupFailure`: the first `pending` read after `start_error` or `start_timeout` is stored. A later sweep confirms only when its sample's `CollectedAt` is newer, and a sweep that re-reads the same sample doesn't reset it. So the docs say "two `pending` reads, the second from a newer sample", not "two sweeps in a row". - `workspacereaper/lifecycle.go` `StartupFailure`: applies only to running builds whose status is `pending`. Not documented: - The example templates (agent-relay#157), because the repository is internal. - The older-coderd `include_agent_metadata` detection fix (agent-relay#146), which is a bug fix with no setting or behavior change. - The agent lifecycle in nack failure details, a minor diagnostic change. Stack 6/6. Review and merge in order: - #31834 (merged) - #31984 - #31985 - #31986 - #31987 - #32094 Refs DOCS-1171 > Generated by Coder Agents on behalf of @nickvigilante. |
||
|
|
03139498d2 |
docs: fix smaller Agent Relay doc drift for v0.15.0 (#31987)
Smaller fixes so the Agent Relay docs match v0.15.0. - `slack.md`: idle release comes from the pool's `idle_release_timeout`. Agent Relay sets `agent_relay_claude_code_release_idle_session_min` on every build, so the module's `release_idle_session_min` input is only a fallback (confirmed in the `agent-relay-claude-code` module's `main.tf`). This matches `claude-code.md`. - `setup.md`: replace "release binaries aren't published yet". `.github/workflows/release.yaml` builds `linux` and `darwin` binaries for `amd64` and `arm64`, plus `checksums.txt`, on tags (there is no goreleaser config). - `setup.md` step 6: check `credential_transport=secrets`, as the agent-relay README says. - `setup.md`, `index.md`: say which features need v0.15.0. - `setup.md` **Start the worker after workspace setup**: point to the agent-ready and runner-up metrics. - `monitoring/index.md`: add `reaper_sweeps_total`, `reaper_sweep_seconds`, `reaper_claim_to_runner_up_seconds`, `reaper_claim_to_agent_ready_seconds` ([agent-relay#154](https://github.com/coder/agent-relay/pull/154)), `claude_code_polls_total`, `claude_code_last_poll_timestamp_seconds`, `claude_code_nacks_total`, `claude_code_pool_sessions`, `claude_code_issued_to_claimed_seconds`, `claude_code_queue_wait_seconds`, and the `client_platform`/`spawn_reason` labels on `work_orders_claimed_total`. - `configuration.md` **Pin a template version**: unpinned rebuilds move to the active version ([agent-relay#135](https://github.com/coder/agent-relay/pull/135)), and a refused rebuild is non-retryable ([agent-relay#136](https://github.com/coder/agent-relay/pull/136)). Verification notes: - Rebuild errors: the code treats both `400` and `403` as non-retryable (`dispatcher.go`, `retryable := ... != 400 && != 403`), so the docs mention both. - The release workflow creates a **draft** GitHub Release (`softprops/action-gh-release`, `draft: true`). The v0.15.0 release is now published, but coder/agent-relay is an internal repository, so customers can't see GitHub release assets. Needs a decision on where binaries are distributed before this wording ships. Stack 5/6. Review and merge in order: - #31834 (merged) - #31984 - #31985 - #31986 - #31987 - #32094 Refs DOCS-1171 > Generated by Coder Agents. --------- Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> |
||
|
|
af41767668 |
docs: add missing options to the Agent Relay configuration reference (#31986)
Brings `configuration.md` closer to Agent Relay v0.15.0 and answers review questions about repo-scoped Cursor pools. - The Cursor `repo_url` pool field. The row says the template clones the repository before the worker starts, and links to **Source control** in `cursor.md`. - `cursor.md` **Source control**: when to set `repo_url`, a two-pool example, and a link to Cursor's any-repo pools docs for routing, which Cursor decides. - Helm values: a commented YAML example with defaults replaces the table. - Removes the HTML source comment at the top of `configuration.md`, which named the private repository, internal paths, and a Linear issue. Per review, this PR no longer documents the status page, its TLS options, or `--dangerous-allow-parameter-credential-transport`. Verification notes: - `repo_url`: agent-relay `internal/services/servicecursorworkers/cursorworkers.go` (`repoOwnerName`, `RegisterPool`) and `dispatch.go` (`buildParameters`), plus the `agent-relay-cursor` module README, which says the template must clone `agent_relay_cursor_repo_url`. - Helm defaults: `helm/coder-agent-relay/values.yaml`. - `reapStartupGrace` is covered in 2/5. `reapDelay` has no Helm value (see 2/5). Stack 4/6. Review and merge in order: - #31834 (merged) - #31984 - #31985 - #31986 - #31987 - #32094 Refs DOCS-1171 > Generated by Coder Agents. --------- Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> |
||
|
|
7340da6380 |
docs: add guidance for high-concurrency prebuilt workspace claims (#31991)
Adds a **Prepare for high-concurrency claims** section to the prebuilt workspaces page. It covers what admins should do when many developers create workspaces from the same preset at once, such as a training session or onboarding day: - Before the event: size the pool with headroom, give it time to fill, confirm `eligible` matches `desired`, and raise `CODER_PG_CONN_MAX_OPEN`. - During the event: don't publish template versions, invalidate presets, or lower `instances`; retry `409 Conflict` from API clients with jitter; watch the claim metrics. Also adds a short note to **Template updates and the prebuilt workspace lifecycle**: until the new version's prebuilds are eligible, new workspaces are built from scratch. ## Verified against code - Pool exhaustion falls back to a normal build (`coderd/workspaces.go`, `ErrNoClaimablePrebuiltWorkspaces`). - `409` comes from `wsbuilder` (`http.StatusConflict`, "A workspace build is already active."). - `CODER_PG_CONN_MAX_OPEN` default is `10` (server CLI reference). - Prebuild metrics carry `template_name`, `preset_name`, and `organization_name` labels (`enterprise/coderd/prebuilds/metricscollector.go`). ## Needs engineering confirmation before merge - [ ] The 20 to 30 percent headroom recommendation - [ ] Retry delay of 1 to 2 seconds with jitter - [ ] Whether to publish a recommended `CODER_PG_CONN_MAX_OPEN` range (field guidance was about 50 to 100 per replica; left out of the page until confirmed) - [ ] The line that a claim in progress can fail if its prebuild is deleted (known limitation noted in #31518; included as configure-around guidance per the content guidelines' bug exception) ## Intentionally left out - "Upgrade to v2.38.5 / v2.39.0+" for the concurrent-claim fix (#31518). That's version history, so per the content guidelines it belongs in the changelog or a Support KB article, not this page. Linear: DOCS-1729 Supersedes #31944, reopened under a human author for attribution. Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> |
||
|
|
0f2a2434dc |
docs: remove accredited and per-framework retention claims (DOCS-1218) (#30777)
Removes two compliance claims in `docs/` that overstate what Coder provides. - `docs/install/server/rpm.md`: Iron Bank images are hardened and vulnerability-scanned, not accredited. The sentence now says that. - `docs/admin/setup/data-retention.md`: the "Compliance Considerations" list gave retention periods for SOC 2, HIPAA, PCI DSS, and GDPR. SOC 2 doesn't prescribe a period, and HIPAA's 6-year rule covers compliance documentation, not audit logs. The list is replaced with neutral guidance; the existing warning to consult security and compliance teams stays. Resolves DOCS-1218. <details> <summary>Decision log</summary> - **Cut the list instead of correcting it.** A corrected per-framework list would still need Security and Legal sign-off and ongoing upkeep, and it would read as Coder advising on the customer's obligations. The page's warning already routes readers to their compliance team. - **Sweep of `docs/`** for `compliant`, `certified`, `accredited`, `FIPS`, `FedRAMP`, `HIPAA`, `SOC 2`, `STIG`, `GDPR`, `DORA`, `CMMC`, `PCI`, and `Iron Bank`. No other claims that Coder itself is compliant, certified, or accredited. Remaining hits describe the customer's requirements, protocol conformance (OAuth 2.1, OIDC, SCIM), or a third-party plugin certification, and stay. - **Out of scope:** whether the Iron Bank image is current is tracked separately. - Checks: `markdownlint-cli2`, `vale`, `check_emdash.sh`, and the pre-commit hook pass locally. </details> --- _Generated by Coder Agents on behalf of @nickvigilante._ |
||
|
|
1271dcb570 |
docs: inherit feature states from ancestor routes in the docs sidebar (#31975)
## Summary A feature `state` in `docs/manifest/` now applies to a route and all its descendants, so each state is set once on the highest route it applies to. `docsmanifestgen check` rejects a route that repeats an ancestor's state, and the repeated states on `main` are removed. ## State model - Put a state on the highest route it applies to. - Add a state to a descendant only when it is new, such as an early access page inside a Premium section. - The sidebar shows a pill on the route that sets the state and on descendants whose state differs. - Every page shows its full state, own plus inherited, under the title. ## Changes - `docsmanifestgen check` (`make lint/docs-manifest`) fails when a route repeats an ancestor's state, following include files and overlays, or lists a state twice. It runs only after the manifest builds cleanly. Table-driven tests in `scripts/docsmanifestgen/state_test.go`. - Keep `state: [premium]` on AI Governance and External provisioners only. Remove the 27 states their descendants repeat in `docs/manifest/ai-governance/**` and `docs/manifest/install/operate/provisioners.yml`, and regenerate `docs/manifest.json`. - Document the model in `contributing/documentation.md` (new "Feature states" section with a YAML example), `docs/.style/content-guidelines.md`, and the doc-check skill. > [!IMPORTANT] > Inherited pills under the page title and the new sidebar behavior need the matching docs-engine change ([DOCS-1440](https://linear.app/codercom/issue/DOCS-1440)). > Merge this after that ships, or child pages show no state pill until it does. ## Testing - `go test ./scripts/docsmanifestgen/... ./scripts/docgenenv/...` - `golangci-lint run ./scripts/docsmanifestgen/...` - `GOOS=windows` and `GOOS=darwin` `go vet ./scripts/docsmanifestgen/` - `make lint/docs-manifest`, `make lint/markdown`, `make lint/docs-redirects` - `make gen/docs-manifest` leaves the tree clean. <details> <summary>Decision log: rebase onto main after #31645</summary> - #31645 (merged 2026-11-04) moved AI Governance to a top-level section with Agent Firewall and AI Gateway nested under it, and added the `ai-coder/...` redirects. That covered this PR's move commits, link and URL updates, and redirects, which caused the conflicts. - The branch was rebuilt on `main`: the two move commits were dropped, and the four state-tooling and guidance commits were cherry-picked. The manifest cleanup was redone as a new commit against `main`'s layout, using the new lint's output as the list of repeated states. - Agent Relay is now top-level with `state: [premium, beta]` and no child states, so it needs no change. - Conflicts in `content-guidelines.md` and the doc-check skill were resolved to keep `main`'s newer text (Vale word-choice updates and relative redirect syntax) and apply only the feature-states lines. - The pre-rebase head was `a797f59737`. </details> > Generated by Coder Agents on behalf of @nickvigilante. Supersedes #31481, reopened under a human author for attribution. --------- Co-authored-by: default <default@example.com> |
||
|
|
b5c43f8c7c |
docs: update Agent Relay SIEM alert messages for v0.15.0 (#31985)
Updates `monitoring/siem.md` to the log messages Agent Relay v0.15.0 writes. | Old `msg` | v0.15.0 `msg` | |---|---| | `workspace ready, runner handoff` | `workspace built, runner handoff` ([agent-relay#154](https://github.com/coder/agent-relay/pull/154)) | | `workspace build passed the session deadline, reporting retryable and deleting` | `workspace build passed the session deadline, reporting failure` (also lists `workspace build succeeded after the session deadline`) | | `workspace build failed, reporting retryable and deleting` | `workspace build failed` | | `delete workspace failed, leaving for reconciliation` | `delete workspace failed, leaving it for the reaper` | The PR also adds the `agent_lifecycle` field, which appears on the handoff record and on reaper records. Verification notes: - Every other quoted `msg` in `siem.md` was checked by grepping `internal/` at `9b96578` and still matches. - `leaving for reconciliation` doesn't exist at v0.15.0. Its replacement comes from `Dispatcher.deleteWorkspace`. Stack 3/6. Review and merge in order: - #31834 (merged) - #31984 - #31985 - #31986 - #31987 - #32094 Refs DOCS-1171 > Generated by Coder Agents. Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> |
||
|
|
75574dfbfe |
docs: document Agent Relay reaper startup grace and reap delay (#31984)
Agent Relay v0.15.0 made the reaper's 15-minute startup window configurable ([agent-relay#152](https://github.com/coder/agent-relay/pull/152)) and added a reap delay ([agent-relay#134](https://github.com/coder/agent-relay/pull/134)). - `configuration.md`: add `--reap-startup-grace` (Helm `reapStartupGrace`) and `--reap-delay`, plus the per-pool `reap_delay` field, under an intro that says how the two options differ. The Cursor `dispatch_deadline: 0` row now points at the startup grace. - `setup.md`: fix the script-ordering note and **Workspace lifecycle**, which hardcoded 15 minutes and said failed builds are deleted "on the next sweep". **Workspace lifecycle** now states the 30-second gap between sweeps, and **Choose cleanup settings** maps each goal to its setting. - `cursor.md`: fix the **Build deadline** bullet and the `pending` lifecycle row. - `troubleshooting.md`: the "session ended but its workspace remains" row mentions the reap delay. - `monitoring/index.md`: add the `delayed` verdict to `agent_relay_reaper_verdicts_total` and define it as a wait before `delete` or `failed`. Verification notes: - The chart has **no `reapDelay` value** at v0.15.0 (only `reapStartupGrace`; checked `values.yaml` and `templates/_helpers.tpl`), so the docs say to set `CODER_AGENT_RELAY_REAP_DELAY` through `extraEnv`. - Pending or starting builds wait `max(grace, dispatch_deadline)`. A finished build whose runner reports `pending` or nothing fails after the grace alone (`workspacereaper/lifecycle.go`). - The reap delay counts from the latest build's `Job.CompletedAt`, not from the worker's exit, so a session that ran longer than the delay gets no extra time (`reapDeadline` in `workspacereaper/reaper.go`). - `delayed` is only a metric label. A sweep records it when the verdict is `delete` or `failed` but the delay hasn't passed. The `Verdict` type has only `keep`, `delete`, `failed`, and `stuck`. - The reaper sleeps 30 seconds after it sweeps every pool, rather than running on a fixed ticker (`sweepLoop` in `servicereaper/reaper.go`). Stack 2/6. Review and merge in order: - #31834 (merged) - #31984 - #31985 - #31986 - #31987 - #32094 Refs DOCS-1171 > Generated by Coder Agents. --------- Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> Co-authored-by: Bobby Ho <bobby@coder.com> |
||
|
|
71ab161291 |
docs: add guide for self-hosting a STUN server (#31996)
Adds a how-to guide for self-hosting a STUN server with coturn and pointing `CODER_DERP_SERVER_STUN_ADDRESSES` at it. The guide is linked from the STUN and NAT page, the networking overview, and the air-gapped comparison table. Refs #16537, DOCS-310 **Verification** - Both coturn install paths were run on an Ubuntu 24.04 VM and checked with `coder netcheck` against a v2.39.0 deployment configured with only self-hosted STUN servers: the coturn 4.6 package under systemd with the documented config, and the `coturn/coturn:4.18.0` container with a published UDP port. Hostname and IP entries in `CODER_DERP_SERVER_STUN_ADDRESSES` both worked. - A client on a separate home NAT network got `p2p` connections from `coder ping`, and the STUN servers logged requests from both the client and the agent. With the STUN servers stopped, connections fell back to DERP and `coder ping` printed the "could not connect to STUN over UDP" hints. Running workspaces picked up the new STUN list without a restart. - Custom relay map path, checked in-process only (a throwaway `derphealth` test, not committed): with a nil built-in region, `tailnet.NewDERPMap` drops `CODER_DERP_SERVER_STUN_ADDRESSES`, and hand-written STUN-only regions loaded from a relay map file report `can_stun: true`. The documented `jq` filter lists them for both built-in and custom maps. - Source-verified only: each address becomes its own STUN-only region (`tailnet.STUNRegions`), which backs the "two or more servers" advice. With the built-in relay off, a relay map that has only STUN-only nodes fails startup (`tailnet.NewDERPMap`, pinned by `TestNewDERPMap/RequireDERPNodes`), which backs the "keep at least one relay node" note. - Not tested: Kubernetes or ingress setups. The VM-only guidance follows Spike's comment on #16537. markdownlint, Vale, `lint/emdash`, `lint/docs-manifest`, and `lint/docs-html` pass on the changed files, and a doc-check self-check left no blocking findings. <details> <summary>Decision log</summary> - **Dropped `stund`.** It has no releases, packages, or container images, so the guide had readers build an unpinned binary from Tailscale's `main` branch with no distribution security updates. It also answers only binding requests that carry a `FINGERPRINT` attribute, so generic STUN test tools can't check it. Its only advantage over coturn is a smaller, memory-safe, STUN-only codebase, and coturn's `stun-only` mode covers the practical need. - **The built-in relay is optional unless you use `CODER_DERP_SERVER_STUN_ADDRESSES`.** `cli/server.go` sets the built-in region to `nil` when `CODER_DERP_SERVER_ENABLE=false`, and `tailnet.NewDERPMap` adds STUN regions only when that region exists, numbering them from its region ID. Deployments with a custom relay map add STUN-only regions to that map instead, so the prerequisite became a "Use a custom relay map" section under Configure Coder. The page doesn't drop the relay entirely, because the built-in relay is still required for `CODER_DERP_SERVER_STUN_ADDRESSES`, and a custom relay map still needs at least one relay node. - **Changed the `jq` filter.** The old filter matched generated `coder_stun_*` region codes, so it returned an empty list for STUN regions written into a custom relay map. The filter now selects nodes with `STUNOnly` set. </details> Supersedes #31802, reopened under a human author for attribution. --- _Generated with Coder Agents on behalf of @nickvigilante._ --------- Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> |
||
|
|
3def3bf5a3 |
feat: add JSON output to coder provisioner keys create (#30152)
Uses the `cliui` output helpers from #30508. `coder provisioner keys create` printed the new key's secret as prose, so scripts provisioning external provisioners had to scrape it and look up the key's ID and tags separately. It now accepts `-o text|json`. JSON is the key as `provisioner keys list` shows it (ID, name, organization, tags, created at) plus the one-time `key`. **Behavior change:** Additive. Default text output is unchanged. The command now fetches the new key's metadata with the returned secret (`GET /api/v2/provisionerkeys/{key}`). If that fails, it prints a warning to stderr, falls back to the name, organization and tags it sent (leaving `id` and `created_at` unset), and still outputs the secret. <details> <summary>Decisions</summary> - `CreateProvisionerKey` only returns the secret, so the key's metadata comes from `GetProvisionerKey(secret)`, the same lookup `coder provisioner start` uses. This replaced an earlier list-and-match-by-name approach, per review. - A failed lookup never fails the command, because the key already exists and the secret can't be shown again. </details> Closes [CLI-36](https://linear.app/codercom/issue/CLI-36) _This PR was generated by Coder Agents on behalf of @nickvigilante._ --------- Co-authored-by: Jeremy Ruppel <jeremyruppel@users.noreply.github.com> |
||
|
|
661cfaca79 |
docs: document JetBrains Air for AI Gateway in JetBrains IDEs (#32052)
Replaces the JetBrains AI Assistant setup with JetBrains Air, the recommended agent workspace bundled in JetBrains IDEs 2026.3+. JetBrains moved AI Chat into Air and supports AI Assistant only [until early 2027](https://blog.jetbrains.com/ai/2026/11/air-in-jetbrains-ides-ga/). - `clients/jetbrains.md`: rewritten for Air only. Covers prerequisites, how Air runs Claude Agent and Codex in the workspace, template setup, starting a session, and the **Agent login** / "Claude subscription (OAuth token)" label. - `clients/index.md`: JetBrains row marks Anthropic as supported and drops the AI Assistant note. - Manifest description updated; the two unused AI Assistant screenshots are removed. Naming follows JetBrains docs: [Agents in IntelliJ IDEA](https://www.jetbrains.com/help/idea/agents-in-ide.html), [Configure agent authorization](https://www.jetbrains.com/help/air-ides/air-configure-authorization.html). Verified on dogfood with IntelliJ IDEA 2026.3 over remote development: Air runs the ACP-registry Claude Agent and the workspace's Codex CLI inside the workspace, both inherit the AI Gateway env/config, and sessions land in AI Gateway. _Opened via Superblink._ |
||
|
|
e307f1d5cf |
feat: add the user-scoped chat-automations experiment (#32064)
## Why The Automations RFC controls availability with one user-scoped experiment. Its text: "The user-scoped `chat-automations` experiment controls availability. Operators configure defaults with `--experiments` and can change per-user rules while Coder is running. Each surface checks the relevant caller or automation's owner, and experiment evaluation fails closed." The later backend PRs (management routes, the `manage_automations` tool, `Publish`) need that check first. This PR registers the experiment and proves the per-user, fail-closed check. Nothing consumes it yet. Part of CODAGT-1135 ## What changed - Registers `chat-automations` in `ExperimentsKnown` and `ExperimentsUserScoped`. An earlier experiment with this name was removed in #30412, and this PR restores none of its consumers. - Keeps it out of `ExperimentsSafe`, so `--experiments=*` does not turn it on. Automations act with their owner's authority, and a test pins the choice. - Adds the name to the `userScopedExperimentStaticCheck` ruleguard rule, so server code cannot decide it from the static list. `TestExperimentsUserScopedRuleguard` keeps the rule in step with `ExperimentsUserScoped`. - Regenerates the swagger files, `docs/reference/api/schemas.md` and `typesGenerated.ts`. - Adds tests for the real experiment name. The evaluator tests cover the startup default, stored `on`, `off` and condition rules for two users, and an off decision on a rules read error, a malformed rule, an unknown mode, an attribute read error, a condition error and a nil subject. A coderd test with a real database checks the same per-user behavior through `api.ExperimentEvaluator` and `GET /api/v2/experiments`. ## Scope No routes, tool, UI or chatd change. I added no helper: `Evaluator.Enabled(ctx, userID, ex)` already decides per user and fails closed, and API handlers reach it through `api.ExperimentEvaluator`. chatd has no evaluator handle on main, because #31327 removed the unused field. The first chatd consumer adds it together with its read. ## Blast radius With the experiment off, which is the default, behavior on main does not change. Two things become visible. `GET /api/experimental/experiments/rules` and `coder exp experiment-rules list` show a `chat-automations` row, and an administrator can store a rule for it. A deployment that already passes `--experiments=chat-automations` sees three small differences: the startup log reports an opted-in hidden experiment where it reported an unknown one, the deployment Overview page stops flagging the name as invalid, and the rules row shows the static default as on. Nothing reads the experiment yet, so no feature turns on. ## Live check A local `./scripts/develop.sh` deployment built from this head ran with no flag, with `--experiments=*` and with `--experiments=chat-automations`. `GET /api/v2/experiments` lists `chat-automations` for the owner and for a member only when the startup list or a rule turns it on, and `--experiments=*` does not turn it on. A condition rule `user.username == "member"` turned it on for the member and off for the owner without a restart, and `reset` restored the startup default. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-sonnet-5-5` • Thinking: `xhigh`_ |
||
|
|
1126533c31 |
feat: export workspace last used time to Prometheus (#31346)
Add an opt-in coderd_workspace_last_used_timestamp_seconds gauge that reports workspaces.last_used_at, the value the dormancy threshold measures inactivity from. To enable it, set --prometheus-collect-workspace-stats or CODER_PROMETHEUS_COLLECT_WORKSPACE_STATS. A separate WorkspaceStats collector refreshes the gauge once a minute in the background from a new GetWorkspaceLastUsedForMetrics query. Each series has a workspace_id label, so a workspace that reuses a deleted workspace's name starts a new series. Workspaces owned by deleted users are excluded. Closes CLIENT-1065 |
||
|
|
0a7ef88af9 |
feat: add option to disable the embedded AI Gateway (#31967)
Adds `--ai-gateway-embedded-enabled` / `CODER_AI_GATEWAY_EMBEDDED_ENABLED` (default `true`) so standalone-only deployments can stop `coderd` from starting the in-memory AI Gateway. `CODER_AI_GATEWAY_ENABLED` stays the global switch: the AI Gateway entitlement, `/api/v2/ai-gateway/serve`, and cost-control metrics still depend only on it. The embedded daemon now starts only when both options are `true`. | `ENABLED` | `EMBEDDED_ENABLED` | Result | |---|---|---| | `true` | `true` | Unchanged | | `true` | `false` | No embedded gateway; standalone gateways keep working | | `false` | any | No AI Gateway | Refs AIGOV-514 ## Open questions for reviewers - **Coder Agents does not work with the embedded gateway disabled.** `chatd` still starts, but model calls fail with "AI Gateway transport factory is not configured" because there is no in-process transport. AIGOV-597 (routing Agents through standalone gateways) was canceled. The docs and option help state that Agents requires the embedded gateway. Is that acceptable, or should `chatd` also be turned off in this mode? - **Option name:** the ticket proposed `CODER_AI_GATEWAY_EMBEDDED_ENABLED` tentatively. OK to keep? ## Verification ``` $ go test ./cli/ -run 'TestServer_AIGateway' -count=1 ok github.com/coder/coder/v2/cli 0.518s $ go test ./enterprise/coderd/ -run 'TestAIGatewayServe' -count=1 ok github.com/coder/coder/v2/enterprise/coderd 0.755s ``` `TestServer_AIGatewayEmbedded` fails when the new check is removed. <details> <summary>Implementation notes</summary> - `codersdk/deployment.go`: new option and `AIBridgeConfig.EmbeddedEnabled` field; updated `--ai-gateway-enabled` description. - `cli/server.go`: outer `if Enabled` sets up cost-control metrics and the blocked-users collector (the standalone `/serve` endpoint uses these too). Inner `if EmbeddedEnabled` creates the daemon, registers the in-memory handler, and adds its cleanup. - `cli/server_test.go`: `TestServer_AIGatewayEmbedded` covers the three modes by checking for the embedded daemon's startup log. - `enterprise/coderd/aibridgeserve_test.go`: `TestAIGatewayServeEmbeddedDisabled` checks the entitlement and `/serve` still work with embedded disabled. - `docs/ai-governance/ai-gateway/standalone.md`: new "Disable the embedded gateway" section. - Remaining files are generated by `make gen`. - Found during review: keeping metrics inside the embedded check would have dropped cost-control metrics for standalone gateways. </details> --- Generated with Coder Agents; reviewed, revised, and verified by @mollymaefraser. |
||
|
|
fb12d6018f |
fix!: redact agent environment variable values in API responses (#31932)
Workspace, build, and agent API responses (`/workspaces`,
`/workspacebuilds/{id}`, `/workspaceagents/{id}`, and so on) returned
agent environment variable values in plain text. Template authors often
pass credentials such as API tokens through `coder_env`, so anyone who
could read the workspace could read those secrets.
`db2sdk.WorkspaceAgent` now replaces every non-empty value with
`***REDACTED***` and keeps the keys. This is the same marker the support
bundle (`sanitizeEnv`) and the agent `/debug/manifest` endpoint already
use. The agent still gets the real values through its manifest
(`db2sdk.WorkspaceAgentEnvironment`), and nothing in the CLI or frontend
reads these values from the API.
Every value is redacted because neither `coder_env` nor
`coder_agent.env` in the Terraform provider has a sensitive flag, and
`proto.Env` has no field to carry one. Selective redaction would need
changes to the provider, the proto, and the database.
## For changelog
- Agent environment variable values are redacted in API responses
(#31932)
> Workspace, workspace build, workspace agent, and template version API
responses now return `***REDACTED***` for every non-empty agent
`environment_variables` value. Keys and empty values are unchanged. The
agent still receives the real values, so workspaces behave as before.
>
> Migration: Update scripts and integrations that read agent environment
variable values from the API or from `coder list -o json`. Read the
values inside the workspace instead.
Closes ENG-1505 (coder/security#51)
<details>
<summary>Decision log</summary>
- Confirmed the leak on `main` (
|
||
|
|
7301cee2c4 |
fix: list every enum value the API can return in the Swagger spec (#30122)
The API reference is generated from Swagger comments and struct tags, and several `enums:"..."` tags narrowed a named enum type, so the docs omitted values the server returns. For example, `User.status` listed only `active` and `suspended`, not `dormant`, and `TemplateVersion.warnings` listed `DEPRECATED_PARAMETERS`, which is not a value of the type. Remove 34 `enums` tags that narrow or duplicate a named type so the referenced type's full value list is used. Tags that describe an intentional subset stay: ACL role fields (which omit the `""` deleted sentinel used only in update requests), `APIKey.scope`, and plain-string fields. `Template.provisioner` keeps its tag because `.swaggo` replaces `ProvisionerType` with `string`. Also fix enum defects that break code generators: - The provisioner jobs and daemons `status` query parameters listed their enum twice (Swagger 2.0 requires unique `enum` items) or with the wrong type. Both are now `[]codersdk.ProvisionerJobStatus` and `[]codersdk.ProvisionerDaemonStatus`, matching what each handler parses, including comma-separated values. The daemons route previously documented job statuses, which the handler rejects with a 500. - Replace the `_` zero placeholder of `WatchErrorCode` with `iota + 1`, so the spec no longer lists 0 or `x-enum-varnames: ["_", ...]`. Wire values are unchanged. Where the narrowed tag hid values the server returns, the SDK type now includes them: `LoginTypeOAuth2ProviderApp`, `BuildReasonAutodelete`, and `MissingTemplateParameter` widen the generated TypeScript unions. The dashboard attributes `autodelete` builds to Coder like other system builds. `APIKey.login_type` and `AuthorizationCheck.action` set explicit examples so the generated samples stay representative. `TestSwaggerEnumsNotNarrowed` fails when a property's enum list drops values of its named type (other than the 15 allowlisted intentional subsets), lists a value the type lacks, or repeats a value. Part of DOCS-1122, split from #30121. --- 🤖 Built with AI assistance. |
||
|
|
a0b595b42d |
docs: say what Agent Relay does with agent readiness (#31896)
## Summary Updates Agent Relay documentation to reflect workspace agent lifecycle handling, startup failure behavior, and configuration changes introduced in v0.15.0 and coder/agent-relay#155. - Clarifies that workers must wait for workspace setup using `coder_script_order`, with examples from the registry modules. - Documents setup timeout requirements and pool-specific budgets: startup grace for Cursor and build budget for Claude Code. - Explains startup failures and timeouts, including faster failure detection (~1 minute) and Claude Code's one-retry behavior in versions newer than v0.15.0. - Documents the known limitation where claimed prebuilds remain `idle` after setup failures. - Adds `--reap-startup-grace` configuration, including its 15-minute default and interaction with `dispatch_deadline`. - Updates troubleshooting guidance with lifecycle states, failure reasons, and relevant log fields. - Corrects Cursor deadline references and the SIEM handoff log message to `workspace built, runner handoff`. Docs only; five files changed. No runtime behavior changes. ## Testing - `make lint/markdown` — passed - `make lint/emdash` — passed - `make fmt/markdown` — completed - Verified configuration options and failure reasons against Agent Relay source. Refs: - https://linear.app/codercom/issue/RELAY-67 - https://linear.app/codercom/issue/DOCS-1473 |