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

|
||
|
|
6bae268487 |
fix: move organization instructions to the Instructions page (#30428)
Moves organization instructions (#30272) from the Coder Agents page to **AI Settings** > **Coder Agents** > **Instructions**, so every Coder Agents instruction is managed on one page. The API and stored data are unchanged. - **Deployment admins** see a "Deployment instructions" section with the existing system prompt and plan mode form, then an "Organization instructions" section. The organization section has an organization picker when there is more than one organization. - **Organization admins and auditors** who can read an organization's chat model configuration get an Instructions entry in the AI settings sidebar and see only the organization section. Auditors get it read-only. - The selected organization is kept in `?org=`, and the sidebar link carries it over from the other AI settings pages. - The Coder Agents page goes back to its layout from before #30272. Its sections and the new page's sections share new `SettingsSection` and `OrganizationSettingsSection` components. - Three docs pages point to the new location. Other behavior changes: - The deployment section shows a loader while loading and an error alert when loading or refreshing fails. Before, the page rendered nothing until both settings loaded. - The deployment forms no longer have their own accessible names, because each section is named by its heading. ## Testing - Vitest for the Instructions page and sidebar link, and stories for the new states. Breaking each of the 9 main code paths, or removing the instructions field's accessible name, fails its test. - The branch merges `main` for #30402, which made the organization picker a combobox. - CI passes on `a0cc6a98660`. - Remote dogfood UAT, [evidence chat](https://dogfood.cdr.dev/agents/1cbf9da4-9671-4890-ade1-c151a1a69cd7): **PASS** on `a0d9c3fca46`, 14 scenarios across every role, `?org=` handling, injected load failures, keyboard use, and a 390 px layout. The remote agent's FAIL (a double-click on Save sends 2 PUTs) also happens on the merge base, so it predates this PR. Delta round on `a0cc6a98660`: **PASS**. When the permission re-check fails, the owner and an organization admin see the alert above the organization section, and the unsaved draft stays and saves. - UAT notes left as is: the fallback for an unreadable `?org=` is read-only, as on the Coder Agents page; `?org=` matching is case-sensitive, as on the Models and Spend pages; the old `/agents/settings/instructions` redirect drops `?org=`; the permission alert shows the server's error message without saying which check failed, as on the Models pages. ## Screenshots From UAT on a test deployment. | Organization admin | Owner, after a failed refresh (unsaved edit kept) | |---|---| |  |  | | **Coder Agents page, no instructions card** | **Unavailable `?org=`: warning and read-only fallback** | |  |  | ## Review record 1. `coder-frontend-review` (8 reviewer agents) on `3dd65e828f9`: fixed in `a0d9c3fca46` (deployment refetch errors were dropped, plus naming, prop types, test waits, and a single-organization story). Declined: `SettingsHeader` in `SettingsSection` and merging the sidebar groups (both change existing layout), and restructuring the moved card (git would stop detecting the move). 2. `frontend-review` (FE1 to FE10) on `a0d9c3fca46`: every rule passes, no changes. 3. Codex, [review](https://github.com/coder/coder/pull/30428#pullrequestreview-5431118231) on `a0d9c3fca46`: 1 P2, a docs sentence wrote "more than 1" where the numbers guide spells out "one". Fixed in `0e71b8f16b9`. 4. Codex, [review](https://github.com/coder/coder/pull/30428#pullrequestreview-5431285875) on `0e71b8f16b9`: 2 findings, each confirmed by a failing test and fixed in `a0cc6a98660`. A failed background re-check of organization permissions showed no alert, unlike the old Coder Agents page and the Models pages (P2). The page tests found the instructions field by its value, so removing its accessible name went unnoticed (P1). 5. `coder-frontend-review` (8 reviewer agents) and `frontend-review` (FE1 to FE10) on `a0cc6a98660`: everything passes, no changes. The round 1 `findByDisplayValue` suggestion is reversed, because FE10 asks for role and name queries. 6. Codex on `a0cc6a98660`: [no major issues](https://github.com/coder/coder/pull/30428#issuecomment-6020794170). > Xum, an AI coding agent, implemented, tested, and opened this PR on behalf of @ibetitsmike. |
||
|
|
e4682343e6 |
feat: match PR number prefixes in chat search (#30404)
Chat search now matches PR numbers by prefix, so typing `3028` already finds the chat for PR `30281` instead of showing zero results mid-typing. The free-text `search:` branch in `GetChats` switches from `pr_number = @search::bigint` to `pr_number::text LIKE @search || '%'`, still guarded by a digits-only regex so the value can never carry LIKE wildcards. The lookup stays a correlated per-chat EXISTS on the `chat_diff_statuses` primary key, which leads with `chat_id`, so the cost is the same as before and no new index is needed. The explicit `pr:` filter stays exact, and ordering is unchanged (no exact-match ranking) so cursor pagination is unaffected. Behavior note: values with leading zeros (`030281`) no longer match PR `30281`, since the old bigint cast normalized them. PR numbers never have leading zeros, so this seemed fine. Closes CODAGT-1342 ## Testing - `TestGetChatsSearch` gains prefix (`4` -> PR 42), no-infix (`2` -> none), and LIKE-wildcard (`4%` -> none) cases; the prefix case fails on the old predicate. - Dogfood UAT through Coder Agents on the branch: searching `3`, `302`, `3028`, `30281` all surface the PR-linked chat; `0281` and `302810` do not; `pr:3028` stays exact. > [!NOTE] > This PR was created by Xum acting on behalf of @ibetitsmike. |
||
|
|
7993c73c87 |
feat: add organization-scoped Coder Agents instructions (#30272)
Adds organization-scoped Coder Agents instructions. Organization admins
set them in **Admin settings** > **AI** > **Coder Agents** >
**Organization settings**, or with `GET`/`PUT
/api/v2/organizations/{organization}/chats/config/system-prompt`.
Implements [CODAGT-984](https://linear.app/codercom/issue/CODAGT-984).
The instructions add to the deployment system prompt and never replace
it. When a chat is created, chatd stores the organization prompt as its
own system row right after the deployment row, only for chats in that
organization. Subagents resolve their parent organization's current
prompt when they spawn, and existing chats keep their stored rows.
Access reuses the organization `chat_model_config` permission: owners
and organization admins edit, auditors read, members get 404 on read and
403 on write. Writes reuse the deployment prompt's sanitization, size
limit (128 KiB by default), and audit behavior, with a new
`chat_organization_system_prompt` audit resource type. Migration
`000613` (the next number after `000612` on `main`) adds the
`chat_organization_system_prompts` table.
## Testing
- Go: enterprise authorization (including an update-only custom role),
validation, and audit tests; chatd row order and subagent tests.
- Frontend: Vitest interaction tests and stories for the card (loading,
load error, refetch error over the cached value, save error, read-only).
- Remote dogfood UAT, [evidence
chat](https://dogfood.cdr.dev/agents/b595a709-0709-44e6-9535-96a922974d61):
round 1 **PASS** on `b027cb5ca67` (permission matrix, validation, UI,
row order, cross-organization isolation, audit, subagents, regression).
Round 2 **PASS** on `618bff67c75` (loading and load-error states,
refetch error over the cached value with unsaved edits kept, update-only
custom role saves over the API, row order, the documented size limit,
rapid organization switching, double-click save).
- CI: rebased onto `main` (`98332c739b0`) as `3850fbaa922`; other commit
SHAs in this description are from before the rebase. Every check passed
on `3850fbaa922`, with `test-go-pg` green on the first attempt. After
the review fixes in item 7, `main` was merged in as `006c4951749` to
resolve new conflicts in generated files and renumber the migration to
`000613`. Every check passes on `006c4951749`. Before the rebase, every
check passed on `b4e76543df2`. `test-go-pg (ubuntu-latest)` passed on
its fourth attempt; the first three failed only the `cli` package
goroutine leak check, with every test passing. Two of those leaked a
coderd instance, which also happens intermittently on `main`:
`TestServer/Logging` cancels `coder server` during startup, and an early
return in `cli/server.go` skips closing coderd. That fix is in #30280.
The first attempt leaked an idle HTTP connection instead (not
investigated).
## Screenshots
From remote UAT on a test deployment (test data only).
| Organization admin saves instructions (`b027cb5ca67`) | Auditor sees
read-only instructions, no save actions (`b027cb5ca67`) |
|---|---|
| 
| 
|
| **Loading state while the first fetch is pending (`618bff67c75`)** |
**Refetch error shown above the field; the unsaved edit is kept and Save
stays enabled (`618bff67c75`)** |
| 
| 
|
## Review record
1. Codex,
[review](https://github.com/coder/coder/pull/30272#pullrequestreview-5387245297)
on `c42b5f9e05c`: 6 findings. Fixed the missing loading state, refetch
failures hiding cached instructions, and two docs style issues
(`58eab5603a4`, `cc73b714630`). Two were first declined in error, then
corrected: the read-only test now checks that typing leaves the value
unchanged (`cc73b714630`), and update-only custom roles no longer get a
500 on save (`618bff67c75`).
2. Independent security review by a clean-context agent,
[comment](https://github.com/coder/coder/pull/30272#issuecomment-5943505041)
on `c42b5f9e05c`: no P0 to P2 findings. A stale P3 comment was fixed in
`34c17aadb7f`; returning `err.Error()` in 500 details was kept to match
the deployment prompt handlers.
3. Codex,
[review](https://github.com/coder/coder/pull/30272#pullrequestreview-5387323380)
on `58eab5603a4`: 2 findings (refetch errors not surfaced, docs line
breaks), both fixed in `cc73b714630`.
4. Codex, blockers only,
[review](https://github.com/coder/coder/pull/30272#pullrequestreview-5387462070)
on `618bff67c75`: 1 P2 (a failed refresh right after a successful save
shows the previous value). Not a blocker, deferred.
5. Final fresh advisory by a clean-context agent,
[comment](https://github.com/coder/coder/pull/30272#issuecomment-5944285083)
on `618bff67c75`: **READY**, no blockers and nothing to cut. It
independently checked authorization, audit, the migration, chatd row
insertion and subagent inheritance, the tests, and soft-deleted
organization handling, and agreed with every deferral. No code changes
followed: the snapshot behavior it suggested documenting is already
documented, and its docs wording note joins the deferred docs item.
6. Codex,
[comment](https://github.com/coder/coder/pull/30272#issuecomment-5952100918)
on `b4e76543df2` (the docs-only follow-up below): no major issues. Mike
asked for a passing Codex review loop after item 5, so this review goes
past the planned stop at the final advisory. No code changes followed.
7. ethanndickson,
[review](https://github.com/coder/coder/pull/30272#pullrequestreview-5409332502)
on `3850fbaa922`: approved with 4 comments. Fixed 3: the audit target is
now empty (`91e77d3fa8c`), the docs no longer re-explain audit logs
(`a0fb6891af5`), and the organization instructions stories went from 9
to 5 (`e836097f93f`). Not fixed: the organization prompt read fails open
on a database error, like the deployment prompt, and ethanndickson is
changing both after merge
([thread](https://github.com/coder/coder/pull/30272#discussion_r4180191267)).
UAT did not rerun for these changes.
Not counted as reviews: the pre-PR frontend self-review, simplify pass,
and test audit (`de8377e94e1`), and a second test audit of
`de8377e94e1..cc73b714630` (pass with nits; the update-only test case
was added after it).
Docs-only follow-up after the advisory, requested by Mike: `b4e76543df2`
adds audit log guidance for prompt changes to the platform controls page
and an update-only custom role note to the organizations page. Codex
reviewed it (item 6). No UAT covers it, and the code is unchanged since
`618bff67c75`. The deferred claim that the Instructions page path is
outdated was wrong, so it's dropped. Item 7 removed the audit log
guidance again; the custom role note stays.
## Soft-deleted organizations
UAT found that a soft-deleted organization's prompt stays readable and
writable by UUID. This is inherited behavior, not new exposure:
`ExtractOrganizationParam` resolves UUIDs without a deleted filter, so
the sibling organization chat routes (MCP servers, model overrides,
models) behave the same. The same `chat_model_config` RBAC still
applies, nobody gains access to another organization, and writes are
audited.
## Deferred (owner: Mike)
- A failed refresh right after a successful save shows the previous
value with an error alert, so a further edit from that view starts from
the old text (Codex round 4, UAT round 2). Trigger: reports of stale
values after saving on unreliable networks.
- Update-only custom roles can save over the API, but the card stays
hidden without read access. Trigger: a customer uses such a role.
- Soft-deleted organization access by UUID, above. Trigger: the platform
starts rejecting deleted organizations in `ExtractOrganizationParam` or
purging their configuration.
- A contrived "code word" instruction was refused as possible prompt
injection; neutral instructions work. Trigger: reports of ignored
organization instructions.
- UX polish: there is no retry action after a failed first load, the
save toast can cover Cancel, there is no unsaved-changes guard, the
oversize error omits the limit, and whitespace-only text clears the
prompt without notice. Trigger: the next settings UX pass.
- Docs: the 413 response and organization name paths are undocumented.
Trigger: the next Coder Agents docs pass.
- Test audit nits: a redundant `waitFor` and an optional read-only plus
refetch story. Trigger: the next change to these tests.
> Xum, an AI coding agent, implemented, tested, and opened this PR on
behalf of @ibetitsmike.
|
||
|
|
3f408825b5 |
docs: add playback controls and descriptions to autoplaying videos (#30263)
## Summary Four docs pages embed autoplaying, looping screencasts with no controls, so readers cannot pause them (WCAG 2.2.2, Level A). This adds `controls` and `muted` to each `<video>` and a one-sentence text description after each video. The renderer-side companion for the beta docs is coder/docs-engine#203. ## Changes - Add `controls` and `muted` to the `<video autoplay playsinline loop>` tag in `external-auth.md`, `open-in-coder.md`, `ai-coder/agents/index.md`, and `compute-engine.md`. `autoplay`, `playsinline`, and `loop` stay. - Add a one-sentence description of each screencast directly below it. - `extending-templates/external-auth.md` is not in `docs/manifest.json`, so it is unpublished. It is fixed for consistency. ## Testing - `pnpm lint-docs` (markdownlint-cli2): 0 errors across 519 files. - `make lint/emdash`, `go run ./scripts/docshtmlcheck`, `go run ./scripts/styleclaims`: pass. - The repo pre-commit hook passed. - Not run: rendering the pages in a browser. The descriptions are inferred from the surrounding prose and file names, not from watching the videos. Linear: [DOCS-1050](https://linear.app/codercom/issue/DOCS-1050) _Generated by Coder Agents on behalf of @nickvigilante._ |
||
|
|
bb9f31d94b |
fix: apply Anthropic prompt caching through OpenRouter and OpenAI-compatible gateways (#29563)
Anthropic models configured through an `openrouter` provider (and, by
the same code path, `vercel` and generic `openai-compat` providers)
never got prompt caching. Two independent gaps: chatd only emitted
`cache_control` breakpoints when the fantasy client was `anthropic`, and
even when a client sent them, the AI Gateway chat-completions
interceptor rebuilt the upstream body from typed
`openai.ChatCompletionNewParams` and silently dropped the unknown key.
Dogfood UAT on main @
|
||
|
|
7f3d35353e |
docs: add chat automations documentation (#30220)
Closes CODAGT-1216 Part of CODAGT-1135 Adds an early-access page for chat automations in Coder Agents: `docs/ai-coder/agents/automations.md`. It covers enabling the `chat-automations` experiment and the `off` experiment rule as the operator kill switch, webhooks (endpoint, bearer secret, 256 KiB JSON body, responses, single and multi use, rotation), schedules (cron and time zone, server previews, no catch-up, Run now), **When busy**, the `manage_automations` tool and heartbeats, the per-owner cap and the queue share, and the accepted risks (spend, silent failures, prompt injection). It also adds the manifest entry (early access, after Chat Sharing), a glossary entry, a `manage_automations` row in the built-in tools table, and a link from the experiment-gated features list in Platform Controls. The page documents the code as built on this stack, not the RFC, where they differ. Notable differences: reasoning effort is only offered for new chat targets; schedules accept an occurrence up to 60 seconds late and never replay older ones; the dashboard has no delete control, so delete is documented through the API; `manage_automations` never returns webhook secrets. Dogfood UAT followed the page step by step on a `develop.sh` instance built from this branch (experiment rule on and off, webhook creation and curl deliveries with the documented status codes we could trigger, schedule previews and Run now, the Manage automations switch), and passed. <details> <summary>Where the page's claims come from</summary> | Claim | Source | |---|---| | Experiment name, user-scoped | `codersdk/deployment.go` (`ExperimentChatAutomations`, `ExperimentsUserScoped`) | | Behavior when the experiment is off | `coderd/exp_chat_automations.go` (`requireChatAutomations`, events handler), `coderd/x/chatd/automation_schedules.go` (scan skips owners, keeps cursors) | | Management routes and fields | `coderd/coderd.go`, `codersdk/chatautomations.go`, `coderd/x/chatd/automations.go` (validation) | | Owner-only update, enable, rotate, run | `coderd/x/chatd/automations.go` (`ErrAutomationOwnerOnly`) | | Webhook endpoint, 256 KiB limit, responses | `coderd/exp_chat_automations.go` (events handler, `writeChatAutomationError`), `coderd/exp_chats.go` (`maxChatRequestBodyBytes`) | | Event data wrapping | `coderd/x/chatd/automations_publish.go` (`automationEventText`) | | Rotating a used single-use webhook returns 409 | `coderd/x/chatd/automations.go` (`RotateAutomationSecret`), `AutomationWebhookFields.tsx` (button hidden) | | Events rate limit | `coderd/httpmw/ratelimit.go` (`RateLimitByEndpointKey`), `--api-rate-limit` default 512 | | Cron, time zone, previews | `coderd/schedule/cron/cron.go`, `coderd/exp_chat_automations.go` (`chatAutomationNextRunCount = 5`, schedule preview) | | 30 s scan, 60 s grace, no catch-up | `coderd/x/chatd/automation_schedules.go` (`automationScheduleInterval`, `automationScheduleGrace`) | | When busy, queue share | `coderd/x/chatd/automations_publish.go` (busy check, `max(1, MaxQueuedMessagesPerChat/2)`), `codersdk/chats.go` (default 20) | | manage_automations gating and containment | `coderd/x/chatd/automations_tool.go`, `coderd/exp_chats.go` (`manage_automations_enabled` checks), `AgentChatInput.tsx` | | Per-owner cap | `codersdk/deployment.go` (`--chat-max-automations-per-owner`), `codersdk/chats.go` (default 50) | | Skipped and missed log messages | `coderd/x/chatd/automation_schedules.go` | | Audit fields | `enterprise/audit/table.go` (`prompt` and `webhook_secret_hash` are secret) | Identifiers kept off the page because the reader never types or receives them: `queue_generation`, `schedule_revision`, `schedule_next_run_at`, and the internal error names above. </details> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ --------- Signed-off-by: Thomas Kosiewski <tk@coder.com> |
||
|
|
a3fbd2384d |
feat: add the Agents automations list page and chat-list automation filter (#30171)
Closes CODAGT-1213. Part of CODAGT-1135 (Automations for Coder Agents,
RFC step 7).
Adds an Automations list to the Agents UI and an `automation_id` filter
on the chat list, so users can see their automations and find the chats
an automation created or wrote to.
## Changes
- **Chat-list filter:** `GET /api/v2/chats?automation_id=<uuid>` returns
root chats whose `chats.automation_id` matches (chats the automation
created) and chats with a non-deleted message whose
`chat_messages.automation_id` matches (chats it wrote to). The nil UUID
is rejected, because the query uses it as "no filter". It is honored
only when the `chat-automations` experiment is on for the caller;
otherwise it is ignored, as the RFC says, and the evaluator runs only
when the parameter is present. Chat authorization is unchanged. Swagger
documents the parameter, and `codersdk.ListChatsOptions` gains
`AutomationID`. The existing partial indexes back the filter.
- **List page:** `/agents/automations`, with an **Automations** sidebar
entry. Both are hidden when the experiment is off for the viewer
(per-user experiment list). The page lists the automations of the
organization selected in the Agents organization picker; it shares the
stored selection with the new-chat form and has its own picker. Columns:
name (with the creating chat for agent-created automations), trigger
(cron and time zone, or webhook single or multi use), target (chat link,
"New chat each run", or a **Missing target** badge for a deleted or
archived target), next run from the server's `next_run_times`, an
enabled switch (PATCH; a non-owner cannot re-enable), **Run now** (owner
only, schedules only, disabled for a missing target and while another
run is pending), and **View chats** (owner only; a paged dialog backed
by the new filter). Chat titles are looked up only for the viewer's own
automations. The list refetches every minute so the next run stays
current. On mobile, the chats header links to the page, which opens full
width with a back link. A Run now failure, such as `409` for a busy chat
with skip or `429` for a full queue or share, shows the server message
in an alert above the table.
- Out of scope, per the ticket: the **Last skipped run** column, and the
editor (CODAGT-1214). The empty state points to the API because the
`manage_automations` tool is not in this stack yet.
## Validation
- Go: `TestListChats/AutomationFilter` covers:
- created and written-to chats, deleted messages, and another user's
chat;
- an unknown id, a malformed id (`400`), and the nil UUID (`400`);
- the experiment turned off by a per-user rule, where the parameter is
ignored, including a malformed id.
- Vitest (`AgentAutomationsPage.test.tsx`), all asserting requests:
- the selected organization's list is requested, and switching the
picker refetches and stores the choice;
- the switch sends `PATCH {enabled:false}`;
- Run now sends its POST when the server answers `409` or `429`;
- View chats requests `?automation_id=`, and Load more requests the next
page;
- nothing is requested with the experiment off.
- Storybook (Pixel): `WithAutomations`, `OtherOwner`, `Empty`,
`MissingTarget`, `RunNowError`, `ChatsDialog`,
`ChatsDialogLoadMoreError`, `Loading`, `RefetchError`, `ListError`, and
`ChatsSidebar/MobileWithAutomations`.
- Remote dogfood UAT: PASS in round 1 (`fa60a15767`) and round 2 on the
current head `b37e9d99d0`. Round 2 repeated every criterion and verified
the review fixes. Screenshots are in the comments below.
- `coder-frontend-review` self-review: every role passes after fixes on
each update, except two items:
- the experiment-off test waits for the not-found page only as a sync
point before asserting that no request was sent;
- there is no story for a chat-title lookup error, because the Storybook
query helper cannot inject errors.
- Codex review: 4 rounds (8, 4, 4 and 6 P2 findings, no P0 or P1).
- Rounds 1 to 3 were fixed, except the model-availability item
(CODAGT-1244).
- Round 4 found no blocker and is tracked in CODAGT-1246, together with
the minor UAT round 2 findings.
- All threads are resolved. There is no clean Codex verdict on the
current head. Further rounds were not requested because findings were
not converging and none was a blocker; the stack orchestrator accepted
stopping at round 4.
- CI: `ci` run 36703512580, started with workflow_dispatch, is green on
the current head `b37e9d99d0`. Pushes to existing stacked PRs did not
start the pull_request `ci` run (noted in the comments). The earlier
head `8f2ee30d8f` was green through a normal pull_request run.
Size: about 1,370 hand-written lines (about 560 of them tests and
stories), plus generated code. This is over the 1,000-line guideline,
mostly from review fixes.
## Stack
Stacked on #30085, #30096, #30112, #30117, #30127, #30134, #30160,
#30166 and #30167 (CODAGT-1215). Base:
`tk/codagt-1215-automations-chat-labels`, merged in (not rebased).
Follow-ups: CODAGT-1244, CODAGT-1246.
---
_Generated with [`xum`](https://github.com/coder/xum) • Model:
`anthropic:claude-opus-5-5` • Thinking: `high`_
|
||
|
|
ff158c0589 |
feat: preserve user-supplied chat titles (#29486)
Chats created through the API or MCP couldn't be given a title, and automatic title generation could overwrite a title the user had set, at creation or by renaming during generation. #30254 tried to keep renames by comparing title text, but text can't tell a user title from a generated one that has the same text. Chat creation over the API and MCP now accepts a title. Each chat records where its title came from: fallback (derived from the prompt), generated, or user. A title can only be replaced by a title from the same source or a higher one, so automatic generation never overwrites a user's title. Title changes no longer reorder the chat list, and clients apply them in the order they were written. Chats created before this change are treated as having fallback titles. Closes CODAGT-1047 Reverts #30254 |
||
|
|
1bb77bb765 |
docs: drop task-list checkboxes from the Chats migration guide (#29856)
## Merge order Standalone; no dependency on the other DOCS-977 PR (configuration reference TOC/callout). ## Summary Tracy and Ian flagged mixed emoji checkboxes and bullets in the docs (Slack thread linked from DOCS-977). This PR removes the one remaining task-list checklist in scope: the "Quick checklist" in the Tasks-to-Chats migration guide. Each `- [ ]` item becomes a plain bullet with the same wording, so nothing renders as a checkbox. Out of scope, per DOCS-977: - `docs/about/contributing/templates.md` — the contributing docs are moving out of the docs (coder/coder#29751). - Every child page of `docs/get-started/` — Nick is retiring them. Neither has any other task-list syntax in the repo, confirmed with a repo-wide grep. ## Fix `docs/ai-coder/agents/tasks-to-chats-migration.md`: converted the 8-item "Quick checklist" from GFM task-list items (`- [ ]`) to plain `-` bullets. The checklist verifies independent parts of the integration (not a sequence), so it stays a bullet list rather than becoming numbered steps. ## Testing - `pnpm exec markdownlint-cli2 --fix docs/ai-coder/agents/tasks-to-chats-migration.md` — 0 errors. - Manual read of the diff: wording unchanged, only the checkbox marker removed. ## QA The page renders as plain bullets under "Quick checklist," with no checkbox glyphs. ## Upstream No. This is Coder product/content documentation, not a Fumadocs engine change. Linear: [DOCS-977](https://linear.app/codercom/issue/DOCS-977/docs-replace-emoji-checkboxes-and-emoji-headings-with-one-icon-style) --- 🤖 Built with AI assistance. --------- Co-authored-by: Ian Evans <5760366+ianjevans@users.noreply.github.com> |
||
|
|
1fd383e4fd |
docs: flatten lone index pages to single files (#30129)
The beta docs engine turns a directory that holds only an `index.md` into an empty collapsible section in the sidebar. Two pages on `main` have that shape: `docs/admin/external-auth/index.md` and `docs/ai-coder/agents/tools/index.md`. docs-engine is handling the shape in its own code (the sidebar render fix in https://github.com/coder/docs-engine/pull/196 and the sync-side handling in https://github.com/coder/docs-engine/pull/195), and this change removes it at the source by moving each page to a flat file: `docs/admin/external-auth.md` and `docs/ai-coder/agents/tools.md`. Both directories held only `index.md`, with no images or other files. The change updates the two `docs/manifest.json` paths, 29 inbound relative links across 17 pages, and the relative links inside the moved pages (three images and two page links in `external-auth.md`, one page link in `tools.md`), which now resolve one directory up. The ESR upgrade table in `docs/install/operate/upgrade/esr-2.29-2.34-upgrade.md` is re-padded because its link cells shrank, which is why that file shows 28 changed lines. No generator under `scripts/`, the docs-preview workflow, or `docs/.style` references either path. Published URLs stay the same, so no redirect is needed. coder.com's `convertPathToRoute` strips the `index.md` or `.md` suffix, the docs-preview workflow's `map_doc_path` maps `<dir>/index.md` and `<dir>.md` to the same route, and docs-engine's `mapMdPath` returns `admin/external-auth` and `ai-coder/agents/tools` for both the old and new paths. For verification, `docs/manifest.json` parses and all 471 of its paths exist. `make pre-commit-light` passes, which covers markdownlint, the table formatter, typos, emdash, and shellcheck, and `go run ./scripts/docshtmlcheck` passes. A local script resolved all 306 relative links in the changed files, and every one that the move touched points at an existing file and heading. linkspector runs on this PR in CI. A backport PR for `release/2.37` moves the same two pages plus `admin/licensing` and `install/other`: https://github.com/coder/coder/pull/30130. This change was prepared with AI assistance. The AI agent that prepared it ran the checks described above. --- 🤖 Built with AI assistance. |
||
|
|
4a62b0fc9c |
docs: add YAML front matter to remaining pages (#30115)
## Summary Add YAML front matter to the remaining published documentation pages so all published pages expose a title through front matter. ## Changes - Add front matter to the 13 published pages that were missing it. - Preserve the page titles and feature states in the manifest. - Remove duplicate H1 headings where the front matter supplies the page title. ## Testing - `pnpm check-docs` passed. - Repository pre-commit checks passed. - Verified all 439 published manifest route entries have YAML front matter. Depends on #30109. Refs DOCS-1124. This pull request was generated by Coder Agents. |
||
|
|
c2d243891f |
docs: remove feature states from page titles (#30109)
## Summary Remove feature-state suffixes from page titles and H1s, keeping availability states in `docs/manifest.json` navigation metadata. ## Changes - Remove Premium and Beta suffixes from eight page titles. - Update the docs content guidelines and doc-check skill to require state metadata instead of title suffixes. - Preserve the existing `premium` and `beta` state values in `docs/manifest.json`. ## Testing - `pnpm check-docs` passed. - Verified all eight affected manifest entries retain their feature state and no affected title retains a state suffix. Refs DOCS-1126. This pull request was generated by Coder Agents. --------- Co-authored-by: Ian Evans <5760366+ianjevans@users.noreply.github.com> |
||
|
|
d40e24cf7d |
docs: nest the CLI reference by subcommand (#29956)
## Summary Nests the CLI reference by subcommand so the Command Line sidebar collapses from 156 flat entries to 49 top-level verbs. Each page's URL follows the invocation, its page title is the full command as inline code, and its sidebar label is only its own verb as inline code. | | Before | After | | --- | --- | --- | | File | `docs/reference/cli/oauth2-provider_dcr_disable.md` | `docs/reference/cli/oauth2-provider/dcr/disable.md` | | URL | `/reference/cli/oauth2-provider_dcr_disable` | `/reference/cli/oauth2-provider/dcr/disable` | | Page title (front matter) | `oauth2-provider dcr disable` | `` `coder oauth2-provider dcr disable` `` | | Sidebar label (manifest) | `oauth2-provider dcr disable` | `` `disable` `` | Resolves DOCS-140 (coder/coder half). Also fixes the Makefile part of DOCS-1073 / DOCS-912, which this change depends on. ## Changes - `scripts/clidocgen`: pages nest by command path. A command with visible subcommands becomes its directory's `index.md`, so `oauth2-provider/index.md` and `oauth2-provider/dcr/index.md` sit above `oauth2-provider/dcr/disable.md`. Subcommand table links are relative to the parent page. - `scripts/clidocgen`: the manifest "Command Line" section is built from the command tree (nested, sorted by name, hidden commands skipped) instead of a flat list. The redundant `coder` child that pointed back at `reference/cli/index.md` is gone. - `Makefile`: the CLI rule now replaces `docs/reference/cli/` wholesale, so stale pages get removed. The manifest rule now runs `clidocgen -manifest-only` on top of the API staging manifest, so the CLI nav is generated instead of edited by hand. As a result, the nine pages that had no nav entry (`ai-gateway*`, `secret enable/disable`, `server fix-oidc-links`) now have one. - `scripts/configdocgen` and 48 prose pages: links point at the new paths (for example `reference/cli/server.md` is now `reference/cli/server/index.md`). ## How to review/QA this PR - `docs/reference/cli/**/*` (approximately 190 pages): Each of these pages are generated automatically. Some pages appear deleted, and some pages appear new. Every deleted page corresponds to a new page somewhere else, so no information is being deleted. The docs in this section should adhere to the following, so a test in the build preview for each of these items should be satisfactory: - [ ] Each subcommand of a command gets nested as a child instead of being displayed as a flat list. - [ ] Each parent command is stored in an `index.md` file. - [ ] The title of each page inside the page should now feature the full `coder XYZ` command. - [ ] The title of each page inside the page should now be formatted as inline code. - [ ] The title of each page in the sidebar should be the most granular subcommand of the whole command string (if the page's title is `coder ai-gateway keys create`, the sidebar label is `create`). - [ ] The title of each page in the sidebar should now be formatted as inline code. - [ ] The page slug for each page is now the most granular subcommand. - [ ] All links now point to the correct page. - `docs/manifest.json`: The changes here reflect the updated structure of the `docs/reference/cli` section. - `docs/**/*.md` outside of `docs/reference/cli/**/*` (approximately 50 pages): The extent of the changes in these pages are just updating the paths to point to the new page locations. - [ ] The links on the page all point to the correct new path in `docs/reference/cli`. - `scripts/clidocgen` (4 files): This is the Go code responsible for generating everything inside of `docs/reference/cli/**/*`. A typical code review here should be satisfactory. - `scripts/configdocgen` (2 files): these two files just have updates to the raw `.md` path used by `docs/admin/setup/configuration-reference.md` and updates the tests to reflect that. - `Makefile`: This updates the `make` targets for generating the CLI docs to fit the new structure. ## Merge ordering Without the renderer PRs deployed, both docs sites show literal backticks in titles and sidebar labels. Without the redirects, the old flat URLs return 404. 1. Deploy before merging this PR: coder/docs-engine#176 (beta-docs renders these titles as inline code) and coder/coder.com#1111 (classic docs renders them as inline code). Both are safe to ship first, because titles without backticks render as before. 2. Merge this PR. 3. Merge coder/coder.com#1112 (redirects from the old flat URLs) only once this content reaches the mainline release branch that serves unversioned `/docs`. ## Testing - `go test ./scripts/clidocgen/ ./scripts/configdocgen/ ./scripts/docshtmlcheck/`: pass. New tests cover page paths, subcommand links, the nested manifest, and front matter quoting. - `make docs/reference/cli/index.md docs/manifest.json docs/admin/setup/configuration-reference.md`, then a forced rerun: the second run produced no diff. - Checked the manifest: all 164 CLI entries resolve to a file, no page is missing a nav entry, and everything outside "Command Line" is byte-identical. - Relative `.md` links across `docs/`: 0 broken, same as `main`. - `make pre-commit` and `make pre-push`: pass. On earlier pre-push attempts, different unrelated vitest files timed out under host load. Those files pass when run alone, and the final push passed with `PARALLEL_JOBS=1`. <details> <summary>Implementation plan and decision log</summary> **Goal (from DOCS-140 and the requester):** URLs follow the command hierarchy. Pages are titled with the full command, and sidebar entries with the last verb only. Both are formatted as inline code. **Contract with the renderers:** a title wrapped entirely in one pair of backticks (``^`[^`]+`$``) renders as inline code. Plain-text consumers (`<title>`, meta, search, llms corpus) strip the backticks. Page title comes from front matter `title`, and the sidebar label from the manifest node `title`. **Decisions** - A parent command is `dir/index.md` rather than a sibling `dir.md`. The root CLI page is already `index.md`, and both docs-engine and the legacy coder.com renderer map `x/index.md` to `/x`. - The manifest is built from the command tree, not from the written files, so ordering is deterministic and the nesting matches the pages exactly. - The manifest discard bug (DOCS-1073 item 1) is fixed here, because without that fix the generated nested manifest would never reach the tree. DOCS-1073 items 2 through 4 (a prose fix and a hidden-command policy) are out of scope. - `-manifest-only` keeps the existing parallel `make gen` layout: the API rule still owns `_gen/manifest-staging.json`, and CLI regeneration doesn't retrigger swag. - The renderer and redirect work lives in the companion PRs in coder/docs-engine and coder/coder.com. It is linked above and not duplicated here. </details> --- > [!NOTE] > Generated by Coder Agents on behalf of @nickvigilante. |
||
|
|
d43dd98baf |
docs: rewrite gerund-leading headings and page titles (#30049)
Rewrites the headings and page titles that `Coder.GerundHeading` flags as gerund-leading, using the imperative for tasks and the noun form for concepts. This PR covers only changes that don't rename a page slug. ## Changes - Rewrites 121 in-page headings, bringing `Coder.GerundHeading` findings in `docs/` to zero. - Adds an empty `<a id="old-slug"></a>` above each renamed heading, so existing bookmarks and inbound deep links still land on the section. The legacy IDs were computed with the same slugger the classic renderer uses (`rehype-slug`), and all 115 that exist on production today match the live `id` attributes; the other 6 are on pages not published yet. - Updates the 18 in-docs links that targeted old anchors to use the new slugs, and the link text that quoted the old heading. - De-gerunds seven page titles (frontmatter and `manifest.json`) whose slugs don't change, for example `Upgrading Best Practices` to `Upgrade best practices`. - Scopes a Vale exception around the glossary term `Coding agent`, where "Coding" is an adjective. ## Not in this PR - **Pages with gerund slugs** (`creating-templates`, `getting-started`, `working-with-dev-containers`, `cloning-git-repositories`, `configuring-okta`, and others) keep their current titles, so the title and slug change together in the slug-rename PR. The redirects for those renames come in a third PR. - **Links outside `docs/`** to old anchors (Go notification strings, an applied SQL migration, golden files, and the generated `prometheus.md`) still target old slugs. They keep working through the legacy anchors, and updating them would need code changes. ## Known limitation `coder/docs-engine` prefixes raw-HTML `id` attributes with `user-content-` (DOM-clobbering protection), and inbound deep links aren't rewritten. Once the docs move to docs-engine, these legacy anchors resolve only as `#user-content-<old-slug>` unless docs-engine adds a fragment fallback. They work on the current coder.com renderer and on GitHub. ## Testing - `vale --filter='.Name=="Coder.GerundHeading"' docs`: zero findings, down from 122. - `make lint/markdown`, `make lint/docs-html`, `make lint/emdash`, and the pre-commit hook: all pass. - Scripted check that every relative `#fragment` link into a changed file resolves to a heading slug or a legacy anchor (177 links). - Scripted check that no legacy ID collides with a heading slug on the same page, and that no untouched heading's duplicate-suffix slug shifted. <details> <summary>Heading renames and legacy anchors (121)</summary> | File | Old heading | New heading | Legacy anchor | | --- | --- | --- | --- | | `admin/integrations/opentofu.md` | Using a custom Terraform binary | Use a custom Terraform binary | `#using-a-custom-terraform-binary` | | `admin/monitoring/connection-logs.md` | Capturing/Exporting Connection Logs | Capture and export connection logs | `#capturingexporting-connection-logs` | | `admin/monitoring/metrics.md` | Setting up metrics | Set up metrics | `#setting-up-metrics` | | `admin/networking/port-forwarding.md` | Accessing workspace ports | Access workspace ports | `#accessing-workspace-ports` | | `admin/networking/port-forwarding.md` | Sharing ports | Share ports | `#sharing-ports` | | `admin/networking/port-forwarding.md` | Configuring port protocol | Configure port protocol | `#configuring-port-protocol` | | `admin/networking/workspace-proxies.md` | Running on Kubernetes | Run on Kubernetes | `#running-on-kubernetes` | | `admin/networking/workspace-proxies.md` | Running on a VM | Run on a VM | `#running-on-a-vm` | | `admin/networking/workspace-proxies.md` | Running as a system service | Run as a system service | `#running-as-a-system-service` | | `admin/networking/workspace-proxies.md` | Running in Docker | Run in Docker | `#running-in-docker` | | `admin/networking/workspace-proxies.md` | Selecting a proxy | Select a proxy | `#selecting-a-proxy` | | `admin/security/audit-logs.md` | Capturing/Exporting Audit Logs | Capture and export audit logs | `#capturingexporting-audit-logs` | | `admin/security/audit-logs.md` | Purging Old Audit Logs | Purge old audit logs | `#purging-old-audit-logs` | | `admin/security/database-encryption.md` | Enabling encryption | Turn on encryption | `#enabling-encryption` | | `admin/security/database-encryption.md` | Rotating keys | Rotate keys | `#rotating-keys` | | `admin/security/database-encryption.md` | Disabling encryption | Turn off encryption | `#disabling-encryption` | | `admin/security/database-encryption.md` | Deleting Encrypted Data | Delete encrypted data | `#deleting-encrypted-data` | | `admin/security/secrets.md` | Displaying Secrets | Display secrets | `#displaying-secrets` | | `admin/setup/data-retention.md` | Keeping Data Indefinitely | Keep data indefinitely | `#keeping-data-indefinitely` | | `admin/setup/index.md` | Migrating from the built-in database to an external database | Migrate from the built-in database to an external database | `#migrating-from-the-built-in-database-to-an-external-database` | | `admin/setup/index.md` | Configuring Coder behind a proxy | Configure Coder behind a proxy | `#configuring-coder-behind-a-proxy` | | `admin/setup/telemetry.md` | Toggling | Turn telemetry on or off | `#toggling` | | `admin/templates/creating-templates.md` | Disabling the template builder | Turn off the template builder | `#disabling-the-template-builder` | | `admin/templates/extending-templates/agent-metadata.md` | Managing the database load | Manage the database load | `#managing-the-database-load` | | `admin/templates/extending-templates/docker-in-workspaces.md` | Authenticating with a Private Registry | Authenticate with a private registry | `#authenticating-with-a-private-registry` | | `admin/templates/extending-templates/index.md` | Running scripts on workspace lifecycle | Run scripts on workspace lifecycle events | `#running-scripts-on-workspace-lifecycle` | | `admin/templates/extending-templates/parameters.md` | Validating parameters | Validate parameters | `#validating-parameters` | | `admin/templates/extending-templates/prebuilt-workspaces.md` | Invalidating prebuilds | Invalidate prebuilds | `#invalidating-prebuilds` | | `admin/templates/extending-templates/prebuilt-workspaces.md` | Managing resource quotas | Manage resource quotas | `#managing-resource-quotas` | | `admin/templates/extending-templates/prebuilt-workspaces.md` | Managing prebuild provisioning queues | Manage prebuild provisioning queues | `#managing-prebuild-provisioning-queues` | | `admin/templates/extending-templates/prebuilt-workspaces.md` | Preventing resource replacement | Prevent resource replacement | `#preventing-resource-replacement` | | `admin/templates/extending-templates/prebuilt-workspaces.md` | Preventing prebuild queue contention (recommended) | Prevent prebuild queue contention (recommended) | `#preventing-prebuild-queue-contention-recommended` | | `admin/templates/extending-templates/process-logging.md` | Configuring custom templates to use workspace process logging | Configure custom templates to use workspace process logging | `#configuring-custom-templates-to-use-workspace-process-logging` | | `admin/templates/extending-templates/process-logging.md` | Viewing workspace process logs | View workspace process logs | `#viewing-workspace-process-logs` | | `admin/templates/extending-templates/process-priority.md` | Verifying the feature is enabled | Verify the feature is enabled | `#verifying-the-feature-is-enabled` | | `admin/templates/extending-templates/resource-metadata.md` | Hiding resources in the dashboard | Hide resources in the dashboard | `#hiding-resources-in-the-dashboard` | | `admin/templates/extending-templates/resource-metadata.md` | Using a custom resource icon | Use a custom resource icon | `#using-a-custom-resource-icon` | | `admin/templates/extending-templates/resource-ordering.md` | Using "order" property | Use the "order" property | `#using-order-property` | | `admin/templates/extending-templates/resource-persistence.md` | Disabling persistence | Turn off persistence | `#disabling-persistence` | | `admin/templates/index.md` | Extending templates | Extend templates | `#extending-templates` | | `admin/templates/managing-templates/change-management.md` | Testing and Publishing Coder Templates in CI/CD | Test and publish Coder templates in CI/CD | `#testing-and-publishing-coder-templates-in-cicd` | | `admin/templates/managing-templates/index.md` | Creating templates | Create templates | `#creating-templates` | | `admin/templates/managing-templates/index.md` | Editing templates | Edit templates | `#editing-templates` | | `admin/templates/managing-templates/index.md` | Updating templates | Update templates | `#updating-templates` | | `admin/templates/troubleshooting.md` | Debugging the startup script | Debug the startup script | `#debugging-the-startup-script` | | `admin/users/groups-roles.md` | Creating custom roles | Create custom roles | `#creating-custom-roles` | | `admin/users/index.md` | Configuring SSO | Configure SSO | `#configuring-sso` | | `admin/users/index.md` | Resetting a password on Kubernetes | Reset a password on Kubernetes | `#resetting-a-password-on-kubernetes` | | `admin/users/quotas.md` | Establishing Costs | Establish costs | `#establishing-costs` | | `admin/users/quotas.md` | Establishing Budgets | Establish budgets | `#establishing-budgets` | | `admin/users/sessions-tokens.md` | Creating tokens with scopes | Create tokens with scopes | `#creating-tokens-with-scopes` | | `ai-coder/agent-firewall/index.md` | Getting Started with Agent Firewall | Get started with Agent Firewall | `#getting-started-with-agent-firewall` | | `ai-coder/agent-firewall/index.md` | Viewing Audit Logs | View audit logs | `#viewing-audit-logs` | | `ai-coder/agent-firewall/nsjail/k8s.md` | Running without user namespaces | Run without user namespaces | `#running-without-user-namespaces` | | `ai-coder/agent-firewall/version.md` | Using Coder Before v2.30.0 with Claude Code Module v4.7.0+ | Coder before v2.30.0 with Claude Code module v4.7.0+ | `#using-coder-before-v2300-with-claude-code-module-v470` | | `ai-coder/agent-firewall/version.md` | Using Claude Code Module Before v4.7.0 | Claude Code module before v4.7.0 | `#using-claude-code-module-before-v470` | | `ai-coder/agents/getting-started.md` | Providing feedback | Provide feedback | `#providing-feedback` | | `ai-coder/agents/models.md` | Managing personal API keys | Manage personal API keys | `#managing-personal-api-keys` | | `ai-coder/agents/models.md` | Removing a personal key | Remove a personal key | `#removing-a-personal-key` | | `ai-coder/agents/models.md` | Using an LLM proxy | Use an LLM proxy | `#using-an-llm-proxy` | | `ai-coder/agents/platform-controls/git-providers.md` | Checking logs | Check logs | `#checking-logs` | | `ai-coder/ai-gateway/audit.md` | Navigating the UI | Navigate the UI | `#navigating-the-ui` | | `ai-coder/ai-gateway/audit.md` | Conducting a forensic audit | Conduct a forensic audit | `#conducting-a-forensic-audit` | | `ai-coder/ai-gateway/clients/jetbrains.md` | Using the AI Assistant | Use the AI Assistant | `#using-the-ai-assistant` | | `install/operate/upgrade/best-practices.md` | Diagnosing liveness probe issues | Diagnose liveness probe issues | `#diagnosing-liveness-probe-issues` | | `install/operate/upgrade/best-practices.md` | Recovering from failed database migrations | Recover from failed database migrations | `#recovering-from-failed-database-migrations` | | `install/operate/upgrade/esr-2.24-2.29-upgrade.md` | Upgrading | Upgrade recommendations | `#upgrading` | | `install/operate/upgrade/esr-2.29-2.34-upgrade.md` | Upgrading | Upgrade recommendations | `#upgrading` | | `install/prepare/licensing.md` | Adding your license key | Add your license key | `#adding-your-license-key` | | `install/server/cloud/azure-vm.md` | Creating and Uploading Your First Template | Create and upload your first template | `#creating-and-uploading-your-first-template` | | `install/server/cloud/compute-engine.md` | Configuring the control plane | Configure the control plane | `#configuring-the-control-plane` | | `reference/releases.md` | Installing stable | Install stable | `#installing-stable` | | `start/first-workspace.md` | Creating your first coder workspace | Create your first Coder workspace | `#creating-your-first-coder-workspace` | | `start/local-deploy.md` | Setting up a Coder deployment | Set up a Coder deployment | `#setting-up-a-coder-deployment` | | `tutorials/best-practices/organizations.md` | Managing Organizations at Scale | Manage organizations at scale | `#managing-organizations-at-scale` | | `tutorials/example-guide.md` | Adding Photos | Add photos | `#adding-photos` | | `tutorials/example-guide.md` | Setting the author data | Set the author data | `#setting-the-author-data` | | `tutorials/example-guide.md` | Setting up the routes | Set up the routes | `#setting-up-the-routes` | | `tutorials/persistent-shared-workspaces.md` | Finding shared workspaces | Find shared workspaces | `#finding-shared-workspaces` | | `tutorials/reverse-proxy-caddy.md` | Getting started | Get started | `#getting-started` | | `tutorials/reverse-proxy-caddy.md` | Generating wildcard certificates | Generate wildcard certificates | `#generating-wildcard-certificates` | | `tutorials/reverse-proxy-nginx.md` | Adding Coder deployment subdomain | Add the Coder deployment subdomain | `#adding-coder-deployment-subdomain` | | `tutorials/testing-templates.md` | Creating the headless user | Create the headless user | `#creating-the-headless-user` | | `user-guides/desktop/desktop-connect-sync.md` | Accessing web apps in a secure browser context | Access web apps in a secure browser context | `#accessing-web-apps-in-a-secure-browser-context` | | `user-guides/desktop/index.md` | Testing Your Connection | Test your connection | `#testing-your-connection` | | `user-guides/desktop/index.md` | Getting Help | Get help | `#getting-help` | | `user-guides/desktop/index.md` | Uninstalling | Uninstall Coder Desktop | `#uninstalling` | | `user-guides/devcontainers/index.md` | Getting started | Get started | `#getting-started` | | `user-guides/devcontainers/troubleshooting-dev-containers.md` | Finding your dev container agent | Find your dev container agent | `#finding-your-dev-container-agent` | | `user-guides/devcontainers/troubleshooting-dev-containers.md` | Getting more help | Get more help | `#getting-more-help` | | `user-guides/devcontainers/working-with-dev-containers.md` | Using the Coder CLI | Use the Coder CLI | `#using-the-coder-cli` | | `user-guides/devcontainers/working-with-dev-containers.md` | Using OpenSSH (config-ssh) | Use OpenSSH (config-ssh) | `#using-openssh-config-ssh` | | `user-guides/devcontainers/working-with-dev-containers.md` | Exposing ports on the parent workspace | Expose ports on the parent workspace | `#exposing-ports-on-the-parent-workspace` | | `user-guides/devcontainers/working-with-dev-containers.md` | Rebuilding dev containers | Rebuild dev containers | `#rebuilding-dev-containers` | | `user-guides/shared-workspaces.md` | Getting Started | Get started | `#getting-started` | | `user-guides/shared-workspaces.md` | Sharing your Workspace | Share your workspace | `#sharing-your-workspace` | | `user-guides/shared-workspaces.md` | Using a shared workspace | Use a shared workspace | `#using-a-shared-workspace` | | `user-guides/shared-workspaces.md` | Accessing workspace apps in shared workspaces | Access workspace apps in shared workspaces | `#accessing-workspace-apps-in-shared-workspaces` | | `user-guides/workspace-access/emacs-tramp.md` | Connecting To A Workspace | Connect to a workspace | `#connecting-to-a-workspace` | | `user-guides/workspace-access/emacs-tramp.md` | Using SSH | Use SSH | `#using-ssh` | | `user-guides/workspace-access/index.md` | Running remote commands with quoting | Run remote commands with quoting | `#running-remote-commands-with-quoting` | | `user-guides/workspace-access/jetbrains/gateway.md` | Configuring the Gateway plugin to use internal certificates | Configure the Gateway plugin to use internal certificates | `#configuring-the-gateway-plugin-to-use-internal-certificates` | | `user-guides/workspace-access/jetbrains/gateway.md` | Using an existing JetBrains installation in the workspace | Use an existing JetBrains installation in the workspace | `#using-an-existing-jetbrains-installation-in-the-workspace` | | `user-guides/workspace-access/port-forwarding.md` | Accessing workspace ports | Access workspace ports | `#accessing-workspace-ports` | | `user-guides/workspace-access/port-forwarding.md` | Sharing ports | Share ports | `#sharing-ports` | | `user-guides/workspace-access/port-forwarding.md` | Configuring port protocol | Configure port protocol | `#configuring-port-protocol` | | `user-guides/workspace-access/vscode.md` | Using the public extensions marketplaces | Use the public extensions marketplaces | `#using-the-public-extensions-marketplaces` | | `user-guides/workspace-access/vscode.md` | Adding extensions to custom images | Add extensions to custom images | `#adding-extensions-to-custom-images` | | `user-guides/workspace-access/vscode.md` | Installing extensions using its `vsix` file at the command line | Install extensions using a `vsix` file at the command line | `#installing-extensions-using-its-vsix-file-at-the-command-line` | | `user-guides/workspace-access/vscode.md` | Installing from a marketplace at the command line | Install from a marketplace at the command line | `#installing-from-a-marketplace-at-the-command-line` | | `user-guides/workspace-access/vscode.md` | Using VS Code Desktop | Use VS Code Desktop | `#using-vs-code-desktop` | | `user-guides/workspace-access/web-terminal.md` | Accessing the Terminal | Access the terminal | `#accessing-the-terminal` | | `user-guides/workspace-lifecycle.md` | Stopping workspaces | Stop workspaces | `#stopping-workspaces` | | `user-guides/workspace-lifecycle.md` | Deleting workspaces | Delete workspaces | `#deleting-workspaces` | | `user-guides/workspace-management.md` | Creating workspaces | Create workspaces | `#creating-workspaces` | | `user-guides/workspace-management.md` | Updating workspaces | Update workspaces | `#updating-workspaces` | | `user-guides/workspace-management.md` | Updating via the CLI | Update with the CLI | `#updating-via-the-cli` | | `user-guides/workspace-management.md` | Starting and stopping workspaces | Start and stop workspaces | `#starting-and-stopping-workspaces` | | `user-guides/workspace-management.md` | Repairing workspaces | Repair workspaces | `#repairing-workspaces` | | `user-guides/workspace-scheduling.md` | Working hours | Work schedule | `#working-hours` | | `user-guides/workspace-scheduling.md` | Basing solely on activity detection | Rely solely on activity detection | `#basing-solely-on-activity-detection` | </details> <details> <summary>Plan</summary> The de-gerund work ships as three PRs: 1. This PR: in-page headings and page titles that do not require a page slug rename. 1. Page slug renames for pages whose filenames are gerunds. 1. Redirects for the renamed slugs. Heading rewrites follow the style guide section "No gerund-leading headings": imperative for task headings, noun form for concept headings, sentence case, and "turn on"/"turn off" instead of "enable"/"disable" per word-choice guidance. The legacy anchor sits on its own line above the heading (with a blank line between) rather than inside the heading, so it does not leak into heading text, TOC entries, or Fumadocs slugs. </details> --- _Generated by Coder Agents on behalf of @nickvigilante._ |
||
|
|
88aa2cc373 |
feat: enable Coder.UnitSpacing (#29944)
## Summary
Adds `Coder.UnitSpacing`, a Vale rule that enforces the style guide's
[non-breaking space between number and
unit](https://github.com/coder/coder/blob/main/docs/.style/style-guide/numbers-units-and-dates.md#non-breaking-space-between-number-and-unit)
policy.
Until now, the guide pointed at `Google.Units (planned)`, but that rule
accepts a regular space, so it can't enforce the policy.
Resolves [DOCS-1072](https://linear.app/codercom/issue/DOCS-1072).
## Changes
- **Cleanup commit**: replaces the regular space (or missing space) with
` ` in 189 prose findings across 55 files. One config default,
`(default: 15s)`, moves to code font instead, as the guide requires for
configuration values. One table row that was realigned also swaps a
pre-existing en dash for a hyphen, since `lint/emdash` checks changed
lines.
- **Enable commit**: adds `docs/.style/styles/Coder/UnitSpacing.yml` at
`warning`, updates the enforcement footer in
`numbers-units-and-dates.md`, and updates the coverage tables in the
style guide README.
- **Reflow commit**: every hard-wrapped paragraph the cleanup touched
(45 paragraphs in 29 files) is rewrapped to one sentence per line.
Joining lines exposed units split across a line break, which now use
` `, and two em dashes on rewritten lines are reworded.
- **Rule fix commit**: the token now matches ASCII whitespace, including
a newline, between the number and the unit, so a hard-wrapped paragraph
can't hide a missing ` `. The class is spelled out because Vale's
`\s` is Unicode and would match U+00A0. Vale can't locate a match that
spans list indentation or a blockquote marker, so splits there still go
unreported.
- **Rule count sync**: the tooling paragraph in the style guide README
now reads 79 rules, 9 tool-checked, to match the coverage table. The 79
corrects drift already on `main` since #29758; the 9 is this PR's new
rule.
- `.vale.ini` turns the rule off for pages generated from Go source:
`docs/reference/{api,cli}/*.md`, `configuration-reference.md`, and
`prometheus.md`. That text comes from flag descriptions, Swagger
comments, and metric help text, which also render outside Markdown,
where ` ` would show up literally.
<details>
<summary>Rule design decisions</summary>
- An `existence` rule matches `\d+(\.\d+)?` followed by a regular space
or no space, then a unit from a curated list (time, data size,
bandwidth, frequency, vCPU/CPU/cores).
- Vale renders Markdown before matching, so ` ` and a literal
U+00A0 both pass. Code spans and fences are skipped.
- Hyphenated compound modifiers (`12-hour clock`) don't match, because
the token allows only a space or nothing between the number and the
unit.
- Exceptions cover HTTP status plurals (`413s`) and decades (`1990s`).
- Severity is `warning`, because the unit list is curated and a count
followed by a unit-like word can still be a judgment call.
- Alternative considered: a `BlockIgnores` pattern for the `<!-- Code
generated ... -->` regions. I didn't use it because it would silence
every rule in those regions, not just this one.
</details>
## Testing
- Ran the rule against fixtures: `30 seconds`, `150ms`, `4 vCPU` in a
table, and `16` / `GB` split across lines in a paragraph all flag.
`30 seconds`, literal U+00A0, `12-hour`, `413s`, `1990s`, and ``
`30s` `` don't.
- `vale docs/` reports 0 `Coder.UnitSpacing` findings, and the counts
for every other rule match `main`.
- A scratch config with `Coder.OneSentencePerLine` turned on reports 0
findings on changed lines.
- `make lint/markdown`, `make lint/style-claims`, `make lint/emdash`,
and the `pre-commit-light` hook pass.
<details>
<summary>CI flake note</summary>
`Storybook` failed on
|
||
|
|
8ff3175299 |
feat: prefill the Coder Agents composer from a prompt link (#29943)
Integrations and docs can now send users to a new Coder Agents chat with a message already written: `/agents?prompt=<url-encoded text>`. - The text fills the new-chat composer. Nothing is sent until the user selects **Send**. - The page moves `prompt` out of the address bar into the router's history state, in the same navigation that already handles `?debug_workspace_build=` (#29811). Other query parameters stay, and a reload of that entry shows the prompt again. - A warning inside the composer, with a warning ring, asks the user to take care before running a prompt that came from a link, since any website can build one. It clears once the user edits the prompt. - The saved draft is untouched. New chat afterwards shows the draft, including when New chat is clicked directly on the prefilled page. The layout now reads the deep link state (shared `utils/deepLinkState.ts`) so it no longer clears the draft in that case. Debug links keep the existing behavior, because they can fall back to the draft-backed composer. - The debug link wins when both parameters are present. A blank `prompt` is ignored. - No experiment flag, because integrations need a stable URL. Documented in `docs/ai-coder/agents/getting-started.md`. Tests: Vitest coverage for prefill-then-send, URL cleanup with history state, debug link precedence, and New chat keeping the draft after a prompt link and clearing it after a debug link. The `PromptLink` and `PromptLinkEdited` stories cover the warning visually. Remote dogfood UAT through Coder Agents passed on the implementation head (sign-in redirect, reload, draft handling, edge cases such as `+`, malformed encoding and HTML-looking text). Known pre-existing behavior on `main`, unchanged here: New chat on a plain `/agents` page clears the saved draft but leaves its text on screen, so a reload shows an empty composer. --- <details> <summary>📋 Implementation Plan</summary> # Plan: `?prompt=` link for the Coder Agents new-chat page **Goal.** Opening `/agents?prompt=<url-encoded text>` shows the new-chat page with that text already in the message box (the composer). The user reviews it and clicks Send. Nothing is sent automatically. **Base.** Branch `agents-prompt-deeplink`, created from `origin/main` at `702b13112d`. The change reuses the link code that #29811 added for `?debug_workspace_build=<build-id>`. ## Decisions 1. **Name the parameter `prompt`, not `q`.** Elsewhere in Coder, `q` means a search filter. 2. **Fill in only; never send.** There is no `submit` option. 3. **Reuse the #29811 flow.** It works in five steps: 1. `AgentCreatePage.tsx` reads the parameter. 2. It removes the parameter from the address bar with a `replace` navigation. 3. It carries the value in `location.state`, the router's per-entry history state. 4. It builds an `AgentCreatePrefill` from the value. 5. `useEmptyStateDraft(prefill.message)` puts the text in the editor. It doesn't touch the user's saved draft. 4. **Show a one-line notice** above the composer: "This prompt came from a link. Review it before you send it." Any website can put text in this link, so the user should read it before sending. The debug link carries only a build ID, so it has no notice. 5. **Set no length limit in the browser.** See the rationale below. 6. **Don't put it behind an experiment flag, and document it.** Integrations need a stable URL. `/agents` itself has no flag today (`site/src/router.tsx:828`). 7. **The debug link wins.** `prompt` applies only when no debug link is active. Both parameters are removed from the URL in one navigation. 8. **Ignore an empty or whitespace-only `prompt`.** The page shows the normal composer. Out of scope: `workspace=` or `model=` parameters, the embed page, and existing chat pages (`/agents/:id`). ## Steps ### 1. Tests first (they should fail) Add two tests to `site/src/pages/AgentsPage/AgentCreatePage.test.tsx`. Copy the setup of the #29811 tests: `renderWithAuth(<AgentCreatePage />, { path: "/agents", route, extraRoutes })` with `vi.spyOn(API.experimental, ...)`. - **"prefills the prompt from a prompt link and sends it only on Send."** Use the route `/agents?prompt=${encodeURIComponent("Fix the flaky test\nin a & b = c")}`. 1. Check that the textbox named "Chat message" has that text. 2. Check that `createChat` has not been called and no file was uploaded. 3. Click Send. 4. Check that `createChat` was called once with that text. - **"moves the prompt out of the URL so New chat gets a plain composer."** Copy the debug-link test with the same name. Use the route `/agents?archived=archived&prompt=hi`. 1. Check `router.state.location` against `{ search: "?archived=archived", state: { prompt: "hi" } }`. 2. Navigate to `/agents`. Check that the composer has no prefilled text. → verify: both tests fail on the current code because the textbox is empty and `prompt` is still in the URL. ### 2. Implement (the tests should pass) In `site/src/pages/AgentsPage/AgentCreatePage.tsx`: 1. Add `promptSearchParam = "prompt"`. 2. Replace `DebugLinkState` and `readDebugLinkState` with `DeepLinkState = { debugWorkspaceBuildId?: string; prompt?: string }` and one reader function. 3. Set `linkPrompt` from the URL parameter, or from the value in `location.state` after the parameter is removed. Keep it only if it isn't blank and no debug link is active. 4. **Extend the existing effect** at lines 102 to 116 so one `navigate` removes both parameters and saves both values in state. Don't add a second effect: each effect would rebuild the URL from the same snapshot and put the other parameter back. The frontend pattern FE8 also says to avoid effects where possible. 5. Build the prefill as `debugPrefill ?? (linkPrompt ? { message: linkPrompt } : undefined)`. 6. Give the form a `key`: - the build ID for a debug link; - `` `prompt:${linkPrompt}` `` for a prompt link; - `"draft"` otherwise. A new link then resets the form. 7. Show the notice when a prompt link is active. Reuse the `Alert` component that `DebugWorkspaceBuildAlert` uses, and place it next to that alert (line 221). In `site/src/pages/AgentsPage/components/AgentCreateForm.tsx`: 1. Make `AgentCreatePrefill.attachment` optional (line 74). 2. Handle a missing attachment in the `prefillFile` initializer (lines 581 to 587). Don't add `useMemo` or `useCallback`: the React Compiler handles that in `AgentsPage`. → verify: `cd site && pnpm test src/pages/AgentsPage/AgentCreatePage.test.tsx src/pages/AgentsPage/components/AgentCreateForm.test.tsx` passes, including the tests #29811 added. ### 3. Story for the visual check Add a `PromptLink` story to `site/src/pages/AgentsPage/AgentsPageLayout.stories.tsx`, next to `DebugWorkspaceBuildLoading` (line 1100). It shows the notice and the filled composer. Its `play` function has no assertions (frontend pattern FE1). → verify: `pnpm test:storybook src/pages/AgentsPage/AgentsPageLayout.stories.tsx` passes. Take a screenshot of the story from `pnpm storybook --no-open`. ### 4. Docs In `docs/ai-coder/agents/getting-started.md`, add a section "### Link to a new chat with a prompt" after "Use the API for programmatic automation" (line 204). Cover: - the URL format, built with `encodeURIComponent`, and one example; - that the link only fills in the message, and the user still clicks Send; - that the link survives sign-in; - that links should not contain secrets, because URLs end up in logs and browser history. `docs/manifest.json` doesn't change. → verify: `pnpm run format-docs && pnpm run lint-docs` finish clean. Check the section against `docs/.style/style-guide/README.md`. ### 5. Gates before commit 1. Run `cd site && pnpm check && pnpm lint && pnpm format`, plus the tests above. 2. Review the diff with the `frontend-review` skill (FE1 to FE10). 3. Commit with the hooks on. `make pre-commit` runs from the hook. ## Dogfooding 1. **Start the server.** Run `CODER_DEV_PORT_OFFSET=true ./scripts/develop.sh` detached and save its PID. - Use the web UI (Vite) URL printed in the startup banner. - Don't use `.coderv2/url`: it can serve an older build of the frontend. 2. **Set up the instance.** 1. Log in as `admin@coder.com` / `SomeSecurePassword!`. 2. Add a provider at `/ai/settings/providers` and a model at `/ai/settings/models`. Without a model, the composer is disabled. 3. On `/agents`, type "my draft" and leave the page, so a saved draft exists. 3. **Check with agent-browser.** 1. Open `<vite>/agents?prompt=<encoded "Fix the flaky test\nline 2 & more = ok 🚀">`. The snapshot should show: - the decoded text in the composer; - no `prompt` in the address bar; - the notice; - no new chat in the sidebar. Take a screenshot. 2. Reload the page. The prompt should appear again, because it is kept in history state (the debug link behaves the same way). 3. Edit the text and click Send. The page should move to `/agents/<id>`, and the first message should be the edited text. 4. Click New chat. The composer should show "my draft". 5. Log out. In a fresh session, open the link, then log in. The composer should show the prompt. 4. **Save the evidence.** - Screenshots of checks 1, 4 and 5, attached with `attach_file`. - One short WebM video of checks 1 to 3, recorded in a fresh session. agent-browser recordings freeze after about two navigations, so keep it short. 5. **Clean up.** Stop `develop.sh` by its PID and confirm its ports are free. ## Acceptance criteria 1. `/agents?prompt=<encoded>` shows the decoded text in the composer, with newlines, `&`, `=` and emoji intact. 2. No chat is created until the user clicks Send. 3. `prompt` is removed from the address bar and other parameters stay. New chat shows the normal composer, and the saved draft is unchanged. 4. A reload shows the link's prompt again, the same way the debug link does. 5. The notice appears only for prompt links. 6. The link works after the sign-in redirect, for both password and OAuth login. 7. An empty `prompt` shows the normal composer. The debug link works as before and wins when both parameters are present. 8. The unit tests, story, docs checks and pre-commit all pass. If a PR is requested, use the title `feat: prefill the Coder Agents composer from a prompt link`. It has no scope because the change touches both `site/` and `docs/`. <details> <summary>Why no length limit, and what the sign-in check covers</summary> - **No length limit.** A limit doesn't stop hidden text: even a short prompt can push lines below the visible part of the box. The real protections are that nothing sends without a click and that the notice asks the user to read the text. Browsers and reverse proxies already limit URL length. The server caps the create-chat request body at 256 KiB (`coderd/exp_chats.go:79`), so a very long prompt fails when sent. - **Sign-in.** `RequireAuth` sends the user to `/login?redirect=<encoded path and query>`. Password login returns through `sanitizeRedirect`, and OAuth login returns through `SafeRedirectPath`. On both paths, the query is decoded exactly once, so `%26` stays inside the prompt. Existing tests cover query preservation (`site/src/utils/redirect.test.ts`, `LoginPage.test.tsx`), so no new test is needed. Dogfooding check 5 confirms it end to end. </details> </details> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ --------- Signed-off-by: Thomas Kosiewski <tk@coder.com> |
||
|
|
d853893e8a |
feat: filter agent chats by chat status (#30009)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. The sidebar's `Chat status` filter only offered `Read`/`Unread`. This turns it into a real status filter backed by the `chat_status` enum, the same value the row icon already shows. Stacked on #30006. - New `status:<waiting|running|error|requires_action|interrupting>` search filter (repeated or comma-separated) plus a `chat_statuses` param on `GetChats`. - Sidebar `Status` submenu offers `Requires action`, `Error`, `Working` and `Idle`; `Working` covers `interrupting`, since stopping a turn is too brief to be worth its own option. A full selection emits no filter. - `Unread` moves out to its own checkbox (`unread=true` in the URL), so it narrows a status selection instead of competing with it. - Grouping by status now sections by the five statuses instead of `Unread`/`Read`, reusing `getChatStatusDisplay` for labels and icons. <img width="439" height="177" alt="image" src="https://github.com/user-attachments/assets/82ef2ef0-cde9-4169-bb29-caa7b9bfdb9e" /> |
||
|
|
f5092aaa4a |
feat: make chat limits configurable deployment options (#28927)
Adds deployment options for the chat limits that shape turn behavior and API acceptance, replacing hardcoded constants in `coderd/x/chatd` and the chat API. Defaults are unchanged. | Option | Default | Limit | |---|---|---| | `CODER_CHAT_MAX_STEPS_PER_TURN` | 1200 | steps (model responses) in a chat turn | | `CODER_CHAT_MAX_GENERATION_RETRIES` | 25 | consecutive retries after a model generation fails with a transient error | | `CODER_CHAT_MAX_QUEUED_MESSAGES_PER_CHAT` | 20 | messages that can be queued in a chat | | `CODER_CHAT_MAX_ATTACHMENTS_PER_CHAT` | 50 | files linked to a chat; linking more deletes the earliest uploads | | `CODER_CHAT_MAX_PROMPT_BYTES` | 131072 | system prompt, plan mode instructions, and each user's custom prompt | | `CODER_CHAT_MAX_CONCURRENT_RECORDING_UPLOADS` | 25 | desktop recordings each server stores at the same time | `codersdk.DefaultChat*` constants remain the single source of truth. Values below 1 fail startup validation, and each option's description ends with "Must be at least 1." `chatd.New` fills any zero field in `chatd.Config.Limits` with its default once, `LimitsFromConfig` is a plain conversion, and the code that receives a limit as a parameter (the `chatstate` queue and file link checks, the turn step check, `chatretry.Retry`, and `chatadvisor.NewRuntime`) returns an error for a limit below 1 instead of choosing a default or disabling the limit. The options are documented in the generated configuration reference and in the platform controls docs. `CODER_CHAT_MAX_GENERATION_RETRIES` counts consecutive retries, and the count resets after each successful step. The default allows 25 retries (26 attempts) where the old constants allowed 24. The same limit now applies to each nested advisor model call and to background title, summary, and turn status label generation, which previously used fixed `chatretry` budgets. Chat creation and tool result bodies keep the fixed 256 KiB limit from main. The prompt-saving endpoints accept bodies up to twice the prompt limit, for JSON escaping and characters that sanitization removes, but never less than 256 KiB, so small prompt limits still return the 400 length error. At the default this equals the 256 KiB limit on main. Four settings from earlier revisions were removed, and the fixed limits from main are back: - `CODER_CHAT_MAX_TOOL_OUTPUT_BYTES`: the agent already keeps a 16 KiB head and a 16 KiB tail of command output, so raising it had no effect and lowering it cut the tail. - `CODER_CHAT_MAX_DYNAMIC_TOOLS_PER_CHAT`: tool definitions share the 256 KiB chat creation body limit, so raising the count did little. - `CODER_CHAT_DEBUG_MAX_BODY_BYTES`: one setting covered two unrelated debug caps. - `CODER_CHAT_DEBUG_MAX_TEXT_RUNES`: the name did not say what it applied to. Root and subagent concurrency caps stay fixed because they are licensing behavior, and `MaxChatFileSizeBytes` stays fixed because the web UI hardcodes the generated constant for client-side checks. `codersdk.MaxChatFileIDs` is removed; the web UI's "Attachment expired" tooltip no longer quotes the number because the cap is now per deployment, and it says that attaching a file beyond the limit permanently deletes the chat's earliest-uploaded attachments. ## Review record | Round | Reviewed head | Result | Disposition | |---|---|---|---| | Codex 1 and 2 (Sep 2 to 3) | `7f10a1572f8`, `8ee09f8fa3b`, `197bb78d5b` | 10 findings, then OK on `197bb78d5b` | all threads resolved | | Codex 3 (Sep 17) | `e4efac249a5` (pre-rebase) | 4 findings | advisor retry limit confirmed and fixed in `9e462b7b3d0` (rebased from `67341e458e8`); ARCHITECTURE.md TODOs added; JSON-escaping body sizing and streamed-argument rune cap declined as pre-existing design (evidence in threads) | | Codex 4 (Sep 18) | `9e462b7b3d0` | 6 findings | recording evicted at attachment cap 1 confirmed and fixed in `5b61895decb`; `Limits` field docs and zero-value fallback documented; prompt retro-enforcement, generated multi-sentence lines, and tool-output truncation metadata declined as pre-existing design (evidence in threads) | | Codex 5 (Sep 18) | `5b61895decb` | 1 finding | over-cap batch of already-linked files accepted after lowering the cap: confirmed and fixed in `f44063e74e5` | | mafredri (Sep 23) | `f44063e74e5` | 24 threads, changes requested | all fixed in `05e3e3d622a`, `c1f78e09e8b`, `709ddb67977`, `d0587a49829`, `ca4347b24de`, and `1f6c9e2a46f`, then answered and resolved; the ARCHITECTURE.md text was written at the author's direction and approved by the author | | Sibling sweep (Sep 24) | `1f6c9e2a46f` | author-requested audit of all 24 mafredri threads for sibling issues, plus a test refactor | fixed in `37eaf07d34d` through `1f14ac041b7`: the advisor retry limit, `chatretry.Retry`, and the turn step check reject values below 1 instead of disabling retries or the limit; limit tests run against both the default and configured values set through `chatd.Config` or `DeploymentValues`; the expired-attachment tooltip is concrete. A required coder-frontend-review run (8 roles in one agent, CD re-run once) found a stale story comment, removed. | | Codex 6 (Sep 27) | `a71383e3a31` | OK, no findings | requested after the rebase at the author's direction, past the six-pass review budget | The branch was rebased onto main `4851c7b60c8` on Sep 27; the previous head was `91b84000adb`, and the earlier SHAs in the review record predate the rebase. Conflicts in the `chatstate` transitions and `CreateChat` keep both main's `InitialStatus` and this PR's `MaxFileLinks`, and main's rewrite of `advisor_internal_test.go` in #28754 keeps main's version plus this PR's limit tests. Two tests added on main needed the new retry arguments: `TestGenerateStructuredTitleWithUsage_FallsBackToTextWhenToolChoiceRejected` and `TestAdvisorRunStreamsReasoningDeltasSeparatelyFromAdvice`. Validation on `a71383e3a31`: the pre-commit hook (generation, golangci-lint, build), the full `coderd/x/chatd/...` suite (20 packages), the chat tests in `codersdk`, `coderd`, and `enterprise/coderd`, the CLI help tests, race-detector runs of the `chatd`, `chatstate`, `chatadvisor`, and `chatretry` packages, and `go build` plus `go vet` on each of the 27 commits. No remote UAT was run. > Xum acted on behalf of @ibetitsmike for this pull request. |
||
|
|
4f2fd36e8f |
feat: add pr_status:none filter for chats without a pull request (#30006)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. Adds `none` to the `pr_status` chat filter, matching chats with no linked pull request. Stacked on #30005. - `none` means no diff-status row, or a row whose `pull_request_state` is null/empty (so chats whose PR was cleared still match), and it ORs with the other statuses, e.g. `pr_status:none,open`. - Frontend picks it up from the shared `CHAT_LIST_PR_STATUS_ORDER`, shown as `No PR`; `searchQuery.ts` now derives its valid set from that list instead of a duplicated literal. - Swagger, API docs and the `list_chats` tool schema regenerated/updated. <img width="508" height="464" alt="image" src="https://github.com/user-attachments/assets/bd6c70e3-c634-499d-ae16-e7953f6da2f9" /> |
||
|
|
6826da9397 |
feat: restore agents-access as a default organization role (#30004)
Restores `agents-access` (**Coder Agents User**) as a built-in organization role and adds it to every organization's `default_org_member_roles`. Members keep Coder Agents by default, and admins can now restrict it per organization by removing the role from the defaults and granting it through IdP role sync or direct assignment. Since #28186, chat permissions lived in the organization-member floor, so the only way to limit Coder Agents was narrowing per-model access lists, which did not hide the feature. - Migration 000602 appends `agents-access` to every organization's defaults, so upgrading keeps every member's access. New organizations get it from `rbac.DefaultOrgMemberRoles()`. - Service accounts do not inherit the role from the defaults (`GetAuthorizationUserRoles`), so they still need an explicit grant for chat. - Owners and Organization Admins keep chat access regardless of defaults. Chats shared with a user stay readable without the role. - Role sync is unchanged. It does not store default roles, so after the default is removed a mapped user gets `agents-access` at their next sign-in. - The retired-role mechanism (`IsRetiredRoleName`) is removed. - `PATCH /api/v2/organizations/{organization}` rejects duplicate `default_org_member_roles` entries (the CLI already de-duplicated them). - Custom organization role requests treat built-in role names case-insensitively, since custom role names are stored lowercase and `Agents-Access` would otherwise become an undeletable shadow of the built-in role. - The Agents permission alert tells restricted members their chats are kept, and the model selector for users without chat permission no longer claims that no models are configured. Docs add "Control who can use Coder Agents" to the Agents getting-started guide. **NOTE**: Migration 000602 deletes custom roles named `agents-access`, which the built-in role would shadow. The down migration does not restore them. Stored member grants of `agents-access` from the earlier built-in role or a deleted custom role stay and now grant chat access. ## Validation - Remote dogfood [UAT](https://dogfood.cdr.dev/agents/e1c18dc6-f6f0-49a1-b6cd-6ce014b51a86) passed on |
||
|
|
b55f721f24 |
fix: apply user-supplied AWS Bedrock API keys instead of dropping them (#28724)
## Bug
Under `/agents/settings/api-keys`, a personal API key saved for a
Bedrock provider never took effect. AI Gateway forwarded the saved
value, but the Bedrock interceptors re-signed every request with the
deployment's AWS credentials (SigV4), overwriting the `Authorization`
header. The key was silently dropped, so users were unknowingly still
billed to the administrator's AWS account with no way to bring their own
credentials.
## Fix
Apply the user's Bedrock key instead of discarding it. AWS Bedrock API
keys are bearer tokens (`Authorization: Bearer <key>`), so when a
personal key is present AI Gateway now sends it as a bearer token and
skips SigV4 signing. This covers every Bedrock route:
- **InvokeModel** (`/v1/messages`): applies the same wire transform as
the signed path (`/model/{model}/invoke[-with-response-stream]`,
`anthropic_version`, `anthropic-beta` → body, `model`/`stream`
stripping) but sets a bearer `Authorization` header instead of signing.
- **Mantle** (`/v1/messages`, `/v1/responses`, `/v1/chat/completions`):
passthrough with a bearer `Authorization` header instead of signing.
The bearer paths resolve no deployment AWS credentials, so BYOK works
even where the deployment has none. Requests without a personal key keep
the existing SigV4 behavior.
This also reverts the earlier interim guard that hid the key field and
rejected Bedrock key upserts: the field is shown again and the API
accepts the keys, because they now work.
<details>
<summary>Implementation notes</summary>
**Gateway (`aibridge`)**
- `messages.newMessagesService` detects BYOK on a Bedrock interception
and routes it through bearer-token option builders instead of the SigV4
path.
- `withBedrockInvokeModelBYOKOptions` /
`bedrockInvokeModelBearerMiddleware` reimplement the Anthropic SDK's
`bedrock.WithConfig` wire transform without signing, because that helper
couples the transform with SigV4 and would resolve deployment
credentials a BYOK request must not depend on.
- `bedrocksig.BearerMiddleware` is shared by the Messages, Responses,
and chat-completions interceptors for the Mantle passthrough; each
installs it in place of `SignMiddleware` when the credential is BYOK.
- Streaming decoding is unchanged: the Bedrock event-stream decoder is
registered by the SDK package's `init` and selected by response
content-type, independent of `bedrock.WithConfig`.
**coderd / SDK / frontend / docs**
- Removed the interim guard and `supports_user_api_key` capability flag;
restored the API-key field for Bedrock providers.
- Docs describe the Bedrock personal key as an AWS Bedrock API key
forwarded as a bearer token for every model family Bedrock serves.
**Tests**
- Unit: bearer middleware transform + auth for InvokeModel; shared
bearer middleware; option-builder validation.
- Integration: end-to-end through the bridge for InvokeModel, Mantle
Messages, Mantle Responses, and Mantle chat completions, asserting
`Authorization: Bearer <key>`, no `X-Amz-*` headers, correct upstream
path/model, no `X-Api-Key` leak, and that InvokeModel streaming decodes
real AWS binary event-stream frames.
- coderd: Bedrock key upserts succeed.
</details>
Closes
[CODAGT-699](https://linear.app/codercom/issue/CODAGT-699/bedrock-provider-settings-for-byok-only-expose-one-api-key).
---
*This PR was generated by Coder Agents on behalf of @f0ssel.*
|
||
|
|
4b3c2b3ca3 |
docs: remove the User spend page from AI Gateway docs (#29844)
## Description Remove the **User spend** page from the AI Gateway and spend management docs, since the page is hidden from the sidebar and marked experimental for this release. The removed content is commented out with a TODO so it can be restored once the page leaves experimental. Related to [internal Slack thread](https://codercom.slack.com/archives/C04M9CNGHGF/p1790190171687059?thread_ts=1790190121.005749&cid=C04M9CNGHGF). ## Changes - Comment out the **User spend** page in the dashboard visibility table and spend details lists in `cost-controls.md` and `spend-management.md`. > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
f64ccfb836 |
feat: add experimental inline MCP servers (#29546)
Closes CODAGT-1131 Fifth PR in the inline MCP servers stack, on top of #29520. A chat owner can now declare MCP servers by URL and headers on their own chat, and chatd connects to them every turn alongside the org-configured ones. They go in a new `inline_mcp_servers` field on `POST /api/v2/chats` and `POST /api/v2/chats/{chat}/messages`, which replaces the whole set (omit to keep, `[]` to remove). Root chats only. `GET /api/v2/chats/{chat}` returns them, with the URL blanked for non-owners and header values never returned. Subagents only get servers marked `allow_in_subagents`, a root chat in explore mode gets none, and a root chat in plan mode gets all of them. URLs must be `https`, or `http` to an IP literal in `CODER_MCP_ALLOWED_PRIVATE_CIDRS`. Header values have no minimum length, so anything under the redactor's 8 byte floor from #29518 is accepted but not redacted, which the docs call out. Every cap is exported from `codersdk`. It's behind the `chat-inline-mcp-servers` experiment, and the `--disable-chat-caller-supplied-tools` kill switch from #29466 covers it too. With either off, declaring servers gets a 403 and existing chats stop connecting to theirs, but `[]` still works so a client can detach. Load failures show up in the chat debug panel as failed connections, as do org servers with an invalid config. Docs are hand-written in `mcp-servers.md`. |
||
|
|
37295547b8 | feat: add default model picker to Coder Agents settings (#29470) | ||
|
|
4def4b480a |
docs(docs/ai-coder/agents/platform-controls): rename sandboxing guide to network isolation (#29847)
Renames the guide added in #29698 from "Sandboxing" to "Network isolation" in both places it appears: the `docs/manifest.json` entry and the `agent-isolation.md` heading. > Generated by Coder Agents on behalf of @bpmct. |
||
|
|
7555486351 |
docs(docs/ai-coder/agents/platform-controls): add agent isolation sandboxing guide (#29698)
Ports the sandboxing guide from coder-private's `prototype-agent-isolation-build-1` branch. Adds `docs/ai-coder/agents/platform-controls/agent-isolation.md` and registers it in `docs/manifest.json` under Platform Controls, tagged early access. 🤖 Generated with [Coder Agents](https://coder.com/docs/ai-coder/agents) |
||
|
|
5e41baf73c |
docs: normalize control plane, coderd, and coder server terminology (#28960)
Normalizes the three overlapping names for the thing that serves the Coder API and dashboard. This is step 1 of the Install/Deploy and Administration refactor ([DOCS-685](https://linear.app/codercom/issue/DOCS-685), [DOCS-738](https://linear.app/codercom/issue/DOCS-738)) and lands first because every later page depends on settled terminology. Resolves [DOCS-871](https://linear.app/codercom/issue/DOCS-871). ## The rule | Term | Means | Use when | |---|---|---| | control plane | The component that serves the Coder API and dashboard, brokers connections, and coordinates provisioners | Default in prose, diagrams, planning, sizing, security | | `coderd` | The process that implements it | Architecture internals, metrics, logs, flags, troubleshooting | | `coder server` | The literal CLI command | Only when the reader will type it | Retired: "the Coder server" as a name for the component, and "a service" as a standalone description of it. ## What changed - **`docs/.style/style-guide/word-choice.md`**: new "Naming Coder's components" rule, with do/don't examples. Also fixes a "Do" example on that page that itself used "the Coder server". - **`docs/reference/glossary.md`**: rewrote `coderd` and Control plane, added a `coder server` entry. The existing Control plane entry defined it as "the collective term for `coderd`, its provisioners, and its database", which made it indistinguishable from the Deployment entry two sections later. Control plane is now the component; Deployment remains the whole installation. - **65 pages** across `docs/admin`, `docs/install`, `docs/get-started`, `docs/tutorials`, `docs/user-guides`, `docs/ai-coder`, and `docs/about`: roughly 154 component-sense "Coder server" usages, 21 bare "the server" usages meaning the control plane, 3 "a service" descriptions, and 43 unbackticked `coderd` mentions in prose. - One real bug caught in passing: `docs/tutorials/best-practices/security-best-practices.md` documented `coderd server --disable-path-apps`, which is not a command. Now `coder server`. Generated files were not touched: `configuration-reference.md`, `prometheus.md`, `audit-logs.md`, `reference/cli/*`, `reference/api/*`, and the generated blocks inside `feature-stages.md`. Those still contain the retired term and need generator-side changes; see the deferred list below. ## Reviewer attention, please **Anchor changes.** 11 headings were renamed, so their fragments change. No in-repo link targets any of them (the one internal link that did was updated), but external deep links from tickets or blog posts would break, and fragments cannot be fixed with a redirect. Happy to revert any of these if you would rather they ride along with the page moves in [DOCS-869](https://linear.app/codercom/issue/DOCS-869), which changes those URLs anyway. <details> <summary>Renamed headings and their old fragments</summary> | File | Old fragment | New heading | |---|---|---| | `admin/networking/index.md` | `#coder-server` | `## Control plane` | | `install/index.md` | `#starting-the-coder-server` | `## Starting the control plane` | | `install/uninstall.md` | `#the-coder-server-binary-and-cli` | `## The Coder binary and CLI` | | `install/registry-mirror-artifactory.md` | `#step-5-configure-coder-server-or-provisioners` | `## Step 5: Configure the control plane or provisioners` | | `install/cloud/compute-engine.md` | `#configuring-coder-server` | `## Configuring the control plane` | | `get-started/index.md` | `#cant-start-coder-server-address-already-in-use` | ``### Can't start `coder server`: Address already in use`` | | `tutorials/external-database.md` | `#coder-server-fails-startup-with-...` | ``### `coder server` fails startup with ...`` | | `tutorials/faqs.md` | `#how-do-i-change-the-access-url-for-my-coder-server` | `## How do I change the access URL for my control plane?` | | `tutorials/best-practices/security-best-practices.md` | `#coder-server` | `## Control plane` | | `tutorials/best-practices/security-best-practices.md` | `#server-logs-and-audit-logs` | `### Control plane logs and audit logs` | | `tutorials/best-practices/scale-coder.md` | `#coder-server`, `#how-to-capture-coder-server-metrics-with-prometheus` | `## Control plane`, `### How to capture control plane metrics with Prometheus` | </details> **One deliberate deviation from the issue.** DOCS-871 proposed reserving "sub-agent" for the Coder Agents sense and using "devcontainer agent" for the workspace sense. I did not make that change. The glossary already disambiguates with "Sub-agent (Coder Agents)" and "Sub-agent (dev containers)", and "devcontainer agent" would violate the existing dev container spelling rule in the same style guide, which requires "dev container" as two lowercase words. The current split reads correctly and costs no churn. Happy to revisit if you disagree. <details> <summary>Deferred, with reasons</summary> - **Generated content still says "Coder server".** `reference/cli/*` comes from Go command help text, `configuration-reference.md` from `configdocgen`, and `reference/api/*` from Swagger annotations. Fixing those means changing Go source, which belongs in its own PR so a docs review does not turn into a backend review. - **`validated-architectures/index.md` "also known as `coderd`"** is fixed here, but the page's larger problem is that it holds four documents in one file. That split is [DOCS-868](https://linear.app/codercom/issue/DOCS-868). - **"server flag" phrasing** in `admin/users/idp-sync.md` and `admin/users/oidc-auth/index.md` means `coder server` flags. Left alone; rewording those sentences is a copy edit, not a substitution. - **Metric and UI labels** such as "Dashboard-to-server latency" in `admin/networking/index.md`. Renaming risks diverging from what the dashboard shows. - **Pre-existing `Coder.GerundHeading` warnings** on headings this PR touches, and a "from from" typo in `scale-coder.md`. Out of scope for a terminology pass. - **Peer-sense "server"** in NAT traversal prose, where "client or server" describes the connection roles rather than the control plane. Needs restructuring, not substitution. </details> ## Verification | Check | Result | |---|---| | `make lint/emdash` | pass | | `make lint/markdown` | pass, 504 files, 0 errors | | `make lint/docs-html` | pass | | `make lint/prose` | pass, findings identical to the `main` baseline (1 intentional demo error, 145 warnings, 1 suggestion; only Vale's file ordering and one line-number shift in `glossary.md` differ) | | `make gen` | clean, no drift | | `make fmt/markdown` | applied | No redirects needed: no page moved or was renamed in this PR. <details> <summary>Merged main, 2026-09-14</summary> One conflict, in `docs/ai-coder/ai-gateway/providers.md`. Both hunks were text this PR had edited and `main` had since deleted in #29053, which removed env-based AI provider configuration: - The deprecated provider seeding note, which held a `coderd` backtick fix, is gone. Took `main`. - The failure-mode table lost its env-drift row. Took `main`'s two rows and reapplied the `coderd` logs wording. `main` also landed new prose carrying the retired terms, so the pass was extended to cover it: - `docs/admin/integrations/oauth2-provider.md`: two "the server log(s)" in the scope-enforcement sections added by #29144 are now "the `coderd` log(s)"; "a `scope` the server will not grant" is now "the control plane". - `docs/reference/cli/index.md` gained "the server" from #29104, and stays deferred as generated content. The new `docs/ai-coder/agent-relay/claude-code.md` needed no change, and no page `main` added links to a heading this PR renamed. </details> <details> <summary>Decision log for the wider refactor</summary> Agreed with @nickvigilante before implementation, recorded on DOCS-685 and in the Notion outline: 1. Feature stages and release channels move to Reference; ESR upgrade guides move under Operate. No new top-level Releases section. 2. `data-retention.md` moves to Administration > Security; `chat-lifecycle-hooks.md` moves into the Coder Agents docs. `admin/setup/` therefore survives as "Deployment configuration" and `configdocgen` is not touched. 3. Prepare is advisory, not a gate, framed as "don't know where to start? Start here", with lead times and owners per item. 4. One actor table, on the Install overview, spanning all five phases, noting that one person can be several actors and several people can be one actor. 5. The quickstart stays independent and is mentioned once, on the Install overview. The proposed `server/single-machine` page is dropped. 6. Coder Validated Architecture keeps its name in nav, defined in-page, with a glossary entry. 7. PR 3 is split: moves only, then prose, so the riskiest change reads as a pure rename diff. 8. For every PR that moves a page, the coder.com `redirects.json` change merges first. 9. There is no Download section and no CLI page in docs. Per-OS CLI steps live on coder.com/download and the Install overview links to it. </details> Generated with Coder Agents on behalf of @nickvigilante. |
||
|
|
c2f2c1708e |
feat: route and link the User spend page for its viewers (#28964)
Routes `/ai/settings/spend` to the spend page and opens it to its
viewers: a **User spend** entry in the AI settings sidebar, the **AI**
entry in the Admin settings menu, and the AI settings index redirect all
admit anyone who can read some organization's group members
(`canViewAISpend`, the same `group_member:read` check the endpoint
applies), so Owners, Auditors, Template Admins, User Admins, and
organization admins reach it the way organization MCP sharers already
do. Documents the page in the AI Gateway cost controls and spend
management guides.
## Why
This is the PR that makes the feature reachable; the spend page remains
unreachable until this merges. It also carries the head branch and
delivery record of the original single PR.
## What to scrutinize
- `canViewAISpend` is a pure entitlement-and-organization predicate.
Each of its three callers owns its query and loading/error behavior. The
Navbar and index redirect skip that query for viewers with site-wide AI
settings permissions. This repeats the short query wiring rather than
introducing a shared hook.
- `AISettingsSidebarView` keeps User spend as a direct navigation entry.
- The index redirect checks spend access last, after every existing
destination.
## Rework note
Rewritten in place on 2026-09-20 as the ninth layer of a nine-PR stack;
the head branch name predates the split. The original description and
the UAT delivery record through round 13 (PASS on
`e830cbf9937d17a0693909bd027cc142393ceef3`) are preserved in the first
comment below. That verdict applies to the pre-split head, not to this
rewritten commit.
## Validation
`pnpm test src/modules/management/AISettingsSidebar.test.tsx
src/modules/dashboard/DashboardLayout.test.tsx
src/pages/AISettingsPage/AISettingsIndexRedirect.test.tsx`, Storybook
`AISettingsSidebarView` (`SpendVisible`, `UserSpendActive`), repository
pre-commit (includes markdown lint for the docs).
## Delivery record
Composed head `d899228f798` passed format, check, full frontend lint,
125 targeted unit tests, and 86 story tests. Every layer passed
integration checks and the commit hooks. Pre-push hooks were skipped as
requested.
The eight-role frontend audit covered `2cb8fb35b12..1adb58ecbd6`.
Findings were fixed before publication: the picker stays mounted after
the initial retention load; its skeleton uses utility classes; vacuous
test loops and the unnecessary predicate comment were removed; and the
entitlement fixture was simplified. RO3 query-wiring duplication is
intentionally retained to keep the access check a pure function, as
requested.
| Audit role | Task | Disposition |
|---|---|---|
| Simplicity and frontend contract | `fff065b7b7` | No findings |
| Reuse | `30b7fde9ac` | RO3 nit accepted above |
| Accessibility | `3bfd41ce80` | SA1 and SA6 fixed |
| Comments | `4eacb22ea8` | CD2, CD3, CD5 fixed |
| Tests | `1b03411670` | Test coverage corrected; literal-model API
regressions pass |
| Types | `7ef176f55d` | Fixture cleanup and picker regression fixes
integrated |
| React | `4d259f8821` | No findings |
| Data flow | `2a897df255` | No findings |
The follow-up fixes were validated by the implementing agents and the
composed-tip checks, not a new independent review of this exact head. No
further Codex or human re-review was requested because the review budget
is exhausted. Live UAT has not been rerun on this head; round 14
exercised `926d489db6c` and remained BLOCKED on the spend-only
entitlement cycle. Round 15 was halted after shared-deployment contact.
No UAT pass is claimed for the current stack.
## Stack context
PR 9 of 9. The stack adds a **User spend** page under **Admin settings**
> **AI** > **User spend**: total and per-user AI Gateway spend for one
organization over a reporting period, read from `GET
/api/v2/organizations/{organization}/ai/spend/users` (#29129, merged).
It is #28964 split into one-concern PRs. Historical UAT covers earlier
heads only; live UAT has not been rerun after these review fixes. Bottom
to top: DateRangePicker limits, shared dimension badge, API client
method, spend table, page view, page container, reporting period,
dimension filters, route and navigation (#28964).
> Xum prepared this PR on behalf of @ibetitsmike.
|
||
|
|
60cc826f2b | feat: sign forwarded MCP identity headers (#29669) | ||
|
|
988520477e |
feat!: remove the experimental chat API mounts after the transition window (#29548)
Remove the `/api/experimental` duplicates of the promoted chat API. #28496 double-mounted the chat, organization chat and MCP server, member model-override, AI provider key, and MCP OAuth2 disconnect routes under both prefixes for the one-release compatibility window decided in CODAGT-921; that window closed with v2.37.0, so these routes now answer only on `/api/v2`. The change also deletes what existed only for the dual mount: the `chatAPIPrefix` plumbing, the shared cross-prefix files rate limiter (`RateLimitByAPICompatibilityEndpoint`), the 410 tombstones for the legacy `chats/providers` and `chats/user-provider-configs` collections with their `ExperimentalClient` SDK methods, and the `/providers` and `/user-provider-configs` 404 reservations on `/api/v2`. Signed chat file download URLs now point at `/api/v2`. Routes that were never promoted stay on `/api/experimental`: the experiment-gated `chats/config/advisor` and `chats/config/computer-use-provider`, `chats/{chat}/stream/desktop`, `chats/{chat}/debug/runs`, and the MCP OAuth2 callback, whose path is pinned as a registered redirect URI with external providers. The frontend already calls `/api/v2` for every promoted route, so only `typesGenerated.ts` changes. Because the experimental mount no longer reserves the removed collection segments, requests such as `GET /api/experimental/chats/models` now fall into the `{chat}` wildcard and return 400 instead of 404; the experimental prefix carries no stability guarantee and the compatibility window is over, so no new reservations were added. `coderd/x/chatd/ARCHITECTURE.md` now describes the single `/api/v2` mount and the remaining experimental routes, and its endpoint headings use the `/api/v2` paths. Closes CODAGT-922 (https://linear.app/codercom/issue/CODAGT-922/remove-experimental-chats-api-paths-after-transition-window). Refs #28496. ## Delivery record - Remote dogfood UAT (Coder Agents chat https://dogfood.cdr.dev/agents/c016b549-201a-4eca-a50f-3c0b7c339db6): verdict PASS on b008976a4dfba3524b220ca846ea3c3492e9cc9c. The branch was since rebased onto main (which had a duplicate migration 000596 until #29568) and gained one docs-only commit (`coderd/x/chatd/ARCHITECTURE.md` only); the current head |
||
|
|
2bf0f567d8 |
feat: add OpenAI Pro reasoning mode to chat model configs (#29584)
Adds `provider_options.openai.reasoning_mode` (`pro`) to chat model configs so admins can turn on OpenAI's Pro reasoning mode for a model, alongside the other OpenAI request options on the model form such as `service_tier`. The field is offered for any model on an OpenAI provider; the field description says Pro is supported from the GPT-5.6 Sol generation and that requests fail when Pro is set on a model that does not support it. There is deliberately no supported-model list anywhere: a newly released model that supports Pro works with no code change, and OpenAI rejects the request when the model does not. Validation rejects only values other than `pro`, non-OpenAI providers, and configs that explicitly force plain sampling (`reasoning_model=false`) or Chat Completions (`use_responses_api=false`), including partial updates that move a configured model onto such a provider or transport. A configured mode implies the Responses API and reasoning-model treatment when `openai_config` leaves those unset (`chatprovider.effectiveOpenAIConfig`), so an alias the pinned SDK has never seen, such as `gpt-daybreak-blue-latest`, still gets `effort` and `summary` and drops `temperature`. The same effective config feeds the client options and the recorded transport, so the two cannot disagree. The pinned fantasy OpenAI provider options do not carry `reasoning.mode`, so the mode is applied as a client-scoped `openai-go` request option when the model client is built rather than per call. The SDK merges pre-serialization `WithJSONSet` overlays by top-level key, so the key is escaped (`reasoning\.mode`) to add `mode` to the existing `reasoning` object instead of replacing `effort` and `summary`. `TestResolveModelCallReasoningModeWire` pins the resulting request body for streaming and non-streaming calls and checks that the fixed computer-use model does not inherit the mode; AI Gateway forwarding of the `reasoning` object is covered in `aibridge`. Because the option is bound to the model client, every call made through a Pro model config carries it, including title generation and quick generation when those fall back to the chat's model; deployments that want cheaper auxiliary calls should point the title generation override at another model. Frontend: the field renders through the existing schema-driven provider options with no hand-written field logic. Two generic changes: `visible_for_providers` is now honored for provider fields the way it already was for general fields (render and payload), so the OpenAI-scoped select does not appear or serialize for Azure, which shares the OpenAI field group; and the add/update model save toasts now carry the server's error detail, so a rejected combination such as Pro with Use Responses API at Off tells the admin which field to change. Docs: `docs/ai-coder/agents/models.md` gains a Reasoning Mode row in the OpenAI provider-specific options table (from the documentation check comment https://github.com/coder/coder/pull/29584#issuecomment-5752457808), and its Azure note now says Azure OpenAI lacks that one option. Not changed: `coderd/x/chatd/ARCHITECTURE.md`. Its OpenAI transport selection table needs a `reasoning_mode` row (client-applied, neither transport) to match `TestProviderOptionsTransportParity`; left for the human author. <details> <summary>Delivery record</summary> - Local validation on every pushed head: targeted Go tests (chatopenai, chatprovider, chatd wire test, aibridge integration test, coderd DB tests for persistence, invalid input, and partial updates), red/green on the wire test (injection removed, and unescaped key), Vitest (`modelConfigFormLogic`, `ModelForm`), Storybook tests for `ModelFormProviderConfig`, biome, tsc, oxlint, golangci-lint on touched packages, pre-commit hook. - Codex round 1 on `e7dbaefeafc`: 3 findings (Storybook assertions, ARCHITECTURE.md TODO, `gpt-daybreak-blue-latest` alias). Disposition: assertions moved to Vitest and alias accepted in `8fccf111111`; ARCHITECTURE.md left untouched by author instruction. Threads replied to and resolved. - Codex round 2 on `8fccf111111`: 1 finding (fixture naming, FE9), renamed in `23449e92317`. Round 3 on `23449e92317`: 1 finding (fixture location, FE9), moved to `testHelpers/chatModels.ts` in `c3bd5aa370f`. Round 4 on `c3bd5aa370f`: "Didn't find any major issues" (https://github.com/coder/coder/pull/29584#issuecomment-5735119236). All threads resolved. - Remote UAT round 1 (chat https://dogfood.cdr.dev/agents/f5ed1d16-be1d-4d39-952b-126a6a829ef1) exercised `e7dbaefeafc`: endorsed PASS. Real `gpt-5.6-sol` turns showed `"mode": "pro"` / `"standard"` / no key in the Debug tab with effort and summary intact; 14 POST and 6 PATCH rejections captured; UI select visibility, persistence, reload, and clearing verified. Low, non-blocking notes: the `gpt-5.6` alias revert in the model identifier field is pre-existing; Pro is dropped silently when a model or transport change makes it unsupported; Pro applies to auxiliary calls (see above). - Remote UAT round 2 on `c3bd5aa370f` (same chat, alias and core re-verify): core PASS, alias FAIL. With `gpt-daybreak-blue-latest` the request carried `{"mode": "pro"}` without the configured effort and summary and kept sending `temperature` (provider 400 then retry on quick generation and title calls), because the SDK does not classify the alias as a reasoning model. Fixed in `d4c338de767`: a configured mode now implies a reasoning model unless `openai_config.reasoning_model` is set, and a mode on a config that forces plain sampling is rejected. Alias UI/API behavior, rejections, and known-model Pro/Default turns all passed on `c3bd5aa370f`. - Codex round 5 on `d4c338de767`: "Didn't find any major issues" (https://github.com/coder/coder/pull/29584#issuecomment-5736190356). Zero unresolved threads. CI green on `d4c338de767`. - Remote UAT round 3 on `d4c338de767` (same chat): endorsed PASS. Alias runs are single-attempt 200s with `{"effort", "summary", "mode": "pro"}` and no `temperature` (quick generation and title calls no longer retry); `reasoning_model=false` plus a mode is rejected by POST and PATCH with the stored config unchanged; the Reasoning Model override at Off hides the select and drops the mode on save; `gpt-5.6-sol` Pro turn unchanged. Remaining low notes, none introduced here: rejection detail for a non-OpenAI provider names the model rather than the provider; Pro is dropped silently when an override makes it unsupported; `PATCH model_config` replaces the whole object (pre-existing on main). - coder-frontend-review on `d4c338de767` (8 role reviewers, 3 passes): 13 failing checkpoints, chiefly a TS mirror of the Go model regex, the `json_name === "reasoning_mode"` gate duplicated in the render filter and payload builder, a defaulted `model` parameter, and comment and type nits. Fixed in `554c90d5fd9`: the pattern and provider scope are generated onto the field schema, one predicate is shared by both call sites, `buildModelConfigFromForm(provider, model, form)` requires the model, and the ModelForm test also asserts the select disappears for an unsupported model. Red/green: stripping `supported_models` or `visible_for_providers` from the generated schema fails 21 and 1 Vitest cases respectively. Declined with rationale: RO4 (move the fixture to `ModelsPage/testFixtures.ts`; FE9 in `FRONTEND_PATTERNS.md` names `testHelpers/chatModels.ts`, and Codex round 3 required it) and a DF5 nit to gate on the committed identifier and warn when a saved mode is dropped (behavior change, separate follow-up). Final pass: all checkpoints PASS or N/A. - Remote UAT round 4 on `554c90d5fd9` (same chat, focused regression after the frontend-review refactor): endorsed PASS. All six claims held (Pro round trip with effort and tier intact; unsupported identifiers hide the select and a save drops the stale mode while keeping the other options; Azure never shows or saves it; the alias shows it only with the Responses override On; Reasoning Model Off hides it and drops it; three real `gpt-5.6-sol` Pro turns were single-attempt 200s with `{"effort","summary","mode":"pro"}` and no `temperature`). Probes aimed at the refactor also passed: `gpt-5X6-sol` is rejected (dot escaping survived the JSON round trip), whitespace-padded identifiers still match, the other 11 OpenAI fields and the Anthropic section still render. Remaining low notes are carried over from round 3 plus one naming note ("Reasoning Mode" versus "Reasoning Model"). The final head `abb58df77d8` differs from `554c90d5fd9` only in `ModelForm.test.tsx`, so it ships the same production code. - Codex round 6 on `554c90d5fd9`: 1 finding (https://github.com/coder/coder/pull/29584#pullrequestreview-5260492465): the two `toBeInTheDocument` assertions added in the frontend-review round violate FE1. Confirmed against `site/AGENTS.md`; removed in `abb58df77d8` (test-only, 7 deletions; the payload assertion keeps the behavior coverage and the `ProviderConfigOpenAI` story captures the hidden state). Thread replied to and resolved. - Codex round 7 on `abb58df77d8`: "Didn't find any major issues" (https://github.com/coder/coder/pull/29584#issuecomment-5749626071). Zero unresolved threads. CI green on `abb58df77d8` (23 success, 8 skipped, `required` pass). - Design change on `e99152e5c57` (owner direction: no model gating; "none or pro" for any model; tooltip states the GPT-5.6 Sol constraint and that requests fail on unsupported models). Removed `codersdk.ChatModelReasoningModeModels`, the generated `supported_models`, `isFieldApplicableToModel`, the `gpt-daybreak-blue-latest` special case, and the `standard` enum value; `ValidateReasoningMode(provider, config)` no longer takes the model; `effectiveOpenAIConfig` makes a mode imply Responses and reasoning-model treatment. PR footprint went from +1130/-22 to +769/-18. Local validation: `go test` for chatopenai, chatprovider, chatd wire test, and the coderd API tests (persistence now covers `gpt-5.6-sol`, `gpt-4o`, `gpt-daybreak-blue-latest`, `gpt-7-nova`; invalid input now rejects `standard`), golangci-lint on touched packages, Vitest (187 tests across `modules/aiModels` and `ModelsPage`), biome, tsc, pre-commit hook. - coder-frontend-review on `e99152e5c57` (8 roles, 1 pass plus a TS and CD confirmation pass): 9 failing checkpoints (SD4, CD1, CD3, CD4, TS3, TS7 x2, RO3, RO5, TN4, DF5). Fixed in `e06bfbe4299`: the ModelForm test edits `mockGPT5` so its provider matches the selected provider state, types the update mock like the sibling story, and drops an unused route; the story spreads `mockGPT5` with a saved mode instead of a dedicated shared fixture (`MockGPT56Pro` removed, `testHelpers/chatModels.ts` back to base); a `ProviderConfigAzure` story captures the panel without `reasoning_mode`; comment nits. Left as a nit with justification: RO3 (the one-line `!hidden && isFieldVisibleForProvider` predicate now appears in both `getVisibleProviderFields` and `getVisibleGeneralFields`; hoisting a helper for two call sites is not worth it). Confirmation pass: TS all PASS; CD flagged one wording nit, fixed before commit. - CI green on `e06bfbe4299` (23 success, 8 skipped, `required` pass). - Codex round 8 on `e06bfbe4299`: 1 P2 finding (https://github.com/coder/coder/pull/29584#discussion_r4057659673): the form still offers Pro with Use Responses API or Reasoning Model at Off, a combination the server rejects, and the failure was not actionable. Disposition: the select stays visible by owner direction (no client-side gating of this field beyond the provider scope; an explicit rejection is preferred over the earlier silent drop), and `e2b43c3aee7` makes the add/update save toasts show the server detail so the admin sees which field to change. Thread replied to and resolved; zero unresolved threads. - Remote UAT round 5 on `e06bfbe4299` (same chat): endorsed PASS with two UI issues to land before release. All seven probes passed: the select offers only Default and Pro for `gpt-5.6-sol` and `gpt-4o` with the tooltip text verbatim; Pro saves on `gpt-4o` and the real turn fails visibly with the provider's "reasoning.mode is not supported with this model" after a single 400 attempt, and works again once Pro is cleared; `gpt-daybreak-blue-latest` with Pro and no overrides is a single 200 to `/v1/responses` with `{effort, summary, mode: "pro"}` and no `temperature`; the `gpt-5.6-sol` Pro turn is unchanged; POST and PATCH reject `standard`, `PRO`, empty, Responses Off, Reasoning Model Off, and Azure, openai-compat, and Anthropic providers with the stored config unchanged, while a model-only PATCH to `gpt-4o` now succeeds; the Azure form shows no Reasoning Mode; the alias with an explicit Responses override still works. Reservations: (1) medium, the UI conflict path only showed "Invalid model config." without the detail (fixed in `e2b43c3aee7`, not yet UAT-exercised); (2) low-medium, a dev-DB row still holding `standard` from round 2 renders an empty red select whose message is the whole field description plus "has an invalid value." and blocks saving unrelated fields (pre-existing generic behavior of `yupTestForField` using the description as the label; no released data can hold `standard`, so no migration); (3) low, no hint next to older identifiers (documented design); (4) low, a chat on such a stored row fails with a generic headline (pre-existing). - Final head `e2b43c3aee7` differs from `e06bfbe4299` only in the two save-toast handlers (`AddModelPage.tsx`, `UpdateModelPage.tsx`, 8 insertions). CI is green on `e2b43c3aee7` (skipped=8, success=23, `required` success). Codex has not run on `e2b43c3aee7`. - Remote UAT round 6 on `e2b43c3aee7` (same chat, https://dogfood.cdr.dev/agents/f5ed1d16-be1d-4d39-952b-126a6a829ef1, settled 2026-09-20T19:02Z): endorsed PASS on the exact final head. Build proven by `/api/v2/buildinfo` (`v2.37.2-devel+e2b43c3aee`, `external_url` at the full SHA) and the UI badge. The round 5 toast issue is resolved: Add and Update saves with Pro plus Use Responses API Off or Reasoning Model Off show "Invalid model config." with the server detail as the description, one 400 each, nothing stored. Compact regression of every round 5 probe held (dropdown and tooltip; Pro on `gpt-4o` fails visibly with the provider's `reasoning.mode is not supported with this model` and works after clearing; alias with and without the Responses override and `gpt-5.6-sol` all send `{effort, summary, mode: "pro"}` with no `temperature` in a single 200; POST and PATCH rejection matrices with stored config unchanged; Azure form without the field). Legacy `standard` row: fails closed on chat, and re-picking Pro or Default saves. Remaining notes, none blocking: the malformed validation copy for an invalid stored enum (pre-existing `yupTestForField` label choice, dev-DB rows only), Pro offered for models that cannot accept it (documented design), and a pre-existing `quickgen` status quirk on `gpt-4o` unrelated to this field. Secret scan clean. - Final head `4f3c6106dfe` adds one docs-only commit on top of `e2b43c3aee7` (`docs/ai-coder/agents/models.md`, 9 insertions, 8 deletions, no code). Remote UAT round 6 exercised `e2b43c3aee7`; the docs commit is not UAT-relevant. Validated with `markdown-table-formatter`, `markdownlint-cli2`, and the pre-commit hook (`fmt/markdown`, `lint/markdown`, `lint/emdash`, `lint/typos`). CI is green on `4f3c6106dfe` (success=24, skipped=7, `required` success) and the documentation check re-run marked its item addressed (https://github.com/coder/coder/pull/29584#issuecomment-5752457808). - Review tally for this PR: Codex 8 completed rounds; coder-frontend-review 34 role passes (24 on `d4c338de767`, 10 on `e99152e5c57`); remote UAT 5 rounds; no human review yet. This is far past the six-review guardrail, so no further Codex or agent review has been requested. Whether to spend another Codex pass on `e2b43c3aee7` is an owner decision; human review is still required before merge. </details> > Xum acted on behalf of @ibetitsmike. |
||
|
|
53ad29512d |
fix: route chat quickgen side calls through the title generation model (#29622)
Chat sublabels were falling back to "Finished latest turn" for most turns on some models. On dogfood, 95% of Claude Fable 5.1 chats over the last 7 days showed the fallback (341/357) while Opus 4.8 sat at 3%. The end-of-turn status label and the whole-chat summary were generated on the chat's own model, and Anthropic rejects the forced tool call that Fantasy's object generation relies on with `400 tool_choice: type "tool" and "any" are not supported for this model.` on every `claude-fable-5-1` request (about 3k such 400s in 7 days). OpenAI-compatible reasoning models such as solstice-1 fail the same call differently, answering with text at the 64-token cap. Title generation kept working because it already resolves a dedicated model: the organization `title_generation` override (Haiku 4.5 on dogfood), then a preferred small model, then the chat model. The failures were only visible at Debug level. Route every quickgen side call (turn status label, chat summary, automatic and manual title) through one shared resolver, `resolveQuickgenModel`, with that same order: `title_generation` override, then an enabled preferred small model, then the chat's model as a last resort. The preferred-model match now also accepts dated snapshot IDs such as `claude-haiku-4-5-20251001`, which is how admins commonly configure Haiku. Candidate failures for labels, summaries, and titles are logged at Warn with provider and model. The admin settings copy and the models doc now say that the title generation override also governs status labels and summaries. Known tradeoff: when the resolved quickgen model itself is unusable at call time (for example an invalid provider key on the small model), the side calls fail and the generic label is shown; there is deliberately no second call on the chat's model. Refs https://linear.app/codercom/issue/CODAGT-1077/fix-agent-turn-status-label-generation-failures ## Delivery record - Remote dogfood UAT, Coder Agents chat https://dogfood.cdr.dev/agents/87bab92b-bd54-4d5c-aba2-8147eaedfa49 (real Anthropic and OpenAI models through the dev AI gateway, UI driven through Playwright). Round 1 on |
||
|
|
cc8c76651e |
fix: use workspaces when chat capabilities are insufficient (#29579)
Chatd's guidance discouraged workspace creation even when the chat
lacked the tools or context needed to finish a request. Make a suitable
workspace the fallback when missing tools, skills, MCPs, or context
block progress, while preferring existing capabilities when sufficient.
Align the system prompt, workspace awareness, planning guidance, tool
description, regression tests, and user documentation. Preserve
template-selection guardrails and delegated-agent restrictions.
**Open review finding:** workspace readiness can precede initial
MCP/context discovery. The wording now acknowledges this limitation; a
runtime synchronization fix is pending a scope decision.
<details>
<summary>Implementation and verification context</summary>
- Coding requests authorize necessary workspace setup without a separate
workspace request; self-contained examples remain workspace-free when
existing capabilities suffice.
- Detached root chats create a workspace; attached stopped workspaces
use start_workspace. Persisted awareness describes the initial state
rather than claiming the chat remains detached.
- Delegated chats report workspace needs to their parent. Provisioning
does not unlock workspace MCP tools in Plan Mode.
- Use actually exposed capabilities; do not assume readiness means all
skills, MCP tools, and context have loaded, or recreate workspaces to
retry discovery.
- Prompt, workspace-creation, template-selection, setup-failure, Plan
Mode MCP boundary, and API prompt-composition tests pass. The creation
E2E now verifies published instructions, skills, and MCP tools appear in
request two with no extra user turn; repeated and race runs pass. This
does not establish live-model compliance or discovery readiness.
- Full make pre-commit passes, including generation, formatting, lint,
and the slim build. All CI checks pass on
|
||
|
|
3787528621 |
fix: accept SVG chat attachments as download-only files (#29330)
Closes https://linear.app/codercom/issue/CODAGT-1032/allow-svg-uploads-without-inline-rendering SVG uploads to the agents chat were rejected with `Unsupported file type`, as was SVG markup pasted as text. Pastes are wrapped as a `text/plain` file, `ClassifyStoredMediaType` relabels the bytes `image/svg+xml`, and `IsCompatibleUploadMediaType` didn't allow that refinement. This PR adds `image/svg+xml` to `codersdk.AllChatAttachmentMediaTypes` and treats it like we already treat PDF: storable, but served with `Content-Disposition: attachment` and never rendered inline, since SVG can carry script. The model receives the source as inlined text rather than an image part. No provider accepts SVG as a native part, so `AcceptsFilePartMediaType` returns false for it up front; the Google branch would otherwise accept it. Whilst here, I've collapsed the three hand-synced lists of text types the model can read (`isInlinableTextMediaType`, the `text/plain` refinement switch, and `IsSyntheticPaste`) into `chatfiles.IsTextAttachmentMediaType`. On the frontend, the `startsWith("image/")` checks go through `isRasterImageMediaType`, so SVG gets a file card instead of an `<img>`, thumbnail, or resize. Dropping an unsupported file onto the composer now shows a toast naming the rejected files instead of silently ignoring them. Supersedes #26969. |
||
|
|
df1a910815 |
chore: remove AI task support from the provisioner protocol (#28790)
Removes AI task support from the provisioner protocol: the task-related proto fields, terraform scanning for `coder_ai_task` resources, echo provisioner support, the regenerated `.pb.go` and `provisionerGenerated.ts`, and the terraform testdata that exercised them. The provisioner API version change lives in `provisionerd/proto/version.go`. **Stack context:** Coder Tasks removal stack (CODAGT-642): #28743 frontend → #28788 CLI → #28789 API → #28790 provisioner → #29084 notifications and usage → #29085 build reasons → #29086 tables → #28750 permissions. The last four PRs replace the single data-drop migration that used to live in #28750; each carries one concern and a focused migration test. **Why:** the proto fields lost their last consumer in #28789; this deletes the producer side and the wire format. **What to scrutinize:** the proto/version handling, and that `coder_ai_task` resources in existing templates are now ignored rather than errors (template imports simply no longer scan for them). **Validation:** `go build ./...`, `go test ./provisionersdk/... ./provisionerd/...`, `go test ./provisioner/terraform -run TestConvertResources`, provisioner list golden regenerated, site tsc, pre-commit hooks. **Size:** +580/-1,286 over 76 files; most files are mechanical testdata and generated-code updates. > Created by Xum (AI agent) on behalf of @ibetitsmike. |
||
|
|
9cd38b5373 |
feat!: remove the Tasks API from coderd and codersdk (#28789)
Removes the Tasks API and task orchestration from coderd and codersdk: the `/api/v2/tasks` handlers, task middleware and search filters, task name generation, autobuild pause/resume logic, task notification enqueues, telemetry, and the codersdk task types. Regenerates apidoc, the API reference docs, and `typesGenerated.ts`. **Breaking change:** the Tasks API is removed; requests to `/api/v2/tasks` fail. Tasks was deprecated in v2.34. **Stack context:** Coder Tasks removal stack (CODAGT-642): #28743 frontend → #28788 CLI → #28789 API → #28790 provisioner → #29084 notifications → #29085 build reasons → #29086 tables → #28750 permissions. The last four PRs replace the single data-drop migration that used to live in #28750; each carries one concern and its own migration number. **Why:** with the UI (#28743) and CLI (#28788) gone, this deletes the server surface. Database tables, RBAC, and notification templates stay until the top of the stack so every layer builds and migrates independently. **What to scrutinize:** - The `enable-ai-tasks` option is removed outright (review feedback): configs still carrying `enableAITasks` fail to parse until the key is deleted. - provisionerdserver now writes `HasAITask: false` on template/build flags; the column and these lines are dropped in #29085. - `codersdk.ResourceTypeTask` stays so audit logs recorded before the removal keep rendering. **Validation:** `go build ./...`, `go vet ./...`, `go test ./codersdk/...`, site biome and tsc, CLI goldens regenerated, pre-commit hooks. **Size:** +242/-10,792 over 76 files; additions are regenerated docs/goldens and test fixture updates. > Created by Xum (AI agent) on behalf of @ibetitsmike. |
||
|
|
d0de33cdf1 |
chore: remove the Coder Tasks CLI and task automation (#28788)
Removes every in-repo Tasks client: the `coder exp tasks` CLI command family, the tasks scaletest runner, and the task-driven triage automation (`traiage.yaml`, `code-review.yaml`, `classify-issue-severity.yml`, `scripts/traiage.sh`). Triage runs through `triage-via-chat-api.yaml` and coder/create-agent-chat-action instead. **Stack context:** Coder Tasks removal stack (CODAGT-642): #28743 frontend → #28788 CLI → #28789 API → #28790 provisioner → #29084 notifications and usage → #29085 build reasons → #29086 tables → #28750 permissions. The last four PRs replace the single data-drop migration that used to live in #28750; each carries one concern and a focused migration test. **Why:** clients come off before the API they call. After this layer nothing in the repo invokes the Tasks API outside coderd itself. **What to scrutinize:** all but three files are whole-file deletions. `triage-via-chat-api.yaml` gets a comment fix. `NavbarView.tsx` and its stories carry two small repairs to the frontend layer below (unused `user` prop, stale `TasksFilter` story wiring) so the stack lints clean from this layer up; they rebase away if folded into #28743. **Validation:** `go build ./...`, `go test ./cli -run TestCommandHelp`, site tsc, pre-commit hooks (gen, fmt, lint). **Size:** +4/-6,938 over 42 files; effectively pure deletion, so it reads much faster than the line count suggests. > Created by Xum (AI agent) on behalf of @ibetitsmike. |
||
|
|
d8e3f4fcf7 |
feat: evict the oldest attachments at the chat file cap (#29063)
Closes CODAGT-933 Long agent sessions were hitting the 50 attachment cap, after which every upload, screenshot and `attach_file` call was rejected, so people were abandoning otherwise healthy chats. Rather than raise the cap (which just moves the cliff and multiplies the worst-case per-chat `bytea` storage), a chat now keeps its 50 most recent attachments. `LinkChatFilesAfterLock` deletes the oldest `chat_files` rows in the same statement and the cascade drops their links. Files in the incoming batch are never evicted, so the only remaining rejection is a single message with more than 50 files. Nothing in the product ever linked one file to two chats, so rather than guard the eviction against it, this adds `UNIQUE (file_id)` on `chat_file_links`, with the migration dropping any existing duplicates in favour of the oldest chat. Evicted attachments render as the existing "Attachment expired" tile. A `pinned` flag is the obvious follow-up if someone needs to keep a specific file around. |
||
|
|
7846490770 |
docs: reconcile H1/label mismatches into front-matter titles (Phase 3) (#28036)
## Summary **Batch B of Phase 3** of the H1 → front-matter migration (`DOCS-484`; parent `DOCS-477`), the editorial follow-up to Batch A (#28030). For the **124** hand-authored pages whose leading body H1 differed from the manifest nav label, this promotes the richer body H1 to the front-matter **page title** and drops the duplicate H1, while keeping the short manifest **label** as the sidebar entry. Policy agreed with the docs owner: - Short sidebar labels win. Duplicate sidebar labels are acceptable. - Identical **page titles** across two pages are not. On a collision, rename the non-generated page's title. ## Page-title collisions resolved Promoting the H1 created 4 page-title collisions; each is disambiguated by renaming the non-generated / secondary page (sidebar labels left unchanged): | page | sidebar label | body H1 | → page title | |------|---------------|---------|--------------| | `install/index.md` | Install | Installing Coder | **Install Coder in your infrastructure** | | `install/cli.md` | Coder CLI | Installing Coder | **Install the Coder CLI** | | `ai-gateway/clients/jetbrains.md` | JetBrains | JetBrains IDEs | **JetBrains** | | `workspace-access/web-ides.md` | Web IDEs and Coder Apps | Web IDEs | Web IDEs *(kept — primary user guide)* | | `extending-templates/web-ides.md` | Web IDEs and Coder Apps | Web IDEs | **Web IDEs in templates** | | `workspace-management.md` | Workspace Management | Workspaces | **Manage workspaces** *(vs generated `api/workspaces.md`)* | These titles are the only non-mechanical editorial calls in this PR. ## Deliberately excluded: generated pages `admin/security/audit-logs.md` and `admin/setup/configuration-reference.md` are `make gen` outputs (`auditdocgen` / `configdocgen`) that Phase 2 did **not** update, so a hand-added title would be reverted on the next generation. They're excluded here and need their generators taught to emit front matter first (Phase 2 pattern), tracked as `DOCS-631`. Batch A (#28030) had the same issue for three other generated pages; it has been corrected there too. ## Verification AI was the primary author of this PR (see disclosure below); per the [AI Contribution Guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) here is the manual verification. - Promote = set front-matter `title` to the body H1 (or the disambiguated title above) and remove that one duplicate H1. No other body prose is reflowed. - Every added front-matter block parses as YAML; all files pass `pnpm check-docs` (markdownlint-cli2 + table formatter): `Summary: 0 error(s)`. - Removing the H1 orphaned one in-page fragment (`[MCP](#mcp)` in `ai-gateway/mcp.md`), now repointed. A cross-file fragment audit into the retitled pages found no real breakage. Anchor-change note Unlike Batch A (title unchanged, a rendered no-op), Batch B changes each page's effective title from the manifest label to the body H1, so the rendered H1 **anchor slug changes**. An audit of cross-file `.md#fragment` links into these pages surfaced no links that break as a result (the only hits were false positives against a still-present `## TLS & Reverse Proxy` heading). Same-file fragments are enforced by markdownlint MD051, which is green. ## Title casing (follow-up, DOCS-742) A follow-up commit puts the promoted titles into sentence case and removes leading gerunds (for example, `Managing workspace schedules` → `Manage workspace schedules`): 57 of the 120 titles changed, the other 63 were already compliant. Proper nouns and branded names (Coder Validated Architecture, JetBrains, File Browser, Dev Containers, Island), acronyms (API, CLI, IDE, MCP, OIDC, URL, UI, CI/CD), the Premium license tier, and maturity labels (Beta, Experimental) are preserved. The four `Nk-users` pages become `Reference architecture: up to N users` (lowercase, matching the CVA landing page's own usage); the CVA landing page keeps its branded title. `pnpm check-docs`: `Summary: 0 error(s)`. Linear: DOCS-484, DOCS-742 > This PR was created with AI assistance (Coder Agents). |
||
|
|
3d2cf5fcc6 |
docs: correct Coder Tasks deprecation version to v2.34 (#28764)
Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com> |
||
|
|
bc77c40296 |
docs: add front-matter titles to mechanical and no-H1 pages (Phase 3) (#28030)
## Summary **Batch A of Phase 3** of the H1 → front-matter migration (`DOCS-484`; parent `DOCS-477`). Adds a front-matter `title` to every navigable docs page whose title can be migrated **mechanically**, with no editorial judgment. This is the content step that Phase 1 (renderers prefer front-matter title, `DOCS-482`) and Phase 2 (tooling + generators front-matter-aware, `DOCS-483`) unblocked. Both are merged; coder.com #964/#974 are merged and live. **Rendered no-op.** The renderers already resolve the page title from the manifest and hide the leading body H1 (Phase 1), so no page changes visually. This just moves the title into front matter where Fumadocs and the migrated tooling can read it. ## What's in this batch Dry-run on `main` (464 navigable pages) splits into: | category | count | this PR | |----------|-------|---------| | already has front-matter title (Reference, from Phase 2 generators) | 196 | skipped (idempotent) | | **mechanical** — leading body H1 equals the manifest label | 138 | ✅ add front-matter `title`, drop the duplicate H1 | | **no body H1** — renders under the manifest label only | 4 | ✅ add front-matter `title` only | | **mismatch** — body H1 differs from the manifest label | 126 | ⏭️ deferred (needs an editorial decision, see below) | 142 files changed, all under `docs/`. ## Deliberately out of scope: the 126 mismatches Pages where the body H1 is richer than the short sidebar label (e.g. label **Modules** / H1 *Contributing modules*, label **Install** / H1 *Installing Coder*) need a canonical-title decision, not a script. A few even look like the body H1 is the redundant one (`install/cli.md` and `install/index.md` both carry the H1 *Installing Coder*). These will land in follow-up batches **by nav section** once the policy is set, so each gets real review. ## Verification AI was the primary author of this PR (see disclosure below); per the [AI Contribution Guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) here is the manual verification. - Every added front-matter block parses as YAML and its `title` round-trips to the manifest label (checked programmatically across all 142 files). - Every removed line is a leading `# H1` that equalled the manifest title; no body prose was reflowed. Front matter is correctly hoisted above pre-existing `<!-- markdownlint-disable -->` comments on the two pages that had them. - `pnpm check-docs` (markdownlint-cli2 + table formatter) passes on the changed set: `Summary: 0 error(s)`. `MD041` stays off (re-enabled in Phase 4); `MD025` is not tripped because the duplicate body H1s are removed. ``` $ pnpm exec markdownlint-cli2 $(git diff --name-only origin/main) Linting: 142 file(s) Summary: 0 error(s) ``` Linear: DOCS-484 > This PR was created with AI assistance (Coder Agents). |
||
|
|
47a77016c4 |
feat(docs/.style): enable Coder.SelectClick, use "select" over "click" (#28599)
Adds a Vale rule enforcing the existing "select, not click" style
guidance: "click" assumes the reader has a mouse, and touch, keyboard,
and assistive-technology users don't click.
`Coder.SelectClick` (warning severity) flags
`click`/`clicks`/`clicked`/`clicking` in prose, exempting:
- Literal mouse-button phrasing (`left-click`, `right-click`,
`middle-click`, `mouse click`, and combinations) — these name an actual
mouse action with no device-agnostic equivalent.
- `one-click`/`single-click` as a compound feature descriptor
("one-click install").
Reworded every existing instructional "click" in `docs/` to the matching
`select` form (`select`/`selects`/`selections`/`selected`/`selecting`)
so the rule ships with a clean baseline, per this repo's Vale-rule
doctrine.
Left alone, deliberately: two generated API reference pages
(`docs/reference/api/enterprise.md`, `schemas.md`) use "click" as an
analytics-event noun, tied to a Go source doc comment and an operation
ID (`report-a-premium-paywall-click`). Fixing those means editing
generated code and an API operation ID, which is out of scope for a
docs-style PR — see the rule's own comments for the reasoning. That
leaves 2 non-zero-baseline findings for this rule.
---
🤖 Built with AI assistance.
---------
Co-authored-by: Ian Evans <5760366+ianjevans@users.noreply.github.com>
|
||
|
|
9c42b14857 |
feat: add /clear chat context command (#24745)
> [!NOTE]
> Xum acted on Mike's behalf in this pull request.
<!-- xum-attribution: model=claude-fable-5 thinking=high -->
Adds a `/clear` slash command to Agents chats that resets the model
context without deleting anything: the transcript stays visible, and the
next prompt runs as if the chat were brand new. It mirrors `/compact`'s
UX (slash menu entry, exact-text interception, dedicated endpoint,
synthetic tool block in the transcript) but generates no summary and
makes no model call.
## How it works
`POST /api/experimental/chats/{chat}/clear` commits synchronously inside
the API transaction through a new `chatstate` transition,
`ClearContext`, allowed from `waiting` and from `error` without queued
messages (`W -> W`, `E0 -> W`). No worker round-trip, no status flicker
to `running`, no migration. Clearing an errored chat clears
`last_error`, and any pending manual compaction request is dropped
rather than left to run against the cleared context.
The endpoint persists the same compressed boundary shape `/compact`
uses: a hidden model-only sentinel row, a visible synthetic
`chat_cleared` tool call, and its result. Prompt assembly already
selects the latest compressed model-only row as the context cutoff, so
the query is unchanged. Boundary detection is generalized to recognize
both `chat_summarized` and `chat_cleared`, so `/compact` after `/clear`
(and the reverse) never reach across the newer boundary, and
auto-compaction does not fire off stale pre-clear usage.
Busy chats, errored chats with queued messages, and clears with no
conversation after the latest boundary return 409. Archived chats are
rejected. The endpoint is owner-only for symmetry with `/compact`.
## Frontend
`/clear` joins the slash command menu, and the previously compact-only
send interception becomes a small built-in command dispatch shared by
both commands, so a personal or workspace skill named `clear` still
takes precedence. Because the clear commits synchronously, the UI keeps
the chat in `waiting`, refetches on success, and surfaces conflicts with
the standard error toast. The transcript renders a "Context cleared"
card via a new `ChatClearedTool` renderer.
## Docs
The user-facing agents architecture page documents `/clear`.
`coderd/x/chatd/ARCHITECTURE.md` carries TODO notes in the affected
sections for the PR author to write.
## Tests
- `chatstate`: transition matrix entries plus dedicated `ClearContext`
coverage (error-state entry, queued-message rejection, boundary row
requirement).
- `chatd`: end-to-end manual clear (fresh next prompt, error recovery,
boundary interplay with compaction, stale-usage auto-compaction
regression, busy rejection) plus boundary and message-builder units.
- `coderd`: HTTP authorization and error mapping for the endpoint.
- Frontend: slash command availability and skill collision units,
stories for the submit path, the conflict toast, and the cleared-card
renderer.
|
||
|
|
0f5c7b3154 |
refactor!: remove default organization model routes (#28632)
> [!IMPORTANT]
> Most of the added lines in this PR are generated API reference content
for publishing the organization-scoped `GET` and `POST
/api/v2/organizations/{organization}/chats/models` replacements. There
is no matching generated-doc deletion because the three removed
default-organization endpoints are experimental and are not present in
the generated public API reference on the current base. The removed
paths remain only as explicit 404 reservations, with no
default-organization shim or functional handler.
## Summary
Remove the unused default-organization chat model collection routes:
```text
GET /api/experimental/chats/models
GET /api/experimental/chats/model-configs
POST /api/experimental/chats/model-configs
```
Use the organization-scoped collection instead:
```text
GET /api/v2/organizations/{organization}/chats/models
POST /api/v2/organizations/{organization}/chats/models
```
## Context
The intention of PR #28440 was to consolidate model availability into
the organization-scoped models collection for CODAGT-898 and remove the
superseded collection routes. That PR removed
`/organizations/{organization}/chats/models/available`, but it missed
these older default-organization routes and explicitly retained one of
them. This PR completes the intended #28440 cutover. The repository has
no SDK, CLI, or frontend consumer for the removed routes.
This change also prevents PR #28496 from promoting the missed
default-organization `/chats/models` route into the stable `/api/v2`
API.
This change is separate from the one-release `/api/experimental`
compatibility window in CODAGT-921. That window preserves experimental
versions of the intended stable API. It does not require compatibility
routes for unused deployment-scoped endpoints.
Refs CODAGT-898.
## Breaking change
Clients that call the removed routes must use the organization-scoped
model collection and provide an organization.
## Changelog
Remove unused default-organization Coder Agents model API routes. API
clients must use the organization-scoped chat models collection.
> [!NOTE]
> Coder Agents generated this pull request on Ethan Dickson's behalf.
|
||
|
|
77743afdb8 |
docs: rewrite extending-agents MCP and skills discovery for pushed context (#28576)
This PR rewrites the MCP and skills discovery sections of `docs/ai-coder/agents/extending-agents.md` to match the current pushed-context architecture. The page documented a removed mechanism: per-chat-turn `.mcp.json` reads with a 5-second discovery timeout, first-turn scans of `.agents/skills/` only, and no mention of pinning. What changed: - Adds a "How the workspace shares context with chats" section: the agent scans and pushes a context snapshot, chats pin one snapshot, a push marks already-pinned chats out of date, and **Refresh context** re-pins. Explains why an in-flight chat can keep an older snapshot. - Documents the readiness gate: only an empty snapshot is published until startup scripts finish. - Documents the scan roots (working directory, `~/.coder`, `~/.coder/skills`, `~/.claude/plugins/cache`, user-declared sources) and that discovery is shallow. - Documents all four skill container directories (`skills`, `.agents/skills`, `.claude/skills`, `.codex/skills`) instead of only `.agents/skills`. - Adds snapshot limits and failure modes: 64 KiB per resource emitted as oversize with no content, 2 MiB aggregate and 500 resource caps emitted as excluded, invalid skill frontmatter. - Replaces the 5-second discovery claim with the 30-second per-server connect timeout and the fsnotify watcher with a 250 ms debounce; notes that tool calls are proxied through the agent, so a pinned chat can list tools it cannot execute while the workspace is unreachable. - Keeps the values that are still correct: 60 s per tool call, `SKILL.md` <= 64 KB, supporting files <= 512 KB truncated, personal skills single file <= 64 KB and <= 100 per user, `read_skill_file` path restrictions. Linear: DOCS-723 https://linear.app/codercom/issue/DOCS-723 <details><summary>Analysis evidence</summary> Every claim was verified against code on this branch's merge base. **Push and pin model** - `agent/agentcontext/push.go`: `RunPush` ships the current snapshot and every subsequent snapshot on change; it skips version 0 (pre-ready). - `coderd/agentapi/context.go`: `PushContextState` persists the snapshot and calls `ContextDirtyMarker.HydrateAndMarkChatsDirty` inside the transaction; the doc comment states it "hydrates chats for the agent that have no pinned hash yet ... and flips already-pinned chats whose hash differs". - `coderd/x/chatd/context_hydration.go`: `HydrateAndMarkChatsDirty` stamps NULL-hash chats via `HydrateAgentChatsContext` and dirties differing chats via `MarkChatsContextDirtyByAgent`; "The pinned hash on dirtied chats is intentionally left unchanged; the refresh endpoint re-pins it." `RefreshChatContext` backs `PUT /chats/{chat}/context` (route registered in `coderd/coderd.go`), and `site/src/pages/AgentsPage/components/ChatPageContent.tsx` wires the **Refresh context** button to it. This confirms the pinning semantics claim: a chat mid-turn keeps its older snapshot until refreshed. - `coderd/x/chatd/chatd.go` (`resolveWorkspaceMCPTools` / `pinnedWorkspaceMCPTools`) builds the turn's MCP tools from `chat_context_resources`, and `coderd/x/chatd/context_prompt.go` builds the instruction block and skill index from the same pinned rows. No per-turn live discovery remains. **Readiness gate** - `agent/agentcontext/manager.go`: `resolveAndBroadcast` returns early while `!m.ready`; `agent/agentcontext/doc.go` describes the version-0 empty snapshot. `agent/agent.go` calls `a.contextManager.SetReady()` after the startup-script lifecycle transition, then reloads MCP servers. (The gate lives on `agentcontext.Manager`, not `agentmcp.Manager`.) **Scan roots and shallow discovery** - `agent/agentcontext/manager.go` `scanRootsLocked`: user sources, then `defaultBuiltinRoots()`, then the working directory. - `agent/agentcontext/defaults.go`: built-in roots are `~/.coder`, `~/.coder/skills`, `~/.claude/plugins/cache`. - `agent/agentcontext/doc.go` and `resolve.go`: instruction files and `.mcp.json` are read only at a scan root's top level; the resolver never descends or climbs. **Skills** - `agent/agentcontext/resolve.go` `skillContainerRelPaths`: `skills`, `.agents/skills`, `.claude/skills`, `.codex/skills`; `skillContainersFor` also treats a root named `skills` as a container, which is what makes `~/.coder/skills` work. - `readSkillMeta`: frontmatter name must match the directory basename and match `workspacesdk.SkillNamePattern` (`^[a-z0-9]+(-[a-z0-9]+)*$`), otherwise `StatusInvalid`; oversize files get `StatusOversize` with no payload. - `coderd/x/chatd/chattool/skill.go`: `maxSkillMetaBytes = workspacesdk.MaxSkillMetaBytes` (64 KiB), `maxSkillFileBytes = 512 * 1024` with truncation, `validateSkillFilePath` rejects absolute paths, `..`, and hidden components. `loadPinnedWorkspaceSkillContent` serves the body from the pin; `bestEffortSkillFiles` needs a live connection. - `coderd/x/skills/skills.go`: `MaxPersonalSkillSizeBytes` = 64 KiB, `MaxPersonalSkillsPerUser` = 100. **Caps** - `agent/agentcontext/resolve.go`: `DefaultMaxResourceBytes` 64 KiB (oversize, empty payload), `DefaultMaxSnapshotBytes` 2 MiB and `DefaultMaxResources` 500 (excluded, payload cleared). `coderd/x/chatd/context_prompt.go` `pinnedContextResources` surfaces non-OK rows with status and error. **MCP timeouts and watcher** - `agent/x/agentmcp/manager.go`: `connectTimeout = 30 * time.Second`, `toolCallTimeout = 60 * time.Second`. No 5-second discovery timeout exists anywhere in `coderd/x/chatd` or `agent/x/agentmcp`. - `agent/x/agentmcp/configwatcher.go`: `defaultWatchDebounce = 250 * time.Millisecond`; the watcher fires on create, write, remove, and rename. `agent/agentcontext/watcher.go` uses the same 250 ms window. - `agent/agent.go`: `a.mcpManager.SetOnReload(a.contextManager.Trigger)` re-resolves and re-pushes when the catalog changes; the shared engine owns one connection set for discovery and execution. - `coderd/x/chatd/chattool/mcpworkspace.go`: tool calls proxy back through the agent connection, so execution requires a reachable workspace. **Validation** - `pnpm install --frozen-lockfile`, `pnpm run format-docs` (no changes), `pnpm run lint-docs` (0 errors), `vale` on the page (0 errors; 1 pre-existing `Coder.GerundHeading` warning on the untouched H1). </details> Generated by Coder Agents on behalf of @nickvigilante. <details><summary>CI flake note</summary> The CI run for commit a60db5adee concluded with `startup_failure` (workflow never started; runner infrastructure), marking Flake Check, Storybook, and gen as failed on a markdown-only change. Unrelated to the changed paths; both runs re-triggered. </details> |
||
|
|
78c65ea556 |
feat: reposition org pickers in AI settings models and MCP pages (#28564)
Repositions the organization picker on the AI settings models and MCP servers pages so it lives with the content it scopes instead of floating above the page header. **Models** (`/ai/settings/models`) - The picker moved out of `OrganizationModelsLayout` into a shared `ModelOrganizationSelect` component that preserves the current path and auxiliary query params when switching orgs. - List page: rendered in the filter row to the right of search. - Add/edit model form: rendered as row 3 of the form grid at 50% width, labeled "Organization". On the edit page it is informational only (a static value, not a picker), since switching org there would 404 the model. Also rendered in the no-provider fallback and "Provider not found" states so the switcher never disappears on those pages. **MCP servers** (`/ai/settings/mcp-servers`) - List page: new client-side search input (matches display name, slug, and URL) with the org picker beside it, label hidden. - Add/edit server form: the picker moved into the form as the third cell of the first row (slug, display name, organization), making it a 3-up. - `OrganizationPicker` now renders a static read-only value instead of a disabled button when the org cannot be changed (no handler or single org). This fixes the muted `content-disabled` text on the update page. The read-only rendering is shared with the models edit page via a new `OrganizationValue` component beside `OrganizationAutocomplete`. **Status columns** (both list tables) - The visible "Status" header and the Enabled/Disabled badges are removed; both list tables drop the status column entirely. Models whose provider is deleted or disabled show a warning "Unavailable" badge (with an explanatory tooltip) beside the name. - Disabled models and MCP servers show a "Disabled" badge beside the name, matching the existing "Default" badge placement, and the row dims like disabled providers: avatar/icon at half opacity, text in `content-disabled`. <details> <summary>Decision log</summary> - `ModelOrganizationSelect` reuses `OrganizationAutocomplete` and reads accessible organizations from the models context (`accessibleOrganizations` added to `OrganizationModelsContext`), rather than duplicating the layout's navigation logic per page. - Navigation semantics are unchanged: switching orgs rewrites the `org` search param and preserves the path and remaining params, exactly as the old layout-level picker did. - The MCP `OrganizationPicker` read-only state uses an `<output>` element (labelable, keeps the `Label` association) rather than a disabled button, so non-interactive values do not render with disabled styling or sit in the tab order. - The add MCP server page keeps a standalone picker above the "cannot add servers" alert since the form (and its picker slot) is not rendered in that state. - Story review: one interaction story per new behavior. A `ModelsPageView` story duplicating the shared picker's select-and-navigate flow was deliberately dropped; list-page placement is covered by the `OrganizationModelsLayout` stories that mount the real `ModelsPage`. The `ModelForm` fallback-branch picker has no dedicated story since its sibling branch and the shared flow are covered. </details> Verification: `pnpm lint:types`, `pnpm check`, and all affected Storybook tests pass (ModelsPage and MCPServersPage: 140), plus the `organizationModels` and `mcpServerFormLogic` unit tests. --- 🤖 This PR was generated by Coder Agents on behalf of @tracyjohnsonux. --------- Co-authored-by: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> |
||
|
|
35cbca080e |
feat: allow sharing MCP servers with users and groups (#28593)
## Summary Adds the missing user-facing half of MCP server config ACLs: admins can now share an MCP server with individual users and groups from the UI, backed by a new permission-safe candidate-discovery endpoint. ## Problem The MCP server config ACL backend already existed (share RBAC action, hydrated `GET .../acl`, sparse `PATCH .../acl`), but there was no frontend for it. There was also no way to populate a sharing autocomplete without the generic organization member/group APIs, which require `organization_member:read` and `group:read` and would wrongly couple MCP sharing to the workspace-sharing mode (the same bug fixed for chat models in #28542). ## Changes Backend: - New v2-only `GET /api/v2/organizations/{organization}/mcp-servers/{mcpserverconfig}/acl/available` returning `codersdk.ACLAvailable`; because this API is new, it is not mounted under the experimental compatibility prefix. Gated on `ActionShare` for the specific server config; performs bounded org-scoped member/group lookups via `dbauthz.AsSystemRestricted`; excludes system users; supports `q`, `limit`, `offset`, and `after_id` with template/chat-model autocomplete semantics. - Tests cover authorization (404 without share), search, pagination, system-user exclusion, org scoping, and a share-only custom role under all three workspace-sharing modes (`none`, `service_accounts`, `everyone`). Frontend: - `shareMCPServerConfig` permission plumbing; the MCP servers list, details page, and AI settings sidebar now admit share-only users (share does not require update; share-only users cannot edit the server form). - Share-only access follows the established permission contract: a bare-share role manages sharing through the list and ACL endpoints (the detail route still requires read, update, or delete, matching the existing enterprise permission-matrix tests), and the disabled-config gate now also admits the share permission so a sharer with read access can open a disabled server. Top-level navigation (Admin settings menu and the /ai/settings index redirect) discovers organization-level MCP sharers and surfaces permission lookup failures instead of silently falling back. - "Share server" action on the MCP server edit page opening a sharing dialog: hydrated ACL grants render from the `GET .../acl` response, adds/removals are saved as sparse `PATCH` deltas (`"read"` / `""`). - Principal autocomplete backed exclusively by the new `/acl/available` endpoint; the sharing flow never calls the generic org member/group APIs (Storybook enforces this by rejecting those API spies). A discovery error surfaces under the autocomplete without hiding existing grants. - Storybook interaction coverage for the dialog (hydrated rendering, add/remove, sparse deltas, error/cancel/reopen paths, autocomplete exclusion and failure) and share-only access to the page/form. Dogfood UAT ran remotely against a dev instance and passed, including verifying via the network log that candidate discovery only hits `/acl/available`. The share-only custom role UI flow could not be exercised there (no premium license on the dev instance); it is covered by the backend permission-matrix tests. > 🤖 This PR was authored by Xum (an AI coding agent) acting on Mike's behalf. |