mirror of
https://github.com/coder/coder.git
synced 2026-12-01 02:38:12 +08:00
407ed0d546367d2b2a550f9d7ecc60fcd2ff2ef4
16744
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
407ed0d546 |
refactor(site/src/pages/AgentsPage): move git commit prompt into GitPanel (#29159)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.
GitPanel already had the composer ref for diff comments, but Commit
still bubbled an `onCommit` callback up to `AgentChatPage` to insert the
canned prompt. The panel now inserts that prompt itself, so the page no
longer owns git-commit wording or the extra prop plumbing.
|
||
|
|
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" /> |
||
|
|
382a8763ff |
chore: move to be shared gateway types and helpers (#29718)
Moves client identification, credential handling, header processing, and error categorization into shareable packages. Generated by Coder Agents on behalf of @pawbana. |
||
|
|
739c27f9b2 |
feat(site): adopt the workspaces-style filter combobox (#29274)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Replace the User spend page's provider, client, and model dropdowns with the Workspaces-style `FilterCombobox`. Keep discrete URL parameters canonical, reset pagination when dimensions change, and preserve the current organization selector, permission gates, retention bounds, and date/time picker. Originally stacked on #28964. That work has landed with a redesigned organization-scoped spend API, so this branch now merges `main` and contains only the combobox changes, not the obsolete stack. The current API has no user-name search: unsupported free text stays local with an explicit validation message and does not change report requests or pagination. <details> <summary>Implementation plan and conflict-resolution decisions</summary> 1. Use the current organization-scoped Spend page from `main` as the baseline; discard obsolete stacked backend, generated API, documentation, and drill-in changes. 2. Adapt provider/client/model URL parameters to the shared combobox grammar, including quoted multi-word values. 3. Load options through the combobox's React Query integration using the existing AI Gateway endpoints and icons. Only session viewers receive dimension controls. 4. Preserve organization selection, date/time presets, retention limits, and pagination. Keep unsupported free text local rather than restoring removed API behavior. 5. Update existing interaction tests and stories for chip selection/removal, permission gates, and narrow/mobile layouts. </details> --------- Co-authored-by: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> |
||
|
|
fb39b59380 |
fix(site/src/pages/AgentsPage): start stopped workspace from desktop panel (#29475)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. > 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Fixes CODAGT-155. Clicking **Reconnect** in the Desktop panel of a chat whose workspace is stopped did nothing: the desktop websocket rejects any agent that is not connected, so every retry failed the same way. Worse, a stopped build carries no agents, so the Desktop tab was hidden entirely in the exact state where a start action is needed. The Desktop tab now renders from the workspace alone, and both the panel and the pop-out window (`DesktopPopoutPage`, which now resolves the chat's workspace itself) share one set of rules via `DesktopWorkspaceState`: - The VNC connection is gated on `latest_build.status === "running" && agent.status === "connected"`, so the session is torn down when the workspace stops and dials automatically once the agent is back, with no manual Reconnect needed. - While the workspace is stopped, the panel offers the build that brings it back, mirroring the workspace page (`getDesktopStartAction`): - **Update and start** via `API.updateWorkspace` when the template requires its active version and the workspace is outdated, since the backend rejects a plain start of the old version. A `ParameterValidationError` toasts a link to the workspace parameters page. - **Start workspace** via `API.retryWorkspace` after a failed start (cleanup stop first), or a plain start for `stopped`/`canceled`. - A failed stop or delete links to the workspace page instead of offering a Start button that would run the wrong transition. - Build and agent transitions show a spinner with the current state; a deleted workspace shows a static message. - The pop-out renders an `ErrorAlert` when the chat or workspace query fails (or the chat has no workspace) instead of spinning on "Initializing desktop..." indefinitely. Validated against a local dev instance with a docker workspace running `portabledesktop`: stop via CLI while connected → panel switches to "Start workspace"; click → "Workspace is starting..." → "Waiting for the workspace agent..." → desktop connected in ~8s without any Reconnect click. Same result on a cold page load while stopped, and in the pop-out window (connected in ~4s). The update/retry/failed-stop dispatch is covered by Vitest and Storybook. |
||
|
|
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" /> |
||
|
|
8f9b8b7386 |
fix(site/src/modules/aiModels): keep effort label width static (#30013)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. The reasoning effort label next to the slider resized with the selected value (`Minimal`/`Medium` are the widest), which shifted the slider track while dragging. Every label now renders in the same CSS grid cell, with all but the selected one `invisible`, so the slot always reserves the width of the longest label without hardcoding a pixel value. The badge keeps hugging its own text and is right-aligned inside that slot. Measured slider track width across all seven effort values in the `ModelSelector` `EffortRow` story: - before: 149, 134, 155, 133, 153, 154 px - after: 133 px for every value <img width="720" height="720" alt="bar" src="https://github.com/user-attachments/assets/d0327500-84f1-4396-8ffe-882dccb0dcc2" /> |
||
|
|
3b5f7e472d |
feat(site): rework agents sidebar filter into a dropdown menu (#30005)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Replaces the agents sidebar filter popover (staged filters + search + `Apply`/`Clear all`) with a dropdown menu that applies changes immediately. - Grouping is a radio group at the top; PR status, chat status and source live in submenus with icons, and `Archived` is a single checkbox. - Selections apply on click instead of being staged, so `Apply` is gone; `Reset` clears filters while keeping the current grouping (grouping is no longer treated as an "active filter"). - Submenus stay open while toggling multiple options, and the existing guards remain: at least one chat status and one source must stay selected. - Adds `DropdownMenuLabel` to the `DropdownMenu` primitives; stories and tests updated to the menu interaction model. | Old | New | | --- | --- | | <img width="298" height="543" alt="AGENTS_FILTER_OLD" src="https://github.com/user-attachments/assets/1b1a3bf2-981a-4dac-848d-8659f970e2be" /> | <img width="428" height="373" alt="AGENTS_FILTER_NEW" src="https://github.com/user-attachments/assets/c4e56421-91fc-4b4f-bf95-63515875fc88" /> | |
||
|
|
cdf50f8b2c |
feat: add mark as read and unread to agent chat menus (#30015)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. The chat read cursor only moved when a chat's stream connected or disconnected, so there was no way to clear an unread dot without opening the chat, or to flag a chat to come back to. `UpdateChatRequest` gains a `read` field that either advances the owner's read cursor to the latest assistant message or clears it, and the agents sidebar exposes it as a **Mark as read** / **Mark as unread** item directly under **Show subagents** in both the right-click and the ⋮ menus. Notes: - The cursor is owner-scoped, so `PATCH /api/v2/chats/{chat}` returns 403 for `read` when the caller is not the owner, even when they may otherwise update the chat. - The item is hidden for the chat that is already open, because opening a chat marks it read and would immediately undo the toggle. That also matches the sidebar, which never shows an unread dot for the active chat. <img width="292" height="215" alt="image" src="https://github.com/user-attachments/assets/31e9e249-70ea-4582-9391-66c4c51621b9" /> <details> <summary>Implementation notes</summary> Backend: - `UpdateChatLastReadMessageID` takes a nullable `last_read_message_id`; `NULL` clears the cursor so every assistant message counts as unread again. - `markChatAsRead` (stream connect/disconnect) now wraps `advanceChatReadCursor`; `clearChatReadCursor` is the new unread path. Both return errors so the HTTP handler can report failures instead of only logging them. Frontend: - `markChatRead` / `markChatUnread` mutations mirror `pinChat` / `unpinChat`: optimistic `has_unread` update, rollback plus invalidation on error, invalidation on settle. - `onMarkChatRead` / `onMarkChatUnread` thread from `AgentsPageLayout` through `ChatsSidebar` → `ChatsPanel` → `ChatTreeContext` → `ChatTreeNode`. `ChatTopBar` deliberately does not pass them, since it only ever renders the active chat's menu. Checks run: `make gen`, `make fmt`, `golangci-lint run ./coderd/...`, `go test ./coderd -run TestChatReadState`, `go test ./coderd -run 'TestSharedReaderStreamChat|TestChatPinOrder'`, `go test ./coderd/database -run TestChatHasUnread`, `go test ./coderd/database/dbauthz -run TestMethodTestSuite`, `tsc --noEmit`, `biome check`, and the AgentsPage Vitest unit and Storybook projects. </details> |
||
|
|
d2c23fda30 | refactor(site): use React namespace for React types (#29837) | ||
|
|
c0ad7f9344 | chore(site): bump @pierre/diffs to 1.5.1 (#29897) | ||
|
|
08283e27f6 |
feat(site/src/pages/AgentsPage): open settings with cmd/ctrl + comma (#30012)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.
Adds a `⌘ ,` / `Ctrl ,` shortcut that opens the Coder Agents settings
panel, alongside the existing `⌘ N` and `⌘ K` bindings.
- `useAgentsPageKeybindings` gains an optional `onOpenSettings` handler
bound to `,`.
- `AgentsPageLayout` navigates to `/agents/settings`, passing the
current location as `from` so the back button returns where the user
came from. No-op when settings is already open, so the original `from`
is preserved.
- The sidebar gear button now has a tooltip showing the shortcut, for
discoverability.
Covered by a new unit test in `useAgentsPageKeybindings.test.ts`.
|
||
|
|
4f372cef02 |
feat: accept include_related on get workspace by owner and name (#29855)
Adds `include_related` support to `GET
/api/v2/users/{user}/workspace/{workspacename}`
(`API.workspaceByOwnerAndName`), matching the get-workspace-by-ID
endpoint.
- Parses `include_related` via `wsrelated.Parse`; absent defaults to
`wsrelated.All()`, present-but-invalid returns 400.
- Passes the parsed config to `singleWorkspaceData`, preserving template
concealment (unauthorized template maps to 404 on this route).
- Omitted related data (build/template) is converted from zero values;
the build-not-found 404 only applies when the build was requested.
- Adds `TestWorkspaceByOwnerAndNameIncludeRelated` covering full,
template-only, latest-build-only, and invalid selections.
- Regenerated API docs/swagger.
_This PR was created by Coder Agents on behalf of @spikecurtis._
|
||
|
|
4d7af5d0d3 |
refactor(scaletest/workspacebuild): reuse latest build and narrow include_related (#29852)
Part of the lite `codersdk.Workspace` work ([GRU-82](https://linear.app/codercom/issue/GRU-82), [RFC](https://app.notion.com/p/coderhq/Lite-Workspace-API-Requests-3aad579be5928060b5e7cc65c539717f)). Cleans up two `client.Workspace` call sites in `scaletest/workspacebuild/run.go`. --- *Generated by Coder Agents on behalf of @spikecurtis.* |
||
|
|
957aefa475 |
feat: add client_session_id to connection_logs table (#29686)
The client session ID is not populated yet; this just adds the ability for agents to send a client session ID with the rest of the connection data, once it gets piped through. |
||
|
|
4851c7b60c |
style(site): update ai bridge fallback icons (#29865)
Updates the AI Bridge fallback icon for unknown providers, models, and clients from the question-mark circle to the lucide dashed circle using secondary content color at 80% opacity. Current circle with ? is too strong and honestly makes the item look like a problem because it doesn't have an icon. Goal is to make it a placeholder. Generated by Coder Agents on behalf of @tracyjohnsonux. |
||
|
|
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 |
||
|
|
756ffb97af |
feat: add a collapse_assistant_steps user preference (#29416)
## Stack context Bottom of a six-PR stack that adds the **Collapse assistant steps** chat preference (Agents > Settings, off by default). With it on, each turn's consecutive tool-step rows fold into one disclosure: "Worked for 2m 14s (7 steps)" once the turn completes, or a ticking "Working for 12s" while it runs. The stack was split out of #29115 for review size; #29115 now sits at the top with the full feature description and the UAT record. 1. #29416 feat: add a collapse_assistant_steps user preference (this PR) 2. #29417 feat(site): group assistant steps into working blocks 3. #29418 feat(site): add the working block disclosure 4. #29419 feat(site): fold assistant steps in the conversation timeline 5. #29420 fix(site): keep streaming text alive inside expanded working blocks 6. #29115 feat(site): add the collapse assistant steps chat preference ## Why The chat UI reads a per-user boolean to decide whether to fold steps. This layer stores it and exposes it through the preference settings API and SDK. `collapse_assistant_steps` follows the existing `task_notification_alert_dismissed` boolean pattern: a `user_configs` key with dbauthz wrappers, no migration. The generated API docs and TypeScript types are regenerated, and the frontend preference mocks gain the new required field. > This PR was prepared by Xum, an AI coding agent, on behalf of @ibetitsmike. |
||
|
|
dd9494d5df |
feat(site): group selected MCP servers into one composer pill (#29258)
When three or more MCP servers are active in the Agents chat composer, their pills collapse into one `N MCPs` pill with an overlapping icon stack. Clicking it opens a popover that lists the same named pills the toolbar shows for one or two servers, so each can be removed with its X. Switching a server on, `Auth`, and `Disconnect` stay in the `+` menu. Always-on servers show a lock instead of an X in the popover and the toolbar, the `+` menu marks them with the same lock, and OAuth-pending servers stay excluded from the count. The popover reuses `ToolBadge` for its rows and shares `BadgePopoverContent` with the `+N` overflow popover. Pills in both popovers truncate long names so the X stays in view, and every pill X (MCP, workspace, planning) honors the composer's disabled state. `MCPServerIcon` moved to `site/src/modules/mcpServers/` with `tile` and `circle` variants and renders a decorative `alt=""`, since every consumer shows the server name beside it; the overlapping icon stack moved into `MCPServerIconStack.tsx`. Known limitation, consistent with the existing pills: removing the third server collapses the group and unmounts the popover, so focus returns to the document. Restoring focus across all badges is left for a follow-up. ## Follow-ups - Move the badge family (`ToolBadge`, `MCPGroupBadge`, `BadgePopoverContent`, `BadgeDismissButton`) out of `AgentChatInput.tsx` into a sibling file as a pure-move PR. - Extract the `+` menu's per-server MCP row into a named component. The second `coder-frontend-review` pass asked for it (RP6); it stays out of this PR because refactoring that working single-caller row inside a feature PR is what SD7 rejects. ## Validation - Stories cover the two-pill, closed, open, long-name, disabled, five-server, and nested-overflow states. Vitest covers removing a server from the popover, switching one on from the `+` menu, the two-pill path, OAuth-pending exclusion, and the disabled composer. - On `ee4d9b52ecf`: `biome check`, `tsc`, the `AgentChatInput` unit tests (12) and Storybook project (71 stories), and the full pre-commit hook pass. The pre-push hook did not run locally; `ci`, `flake-go`, and `AI Documentation Check` pass on this head. - Live UAT passed on `282d3f0257e`: long names truncate with the X reachable at 320 to 414px, always-on pills show the lock, and 4 to 3 to 2 servers collapses back to named pills. Earlier rounds covered the grouping threshold, `mcp_server_ids` persistence, and nested overflow. Later commits were not re-exercised live. - Codex: nine rounds, clean from round 6 on, the latest on `48f82d33bbf`. It was not re-requested on `ee4d9b52ecf` because the six-pass review budget was already spent. @DanielleMaywood: four threads fixed in `d17ca4d6d27`, one question answered in-thread. - `coder-frontend-review` pass 1 on `d17ca4d6d27` produced `48f82d33bbf`. Pass 2 ran on request against `6cce1dc3053`, which merges `main` again and keeps both sides of an `AgentChatInput.test.tsx` conflict. It produced `ee4d9b52ecf`: named `MCPGroupBadgeProps` and `MCPServerIconStackProps`, an inlined single-use slice, and the `+N` chip on `-ml-1.5 text-2xs`. All eight roles end PASS or N/A. Declined: reusing `MCPServerIcon` in the single-server pill and `+` menu row (it frames a smaller glyph, so it would restyle existing surfaces) and replacing the stories' `buildMCPServer` factory (that file's convention). > Xum (Coder's coding agent) implemented this on behalf of @ibetitsmike. |
||
|
|
856e764fe4 |
feat(site): support workspace file uploads from the new chat page (#27112)
> Written by Mux on behalf of Mike.
## What
Workspace-routed files, such as zip archives, can now be attached on the
new-chat page when a running workspace is selected. Previously the
upload endpoint required a chat ID that did not exist yet, so the
landing page rejected these files with a misleading toast.
## How
- Queue workspace files locally until submit, then create an idle chat,
upload the queued files, send the first message with workspace-file
references, and navigate after the message succeeds.
- Keep retries and partial failures safe by re-uploading into a fresh
chat, archiving failed shell chats, and preserving the draft. If
archiving returns 409 because the server did commit the first message,
navigate to the chat instead of showing errors.
- Ignore files explicitly removed before or during upload, but treat
reset, scope changes, and unmount as cancellation so the flow cannot
continue with stale or partial workspace files.
- Lock the organization, workspace, and composer controls for the
complete create, upload, and send sequence, and keep them locked after
success until the page navigates. A synchronous guard ignores any second
submit, so a pending Enter or Send click cannot create a duplicate chat
without the files.
- Refuse new files of any kind (picker, drop, paste) while a submit is
in flight, with a toast (paste goes through a small plugin because
Lexical ignores paste on a read-only editor), so a file added
mid-sequence is never uploaded and then silently dropped.
- Files attached before submit show a `deferred` chip state ("Uploads
when sent"), distinct from the chat page's `queued` state ("Waiting to
upload...").
- Show landing-page copy that asks the user to select a running
workspace.
## Follow-ups
- The create page gates workspace uploads on any connected root agent;
the server picks the agent with `agentselect.FindChatAgent`, so a
multi-root-agent workspace with a disconnected chat-suffixed agent
passes the gate and fails on upload (error toast, draft preserved, shell
chat archived). An exact probe needs the selection exposed by the API.
Tracked in [CODAGT-1174](https://linear.app/codercom/issue/CODAGT-1174).
- Freeze regular attachment remove controls while the deferred workspace
upload runs (adding files is already refused); the message is sent with
the attachment IDs snapshotted at submit time, and
`AttachmentPreview`/`AgentChatInput` currently have no read-only mode
(the same window exists on the chat page while a send is pending).
- Skip the final navigation when the user leaves the page while the
deferred first-message request is in flight (needs an unmounted signal
through the page; the regular create path on main has the same window).
- Route a failed deferred first message through the form's inline
hook-failure presentation (with the lifecycle-hook dispatch detail)
instead of the toast; needs the send mutation state lifted into the
form.
- Recover from a first-message request that never responds (client
timeout or cancel, archiving the shell chat on abandon); the create path
on main has the same hang
([CODAGT-1177](https://linear.app/codercom/issue/CODAGT-1177)).
- Show one refusal toast per paste batch and use one policy for inline
attachments during a pending send on both pages
([CODAGT-1178](https://linear.app/codercom/issue/CODAGT-1178)).
## Testing
- `AgentCreatePage.test.tsx` covers the create, upload, send, navigate
order and each archive path; `AgentCreateForm.test.tsx` covers the
deferred-upload form behavior. The stories added here keep only distinct
visual states.
## Notes
Queued `File` objects do not survive a page reload. A browser closing
mid-sequence can leave an idle, archivable chat after an explicit
submit.
|
||
|
|
0eed5465f2 |
feat: allow creating chats without an initial message (#27111)
> Written by Mux on behalf of Mike.
## What
`POST /api/v2/chats` now accepts an empty `content` array. The chat is
created idle (`waiting`) with system messages only: no user message is
inserted, no ownership hint is published, and no chat worker picks it
up. Generation starts when the first message is POSTed to
`/chats/{chat}/messages`.
## Why
The new-chat page needs to upload files into the chat's workspace before
the first turn, and `POST /chats/{chat}/workspace-files` requires a chat
ID. There was previously no way to sequence "create chat, upload files,
send first message": creation required non-empty content and started
generation immediately. This PR adds the enabling primitive; the UI
lands in the next PR of the stack.
## How
- `chatstate.CreateChat` takes an explicit `InitialStatus` (`waiting` or
`running`, validated). The existing `IsRunnable()` gate keeps ownership
hints suppressed for `waiting` chats.
- `chatd.CreateChat` derives the status from `InitialUserContent`: empty
content means `waiting` with system messages only, and `APIKeyID` is
only required when a user message is inserted.
- `createChatInputFromRequest` returns empty blocks for empty content
instead of rejecting; the `/messages` path still rejects empty sends.
- Chats created this way carry the `New Chat` placeholder title. Title
generation now treats that placeholder as replaceable. When the first
message lands on such a chat, `chatd.SendMessage` detects the first user
turn inside its transaction (under the chat row lock), writes the
fallback title in the same transaction, and reports `FirstUserTurn`;
`postChatMessages` then fires `GenerateChatTitleForMessagesAsync` to
upgrade it. A failed title call therefore still leaves a meaningful
title.
- `ARCHITECTURE.md` carries `TODO (#27111)` items in the transition list
and the `POST /api/v2/chats` section for the new `N -> Create -> W`
transition (the doc text and the diagram edge are left for the author
per the chatd guardrail).
## Follow-ups
- Automatic title generation (both the create path and the first-message
path added here) writes the generated title unconditionally, so a user
rename that lands while the title model call is in flight is
overwritten; a compare-and-set title update would close that
pre-existing window.
- `chats.last_reasoning_effort` is derived from inserted messages, so an
idle chat created with `reasoning_effort` does not persist it until its
first message; the first message applies the owner's personal
reasoning-effort override (when it targets the same model) if the
request omits an effort, matching `POST /chats` with content.
## Testing
- chatstate: `N -> W` lands in `StateW` with no ownership hint; invalid
initial statuses are rejected.
- chatd: empty create produces a `waiting` chat with system messages
only.
- HTTP: empty create + first message (`W -> R0`, inserts directly, not
queued), immediate archive of an idle chat, workspace file upload
against an empty-created chat, and title generation on the first
message.
|
||
|
|
87303d6f0d |
feat(site): route non-attachment chat files to workspace uploads (#27080)
## What
Frontend for chat workspace uploads:
- Files whose declared MIME type is outside the attachment allowlist are
automatically routed to the workspace upload endpoint (picker,
drag-drop, and paste). Empty/`application/octet-stream` types stay on
the attachment path so the server can sniff bytes.
- `useWorkspaceFileUploads`: react-query mutation with eager upload on
select, bounded to 3 concurrent streams, per-entry abort (removing a
chip cancels its in-flight request), and generation-scoped workers so
switching chats mid-upload cannot leak a stale upload into the new chat.
- Composer chips (`WorkspaceUploadPreview`) show queued ("Waiting to
upload..." beyond the 3 in flight), uploading, uploaded, and error
states; removal copy makes explicit that already-uploaded bytes stay in
the workspace.
- Timeline chips (`WorkspaceFileChip`) render `workspace-file-reference`
parts with name/size and the absolute path in a tooltip.
- References survive message edits and queued-message edits.
- Upload error text is the server message plus its detail when present,
without a doubled period or the generic developer-console hint. The
shared `formatAgentAttachmentUploadError` helper had the same defect for
inline attachments and is fixed there.
- The affordance is gated on a bound workspace with a connected agent;
otherwise the input falls back to attachments only. A disabled
(read-only) composer refuses workspace routing entirely. The target
agent is the one the server resolves for the chat binding (main now
enriches the binding server-side), so the frontend no longer mirrors
`agentselect.FindChatAgent`.
- Message edits only rehydrate `workspace-file-reference` parts whose
`workspace_file_workspace_id` matches the currently bound workspace;
references from a previous binding are dropped from the edit draft (the
server also rejects them).
## Why
Completes CODAGT-211: dropping a `.zip`/`.tar.gz`/dataset whose MIME
type is outside the attachment allowlist into chat lands it at
`~/.coder/chats/<chat-id>/files/` where the agent can act on it, without
pushing bytes through the LLM context.
## How tested
- `pnpm vitest` for the upload hook (including a chat-switch race
regression test), routing predicate, message parsing/helpers; Storybook
interaction tests for the chip states; `tsc`, biome, React Compiler
check, and knip all clean.
## Follow-ups
- Persist workspace-upload metadata per chat so composer chips survive a
failed workspace rebind and navigating away from and back to a chat.
Today the hook resets when the chat or bound workspace changes (the
server rejects references from a previous binding) and the upload list
is client state only, so the chips are dropped even though the bytes
stay in the workspace.
([CODAGT-1172](https://linear.app/codercom/issue/CODAGT-1172))
- Expose workspace-upload availability from the backend (the agent
`agentselect.FindChatAgent` would pick) instead of the client gating on
the bound agent or, when the chat has none yet, on any connected root
agent; a multi-root-agent workspace whose selected agent is disconnected
currently gets the server's 409 on upload.
([CODAGT-1174](https://linear.app/codercom/issue/CODAGT-1174))
- Reset or re-validate composer chips when `repairChatAgentIDs` replaces
the bound agent after a workspace rebuild (the hooks scope on chat and
workspace ID only); belongs with the upload-metadata persistence above.
- Render timeline chips whose `workspace_file_workspace_id` differs from
the chat's current binding in a stale/unavailable state (the prompt
already renders such references as unavailable); needs the current
binding threaded into the timeline and a chip variant.
([CODAGT-1173](https://linear.app/codercom/issue/CODAGT-1173))
- Files with an unknown MIME type (empty or `application/octet-stream`,
for example a random `.bin`) stay on the attachment path by design,
where the server classifies the bytes and rejects them with "Unsupported
file type"; routing that rejection to the workspace upload instead is a
follow-up
([CODAGT-1170](https://linear.app/codercom/issue/CODAGT-1170)).
`text/csv` is an allowlisted attachment type and stays inline (UAT
finding).
- Route large files of allowlisted types to workspace upload by size
([CODAGT-1169](https://linear.app/codercom/issue/CODAGT-1169)).
Part of CODAGT-211. Stack: agent API -> coderd endpoint -> UI (this PR).
> This PR was authored by Mux (AI) working on Mike's behalf.
|
||
|
|
2c1e888d6c |
fix(site/src/pages/AgentsPage): preserve chat row width with menu open (#29422)
Opening a chat row's actions menu could leave the row inset with rounded corners after the pointer moved into the portaled menu. Apply the same full-width layout used on hover while the menu is open, keeping the row edge-to-edge until the menu closes. Linear: https://linear.app/codercom/issue/CODAGT-1040/new-chat-sidebar-row-changes-from-full-width-to-pill-shape-on-hover <details> <summary>Coder Agents implementation notes</summary> - Reproduce the visual state using the existing sidebar menu Storybook story. - Preserve the chat row's hover geometry whenever its dropdown trigger reports `data-state="open"`. - Verify with the sidebar Storybook suite, frontend typecheck, repository hooks, and visual inspection. </details> _Generated by Coder Agents on behalf of @tracyjohnsonux._ |
||
|
|
93a00bd515 |
fix(site): steepen overlay enter and exit easing (#29822)
Overlay enter and exit used the default CSS ease curve, which starts too gently, so menus, dialogs, popovers, selects, and drawers felt slow at their existing durations. They now use `ease-out-strong (cubic-bezier(0.19, 1, 0.22, 1))`. Durations are unchanged. Dropdown and context menus share the menu content class. https://github.com/user-attachments/assets/402b422f-cd71-4264-96f7-2918d6d62ed3 |
||
|
|
5dde49dffb |
feat: add chat workspace file upload endpoint (#27079)
## What
Adds `POST /api/v2/chats/{chat}/workspace-files`, which streams the
request body to the chat's bound workspace agent and returns the final
path/name/size, plus the `workspace-file-reference` message part type
that carries the uploaded file's metadata through chat messages:
- `coderd/exp_chats.go`: owner-only middleware (chat RBAC update +
reject archived), workspace exec authorization (403/409 like the
existing chat exec paths), agent selection (prefer the chat's bound
agent, else deterministic `agentselect.FindChatAgent`, without
persisting a binding), 30s dial timeout, chat/ancestor tracking headers
on the agent connection, and agent error passthrough (agent HTTP status
preserved, 502 with a generic detail for transport failures; the real
error is logged). Deleted and non-running workspaces get a specific 409
("Workspace is stopped. Start the workspace before uploading files.")
before agent lookup. Each failed upload logs one structured warning, and
`coderd_chat_workspace_upload_total{status}` counts outcomes. The route
shares the files rate limit and documents its 429.
- Input validation: client-supplied `workspace-file-reference` parts
must point inside `/.coder/chats/<chat-id>/files/` with a matching
basename, non-negative size, and a `workspace_file_workspace_id` equal
to the chat's currently bound workspace (the upload response echoes it
as `workspace_id`). References uploaded before a workspace rebind are
rejected instead of silently sending the agent an unreadable path. The
file name must already be in sanitized form
(`SanitizeWorkspaceUploadName(name) == name`), and the cleaned path and
base media type are what gets persisted; message edits share the same
validation. Parts are rejected on chat creation (no chat ID exists yet).
- `coderd/x/chatd/chatprompt`: references render into the prompt as text
only, `[workspace file: <name> (<size>) at <path>]`; file bytes never
reach the LLM. Title derivation (`TitleText`) uses the bare file name,
so fallback titles carry no internal marker.
- `codersdk`: part-type constants/fields,
`ChatMessageWorkspaceFileReference` builder, and
`Client.UploadChatWorkspaceFile` (RFC 5987 filename in
`Content-Disposition`).
No DB migration: parts persist as JSON in `chat_messages.content`.
## Why
Bridges chat and the workspace filesystem for CODAGT-211: users drop a
file in chat, the bytes land where the agent's tools can operate on
them, and the model learns the path from the reference part.
## How tested
- `go test ./coderd -run 'WorkspaceFile|ChatInput|UploadChat'` including
an integration test that runs a real in-memory agent, uploads through
the coderd route, verifies bytes on disk, and exercises collision
suffixes.
- `go test ./codersdk ./coderd/x/chatd/...`, `make gen`
(swagger/types/docs), `make lint`.
- Rebased onto main 2026-09-21: the chat API moved from
`/api/experimental` to `/api/v2`, so the route is registered in
`coderd/chat_routes.go` and the SDK method lives on `codersdk.Client`.
## Follow-ups
- The files rate limit counts requests, not bytes or concurrency;
whether this route should use a per-user concurrency cap instead, and
whether the new-chat page should keep partial successes on a 429, is
still open
([CODAGT-1171](https://linear.app/codercom/issue/CODAGT-1171)).
Part of CODAGT-211. Stack: agent API -> coderd endpoint (this PR) -> UI.
> This PR was authored by Mux (AI) working on Mike's behalf.
|
||
|
|
47345bfc4e | fix: adapt agent docs, skills, and Coder Agents prompts for Claude Opus 5.5 (#29817) | ||
|
|
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.*
|
||
|
|
99c42af5fc |
fix(site/src): stop delete dialog keys and clicks from activating rows (#29868)
Fixes [DASH-106](https://linear.app/codercom/issue/DASH-106/show-validation-error-for-incorrect-workspace-deletion-confirmation). In the workspaces list, pressing Enter or Space in the delete confirmation input took you to the workspace page. Nothing was deleted and there was no explanation. Review turned up related problems in the same dialog, which this PR also fixes. **Root cause:** React sends events from portaled content (dialogs, menus) up through the component tree to parent components. The delete dialog is rendered inside a clickable workspace row. The row reacted to Enter and Space from the dialog's input as if the row itself had been activated, and it did the same for middle clicks. The actions cell already stopped normal clicks from reaching the row, but not key events or middle clicks. **Changes** - `useClickable` / `useClickableTableRow`: - Enter and Space only activate the row when the row itself has focus. - Clicks, middle-clicks, and double-clicks from portaled content are ignored (`isFromPortal`). A middle-click paste (Linux) into the dialog no longer opens the workspace in a new tab. - A nested native button still sends its own click to the row unless it stops click propagation, as the existing row buttons already do. - New `DeleteConfirmationField` + `useDeleteConfirmation`, shared by `WorkspaceDeleteDialog` and `DeleteDialog`. They previously duplicated this logic. The shared field provides: - Enter with a wrong name shows the error immediately, instead of only after the input loses focus. Screen readers announce it (`role="alert"`). - The typed text is quoted and keeps its whitespace, so a stray space is visible. - `WorkspaceDeleteDialog` clears the typed name, "Orphan Resources", and the error whenever the dialog closes, including after confirm (the parent closes it then). Before, typing the correct name, cancelling, and reopening showed an enabled Delete button, so one click deleted the workspace without retyping. - `DeleteDialog` (shared) clears the typed name whenever its dialog closes, including when the parent closes it, as the organization page does after a failed delete. Before, reopening showed Delete already enabled. Callers that keep the dialog open after a failed delete (templates, users) still keep the typed name so the user can retry. - `WorkspaceOutdatedTooltip`, `ProviderRow`, `ModelRow`: removed key handlers that only worked around the old row behavior, and corrected their comments. **Decisions** - The mismatch error appears below the input without a reserved slot, so the controls below move down when it shows (unchanged from `main`, by design decision). - Enter with an empty input stays silent on purpose. It doesn't confirm or navigate, and the disabled Delete button signals that a name is needed. - Workspace names can't contain spaces, so a typed space leads to the mismatch error. The input doesn't block spaces. **Verification** - Unit tests: - Enter and Space from inline and portaled inputs don't activate a clickable element. - Clicks and middle-clicks from portaled content don't activate the row. - Enter with a wrong name marks the input invalid and announces the error. Editing the name clears it. - A matching name confirms on Enter. - The workspace dialog reopens empty after cancel and after confirm. The shared dialog reopens empty after its parent closes it, and keeps the typed name while it stays open for a retry. - Each new test fails when the code it covers is removed. - Stories: new `FilledWrongSubmitted` (error shown while focused). - Related unit tests and stories pass for every clickable table page and every `DeleteDialog` caller (workspaces, templates, organizations, users, Agents). - Tested by hand by @tracyjohnsonux before the reset, shared-field, and click-guard changes. --- _Generated by Coder Agents on behalf of @tracyjohnsonux._ |
||
|
|
282365b23a | feat: report clicks on the workspace build debug action to telemetry (#29853) | ||
|
|
6f0c4474ee |
feat(site/src): show agent startup logs in start and create tools (#29550)
feat(site/src): show agent startup logs in start and create tools (#29550) start_workspace and create_workspace wait for agent startup after the build, but the row only showed the finished build log. Show the agent startup log below it, using the same Logs components as the build log. Closes CODAGT-166 |
||
|
|
23cf5fcbe7 | ci: remove one-off helm index repair workflow (#29926) | ||
|
|
aa87166c2f | docs: fix step order and values.yaml in Azure App Gateway guide (#29927) | ||
|
|
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. |
||
|
|
fb8b6dc2fb |
feat: hide the User spend page from the AI settings sidebar (#29843)
## Description Hide the **User spend** page from the AI settings sidebar for this release and mark the page as experimental. The page stays reachable at `/ai/settings/spend`, so nothing else about it is removed. Related to [internal Slack thread](https://codercom.slack.com/archives/C04M9CNGHGF/p1790190171687059?thread_ts=1790190121.005749&cid=C04M9CNGHGF). Screenshot <img width="1186" height="613" alt="Screenshot 2026-09-25 at 13 44 50" src="https://github.com/user-attachments/assets/820058d5-1b88-4fe7-8c95-01b1fe2211cb" /> ## Changes - Remove the sidebar nav item and the spend access lookup that only fed it. - Add an `Experimental` badge next to the page title and a warning alert explaining that reports may load slowly and the page may change or be removed. Docs for the **User spend** page are updated upstack in #29844. > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
46ccaf3764 |
chore: mark organization AI spend users endpoint as experimental (#29842)
## Description
Move `GET /organizations/{organization}/ai/spend/users` under
`/api/experimental` so the per-user spend report is not part of the
stable API for this release. The endpoint behavior is unchanged.
Related to [internal Slack
thread](https://codercom.slack.com/archives/C04M9CNGHGF/p1790190171687059?thread_ts=1790190121.005749&cid=C04M9CNGHGF).
## Changes
- Register the route on the experimental handler and mark it
`@x-apidocgen {"skip": true}`, which removes it from the generated API
reference.
- Move the Go SDK method to `ExperimentalClient` and the frontend method
to `API.experimental`.
- Drop the docs link to the removed API reference section. The link is
commented out with a TODO so it can be restored later.
User-facing docs for the **User spend** page are updated upstack in
#29844.
> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
|
||
|
|
9afdea4808 |
docs(docs): document RPM install on RHEL-family Linux (#29295)
## Summary Coder ships `.rpm` assets with every release and `install.sh` routes the RHEL family to `install_rpm()`, but no public page said so. The only page that named RHEL was the uninstall page. This adds an RPM install page for the control plane. New page `docs/install/server/rpm.md`: - Supported distribution matrix for RHEL 8/9/10, Rocky, AlmaLinux, CentOS Stream, Amazon Linux, Fedora, and openSUSE, with the `ID`/`ID_LIKE` detection that makes derivatives work. - Install tabs for the install script, `dnf install`, and `rpm -U`. - What the package lays down: `/usr/bin/coder`, `/etc/coder.d/coder.env`, `coder.service`, `coder-workspace-proxy.service`, and the unprivileged `coder` user. - Configure-then-start ordering, because `coder.service` carries `ConditionFileNotEmpty=/etc/coder.d/coder.env` and won't start against an empty config. - SELinux caveat for Docker/Podman inside workspaces on RHEL nodes, linking the existing guidance instead of duplicating it. - Iron Bank UBI9-minimal pointer for hardened environments, scoped correctly as a container image rather than an RPM path. Supporting edits: manifest entry under "3. Install the control plane" between OpenShift and Cloud Providers, a row in the platform table on `install/server/index.md`, and a pointer from `install/cli.md`. ## Placement The page sits at `docs/install/server/rpm.md`, as a sibling of Docker, Kubernetes, Rancher, and OpenShift, rather than under community install methods: RPMs are officially built and shipped, not an unofficial method. It is a control-plane deployment page, not CLI download content, so it is out of scope for the CLI-retirement work. ## Verification Claims on the page were checked against real RHEL-family images, not just the install script: | Check | Method | Result | |-------|--------|--------| | `ID` and `ID_LIKE` per distribution | `docker run <image> sh -c '. /etc/os-release; ...'` across UBI 8/9/10, Rocky 9, Alma 9/10, CentOS Stream 9/10, Amazon Linux 2/2023, Fedora, openSUSE Leap and Tumbleweed | Every RHEL-family image lists `fedora` in `ID_LIKE`; both openSUSE variants list `opensuse`. Matches the `distro()` branch in `install.sh` | | `dnf install ./coder_*.rpm` | Rocky Linux 9 container | Installs cleanly | | Package contents | `rpm -ql coder` | `/usr/bin/coder`, `/etc/coder.d/coder.env`, `coder.service`, `coder-workspace-proxy.service` | | Service account and start condition | Installed unit file | Runs as `coder:coder`; `ConditionFileNotEmpty=/etc/coder.d/coder.env` | | Architectures | `.github/workflows/release.yaml` | `amd64`, `armv7`, `arm64` | Not verified: `systemctl enable --now coder` against a live database, since the containers used for verification have no init system. The `systemctl is-active` output on the page is standard systemd output, flagged here for the reviewer. Lint: `make lint/markdown`, `make lint/emdash`, and `make lint/prose` all clean on the changed files; `pnpm run format-docs` applied. <details> <summary>Implementation plan and decision log</summary> ### Style guide application The first revision of this page was drafted from sibling install pages rather than from the style guide, and was rewritten against [`docs/.style/content-guidelines.md`](https://github.com/coder/coder/blob/main/docs/.style/content-guidelines.md) and the prose style guide. What changed: one sentence per source line, declared audience and outcome in the opening paragraph, numbered procedures with one instruction per step and conditions stated first, `refer to` instead of `see`, `sh` fences instead of `shell`, H3 tab headings, non-breaking space between number and unit, and `Learn more` instead of `Next steps`. ### Decisions - **No version numbers or FIPS certification claims for Iron Bank.** The tags in `scripts/ironbank/hardening_manifest.yaml` are stale (`0.15.3`); documenting them would re-create the drift. The page links the registry and names the UBI9-minimal base only. - **Iron Bank framed as a container path.** It is a container image, so the page routes readers to Kubernetes/OpenShift rather than implying it is an alternative to the RPM. - **Dropped an unverified SELinux claim.** An earlier draft asserted that the control plane runs under enforcing mode with no policy changes. That was not tested, so it is gone. The section now covers only the workspace container-runtime case, which links to existing verified guidance. - **`ID_LIKE` values kept out of the table.** They vary by version (RHEL 8/9 report `fedora`, RHEL 10 reports `centos fedora`), so the table lists `ID` and the prose states the invariant the install script actually matches on. - **Minimal edit to `install/cli.md`.** That file is slated for deletion in the Install restructure, so it gets a pointer and nothing more. ### Rebase onto the install spine restructure The install spine restructure landed on `main` while this PR was open and removed the install-method tabs on `install/index.md` that the first revision pointed from. The branch was rebased and squashed onto it: the page moved from `docs/install/rpm.md` to `docs/install/server/rpm.md`, every relative link was repointed at the new locations (`../plan/sizing/index.md`, `../prepare/airgap.md`, `../operate/upgrade.md`, `../operate/uninstall.md`, `./kubernetes/index.md`), the install script snippet picked up the standardized `curl -fsSL` flags, and discovery moved from the removed `install/index.md` tabs to the platform table on `install/server/index.md`. The prose is otherwise unchanged. ### Follow-ups tracked elsewhere The install spine has no other bare-host or Linux-package option under platforms; every other entry is a container platform or a cloud VM. Open question recorded on the IA proposal: whether this generalizes to a single "Linux host (system packages)" page covering `.deb` and `.apk` too. </details> --- Linear: [DOCS-886](https://linear.app/codercom/issue/DOCS-886/document-support-for-running-coder-on-red-hat-linux) 🤖 Generated with Coder Agents on behalf of @nickvigilante. |
||
|
|
702b13112d | feat: add Debug with Coder Agents action for failed workspace builds (#29811) | ||
|
|
b3e073b7c2 |
test(coderd/x/chatd): strengthen synthetic key lifecycle coverage (#29885)
Strengthen coverage of existing synthetic Gateway key behavior: check reuse and renewal on both sides of the renewal margin, preserve key identity and unrelated fields during renewal, synchronize concurrent mint callers before they contend for the existing lock, and verify colliding user-created tokens remain untouched. Uses a mock clock and joins workers on failure. No production changes or dependency on model authorization. Independent extraction from #29846. Verified locally: `make pre-commit` and five focused synthetic-key race-test runs passed against unchanged production code. The combined extraction branch also passed the complete Chatd suite. Extracted and verified with AI assistance on behalf of @johnstcn. |
||
|
|
150d366259 | docs: add branch-naming rule to prevent issue-tracker auto-link collisions (#28574) | ||
|
|
5e12a74f38 | fix: run the test recipe under MAKE_TIMED instead of skipping it (#29849) | ||
|
|
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`. |
||
|
|
1c974608b1 |
feat: rotate, decrypt, and delete encrypted chat_mcp_servers headers (#29520)
Relates to #25381 `chat_mcp_servers.headers_key_id` has a foreign key to `dbcrypt_keys(active_key_digest)`, but `dbcrypt rotate`, `decrypt` and `delete` didn't know about the table. `rotate` finishes by revoking every old key, so an encrypted header row would fail that revoke with an FK violation, which is the same class of bug as #25381. This PR adds `chat_mcp_servers` to all three commands. `rotate` re-encrypts under the new key (and encrypts plaintext rows with no key ID, like `gitsshkeys`), `decrypt` writes the plaintext back and clears the key ID, and `delete` removes the encrypted rows outright, like `user_secrets`, since a server without its headers can't authenticate anyway. Rows with `{}` headers are never encrypted, so they're left alone. The org-level `mcp_server_configs` gap is still tracked at #25381. I've stacked this on the `mcpclient` PR, though it only depends on the `chat_mcp_servers` table PR, as `gh stack` is linear. Part of CODAGT-1131 |
||
|
|
016df8cbab |
feat(coderd/x/chatd/mcpclient): add hardened connect path for inline MCP servers (#29518)
Third PR in the inline MCP servers stack, on top of https://github.com/coder/coder/pull/29517. This adds the `mcpclient` side that chatd will use to talk to servers a chat owner declared by value on the chat. Nothing in chatd calls the new functions yet. `mcpclient` now owns its input type. `ConnectAll` and the new `ConnectInline` both take `[]mcpclient.Server`, and `ServerFromConfig` converts an org-configured row at the boundary, so a caller never has to fake a `database.MCPServerConfig` for a server that has no row. The org path behaves as before with two exceptions: `connectAllWithHooks` no longer skips disabled servers (the call site in `generation_preparer.go` filters them), and a `custom_headers` row with malformed JSON or an unknown auth type used to connect without those headers, whereas now conversion fails and the caller skips the server with a warning. Org-configured servers were set up by an admin, so we don't put many limits on them. Inline ones are supplied by whoever created the chat, so `ConnectInline` treats the server as untrusted. HTTP response bodies are capped at 1 MiB, a server can expose at most 64 tools with each definition under 64 KiB and 256 KiB in total, and tool results are capped at 256 KiB. If a server blows the tool caps we skip the whole server rather than hand the model a partial tool set, and an oversized result comes back to the model as a tool error rather than being truncated silently. Everything the server sends that we log or hand to the model (tool names, descriptions, schemas, results, connect errors) has the values in `Server.SensitiveValues` replaced with `[REDACTED]`; chatd sets that to the URL and header values. Header names aren't redacted, as they're public and short enough that redacting them would rewrite ordinary text. For the same reason the redactor ignores anything shorter than `MinSensitiveValueBytes` (8), and #29546 rejects header values that short at the API. The slug is caller-supplied too, so it also goes through the redactor wherever it lands in a tool name, connect summary or log field. `AppendInline` merges the resulting tools into an existing tool list with the existing names winning, so an inline server can't shadow a builtin or org-configured tool. Collisions are logged once per server with the `config_id`. Lastly, every `tools/call` (for both kinds of server) now carries the model's tool call ID in `_meta` under `com.coder/tool_call_id`. It's a correlation ID that's stable across chatd retries of the same call, so a server can use it to dedupe if it wants to. We make no other idempotency promise. Part of CODAGT-1131 |
||
|
|
acebdf5b60 |
feat: add chat_mcp_servers table with encrypted headers (#29517)
This is the second PR in the stack that adds experimental support for attaching MCP servers to a chat; https://github.com/coder/coder/pull/29466 is the first. This one is just the persistence layer, nothing reads from the table yet. It adds a `chat_mcp_servers` table, unique on `(chat_id, slug)` and cascading on chat deletion. Each row stores the server URL, a JSON object of request headers, per-server tool allow and deny lists, and three flags that later PRs in the stack use to decide when the server gets connected: `allow_in_plan_mode` (mirroring the existing column on `mcp_server_configs`), `allow_in_subagents`, and `forward_coder_headers`. All three default to `false`. Headers are the sensitive part, so they're encrypted at rest via `dbcrypt` in the same way `external_auth_links` are: `headers_key_id` records which key was used, and `NULL` means plaintext. Empty or `{}` headers are stored as `{}` with no key, so servers that don't need auth never produce ciphertext. The `dbcrypt` wrappers cover the chat-scoped reads and writes, plus `GetChatMCPServersByChatOwnerID` and `UpdateEncryptedChatMCPServerHeaders`, which follow the per-user shape that `Rotate` and `Decrypt` in `cliutil.go` use. I haven't wired those two into `coder server dbcrypt rotate` and `decrypt` in this PR. For authz, reading a chat's servers requires read on the chat, and upserting or deleting them requires update on the chat. The two owner-scoped queries above are system-only. Part of CODAGT-1131 |
||
|
|
c1af0793e5 |
feat: add caller-supplied tools kill switch for chats (#29466)
This is the first PR in a stack that adds experimental support for attaching MCP servers to a chat when it's created, and then deprecates `unsafe_dynamic_tools` in favour of them. Both are "caller-supplied tools", i.e. tools the client hands to coderd at chat creation rather than tools an admin has configured, so we want a single switch admins can use to turn all of them off. This PR adds that switch: `--disable-chat-caller-supplied-tools` (`CODER_DISABLE_CHAT_CALLER_SUPPLIED_TOOLS`). It follows the existing `disable-*` deployment flag pattern (`--disable-chat-sharing` etc.), so there's no new API route and it's independent of any experiment. When set, `POST /api/v2/chats` returns a `403` if the request includes `unsafe_dynamic_tools`, and chats that already have dynamic tools run without them; a call to one gets a tool error result and the model just continues. Later in the stack, chat-attached MCP servers are gated behind the same flag. It's unset by default, so nothing changes unless you opt in. Part of CODAGT-1131 |
||
|
|
9700db5b53 |
chore: update low-risk dependencies (#29860)
## Summary Updates pinned dependency overrides across three independent pnpm installs: | File | Package | From | To | |------|---------|------|----| | `package.json` (root) | brace-expansion | 1.1.16 | 1.1.18 | | `offlinedocs/package.json` | brace-expansion | 1.1.16 | 1.1.18 | | `scripts/apidocgen/package.json` | form-data | 4.0.4 | 4.0.6 | All pinned via `pnpm.overrides`; each `pnpm-lock.yaml` is regenerated to match. There is no `pnpm-workspace.yaml`, so root, `offlinedocs/`, and `scripts/apidocgen/` are separate installs and each bump is isolated to its own tooling. ## Testing Run locally per install: **Root** - `pnpm install` — resolves/locks `brace-expansion@1.1.18`; no stale references - `pnpm run check-docs` (markdownlint + table formatter, uses js-yaml) — 505 files, 0 errors - `quicktype` JSON→TS + `biome --version` — pass **offlinedocs** - `pnpm install` — resolves/locks `brace-expansion@1.1.18`; no stale references - `pnpm run lint:types` / `format:check` / `build` — pass, 453 pages built **scripts/apidocgen** - `pnpm install` — resolves/locks `form-data@4.0.6`; no stale references - `widdershins --version` + full render of `coderd/apidoc/swagger.json` (exercises form-data) — rendered successfully No behavioral changes; dependency version bumps only. |
||
|
|
2de1f8b111 |
feat: link promoted chat messages to their queue entry (#29859)
Signed-off-by: Thomas Kosiewski <tk@coder.com> |
||
|
|
b0b472de9e | feat(codersdk/toolsdk): add owner_id to the coder_create_chat MCP tool (#29704) | ||
|
|
7c74fa3548 |
feat: add workspace file upload agent API (#27078)
## What Adds a dedicated workspace-agent endpoint, `POST /api/v0/upload-chat-file`, that streams a request body into the chat's upload directory `~/.coder/chats/<chat-id>/files/<name>`, plus the SDK plumbing to call it: - `coderd/x/chatfiles`: upload-name sanitization (`SanitizeWorkspaceUploadName`), collision suffixes (compound extensions such as `.tar.gz` stay intact: `archive_2.tar.gz`), and the shared `~/.coder/chats/<id>/files` path layout. - `agent/agentfiles`: the HTTP handler. On Linux/macOS the directory chain is opened with `openat(O_NOFOLLOW)`, so symlinked path components are rejected. The body streams into a hidden `.<name>.upload-<random>` temp file and is published under its final name only when complete, via `linkat` over the `_2`, `_3`, ... collision sequence, so existing files are never overwritten and a half-written file is never visible under its final name. Filesystems without hard links fall back to an exclusive placeholder plus `renameat`. Other platforms use an afero-based fallback with the same semantics. Stale temp files older than an hour are swept before each upload, and failures are logged with a structured warning. - `codersdk/workspacesdk`: `AgentConn.UploadChatFile` + regenerated `agentconnmock`. ## Why Coder Agents chat can attach images/text/PDF to prompts, but arbitrary files (zips, datasets, binaries) have nowhere to land where the agent's tools can act on them. This is the agent-side foundation; the coderd route that fronts it is stacked on top. Design notes: - There is deliberately no size cap; the resource profile matches existing SSH/WebSocket proxying, and client cancellation aborts the stream (a failed write removes the temp file, so no partial files remain). Because the agent HTTP server uses fixed 20 s read/write timeouts, the handler pushes both deadlines forward on every received chunk, so a slow upload only fails after a 20 s stall. If the connection does not support deadline changes, the agent logs one warning per request. - This endpoint is not gated by `CODER_AGENT_BLOCK_FILE_TRANSFER`. That flag targets SSH-transport file tools (scp/rsync/sftp). Chat uploads are an agent API capability like `write-file` and `edit-files`, which already bypass the flag; the interaction is documented in the FAQ. ## How tested - `go test ./agent/agentfiles ./coderd/x/chatfiles ./codersdk/workspacesdk` (unit + umask/symlink/collision integration tests). - UAT on a dogfood-style deployment (2026-09-21): uploads longer than 20 s went from 502 to 201 once the workspace agent was restarted on this build; a coderd restart alone keeps the old agent running, so the per-chunk deadline extension needs the agent rolled (older agents get the 409 "Restart the workspace" from #27079). Part of CODAGT-211. Stack: agent API (this PR) -> coderd endpoint -> UI. > This PR was authored by Mux (AI) working on Mike's behalf. |