Repository navigation
chore: sync upstream 7c7e2e73cf - #389
Conversation
…t view helpers with the overview card (coder#31411) Moves two pieces of shared logic out of their single owners, so the overview card container in coder#31590 can read them without copies, and lets the card view show a failed attachments request. The Git panel behaves as before. The Summary panel behaves as before except for its failed attachments request, which now shows the same one-line alert as the card. 1. `hooks/useChatAttachments.ts` takes the Summary panel's attachment list: the files in the loaded messages, then the server's `chatAttachments` list for the messages before them. It also owns the request state and the retry (`earlierAttachmentsRequest`). The card and the panel read the same React Query key, so the earlier-attachments request runs once. 2. `components/GitPanel/gitViews.ts` is a pure module for `GitView`, `viewIdFor`, `DiffStats`, `computeRepoStats`, `repoLabel`, and `repoBranchLabel`. `GitPanel` imports them, and `RepoHeader` uses `repoBranchLabel` instead of its inline branch label. The card view types its repository rows with `DiffStats`. 3. The card view takes `earlierAttachmentsRequest`. When the request fails, Attachments shows the error and a **Retry** button. The section shows even when no attachment loaded, and the card no longer says "Nothing to show yet" then. 4. The new `AttachmentsErrorAlert` renders that error in both the card and the Summary panel. The full `ErrorAlert` was too tall for both: the server message wrapped, and the panel pushed **Retry** below its fold. The new alert is one row with a fixed "Failed to get attachments" message, no debug detail, and an extra-small **Retry** button. | Overview card | Summary panel | |---|---| |  |  | ## How to test 1. Run `pnpm test src/pages/AgentsPage/components/ChatSummaryPanel.test.tsx src/pages/AgentsPage/components/ChatOverviewCardView.test.tsx src/pages/AgentsPage/components/GitPanel/GitPanel.test.tsx` in `site/`. 2. In Storybook, open `GitPanel`. Nothing changes visually. Open `ChatSummaryPanel`. Only the `EarlierAttachments*` stories with a failed request change, to the one-line alert. 3. Open `ChatOverviewCardView`, story `EarlierAttachmentsError`, and `AttachmentsErrorAlert` for the new alert at the card width (idle and retrying) and the list width. ## What to look at first 1. The retry state in `useChatAttachments`. A retry clears the error of a query with no data, so the hook keeps the failed error until the retry settles. The test "keeps the failure and its retry button while the retry runs" fails without this. 2. `AttachmentsErrorAlert` lays the message and **Retry** on one row with child selectors (`[&>div>div]`, `[&>div>div>div]`) on `Alert`'s internal markup. A change to `Alert`'s nesting would undo the layout, which the `AttachmentsErrorAlert` stories would catch. The alert also no longer shows the server's error message. 3. `computeRepoStats` in `gitViews.ts` drops the `if (!repo.unified_diff) continue` branch. An empty diff counts zero lines and stays out of the map, so the result is the same. <details> <summary>Review history</summary> Follow-up fix: the card view shows a failed earlier attachments request with a retry. `useChatAttachments` exports its `EarlierAttachmentsRequest` type for the view, and `OverviewListSection` takes `children` after its rows. A new test clicks **Retry** and checks the callback. It fails when the section drops its `children`. The PR title changed from `refactor` to `feat` for this. Polish pass changes: added `gitViews.ts` and the retry test. The PR title changed from "move the chat attachments list into a hook" to cover the Git helpers. Final round fixes: renamed the hook's `earlier` result to `earlierAttachmentsRequest`, typed the card's repository rows with `DiffStats`, and made the retry test assert the visible error and wait for the retry to finish. Declined in the final round: - Keep `computeRepoStats` private in `GitPanel.tsx`. The requester asked for it in `gitViews.ts` next to the other Git view helpers. - Delete the retry test because the `EarlierAttachmentsRetrying` story covers the state. The requester asked for this test. It fails in CI when the alert disappears during the retry, while the story only changes a screenshot. - Pass `earlierAttachmentsRequest` to `ChatAttachments` as one prop. It saves about six lines but touches the `ChatAttachments` stories. Smaller error alert: added `AttachmentsErrorAlert` and used it in the card and in `ChatAttachments`. The `EarlierAttachmentsFailed` story no longer scrolls **Retry** into view, since the alert fits the panel. The retry test no longer checks the server's error text, which the alert stopped showing. It still checks that **Retry** stays disabled during the retry and disappears after it. </details> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ --------- Co-authored-by: Jaayden Halko <[email protected]>
…#31925) Documents how AI Gateway assigns every request to one organization, and how that organization now decides the effective group, budget, overrides, and spend. Adds a **Request organization** page and corrects pages that still described budget resolution as deployment-wide. Refs AIGOV-753. Describes behavior merged in coder#30902, coder#31118, coder#31119, coder#31120, coder#31121, coder#31583, and coder#31584. ## Changes - New page `docs/ai-governance/ai-gateway/request-organization.md` (sidebar, after Cost control): resolution order, the effective group fallback, rejected requests, what the organization controls, a multi-org worked example, reports that still resolve across all orgs, and the caveat for standalone gateways older than v2.40. - `cost-controls.md`: removes "the effective group is deployment-wide", scopes overrides and effective group resolution to the request's organization, and adds the reporting caveat. - `standalone.md`: older replicas check budgets across all organizations. - `coder-agents/platform-controls/{index,spend-management}.md`: these said an override beats every group budget, which is no longer true for chats in another organization. ## For reviewers - **Mismatch rejection is not documented.** The ticket and RFC describe rejecting a workspace/chat org mismatch. A chat can only bind a workspace in its own org (`coderd/exp_chats.go`), chatd requests resolve to the chat's org even with a workspace, and no client request can carry both inputs. The page says the two always agree instead. - **"v2.40" is inferred.** `release/2.39` is on aibridged API v1.5 and `main` is on v1.6, so v1.6 ships in v2.40. A 2.39.x backport would make this wrong. - **Custom prices.** The price lookup reads per-org prices, but no API or CLI can set them yet, so the page says custom prices apply in every org. This needs an update when per-org prices ship. - **Site-wide reports.** The avatar menu, Agents usage indicator, `GET /api/v2/users/{user}/ai/spend`, Members tab budget, Groups page combined limit, and `blocked_users` metric still resolve across all orgs (`TODO(AIGOV-527)`), so they can disagree with what was enforced. ## Release note draft ```markdown - AI Gateway budgets and spend follow the request's organization (coder#31119, coder#31120, coder#31121, coder#31583, coder#31584) > Every AI Gateway request now belongs to one organization: the workspace's organization for workspace session tokens, the chat's organization for Coder Agents, and otherwise the organization of the user's effective group. Budgets, user overrides, and spend apply within that organization only, instead of across all of the user's organizations. Users in one organization see no change. Users in several organizations can hit a smaller budget, or have no limit at all, in another organization's workspaces and chats. Requests are rejected when the user is no longer a member of the workspace's or chat's organization, or of any organization. > > Migration: Set budgets in every organization your users send AI requests from. Upgrade standalone AI Gateway replicas to v2.40. Older replicas keep checking budgets across all organizations until upgraded. ``` ## Validation `make pre-commit-light`, Vale on the changed files, and `make lint/docs-manifest` pass. A `doc-check` author self-check found 13 blocking findings, all fixed. Not applied: a suggested test pinning the site-wide spend endpoint (code change, out of scope for this docs PR). <details> <summary>Decision log and verified behavior</summary> Sources: AIGOV-753, epic AIGOV-749 and its delivered tickets (AIGOV-712 to 716), the canceled AIGOV-717, and the RFC "AI Gateway Model RBAC and Org-Scoping" (Phase 1). Verified against `main` (`a3aab79775`): | Claim | Evidence | |---|---| | Order: workspace session token, chat org, site-wide effective group | `coderd/aibridgedserver/orgresolver.go` `resolveOrganization` | | Workspace session token = `coder_workspace_owner.session_token` | `provisionerdserver.WorkspaceSessionTokenName`, `workspaceAttribution` (API tokens excluded) | | Rejections return `403 unauthorized` | `coderd/aibridged/http.go` IsAuthorized failure path | | Rejected: deleted workspace, not a member of the workspace/chat org or org deleted, no live org | `orgresolver.go` `ErrUnknownWorkspace`, `ErrUnknownOrganizationMember`, `ErrNoOrganization` | | Chat request takes chat org even with a workspace | `enterprise/aibridged_integration_test.go` "delegated organization with workspace" | | With an org, only that org's groups, override, and Everyone group count | `coderd/aibridge/budget/budget.go`, coder#31119 | | Fallback with no budgets: default org, then earliest membership | `GetUserEveryoneFallbackGroup` | | Budget counts only spend recorded against its group | `GetUserAISpendSince` keyed on `effective_group_id` | | Notifications use the per-request effective group | `coderd/aibridgedserver/notifications.go` | | Per-org prices not settable | `UpsertOrganizationAIProviderModelConfig` has no non-test caller | | v2.39 gateways: site-wide budget check, no org recorded | `release/2.39` `coderd/aibridged/http.go`, `aibridge/recorder/drpc_recorder.go` | Page vs. section: a dedicated explanation page, because `cost-controls.md` is already long and RFC Phases 3 and 4 (model RBAC, "require organization scope") will build on the same resolution rules. </details> --- *This PR was generated by Coder Agents on behalf of @SasSwart.*
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Completed but unsent workspace-upload chips disappeared when leaving a chat or when an optimistic workspace rebind rolled back, even though the files remained in the workspace. Persist compose-draft metadata by chat and workspace, restore completed references when returning, and clear them on successful send or explicit removal. PNGs use the normal image-attachment path, which already persists drafts, so they do not reproduce this issue. To reproduce the original bug, upload a `.zip` or `.tar` in an existing chat with a running workspace, wait for completion, **do not send the message**, then switch chats and return. Check whether the unsent composer chip survives, not whether the file remains in the workspace. Refs [CODAGT-1172](https://linear.app/codercom/issue/CODAGT-1172) and coder#27080. <details> <summary>Implementation decisions</summary> - Store metadata only in browser localStorage. File bytes stay in the workspace; there is no backend change or cross-device synchronization. - Enable persistence only for the existing-chat composer, keeping message edits and deferred new-chat uploads separate. - Preserve previous scopes for navigation and rebind rollback, cancel unfinished uploads, and ignore stale worker completions. - Warn on storage failures without blocking the current draft. Keep previously saved references when they are still current; otherwise attempt to clear stale metadata so removed files do not return. </details>
…der#32305) > 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Agents chat now warns when workspace build or agent startup logs reach the storage limit. Startup warnings include `/tmp/coder-startup-script.log` as a recovery path. Keep known truncation warnings visible when logs are empty or fail to load. Preserve overflow-only workspace updates, recover completed-build metadata after workspace lookup failures, and retain historical build metadata when a newer build starts. Show a separate notice when truncation status cannot be checked. Refs CODAGT-1185. <details> <summary>Validation and review decisions</summary> - Passed 24 focused unit tests and 14 Storybook tests, `pnpm check`, `pnpm lint`, `pnpm format:check`, `make lint/emdash`, and `git diff --check`. - Regression tests cover overflow-only build and agent updates, the build-ID fallback after workspace lookup failure, and metadata retention across a newer-build watch event. Stories cover empty, waiting, and failed log output. - Checked the five added Storybook states in dark and light themes at desktop and 320px widths. Axe reported no violations or incomplete results; keyboard focus checks passed. No actual screen-reader test or base-branch visual comparison was run. - Completed the frontend pattern check, eight independent frontend review roles, test audit, and documentation self-check with no remaining blocking or should-fix findings. No product-docs changes were needed. - Reused the existing React Query cache for historical metadata rather than adding polling or mirrored state. Story query fixtures are local to each story, and exported query-key helpers are documented. - Corrected the earlier accessibility assessment: tool output already renders inside the transcript's `role="log"` live-region ancestor. No nested live region was added. The Codex accessibility thread remains open because actual screen-reader announcements have not been verified. </details> <img width="631" height="213" alt="image" src="https://github.com/user-attachments/assets/f77f89fd-3a3a-4650-b9c7-abf33faba62f" />
Zed connects over plain SSH and sends no app name, so its sessions show up as SSH. When no app name is set, the agent now labels a session `zed` if its command starts Zed's remote server proxy (`zed-remote-server-… proxy --identifier …`). `zed` was already in the list of apps Coder knows, so it now shows up in session counts, connection logs and metrics with no server change. Closes ENG-359
Without coder/sqlc's CTE scope fix (coder/sqlc#1), sqlc rejects valid queries that put a subquery inside a CTE with a false "column reference is ambiguous" error. The fix only ever existed on the side branch the old pin pointed at. coder#25105 moved the pin to the fork's merge of upstream v1.31.1, which didn't include it, so the fix was silently dropped. No current query hits the bug, but the next one would have failed at make gen. The fix is now on the fork's main. Generated code is unchanged.
closes CODAGT-1506 Project skill action chips show the skill's slug (`deploy-bot`, `security-review`), because skill names must be kebab-case. This adds an optional display name that labels the chip instead. Project skills get a `display_name` column, set through `display_name` on the create and update requests. It is limited to project skills (the same rule as `action`), trimmed, single line, and at most 64 Unicode code points. The chip, its tooltip, and the "More" menu show the display name, sort by it, and fall back to the skill name when it is empty. When a display name is set, the tooltip and the menu item also show the `/name` slash command, so actions that share a display name stay distinguishable. Clicking an action still inserts `/name`, and the `/` menu is unchanged. The project skill editor shows a **Display name** field under **Show as action** only while that switch is on. Turning the switch off hides the field but keeps its value, and saves omit `display_name` while the action is off, so the stored value stays. The display name lives in the database rather than SKILL.md frontmatter, so downloading and re-importing a skill does not carry it. To share the code-point length check with the editor, `countCharacters` and `maxCharacters` move from `ChatProjectDialog.tsx` into `site/src/utils/formUtils.ts`. <img width="637" alt="Project skill editor with the Display name field under Show as action" src="https://raw.githubusercontent.com/coder/coder/assets/pr-skill-action-display-name/pr/edit.png" /> <img width="520" alt="Action chips labeled with display names, with the tooltip open" src="https://raw.githubusercontent.com/coder/coder/assets/pr-skill-action-display-name/pr/chips.png" /> Refs CODAGT-1506
…ing (coder#32188) GetWorkspaces sorted the requester's favorite and own workspaces first by matching the owner's username. Usernames are unique only among non-deleted users, and a deleted user keeps theirs, so a user who took a deleted user's username saw that user's deleted workspaces and favorites sorted as their own when listing deleted workspaces. Match by owner_id instead, as the sort did before coder#22290. The username form most likely worked around the sqlc CTE bug: with the EXISTS (tasks) filter the query had then, sqlc without the coder/sqlc fix rejected the bare owner_id as ambiguous. coder#29085 removed that filter, so the owner_id form generates with either sqlc.
…oper messages (coder#32053) When a user approves a command with "Yes, and don't ask again", a developer message is appended after the tool result. `correlatingToolCallID` only checked the last `input` item, so these requests weren't correlated and the session page split the agentic loop into a new thread with no prompt. `correlatingToolCallID` now walks back from the end of `input`, and skips developer/system messages and reasoning items. The request is correlated if the first remaining item is a tool result with a `call_id`. A user message or any other item means a new turn, so it isn't correlated. Fixes AIGOV-727 Generated by Coder Agents on behalf of @roothorp
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Better aligns the submenu items with their content. Furthermore, highlights the parent item that opened the submenu. | Old | New | | --- | --- | | <img width="790" height="471" alt="Image" src="https://github.com/user-attachments/assets/9a32777a-8dcc-4b27-8414-e449e844c984" /> | <img width="816" height="471" alt="Image" src="https://github.com/user-attachments/assets/27094d23-ac37-4fbc-92c1-3573bf7916a1" /> |
fixes ENT-252 In a port forward test for UDP, there are actually 2 UDP socket on the remote side (the local side uses a mocked network). There is the target socket where our echo server is listening, and the UDP socket that the workspace agent opens up to talk to it. We must be getting crosstalk on the workspace agent socket, because the echo server was already filtering based on prefix. The solution in this PR is to move the filtering all the way back to the test function itself, so if crosstalk comes either on the echo socket or the workspace agent socket, we'll forward it across the tailnet, but ultimately filter it in the test function before asserting. --------- Signed-off-by: Spike Curtis <[email protected]>
…on Windows (coder#32323) Fixes CODAGT-1333. `TestTools/WorkspaceExecute` failed on Windows with `GetFileAttributesEx /tmp: The system cannot find the file specified.` The agent runs commands via `sh -c` on every platform (`agent/agentproc/process.go`), which is Git Bash/MSYS on Windows runners. There `pwd` prints a POSIX path like `/tmp/...`, and `filepath.EvalSymlinks` cannot resolve it. The command itself ran in the right directory; the assertion was wrong. The test now runs `touch marker.txt` in the requested workdir and asserts the file exists at `filepath.Join(workDir, "marker.txt")` on the host. This is the same approach `agent/agentproc` `CustomWorkDir` already uses for this reason. No timeouts changed. --- _Generated by Coder Agents on behalf of @f0ssel._
Adds the database layer for attaching workspace templates to chat projects: the schema, the queries, their authorization, and the audit type. Nothing calls the new queries yet, and the existing create and update handlers pass the new parameters unset. The API, the limit's enforcement, and the agent tools follow in the PRs above. - Attachments live in a `chat_project_templates` table (`project_id`, `template_id`, `created_by`, `created_at`), deleted with the project or the template. `chat_projects` gains `limit_templates` (default `false`), `default_template_id`, `default_template_version_preset_id`, and `default_parameters jsonb`. A project stores a default preset or default parameter values, not both. - `InsertChatProjectTemplates` needs project `update` and `use` on every template. It skips templates that are already attached, and templates outside the project's organization, so an attachment never crosses organizations. `DeleteChatProjectTemplate` needs project `update` and template `read`, and clears the project's default when it detaches the default template. Both checks are in dbauthz. - `GetChatProjectTemplatesByProjectIDs` is authorized through the project, and leaves out deleted, deprecated, and agent-disabled templates. It does not check the caller's access to each template, so callers do that before they expose one. - `UpdateChatProjectByID` changes the template settings only when the request sets them, so an update that omits them cannot write back a stale snapshot. - `AuditableChatProjectTemplates` is the audit form of a project's attached templates, logged as a write to the project. The new `chat_projects` columns are tracked in the project's own audit diff, with the default parameter values masked because they may hold credentials. **NOTE**: the migration adds one table and four columns and changes no existing rows. Existing projects keep unlimited template access. Stack (merge top to bottom): - coder#32309 👈 - coder#30754 - coder#32310 - coder#30755 - coder#30756 - coder#30898
## Description
Adds the experimental `GET
/api/experimental/organizations/{organization}/ai/model-prices/unpriced`
endpoint behind the "N models not set up" warning on the organization AI
spend page
([Figma](https://www.figma.com/design/6TkixpkUIM5Qv6I7qhM3xZ/AI-Gov---user-spend?node-id=70-11964&t=KQwENGjcQvVT9qkh-4)).
It lists the models used in the period that still hold no price in the
organization, using the query from this stack.
## Changes
- Add the `organizationUnpricedAIModels` handler and
`ExperimentalClient.OrganizationUnpricedAIModels`:
- Reuses `aiSpendRetainedPeriod`, since token usage is subject to data
retention.
- Returns the applied period, `count`, and `models` (provider name,
display name, icon and type, model, token count), most unpriced tokens
first.
- Requires read on the organization's model prices (owners and
organization admins), so the UI only requests it for users who can set
prices.
- Add handler tests for the response, period validation, organization
scoping and role access.
Note: pagination will be added in a follow-up.
Closes AIGOV-730
> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
…kspace sharing indicator (coder#32321) The "Workspace permissions" trigger (people icon next to the owner name in the workspaces table) was a 14×16px button with the workspace name link directly above it, so it failed WCAG 2.5.8 (axe `target-size`) on both size and spacing. The trigger is now 24×24px. The extra area extends sideways and downward only, and negative margins cancel it out, so the icon stays in the same place and the row height does not change. If the target grew upward too, it would cover the bottom of the workspace name link, and axe would then flag that link as partially obscured. A new `TriggerFocused` story tabs to the trigger, so Pixel captures the 24px focus ring. Closes DEQ-361 | Ticket | UI surface | Screenshots | |---|---|---| | DEQ-361 | `/workspaces` table, sharing indicator next to the owner name | [Linear comment](https://linear.app/codercom/issue/DEQ-361/target-does-not-meet-minimum-size-or-spacing#comment-5ba3bb9c) | **Verification** - On the dev server at `/workspaces` with one shared workspace, axe-core 4.11 `target-size`: - before: one violation on the trigger (`14px by 16px ... safe clickable space 16px`); - after: no violations. The trigger is 24×24, the icon sits at the same x/y as on `main`, and the row is still 72px tall. - `pnpm check`, `pnpm lint` (including `tsc`), and the story tests for `WorkspaceSharingIndicator.stories.tsx` pass. - The existing hover stories render the trigger in a plain block rather than a flex row, so the -8px bottom margin may cause small Pixel diffs there. <details> <summary>Decision log</summary> - Batch label `target-size-small` contains one eligible ticket, DEQ-361, so this is one root cause and one PR. - I fixed the call site rather than `TooltipTrigger`. The shared interactive trigger wraps content of many sizes, and other callers already size it themselves. - First attempt: `size-6 -m-1.25` (symmetric). It fixed the trigger, but on the real page axe then flagged the workspace name link as partially obscured. I switched to `-mx-1.25 -mb-2 pb-2`, which grows the target only into the empty cell padding below. - Tradeoff: the focus ring now has 1px above the icon and 9px below it, so it is not centered. The ticket has `ux-input-needed`, so design may want to weigh in. - Test: I wrote a play-function geometry assertion and confirmed it failed on `main` (14 < 24) and passed on the branch. I then dropped it, because FE1 and FE10 prohibit geometry assertions in play functions. Story-only coverage follows the precedent in coder#30844. - Self-review: `frontend-review` found no FAILs. `frontend-deep-review` found no blocking or should-fix issues; I fixed its nits (the comment wording and a redundant `self-start`). `frontend-accessibility` passes `target-size`, `button-name`, `nested-interactive`, and `aria-allowed-attr`. </details> 🤖 Generated by Coder Agents on behalf of @chrifro.
Main cannot initialize database migrations because coder#32309 reused version 000643, already taken by the skill display-name migration from coder#31747. Renumber the later chat-project migration and its fixture to 000644, preserving the earlier migration number. All three renames leave SQL contents unchanged.
The chat page got a chat's messages, queue and status from three places: REST pages, action responses and stream events. None of them had a version, so the client could not tell which was newer and reconciled them with rules of its own. A refetch or a response could replace newer state from the stream, and a stream message that failed to parse lost its events and left an error until a reload. The server now returns snapshot_version on the newest messages page and on stream events (coder#29662), which makes one copy enough. Each chat has a store that loads the newest page once; after that, only stream events and older pages change it. To reconnect, to return to a chat within five minutes, or to recover from a failed parse, the client opens the stream again at the highest version it applied. It refetches no messages, so no response replaces what the stream set. The client no longer reads messages or queue rows from action responses, so a send, an edit or a queue change would show only once the stream reports it. The store therefore shows the action's direct effect at the click and keeps it until the stored state holds the result or the request fails. It does not end at the next stream event of a kind, because that event can report another change, and the user's change would disappear and come back. A sent message has no ID until the server creates it, so pending sends are matched to new messages in click order, and a chat's send, edit and queue requests run one at a time to keep that order. This assumes one user in one client. A message from an agent, an automation or another API client can end a pending send early, and the next stream event corrects it. The composer clears at the click, because the chat already shows the sent message. It stays editable, so text typed during the request is kept. Closes CODAGT-903
Enable bridged request forwarding in AI Gateway proxy mode. Responses are captured through `TeeBuffer`. Proxies are created per-request reusing transports. Handle `http.ErrAbortHandler` inside the circuit-breaker wrapper so aborted responses are classified by HTTP status before the panic is propagated. Generated by Coder Agents on behalf of @pawbana.
…31990) Fixes the `warning`-level findings that the Vale findings spike review marked valid: - **`Coder.GerundHeading`**: `docs/.style/styles/Coder/README.md`, "Authoring a new rule" is now "Author a new rule". Nothing links to the old anchor. - **`Coder.Semicolons`**: `templates/extending-templates/docker-in-workspaces.md`. Each semicolon is now a sentence break, with the new sentence on its own line. - **`Coder.UnitSpacing`**: added ` ` between number and unit in `get-started/index.md` (10 minutes), `mcp-server.md` (5 minutes), `ai-governance/ai-gateway/setup.md` (60 days), and `reference/feature-stages.md` (60 seconds). These three rules now have 0 findings in `vale docs/`, and the changed files have no new findings from other rules. --- AI-generated by Superblink on behalf of @nickvigilante. Supersedes coder#31877, reopened under a human author for attribution. Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Adds a "Sandbox agents" guide under Extending templates, and adds startup time tips from the [Improving Coder Workspace Startup Times](https://www.youtube.com/watch?v=-xcVJQWVCxs) livestream to the speed-up templates guide. **Sandbox agents** (`docs/templates/extending-templates/sandbox-agents.md`) is organized around three traits: kernel, network, and secrets isolation, plus fast startup. Each trait has a short methods table with tradeoffs, plus examples and references. - Starts with the coder-labs registry templates (agent-sandbox, Plain Sandbox, OpenShell) that implement all three, and calls out [agent-sandbox](https://agent-sandbox.sigs.k8s.io/). - Explains what the sandbox covers for CLI Agents, Coder Agents, and Agent Relay. - Shows how to define sandbox profiles as immutable parameters with one preset each, and how to control which profile an agent gets. - Kernel: gVisor, Kata, and EKS Nitro Sandboxes (`isolated-sandbox` RuntimeClass in EKS Auto Mode). - Network: separate proxy Pod vs. sidecar, example rules using an internal GitHub and artifact store, and a cloud firewall layer (AWS Network Firewall, Route 53 Resolver DNS Firewall) that also limits DNS. - Secrets: `api_key_scope = "no_user_data"`, a scoped AI Gateway token (skipped for prebuilds, optional `lifetime`), per-workspace EKS Pod Identity, and just-in-time credentials from Vault. **Speed up templates** (`docs/workspaces/speed-up-templates.md`) gets new sections for pre-warming Kubernetes nodes (with GKE, EKS, and AKS alternatives), building tools into the image, prebuilt workspaces (including one preset for each configuration), and skipping the Kubernetes rollout wait (with coder-logstream-kube to surface Pods that can't start). It links the [fast-workspaces-lab](https://github.com/coder-contrib/fast-workspaces-lab) repo for the sample base image, node schedule, and prebuild templates. **Agent Firewall** gets a notice on its index page and in the glossary that it is being phased out, pointing to the sandbox guide. The sandbox guide doesn't mention Agent Firewall. Two diagrams in the speed-up templates guide come from the talk's slide deck, cropped to the diagram. Notes for reviewers: - The scoped AI Gateway token (`user:read_personal`) isn't tied to a workspace, so with several organizations, AI Gateway uses the user's effective group for budgets. The page doesn't mention this. - The Nitro (coder/registry#1253) and Cilium (coder/registry#1254) registry templates are still open, so they aren't linked yet. <details> <summary>Decisions and checks</summary> - **Structure:** three traits, several ways to get each, and simple tradeoffs. - **Sysbox** is not listed as kernel isolation, because system calls still reach the node's kernel. - **Deployments** stay the recommendation over bare Pods, because `wait_for_rollout` and coder-logstream-kube cover the startup and error cases. - **Token lifetime** is left commented out in the example: Coder can't revoke the token at stop, and a lifetime shorter than autostop breaks running workspaces. - **Process logging** wording: the eBPF sidecar runs inside the sandbox with gVisor, Kata, or Nitro, so the page asks readers to test it. - **"CLI Agents"** is kept as the term for agents that run fully in the workspace. - **Verified in code:** - `mutable = false` is enforced on later builds (`coderd/dynamicparameters/resolver.go`). - Presets match by subset, also without a `preset_id` (`coderd/database/queries/prebuilds.sql`, `coderd/workspaces.go`). - `no_user_data` blocks the Git SSH key and external auth (`coderd/gitsshkey_test.go`, `coderd/externalauth_test.go`). - Token creation is rejected for the prebuilds system user (`coderd/apikey.go`), and the default token lifetime is 7 days (`codersdk/deployment.go`). - No Coder code sets `CODER_SESSION_TOKEN` in a workspace; registry modules such as `coder-login` do. - **Checks run:** `make lint/emdash`, `make lint/docs-html`, `make lint/docs-manifest`, markdownlint, markdown-table-formatter, Vale (0 errors), and the pre-commit hook. </details> 🤖 This PR was generated by Coder Agents on behalf of @bpmct.
…er#32331) Switches every GitHub App token step in the release workflows from `actions/create-github-app-token` with a private key to [coder/github-app-token-action](https://github.com/coder/github-app-token-action). Each App's key becomes a non-exportable Cloud KMS key that only these workflows, in their environments, can sign with. **`coder-release-publisher`** - `release.yaml` (environment `release`): the tagging token and the release-publishing token. - `create-release-branch.yaml` (environment `release-refs`, `main` only): the release-branch token. The job gets `id-token: write`. - Scope is unchanged: `repositories: coder`, `contents: write`, `workflows: write`. **`coder-package-publisher`** - `release.yaml` `publish-packages` (environment `release-publish`): `repositories: packages`, `contents: write`. - `release.yaml` `publish-homebrew` (environment `release-publish`): `repositories: homebrew-coder`, `contents: write`, `pull_requests: write`. - Both jobs get job-level `contents: read` and `id-token: write`. Before, they inherited the workflow's `contents: read`. **Unchanged** - Who approves: every environment still needs a release manager, and admins can't bypass. - Each token covers one repository and is revoked when its job ends. - The KMS keys, `APP_KEYS_WORKLOAD_ID_PROVIDER` and the App IDs are environment secrets, already set in `release`, `release-refs` and `release-publish`. Release branches 2.39, 2.38, 2.37, 2.34 and 2.29 run their own `release.yaml` and get the same change once this merges. The old private keys are deleted after that. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…ide (coder#31979) > [!NOTE] > Coder Agents generated this PR. Adds a "Migrate to Coder" group to the docs sidebar with a short index page, and a guide for teams moving from Microsoft Dev Box to Coder. - `docs/install/plan/migrate.md` (new): says who the guides are for and lists them. - `docs/install/plan/migrate/dev-box.md` (new): who it's for, what carries over, a concept-mapping table, 11 numbered migration steps, and **Learn more**. The steps cover the inventory, the control plane, Entra ID (OIDC), templates on Azure (image, network, persistence, access, quotas), customizations and dotfiles, Git auth and secrets, RDP, editors, schedules and hibernation, Intune, and the pilot and cut-over. Each step links to existing Coder docs instead of repeating them. - `docs/install/plan/migrate/ona.md` (moved from `migrate-from-ona.md`): relative links only, plus a redirect from `install/plan/migrate-from-ona` in `docs/redirects.json`. - `docs/manifest/install/plan/migrate.yml` (new) and `docs/manifest/install/plan.yml`: the new group, with the Ona guide under it. This follows the existing `upgrade.md` plus `upgrade/` layout. `docs/manifest.json` is regenerated. Microsoft retirement dates come from Microsoft's own [Dev Box retirement guide](https://learn.microsoft.com/azure/dev-box/dev-box-retirement-guide): the closing-down period started September 14, 2026, and the service retires September 18, 2028. ### Follow-ups outside this PR - **Starter template is broken today.** The registry `azure-windows` template pins `windows-rdp` at `~> 1.0`, which now resolves to 1.4.0. That version requires `agent_name`, so `terraform plan` fails with `agent_name must be set when enable_native_rdp is true.` The copy in `examples/templates/azure-windows/main.tf` also passes `resource_id = null`, which 1.4.0 rejects at `terraform init`. The guide tells readers to set `agent_name = "main"` until both templates are fixed. - **Activity detection docs.** `docs/workspaces/workspace-scheduling.md` and `docs/templates/managing-templates/schedule.md` say only some session types count as activity, but the code counts any connection through the agent (`agent/agent.go` `Collect`, `coderd/workspacestats/reporter.go`). The guide follows the code. Those pages need a separate fix, and an SME should confirm RDP end to end. - **Comparison page.** The coder.com comparison page compares Coder with Windows 365 and VDI, not Dev Box, and still says Dev Box is in "maintenance mode". The guide no longer links to it, so DOCS-1414's comparison-link item waits until the page is corrected. <details> <summary>Reusable outline for future migration guides (DOCS-1414)</summary> The repo has no place for page templates, so the outline lives here. ```md --- title: Migrate from <Platform> to Coder --- <1 to 2 sentences: who it's for (persona and current setup) and the outcome.> <Optional: dated facts about the platform, citing the vendor's own announcement.> ## Before you begin <Access, licenses (mark Premium), cloud permissions.> ## What carries over <Architecture difference in 2 to 3 sentences. "You can keep" list, then "You rebuild" list.> ## Concept mapping | <Platform> (link to the vendor's docs for each concept) | Coder (link to Coder docs) | ## Step 1: Inventory your <Platform> resources ## Step 2: Deploy the Coder control plane ## Step 3: Connect your identity provider ## Step 4: Replace <environment definition> with templates ## Step N: Bring your devcontainer.json (Codespaces, Ona, DevPod) ## Step N: Configure Git authentication and secrets ## Step N: Set up editors (and remote desktops, if relevant) ## Step N: Speed up workspace startup (prebuilt workspaces) ## Step N: Replace schedules and cost controls ## Step N: Move agent workloads ## Step N: Pilot and cut over <One neutral link to the coder.com comparison page, if one exists and is current.> ## Learn more ``` Rules: facts only, with no scoring or positioning language. Check every mapping row against the vendor's current public docs and record the date checked in the PR. Link to Coder docs rather than repeating them. Mark Premium features inline. </details> ### Verified against Microsoft docs checked November 5 and November 10, 2026, in the MicrosoftDocs/azure-docs source (`articles/dev-box/`) and on learn.microsoft.com: - `dev-box-retirement-guide.md` (dates, workload deletion) - `overview-what-is-microsoft-dev-box.md`, `concept-dev-box-architecture.md` (dev centers, projects, pools, definitions, network connections, Microsoft-hosted network, Intune enrollment, Entra join, Windows 10 and 11 client editions) - `how-to-manage-dev-box-pools.md` (local admin or standard user setting) - `concept-what-are-dev-box-customizations.md`, `how-to-configure-team-customizations.md`, `how-to-configure-user-customizations.md` (WinGet, PowerShell, Git-Clone tasks, Key Vault secrets) - `how-to-configure-azure-compute-gallery.md` - `how-to-configure-stop-schedule.md` (one stop time per pool), `how-to-configure-stop-on-disconnect.md`, `how-to-configure-dev-box-hibernation.md`, `how-to-auto-delete-dev-box.md`, `tutorial-dev-box-limits.md` (maximum dev boxes per developer) - `concept-dev-box-role-based-access-control.md`, `how-to-install-dev-box-cli.md`, `how-to-set-up-dev-tunnels.md`, `quickstart-create-dev-box.md`, `how-to-enable-single-sign-on.md` - Intune [supported operating systems](https://learn.microsoft.com/intune/fundamentals/ref-supported-platforms) (Windows client editions, no Windows Server) Coder side: - Registry `azure-windows` template (`main.tf`, `README.md`) and `examples/templates/azure-windows/`: azurerm resources, Windows Server 2022 image, one resource group, virtual network, and storage account per workspace, VM deleted on stop, persistent `F:` disk, `windows-rdp` module, generated admin password shown in metadata, no Entra join, no `daily_cost` - Registry `windows-rdp` module at `release/coder/windows-rdp/v1.4.0`: **Web RDP** (subdomain app) and **RDP Desktop** (Coder Desktop) apps, `agent_name` validation, Devolutions Gateway install from PowerShell Gallery on every start. Reproduced the plan failure with Terraform 1.17.1. - Registry `dotfiles` module: Bash script only - `cli/dotfiles.go`, `cli/dotfiles_windows.go` (`install.ps1`, `bootstrap.ps1`, `setup.ps1`, run with PowerShell, cloned with Git) - `enterprise/coderd/workspacequota.go` (build denied when consumed plus cost exceeds budget), `docs/admin/users/quotas.md` - `coderd/schedule/autostop.go` (autostop requirement stops at the start of quiet hours), `docs/reference/cli/server/index.md` (`CODER_QUIET_HOURS_DEFAULT_SCHEDULE`, `CODER_ALLOW_CUSTOM_QUIET_HOURS`) - `docs/workspaces/workspace-access/remote-desktops.md`, `docs/admin/networking/index.md` (agents must reach the access URL) - `docs/admin/users/oidc-auth/microsoft.md`, `docs/admin/users/idp-sync.md`, `docs/admin/users/organizations.md`, `docs/admin/users/groups-roles.md`, `docs/templates/template-permissions.md` (Premium markers, organization roles) - `coderd/workspacestats/reporter.go`, `coderd/agentapi/stats.go`, `agent/agent.go` (any connection through the agent extends the autostop deadline) - `docs/admin/external-auth.md` (Azure DevOps via Entra ID), `docs/admin/security/secrets.md` - `agent/usershell/usershell_windows.go` (scripts run with PowerShell on Windows) - No hibernation feature exists in the Coder codebase. Checks run: `make gen/docs-manifest`, `make pre-commit-light` (markdownlint, `lint/emdash`, `lint/docs-redirects`, typos), Vale (0 alerts on the new pages), `lint/docs-html`, `lint/docs-manifest`, `docsredirectscheck -base origin/main -branch main`, a check that all 159 relative links and anchors in the three pages resolve, and a `doc-check` self-review. ### Open questions for the reviewer - **Intune and Entra join:** the guide says Coder doesn't enroll workspaces in Intune, that Intune needs a Windows client image, and links Microsoft's Entra VM sign-in docs. Should a separate guide cover setting up Intune with Coder? - **Windows client editions:** the guide tells readers to check Microsoft licensing before using Windows 10 or 11 images on Azure VMs. It makes no licensing claim itself. - **Windows support in registry modules:** the guide now says the `dotfiles` module is Bash only. Whether `git-clone` and other modules work on Windows is unverified. Closes DOCS-1414, Closes DOCS-1416 Supersedes coder#31807, reopened under a human author for attribution. --------- Co-authored-by: Coder Prototypes <[email protected]> Co-authored-by: Ian Evans <[email protected]>
…2301) Removes the `minimumReleaseAgeExclude` entry for `@coder/[email protected]` that coder#32298 added, as discussed in coder#32298 (comment). 0.4.1 was published at 2026-11-16 22:45 UTC. Until 2026-11-17 22:45 UTC, pnpm's minimum release age check fails CI installs (`ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`). Re-run CI after that and merge. 🤖 Generated by Coder Agents on behalf of @aqandrew.
…ns with Cloud KMS (coder#32352) Switches App token steps from `actions/create-github-app-token` with a private key to [coder/github-app-token-action](https://github.com/coder/github-app-token-action). Each App's key becomes a non-exportable Cloud KMS key that only the listed workflow, in its environment, can sign with (coder/gcp#383). | Workflow | App | Environment | Token | |---|---|---|---| | `backport.yaml` | `coder-backporter-app` | `main` | coder: contents, pull_requests, workflows, issues write | | `aigateway-prices-refresh.yaml` | `coder-automations` | `main` | coder: contents, pull_requests write | | `audit-docs-paths.yaml` | `coder-ci-reader` | `main` | coder.com: contents read | | `contrib.yaml` (`cla`) | `coder-cla` | `main` | cla: contents write | | `contrib.yaml` (`community-label`) | `coder-org-membership-bot` | `main` | members read | - **Scope is unchanged:** same repositories and permissions as before. The token is revoked when the job ends. - **Permissions:** each signing job gets `id-token: write`. - **backport.yaml and contrib.yaml community-label:** the old steps set no `repositories`, so the token defaulted to this repository. The action needs it explicitly, so they now say `repositories: coder`; the membership token requests only `members: read`, which is all the App has. - **Tighter than today:** the `main` environment holds all five keys, so any job in `main` could use any of them. Now each key only signs for the one workflow file above, on `main`. - **Secrets:** the KMS key and `APP_KEYS_WORKLOAD_ID_PROVIDER` are already set in the environment. The old private-key secret is deleted after this merges. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
Boring fix for conditionally deciding if this is worth rendering a `Errors` and a `Warnings` headings if we have content to actually render inside of them. | Old | New | | --- | --- | | <img width="1139" height="626" alt="image" src="https://github.com/user-attachments/assets/30fa82ab-eb9c-4cc3-bb2b-3c74d6e0c682" /> | <img width="1133" height="515" alt="image" src="https://github.com/user-attachments/assets/ae4f0449-8e92-47ed-8971-1903336e600c" /> |
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Replace the legacy template filter controls with the shared `FilterCombobox` on both the Templates page and AI Settings → Templates, matching the workspace filtering UI. - Combine author, organization, deprecated, and compatibility-mode filters in one input with removable chips while retaining URL-backed filter queries. - Keep `author:me` available to users without permission to list other users, without fetching the user list. - Update the compatibility-mode documentation and Storybook stories for the new controls. <img width="538" height="312" alt="image" src="https://github.com/user-attachments/assets/c7b541eb-0f4e-4456-b31c-70dd85cfe0e9" />
The `run` job in `eval-coder-agents.yaml` checks out the PR's head and runs its code, including its own `scripts/harbor-coder`. It currently uses the `main` environment, which holds main-only secrets for other workflows. This moves it to a dedicated `eval` environment, so only eval secrets are ever in scope. - **Depends on** coder/github-org-terraform#124, which creates `eval` (only `main` may deploy, no reviewers, no admin bypass). Merge that first; otherwise GitHub creates `eval` unprotected on the first run. - **`EVAL_CODER_SESSION_TOKEN`:** the job references it, but it isn't set in `main` today. When it's added, put it in `eval`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Replace the legacy audit log filter controls with the shared `FilterCombobox`, matching the workspace and template filtering UI. - Combine resource type, action, user, build reason, and organization filters in one input with removable chips while retaining URL-backed filter queries. - List existing audit log presets under a searchable **Show…** section, and replace existing single-value filters rather than adding conflicting values. - Respect user-list and audit-log permissions when suggesting users and organizations, and update regression tests and Storybook stories for the new controls.
…der#31786) > 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Replace the legacy organization member filter controls with the shared `FilterCombobox`, matching the workspace, template, and audit log filtering UI. - Combine account status and service-account filters in one input with removable chips while retaining URL-backed filter queries. - Preserve free-text searches and advanced query fields when adding or removing filters, and show validation errors on the input. - Reuse shared user status options and add regression tests and Storybook stories for the new controls. <details> <summary>Wording alignment</summary> Use “User type” and “User type is…” to match the deployment Users filter from coder#29809. Keep the organization-specific “Search and filter members…” placeholder and existing filter behavior. </details> <img width="1100" height="420" alt="image" src="https://github.com/user-attachments/assets/10f66ed9-354f-4196-a4f5-3eb48a0788ae" />
docs-pr-preview-deploy.yaml has failed on every docs PR since 2026-11-17 22:59: its engine job reads the `DOCS_ENGINE_APP_ID` and `DOCS_ENGINE_APP_PRIVATE_KEY` repository secrets, which aren't set. This gates the engine job with `false &&`. The build, deploy and comment jobs need it, so they skip too, and docs PRs show skipped checks instead of failed ones. Previews come back by dropping `false && ` once the job has another way to read docs-engine. `test-docs-preview-mapper.sh` and actionlint pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
The tests from coder#32063 and coder#32062 are two to three times the size of the code they cover, and a lot of them can't fail for a reason we'd care about. This PR removes those, with no production changes. In `coderd/schedule/cron`, two tests rebuilt the schedule rule a second time to compare against, which was also the only use of `export_test.go`, so that goes too. Most of the rest, in both packages, are table rows that take the same branch as a row that stays. I also dropped a copy of the webhook scheme list and a repeated-request test that belongs at the route. What's left is a row per reject branch, the RFC cases, the regression test for the `Next` hang and the constant-time scan. I replayed each fix commit from the two PRs against the smaller suite, and the pre-fix code still fails a test for every one, other than a fix to the wording of a zone error. One row that stays is changed: the bearer wrong-scheme case used `Basic`, which was only rejected because of where its space lands, so nothing covered the scheme word. It's now `Digest`. coder#32162 overlaps with this in `cron`. With the shim's users gone it no longer needs to touch that package, so it's now stacked on top of this PR.
Follow-up to coder#25601, where I missed the other way agents avoid `*_internal_test.go`: an `export_test.go` file that re-exports unexported symbols, just so a `package foo_test` test can reach them. There were 13 of these on `main`, most recently from coder#32063. This PR removes 8 of them. Tests of package internals are now `*_internal_test.go` files, with no changes beyond the package name and the symbols they call. `messagepartbuffer` and `agentcontext` only needed one small accessor each, so `Buffer.EpisodeCount` and `Manager.Started` are just exported for real, and their tests stay where they were. To stop new ones appearing, the `testpackage` linter no longer skips `export_test.go` (the 5 that are left are excluded by path), and `AGENTS.md` and `.claude/docs/TESTING.md` now state the rule. `export_test.go` is an agent idiom, and imo we should try and get rid of it. So, once this PR is approved, we'll fix up all the remaining ones in a follow-up PR, somehow, and undo the lint exclusion when we do.
…coder#32219) > 🤖 This PR was written by Coder Agents on behalf of Jake Howell. Split the display-only composer out of `AgentChatInput`. `ChatPageInput` now chooses `ReadOnlyChatComposer` explicitly instead of using `readOnlyNotice` as a mode switch, so read-only chats no longer mount the editable composer's hooks or Escape-to-interrupt handler. Reuse the metadata badges, responsive overflow, and mobile menu positioning across both composers. Name the extracted popovers for assistive technology, and cover the split with an Escape regression and dedicated desktop/mobile stories. Closes [CODAGT-1385](https://linear.app/codercom/issue/CODAGT-1385/split-the-read-only-composer-out-of-agentchatinput). Follow-up to coder#30483. <details> <summary>Implementation decisions</summary> - Keep `AgentChatInput.isReadOnly` for disabled-editor flows; remove only the display-only mode. - Share setup-notice eligibility and active-MCP selection so the two composers cannot drift. - Preserve the existing permission policy, context refresh, queue display, and attachment orchestration. Broader read-only sidebar and permission cleanup stays out of scope. </details>
…oder#32308) Replaces `scripts/gpgkms` with [`github.com/coder/gpgkms`](https://github.com/coder/gpgkms) v0.2.0, the same code extracted into a shared module (terraform-provider-coder already signs its releases with it). v0.2.0 also rejects keys that aren't HSM-backed (`gpg-release` is `HSM`, and the check reads `protectionLevel` from the existing `GetPublicKey` call, so no new IAM is needed), limits each KMS request to a minute, and writes `-out` atomically. - `go.mod`: gpgkms is a `tool` dependency, so the version is pinned in `go.mod`/`go.sum` and Dependabot keeps it current. This bumps go-crypto 1.4.1 → 1.5.2, google.golang.org/api 0.308.0 → 0.311.0 and circl 1.6.3 → 1.6.5, plus a few indirect dependencies. go-crypto is now only indirect: nothing else in coder/coder imports it. - `scripts/gpgkms.sh` (new): runs it with `go tool` (like `scripts/format_go_file.sh` does for gofumpt and gci), passing the release key's OpenPGP identity (name, email, creation time, 4-year lifetime). The library takes these as flags instead of hardcoding them, so they now live in one place. - It also pins `-fingerprint 0F685EFE0AE5A8182A473DD86E3A8E5613707520`, so signing and `public-key` fail if the KMS key or creation time ever change. That's the fingerprint every current main build prints (e.g. run 44031030839), and I recomputed it from the KMS public key and the creation time alone, without signing anything. The fingerprint doesn't cover the user ID or lifetime; the equivalence check below does. - `scripts/sign_with_gpg.sh` and the "Print GPG KMS public key" step in `build.yaml` call the wrapper instead of `./scripts/gpgkms`. Signatures stay armored `.v2.asc` files, as before. - `scripts/gpgkms/` is deleted. ## Same key, same signatures The OpenPGP key's fingerprint depends on these exact inputs, so I checked that nothing changed. With a local RSA-4096 key standing in for KMS, the deleted `newEntity`/`writePublicKey`/`sign` produce the same output as the gpgkms CLI with the flags read out of `scripts/gpgkms.sh`: - The public key is **byte for byte identical**. - A signature with `-prepend` is armored the same way and has the same length (only the timestamp differs). Both the prepended signature and the KMS signature verify in both outputs. - Changing the lifetime in the wrapper by one hour makes the comparison fail, so the check is sensitive. ``` $ git -C gpgkms describe --tags v0.2.0 $ WRAPPER_ARGS_FILE=wrapper-args.txt go test ./cmd/gpgkms -run TestCoderWrapperMatchesOldCoderCode -count=3 -v === RUN TestCoderWrapperMatchesOldCoderCode equiv_coder_test.go:40: wrapper args: ["-name" "Coder Release Signing Key" "-email" "[email protected]" "-created" "2026-11-16T00:00:00Z" "-lifetime" "35040h"] --- PASS: TestCoderWrapperMatchesOldCoderCode (0.33s) --- PASS: TestCoderWrapperMatchesOldCoderCode (0.11s) --- PASS: TestCoderWrapperMatchesOldCoderCode (0.20s) ok github.com/coder/gpgkms/cmd/gpgkms 0.634s # with -lifetime 35041h equiv_coder_test.go:56: public keys differ: FAIL # with the wrapper's -fingerprint pin and a random test key derived key has fingerprint 9794B34B5E098DE61DD6CE247E0DFD4BF203C917, want 0F685EFE0AE5A8182A473DD86E3A8E5613707520 (wrong -key, -created or KMS key?) ``` (The byte-for-byte comparison runs without `-fingerprint`, since the test key is random.) gpgkms also has its own compatibility test against this identity (`compat_test.go`). Other checks: ``` $ ./scripts/gpgkms.sh public-key # from the repo root (build.yaml) gpgkms: -key is required $ cd scripts && ./gpgkms.sh public-key # from scripts/ (build_go.sh -> execrelative) gpgkms: -key is required $ ./gpgkms.sh sign -key x -prepend ../no-such-file -out o.asc ../go.mod # relative paths resolve from the caller gpgkms: read prepend signature: open ../no-such-file: no such file or directory $ shellcheck -x scripts/gpgkms.sh scripts/sign_with_gpg.sh # clean $ shfmt -d scripts/gpgkms.sh scripts/sign_with_gpg.sh # clean $ actionlint .github/workflows/build.yaml # clean $ go build ./... && go mod tidy -diff # clean ``` Not run here: real signing through Cloud KMS. The first main build after merging prints the public key in the job summary; it should be identical to the one printed by current main builds. --- AI disclosure: this PR was written by an AI coding agent (Xum) at my direction, and the agent ran the verification above. It stays a draft until I've reviewed it.
Historically, much of the UI used title case. This PR adds a lint check that reports title case UI text so it can be converted to sentence case, and converts the existing text. - `site/scripts/check-sentence-case.mjs` runs as `pnpm lint:sentence-case` and is part of `pnpm lint`. It reads JSX text and string/template literals from the TypeScript AST and skips literals that are code rather than UI text (imports, types, property names, tagged templates, values of JSX attributes that are not displayed such as `className` or `style`, and operands of `===`/`case` comparisons). JSX text across inline elements and conditional JSX is checked as one phrase. `--fix` lowercases the reported words. The checker is a heuristic: it is not meant to model every code shape, so use a `sentence-case-expect` comment where it guesses wrong. - Proper nouns (Coder products, role names, third-party products, protocols, font names) live in `PROPER_NOUNS`. For other deliberate exceptions, a `sentence-case-expect` comment on the line above suppresses the report and fails when that line no longer needs it. - Existing UI text is converted to sentence case, and tests that assert on it are updated. - Deployment option lookups (`useDeploymentOptions`) now use CLI flags instead of display names, so they do not depend on UI wording. ## Performance `pnpm lint:sentence-case` takes **1.6 s** and is 2% to 4.5% of `pnpm lint`. Measured on 82317c9 in a dev workspace (Xeon Platinum 8375C, 16 vCPUs, Node 22.23.4, TypeScript 6.0.2, warm file cache). CI buffers the output of the lint steps, so its log has no per-step times to compare against. | Measurement (20 runs) | Result | |---|---| | Wall time | 1.64 s mean, 0.03 s standard deviation, 1.62 s to 1.71 s | | CPU time | 3.0 s | | Peak memory (RSS) | 154 MB, of which 116 MB is Node with `typescript` loaded | | Input | 1,301 of the 2,199 `.ts` and `.tsx` files in `site/src` (the rest are excluded), 210,684 lines, 6.1 MB | | Throughput | About 130,000 lines per second | | Time per file | 0.5 ms median, 3 ms at the 95th percentile, 76 ms maximum (`src/api/api.ts`, 121 KB) | Each step of `pnpm lint`, median wall time of 5 runs: | Step | Wall time | |---|---| | `lint:check` (Biome) | 0.96 s | | `lint:oxlint` | 0.32 s | | `lint:types` (`tsc`) | 5.8 s with its incremental cache, 45 s without | | `lint:circular-deps` | 5.7 s | | `lint:compiler` | 15.6 s | | `lint:sentence-case` | 1.6 s | | `knip` | 6.6 s | | All of `pnpm lint` | 37 s with the `tsc` cache, 76 s without | <details> <summary>Where the time goes, scaling, and limits</summary> Phases of one run, from in-process timers. The split between parsing and checking is approximate. | Phase | Time | Share | |---|---|---| | Node startup | 0.03 s | 2% | | Load the `typescript` module | 0.32 s | 20% | | Find and read the files | 0.04 s | 2% | | Parse (`ts.createSourceFile`) | 0.83 s | 52% | | Check logic | 0.38 s | 24% | Scaling, from synthetic inputs passed to `checkSource` (median of 3 to 5 warm runs): - Clean input is linear in size: 0.2 ms to 0.35 ms per KB for one file from 54 KB to 7 MB. 100,000 string literals take 0.3 s, 100,000 sibling JSX elements take 0.8 s, and JSX nested 800 levels deep takes 10 ms. - Conditional JSX stays bounded by the 64-variant cap: 1 to 48 conditional children in one element take at most 3.4 ms. - Reporting and fixing add no measurable time. On the merge base with `main` (378 reports in 175 files), a check, `--fix`, and a second `--fix` each take 1.6 s to 1.7 s. - The 21 unit tests run in about 30 ms, 1.7 s including Vitest startup. Two limits, neither reachable with the current source: - Time is quadratic in the reports for one file, because the fixed text is rebuilt once per report. A 3.5 MB file takes 0.7 s clean and 18.0 s with 12,800 reports. The most reports in one file on the merge base is 16. - One JSX element with more than about 120,000 text phrases fails with `RangeError: Maximum call stack size exceeded`, because the phrases are spread into `push`. </details> --------- Co-authored-by: Jake Howell <[email protected]>
…#31159) Addresses @ethanndickson's [review comment on coder#30882](coder#30882 (comment)): the same `SKILL.md` file could be manual-only in Claude Code and the project dialog but automatic in Coder, because the server and the browser each handled `disable-model-invocation` in their own way. The server now owns the key for personal, organization, and project skills: - When a create or update request leaves `model_invocable` unset, `disable-model-invocation: true` in the content turns automatic use off, and `false` turns it back on. The key is read with the function workspace skills use, so a file gets the same setting in both places. Only YAML booleans count, so a quoted `"true"` is ignored. - An explicit `model_invocable` in the request always wins. - New content without the key leaves the setting unchanged, so editing text never turns it back on. - Content is stored as uploaded. Every API response returns content whose key agrees with `model_invocable`: when the stored file says otherwise, the server replaces the value of the key or adds the key before the first one, and leaves every other byte alone. - **Download** and **Export all** save the content the API returns, so the browser no longer edits the file. `withDisabledModelInvocation` is removed. - An upload is rejected with a 400 when the key holds a value the server can't replace with a boolean, such as a list. A later change to `model_invocable` can then always reach the file. Two edges: - Adding the key makes the returned file about 30 bytes larger, so a file at the 64 KB upload limit can be too large to upload again. - A skill stored before the upload check with a value the server can't replace is returned as stored. Workspace skills already honor the key since coder#31147. coder#31160, the frontend PR on top of this one, adds the switch to the personal and organization skill editors. > Generated by an agent on behalf of the user --------- Co-authored-by: Cursor <[email protected]> Co-authored-by: Nick Vigilante <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b7383935e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| onRefreshContext={onRefreshContext} | ||
| isRefreshingContext={isRefreshingContext} |
There was a problem hiding this comment.
Hide refresh action from read-only chat viewers
When another user's chat has dirty or errored context, this callback makes ContextUsageIndicator render an enabled Refresh context button. Activating it sends PUT /api/v2/chats/{chat}/context, but refreshChatContext requires policy.ActionUpdate, so a read-only viewer receives a failed request and error toast. Omit the refresh callback and pending state from the read-only composer.
Useful? React with 👍 / 👎.
| return | ||
| } | ||
|
|
||
| rows, err := api.Database.GetUnpricedAIModels(ctx, database.GetUnpricedAIModelsParams{ |
There was a problem hiding this comment.
Match historical usage by provider type
When a deleted provider name is reused for a different provider type during the report window, this endpoint misattributes the old provider's usage. GetUnpricedAIModels groups interceptions by provider_name and joins the current live provider by name alone, while deleted names are explicitly reusable, so retained Anthropic usage can be reported as OpenAI and evaluated against the wrong prices or combined with new usage. Carry the interception's provider type through the query and require it to match the live provider type.
Useful? React with 👍 / 👎.
| "format": "biome format --write .", | ||
| "format:check": "biome format .", | ||
| "lint": "pnpm run lint:check && pnpm run lint:oxlint && pnpm run lint:types && pnpm run lint:circular-deps && pnpm run lint:compiler && knip", | ||
| "lint": "pnpm run lint:check && pnpm run lint:oxlint && pnpm run lint:types && pnpm run lint:circular-deps && pnpm run lint:compiler && pnpm run lint:sentence-case && knip", |
There was a problem hiding this comment.
Make the sentence-case gate pass on the existing tree
Because the new checker scans the entire existing src tree, this command currently exits 1 on the committed tree with 23 diagnostics, including Linked Accounts and several Claude Code/Cursor labels. CI runs make lint, which reaches this script through lint/ts, so every lint job fails until the existing findings are fixed or baselined, or the relevant proper nouns are exempted.
AGENTS.md reference: site/AGENTS.md:L88-L92
Useful? React with 👍 / 👎.
…ze ChatWatchEventKind Restores the fork's keep-newer-edit behavior that the upstream requestInFlight flow dropped: a send captures the target load count and skips its rollback and post-send bookkeeping when another edit was loaded during the request, so the newer edit keeps the editor. check-apidoc.sh now sorts codersdk.ChatWatchEventKind's enum values like the other enums declared across two files, since swag collects those constants in nondeterministic map order.
…ight send The upstream chat store surfaces a pending send as a queued row, which the dock read as a queued answer: the form marked the question answered before the request settled, so a failed send could not show its error. deriveAskUserQuestionState now skips pending rows, whose IDs the server never assigns. Upstream also gates Edit message and queued-edit actions on a quiet submission, but the fork keeps an edit opened during an in-flight send (useConversationEditingState skips the send's rollback for it), so the actions only depend on the viewer owning the chat again.
…answers A steer send shows its optimistic row as a pending transcript message, not only as a queued row, so the dock still read the answer as delivered and a failed send could not show its error.
Sync upstream coder/coder 7c7e2e7 into 01326aa
Resolves the failed daily sync job from 2026-11-19 07:19Z; tracks #388 (sync-blocked).
Two-parent merge commit 31bcac3 (parents 01326aa + 7c7e2e7), then:
Conflicts resolved (about 20 files)
chatdmig routing
chatdmig route: 000643_skill_display_name = chatd, 000644_chat_project_templates = chatd (rc 0, nothing mixed).Validation
Mac-native go vet on agent/agentcontext and coderd/x/chatd is clean; fork queries grep verified. Colima container build, DB tests, and site typecheck/vitest run in the Fork ops slot and via fork-ci on this exact head.
Posted by Xum (agent) on behalf of @ibetitsmike.