mirror of
https://github.com/coder/coder.git
synced 2026-11-23 03:52:15 +08:00
main
18028
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ecc0850e36 |
refactor(site/src/pages/TemplateBuilder): read create errors from field validations (#32561)
The template builder customizations step now reads create errors from the API's field validations, which #32559 adds, and shows them with `getFormHelpers(form, createError)`, like other forms in the codebase. The HTTP status to field map and the custom `getFieldHelpers` wrapper are removed. The step remounts after a failed create, so the fields the error names are passed as `initialTouched`, which `getFormHelpers` needs before it shows an API error. As in other forms, the error stays on its field until the next submit. Errors that no rendered field owns still show in the alert above the form. That covers the 404 returned when the user can see the organization but can't create templates in it, which carries no field validation. Stacked on #32559. <details> <summary>Decisions</summary> - **Shared `getFormHelpers` instead of custom clear-on-edit logic:** an earlier version used Yup `notOneOf` to clear the error once the value changed. It needed its own helpers, one of them a duplicate of a helper in the Secrets page, so we chose the codebase convention. - **No-permission 404:** we left it without a field validation, so it shows in the alert. It only happens if a permission is revoked between loading the page and submitting. </details> > [!NOTE] > Generated by Coder Agents on behalf of @jeremyruppel. |
||
|
|
0ecf0d80b4 |
fix(coderd): attribute template builder create errors to request fields (#32559)
The template builder's create endpoint now attaches `validations` to its name conflict (409) and missing organization (404) responses, naming the `name` and `organization_id` fields. This matches the regular create-template endpoint, which already returns a `name` validation on conflict. With this, the builder UI in #32492 can show these errors inline on their fields through `getFormHelpers(form, createError)` instead of mapping HTTP status codes to fields. The 404 returned when the user can see the organization but cannot create templates in it still has no field validation. It falls back to the form-level alert. > [!NOTE] > Generated by Coder Agents on behalf of @jeremyruppel. |
||
|
|
013d00e8ea |
docs: list AI Gateway before Agent Firewall in the AI Governance sidebar (#32554)
## Summary Lists AI Gateway before Agent Firewall under AI Governance in the docs sidebar. The sidebar now matches the AI Governance landing page, which already introduces AI Gateway first. ## Changes - `docs/manifest/ai-governance.yml`: swap the order of the two child includes, and reorder the section description to "AI Gateway, Agent Firewall, and reporting." - `docs/manifest.json`: regenerated with `make gen/docs-manifest`. No page content, paths, or redirects change. ## Testing - `make gen/docs-manifest`, `make lint/docs-manifest`, `make lint/docs-html`, and `make lint/emdash` pass. - Checked that the regenerated `docs/manifest.json` differs from `main` only in the AI Governance children order and its description. Closes [DOCS-1858](https://linear.app/codercom/issue/DOCS-1858/move-ai-gateway-above-agent-firewall-in-the-ai-governance-docs-sidebar) --- _Generated by Coder Agents on behalf of @nickvigilante._ |
||
|
|
eabd63b0fc |
docs: add an air-gapped K3s install tutorial (#31869)
Adds a tutorial that installs Coder on a single-node K3s cluster in a
fully air-gapped environment. It stages every artifact on an
internet-connected workstation, builds a Coder image with a Terraform
provider mirror and a workspace image with code-server preinstalled,
carries everything to the host on removable storage, runs every host
command on the host itself, and ends with a workspace that has no
outbound access. The page is added under the Kubernetes install pages in
the sidebar and linked from the air-gapped deployments page.
The commands were first run end to end on an arm64 Raspberry Pi 4 Model
B with 4 GB of memory running Ubuntu Server 26.04 LTS, with SSH from the
workstation. After review moved the page to a strict air gap, the whole
page was run again on amd64: staging on a Linux workstation, then the
host steps on an Ubuntu Server 26.04 systemd container on a network with
no internet access and no route to the workstation. The starter
Kubernetes template needs three changes to work in this environment (the
hardcoded `amd64` agent architecture, the `Always` image pull policy,
and the code-server install in the startup script), and the chart's
default 2 CPU and 4Gi memory request does not schedule on a 4 GB host.
The page makes each change with a command and states the expected
output.
Maintenance and limits for the reviewer:
- Versions are pinned in the page (K3s, Coder, both Terraform providers,
code-server, Helm, PostgreSQL). The release automation in
`scripts/releaser/docs.go` only updates
`docs/install/server/kubernetes/index.md`, so these will not update on
release.
- The architecture is set once with `ARCH` and `K3S_BINARY`. The current
host steps were run on amd64 only. The arm64 run on the Pi predates the
move to removable storage.
- A host with no default route can't start K3s, so the page checks for
one and adds the black-hole route from the K3s air-gap docs. The test
sandbox can't load kernel modules, so a `veth` interface stood in for
the `dummy` interface type. `dummy.ko` ships in Ubuntu 26.04's base
`linux-modules` package.
- The Dockerfiles and the PostgreSQL manifest are new content that
overlaps with the example Dockerfile on the air-gapped deployments page.
I left that page's Dockerfile alone because it has separate problems,
which are tracked outside this PR.
- No identifiers were stripped from the page. Every host address, user
name, and host name is a placeholder.
- The doc-check review suggestion about the `wget` command in the final
verification step is not applied. The workspace image includes `wget`,
so a failure means the request did not succeed.
---
🤖 Built with AI assistance.
|
||
|
|
8d8088abd5 |
feat(site): add storybook:screenshot script (#32394)
Adds `pnpm storybook:screenshot <story-id>`, which saves a PNG of a story from a running Storybook dev server. We keep hand-rolling Playwright or agent-browser snippets for this, and the Storybook MCP server only returns preview URLs, not images. ```sh cd site pnpm storybook # in another terminal pnpm storybook:screenshot pages-loginpage--example -t light # /tmp/storybook-screenshots/pages-loginpage--example.png ``` The script loads the story's `iframe.html` in headless Chromium (via the existing `@playwright/test` dependency), waits for Storybook's render events, fonts, and network idle, then prints the output path. Options are `-o/--out` and `-t/--theme`; `$STORYBOOK_URL` overrides the server address. Readiness uses Storybook's channel events (`STORY_RENDERED` after play functions, or `STORY_ERRORED` / `STORY_THREW_EXCEPTION` / `PLAY_FUNCTION_THREW_EXCEPTION`), all contained in `loadStory()`. This is the same mechanism `@coder/pixel-storybook` uses. A failed render still captures but exits 1. A component that throws during render exits 0, because the router addon's error boundary renders its own error page and Storybook reports success. <details> <summary>Decision log</summary> - Storybook's MCP server (`@storybook/addon-mcp` 10.6.2) has no screenshot tool; `stories-preview` returns URLs only. - Trimmed an earlier version with title path and URL inputs, viewport, full-page, selector, and timeout flags, and "did you mean" suggestions, to keep the script short. - Replaced polling `__STORYBOOK_PREVIEW__.currentRender.phase` (undocumented internal state) with channel events from `storybook/internal/core-events`. - Listeners attach on `DOMContentLoaded`, not via `requestAnimationFrame` polling: Storybook's `vite-app.js` module creates the preview synchronously, module scripts run before `DOMContentLoaded`, and the first render starts after. Measured on three stories: the preview existed at `DOMContentLoaded` with no render started. </details> <details> <summary>Verification</summary> Against a local `pnpm storybook`: - Page and component stories capture and exit 0; `-t light` applies the theme. - Temporary stories with a throwing play function and a throwing loader exit 1 with `playFunctionThrewException` and `storyThrewException`. - Unknown story ID exits 1 with `Story not found`. - `knip` passes. Biome and oxlint ignore `scripts/*.mjs`. </details> --- _Generated by Coder Agents on behalf of @jeremyruppel._ |
||
|
|
37b6f90e26 |
fix(site/src): surface template builder organization and create errors on their fields (#32492)
The template builder Customizations step had two error-handling gaps. Both are fixed here because they come from the same step's error handling. - **DEQ-612:** the Organization field rendered only once the permitted-organizations query returned options. While that query was loading or after it failed, Create template did nothing and no message appeared. Now the field renders disabled with "Loading organizations…" as its description while it loads. If the query fails with no data, an `ErrorAlert` with a Retry button takes the field's place. - **DEQ-614:** a failed create showed only a page-level `ErrorAlert` that named no field (WCAG 3.3.1). The create endpoint returns 409 (duplicate name) and 404 (organization not found) without `validations`, and this PR stays inside `site/`, so the step maps 409 to the ID field and 404 to the Organization field. `FormField` then sets `aria-invalid` and links the server message with `aria-describedby`. That field gets focus, and the error clears once the value changes. Other create errors still show in an `ErrorAlert`, now at the top of the form. The step remounts after `BuildingTemplateLoader`, so `TemplateBuilderPageView` keeps the submitted values while a create error is shown, and the step restores them. Without this, the user's ID would reset to the base default and the error would describe a value that is no longer in the field. Supporting changes: - `OrganizationAutocomplete` accepts `autoFocus`. - `mockApiError` accepts an optional `status`. - The selected organization is now derived from the form value, not kept in duplicate `useState`. Closes DEQ-612 Closes DEQ-614 | Ticket | UI surface | Screenshots | |---|---|---| | DEQ-612 | `/templates/new/builder`, Customizations step, Organization field (loading and load error) | [before/after](https://linear.app/codercom/issue/DEQ-612#comment-877f37f8) | | DEQ-614 | `/templates/new/builder`, Customizations step, ID and Organization fields after a failed create | [before/after](https://linear.app/codercom/issue/DEQ-614#comment-08982642) | **Dropped review findings** - Type `createError` as `Error | null` (TN, raised as a side note): kept as `unknown`, the same type `ErrorAlert` accepts. Stories pass `mockApiError` objects, which are not `Error` instances. - Attribute assertions in the new Vitest test (`toBeInvalid`, `toHaveAccessibleDescription`, `toHaveFocus`): kept. The invalid state, the linked description, and focus placement are what this accessibility fix delivers, and nothing else checks them. - Inject the create error through Formik `initialErrors` or `setFieldError` instead of wrapping `getFormHelpers` (RP, side note): not done. Formik field errors only show once the field is touched, and the next validation run clears them. The wrapper keeps the server error until the value changes. - `RetryButton` is imported from `pages/AgentsPage/components` (several roles, side note): `AISettingsPage` already imports it the same way. Moving it to `components/` is out of scope. - Focus stays on `<body>` after an unmapped (for example 500) create error (SA6, nit): this was already true on main. The alert has `role="alert"`, so it is announced. <details> <summary>Grouping and decision log</summary> - One PR for both tickets, as requested: they share `TemplateCustomizationsStep` and the create-error path in `TemplateBuilderPageView`. 125 non-test lines changed. - The DEQ-614 ticket suggests adding `Validations` in `coderd/templatebuilder_handler.go`. The `site/`-only constraint rules that out, so the step maps the 409 and 404 statuses to fields. If the backend later adds `validations`, `getFormHelpers(form, createError)` can replace the map. - A 404 has no field to sit on while organizations fail to load, so it falls back to the top alert. - After a 404, the restored organization id may no longer be in the options. The combobox then shows empty with "Organization not found." and is not auto-replaced, so the message stays visible until the user picks an organization. - New stories: `OrganizationsLoading`, `OrganizationsLoadError`, `DuplicateIdError`, `OrganizationNotFoundError`, `CreateError`. - axe-core 4.11 on those stories: no violations. One incomplete result, `aria-valid-attr-value` on the `#organization` combobox: its `aria-controls` points at popover content that is not mounted while closed. It also appears on main. - Seen in screenshots, not changed: on main, the two-column grid already sizes to its content, so a long inline error (for example the duplicate ID message) widens the columns slightly. Every field error does this. </details> 🤖 Generated by Coder Agents on behalf of @aqandrew. |
||
|
|
e53ffc9194 |
fix(site/src): fix workspace sharing popover a11y issues (#32472)
Fixes four accessibility issues in the workspace Share popover. The popover and the Workspace settings > Sharing page share `WorkspaceSharingForm`. - **Dialog name (DEQ-616):** the popover is now named by its "Workspace sharing" heading through `aria-labelledby`, which fixes axe `aria-dialog-name`. - **Table labels (DEQ-615):** the actions column header gets sr-only "Actions" text, which fixes axe `empty-table-header`. The ticket also flagged the same empty header in `ChatSharingPopover`, so that one is fixed too. The loading, error, and sharing-disabled tables now carry the same `aria-label` as the members table. - **Focus after an update (DEQ-643):** the controls were natively `disabled` while a mutation was pending, so focus dropped to `<body>`. This happened on a member's role change, and on Add member. Now: - Each row's role select uses `aria-disabled`, and it ignores open and change requests while that member's update is pending. - Add member uses `aria-disabled` while pending, and the form action guards against a second submit. - After a successful add, focus moves to the member search, ready for the next member. - **Add member looks focused (DEQ-644):** in the dark theme the enabled Add member button had a solid white fill, which read as focused. It now uses the `outline` variant, so the `:focus-visible` ring is the only focus cue. A new `MemberSelected` story covers this state. | Ticket | Surface | Screenshots | |---|---|---| | Closes DEQ-616 | Share popover dialog | n/a (ARIA only) | | Closes DEQ-615 | Sharing table headers and states (Share popover, Sharing settings, chat Share popover) | n/a (ARIA only) | | Closes DEQ-643 | Role selects and Add member focus | n/a (focus behavior) | | Closes DEQ-644 | Add member button | [before/after](https://linear.app/codercom/issue/DEQ-644/workspace-sharing-dialog-share-button-looks-focused-when-a-user-is#comment-6232ad35) | **Verification:** I ran axe on the `ShareButton` stories in both themes. The base branch reports `aria-dialog-name` and `empty-table-header`; this branch reports neither. Using a keyboard against a delayed mock API, I confirmed that focus stays on the row role select during an update, and that it moves to the member search after an add. On `main`, focus dropped to `<body>` in both cases. <details> <summary>Decision log and dropped review findings</summary> - **Grouping:** one PR, because all four tickets are in the workspace sharing popover and three of them touch `WorkspaceSharingForm.tsx`. - **Why not `disabled`:** a natively disabled element loses focus. Unlike `disabled`, `aria-disabled` keeps the control focusable, and the guards stop duplicate requests. The row select is controlled (`open`/`onOpenChange`) so it cannot open while it is pending, because a selection made then would be silently dropped. - **Where focus goes after an add:** the member search, which is the start of the add flow. The Add member button stays disabled after the reset because nothing is selected, so focus cannot stay there. - **Dropped (nit):** "two comments repeat the `aria-disabled` rationale". They explain two different controls, and each one guards against a revert at its own site. - **Dropped:** "`RoleSelectField` still uses `disabled={isLoading}`". Submitting moves focus to the Add member button or the search, so focus cannot be on that field when it becomes disabled. - **Dropped:** "the `(newValue: WorkspaceRole)` annotation on Radix's `string`". This is the pattern the file already uses in `RoleSelectField`. - **Pre-existing, not changed:** `heading-order` on the popover's `h3`; `link-in-text-block` on the Sharing settings page. - **Hooks:** `make pre-push` fails on `cli TestSSH/Env`. That test also fails on unmodified `origin/main` in this workspace, and this PR changes only `site/`. I pushed with the hook's default opt-out (no `--no-verify`). </details> 🤖 Generated by Coder Agents on behalf of @aqandrew. |
||
|
|
462b474729 |
fix: refuse unknown built-in PostgreSQL data versions (#32489)
<!-- Authored with Coder Agents on behalf of @Emyrk --> Refs https://linear.app/codercom/issue/CORE-634/upgrade-embedded-postgresql-to-a-non-eol-version. Precedes #32144. Refuse to start built-in PostgreSQL when an existing data directory has a missing or unsupported version, rather than letting embedded-postgres replace its data. - An existing `PG_VERSION` other than 13, including 18 or 19, now returns an error without starting PostgreSQL. - A missing marker also returns recovery guidance instead of initializing over existing data. - Fresh databases and existing PostgreSQL 13 databases keep their current behavior. - Development database recovery uses the same guard. <details><summary>Agent context</summary> The bundled embedded-postgres v1 library can delete an existing data directory whose version does not match its PostgreSQL 13 binary. This change checks the directory before invoking the library, without changing the binary version or migrating data. Only Coder builds containing this guard gain the protection; already-released older binaries remain unchanged. </details> --- <sub>Coder Agents on behalf of @Emyrk.</sub> |
||
|
|
41ab09f075 |
fix(site/src/components/Combobox): apply caller className to ComboboxButton (#32557)
`ComboboxButton` destructured `className` and `children` but never used
them, so caller styles were silently dropped. It now merges `className`
with `cn(...)`, and `children` is removed from its props type since the
component renders its own label.
The only visible change is in the change version dialog, where the
caller's `pl-3.5` now applies (12px to 14px left padding). The IdP sync
forms' `w-72` matches their containers, and `SelectFilter`'s `shrink-0
grow` matches the defaults.
Closes DEQ-635
> 🤖 Generated by Coder Agents on behalf of @jeremyruppel.
|
||
|
|
56aed06a1c |
fix(site/src): name MultiSelectCombobox inputs and stop announcing the highlighted option as selected (#32551)
Fixes two screen reader problems in `MultiSelectCombobox`.
- **Inputs had no accessible name (DEQ-622).** The IdP group, role, and
organization sync forms and multi-select dynamic parameters passed
`inputProps.id` and pointed a visible `<Label htmlFor>` at it. cmdk
1.1.1 replaces the input's `id` and `aria-labelledby`, so the label
named nothing. These fields now pass `commandProps.label` with the
visible label text, the pattern `OAuth2AppForm` already uses.
`inputProps` no longer accepts `id` or `aria-labelledby`, because cmdk
throws them away.
- **The highlighted option was announced as selected (DEQ-628).** cmdk
sets `aria-selected="true"` on whichever row is highlighted. A picked
option leaves the list, so every listed option, including the "Create"
row, now passes `aria-selected={false}`. This relies on the existing
cmdk patch from #32020.
Closes DEQ-622
Closes DEQ-628
| Ticket | UI surface |
|---|---|
| DEQ-622 | IdP group, role, and org sync "Coder
group/role/organization" inputs; multi-select dynamic parameters |
| DEQ-628 | Option list of every `MultiSelectCombobox`: IdP sync, OAuth2
app scopes, multi-select dynamic parameters |
No screenshots: only the accessible name and ARIA state change, so
nothing looks different.
<details>
<summary>Grouping and decision log</summary>
- Both tickets are in the same component, so they ship in one PR as
requested.
- I did not patch cmdk to honor a caller's `id`. cmdk finds the input by
its own generated id to move focus when the value changes, so a custom
id would break keyboard focus. `commandProps.label` is the hook cmdk
provides, and one form already uses it.
- I removed the visible labels' `htmlFor`, because no element has that
id. The visible text and the hidden cmdk label match, so the accessible
name matches the visible label.
- For DEQ-628 I used `aria-selected={false}` instead of
`aria-multiselectable`. Picked options are shown as badges outside the
listbox, so no listed option is ever selected.
- Verified in Storybook with axe-core 4.11 (IdpSyncPage Default and
RolesTab, IdpOrgSyncPageView Default, DynamicParameter MultiSelect): the
inputs are named "Coder group", "Coder role", "Coder organization", and
the parameter name. With the list open, the highlighted row has
`aria-selected="false"`. The change adds no axe violations. These ones
were already on `main`: `aria-valid-attr-value` while the list is closed
(cmdk's `aria-controls` points at a list that isn't rendered),
`aria-required-children` when the list is empty, and
`empty-table-header` on the org sync table.
- Self-review: frontend-review FE1 to FE10 all pass. The
frontend-deep-review sub-agents failed to finish because of a harness
context error, so I ran the roles inline against the role files. Two
changes came out of that: the four repeated call-site comments moved
into the `commandProps` JSDoc (CD5), and the test now uses a `selected`
role query (TS2).
</details>
🤖 Generated by Coder Agents on behalf of @aqandrew.
|
||
|
|
d3a57ec1ca | fix(site/src/pages/AgentsPage/AgentSettingsPage/AgentSettingsSkillsPage): keep organization skills visible across many organizations (#32410) | ||
|
|
13381e306d |
feat: paginate the organization unpriced AI models endpoint (#32170)
## Description
Paginates the experimental `GET
/api/experimental/organizations/{organization}/ai/model-prices/unpriced`
endpoint from #31753. The list is keyed by the requested model, which
clients set, so it has no upper bound.
## Changes
- `GetUnpricedAIModels` takes `limit_opt` and `offset_opt`, and each row
carries the `count` of every model. A zero limit returns every model, so
the unpriced models notification is unchanged.
- The endpoint reads `limit` and `offset` with
`parseOrganizationAISpendPage` (default 10, maximum 100), as the other
AI spend endpoints do.
- `count` is now the number of models over every page.
- `ExperimentalClient.OrganizationUnpricedAIModels` takes an
`OrganizationAISpendPage`.
- Add query and handler tests for pagination.
Related to AIGOV-730
> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
|
||
|
|
f70ced16a4 |
ci: stop contrib jobs from creating main deployments (#32547)
The `community-label` and `cla` jobs reference the `main` environment for their Cloud KMS signing keys (#31763, #32352). By default that creates a GitHub deployment, so every PR shows "temporarily deployed to main". Setting `deployment: false` keeps the environment's secrets and branch rules without creating a deployment. Other workflows that use `environment: main` for secrets only are left for a follow-up. <details> <summary>Verification</summary> - `make lint/actions` (actionlint, zizmor): no findings. - Not verifiable before merge, because `pull_request_target` runs the workflow from `main`: - `deployment: false` fails the job if the `main` environment has a custom deployment protection rule. Needs a repo admin to confirm it has none. - The KMS signing for `coder-cla` and `coder-org-membership-bot` should still accept the OIDC token without a deployment. - After merge: open a test PR and confirm both jobs mint tokens and no deployment appears. </details> --- _Generated by Coder Agents on behalf of @jeremyruppel._ |
||
|
|
d7211223c9 |
feat: add the AI spend cost details dialog (#32469)
## Description Adds **Cost details** to each top spender's menu. It opens a dialog with the user's spend in the period, broken down by provider, model, and client. ## Changes - Add `CostDetailsDialog`, with the **Providers**, **Models**, and **Clients** sections. A model with no price shows **No pricing**, and a partly priced item shows a warning next to its cost. - Reuse the top spenders' details request, with loading and error states in the dialog. - Show a note when the details response doesn't include the user, instead of loading forever. - Show the user menu to every viewer. **User AI session logs** still needs read access to every user's sessions. - Keep **Run detailed report** disabled with a `TODO(AIGOV-731)`. - Add stories for the dialog states. Closes AIGOV-732 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
daf8d43568 |
feat: show unpriced models next to the AI spend top spenders (#32468)
## Description Shows a warning next to each top spender who used models without a price, with a tooltip naming how many models are missing pricing. ## Changes - Request the top spenders' details from the users endpoint with their `user_ids` and the same period, after the overview loads. - Show the warning with the number of models that have unpriced usage, and a tooltip with a **View docs** link to setting model prices. - The details have no loading state: while they load, or if the request fails, a row shows no warning. - Check the users request period in the default and picked range tests, and add stories for the warning and tooltip. Related to AIGOV-732 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
8e8e071e01 |
feat: add the AI spend top spenders card (#32342)
## Description Adds the **Top spenders** card to the AI spend Overview tab, with the top 10 users by spend. ## Changes - Add `TopSpendersCard`, with a summary of how much the listed users spent compared with everyone else, for example "Top 10 users spent 91% of the total. The other 34 users spent $2,693.00." - Keep **Detailed report** disabled with a `TODO(AIGOV-731)`. - Add a menu per user with **User AI session logs**, which opens the sessions page filtered to that user and period. The sessions page needs read access to every user's sessions, so the menu is hidden without it. - Add tests for the summary and the session logs link, and stories for the card states. Related to AIGOV-732 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
e677c6e1b1 |
feat: add the AI spend trends chart (#32341)
## Description Adds the **AI spend trends** card to the AI spend Overview tab: the overview's daily spend as a bar chart, built on the shared `Chart` components. ## Changes - Add `SpendTrendsCard`. Each bar is one UTC day, so the axis, the tooltip, and the subtitle format the days in UTC and say so. - Label the first, middle, and last days, so the axis stays evenly spaced for any range. - Show a skeleton while loading and an empty state when the period has no spend. - Add `OverviewCard`, the bordered panel the overview cards share, and `formatSpendDays` for the subtitle's range label. - Add stories for a week, a month, a single day, loading, no spend, and the open tooltip. Related to AIGOV-732 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
c4ba26df76 |
feat: add the active users and median spend cards (#32340)
## Description Adds the **Active users** and **Median spend** cards to the AI spend Overview tab, from the user count and median spend the overview endpoint already returns. ## Changes - Render both cards with `StatCard`, side by side below **Total spend**. - Add a story for an organization with no spend in the period. Related to AIGOV-732 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
dac4d49370 |
feat: add the AI spend unpriced models popover (#32339)
## Description Turns the "N models not set up" warning on the **Total spend** card into a popover that lists the models used in the period without a price, with a link to the model pricing docs. ## Changes - Add `UnpricedModelsPopover`. Each model shows its provider icon and `<provider>/<model>`, since the endpoint returns the same model once per provider, and the list keeps a fixed height and scrolls when there are more models than fit. - Use singular copy when only one model has no price. - Add stories for one, several, many, and unknown-provider models, and for the same model on two providers. Related to AIGOV-732 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
78ee4f3372 |
feat: add the AI spend total spend card (#32338)
## Description
Adds the **Total spend** card to the AI spend Overview tab. The total
comes from the fast overview endpoint, and the "N models not set up"
warning from `GET
/api/experimental/organizations/{organization}/ai/model-prices/unpriced`,
which is slower, so the total renders first and the warning follows with
its own loading state.
## Changes
- Add `API.experimental.getOrganizationUnpricedAIModels` and the
`organizationUnpricedAIModels` query. The page requests it alongside the
overview, and viewers who cannot read the organization's model prices
get a 403.
- Add `StatCard`, the labeled figure the overview cards share, and
`TotalSpendCard`, which shows a skeleton until the total loads and a
spinner while the unpriced models load.
- If the unpriced models request fails, including the 403, hide the
warning instead of blocking the total.
- Format the total with the existing `formatCostMicros`, e.g.
"$2,621.70", like the other spend amounts.
- If an overview refetch fails, keep the cached cards below the error.
- Add `MockUnpricedAIModels`, a test for the unpriced models request,
and stories for the card states, including the hidden warning when the
request fails.
Related to AIGOV-732
> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
|
||
|
|
51ccf7e575 |
feat: add the AI spend overview page shell (#32337)
## Description
Adds the shell of the redesigned AI spend page, which will replace the
existing Spend page. For now it is only accessible at
`/ai/settings/spend/experimental`.
## Changes
- Add `API.experimental.getOrganizationAISpendOverview` and the
`organizationAISpendOverview` query for `GET
/api/experimental/organizations/{organization}/ai/spend`.
- Add the `AISpendPage` route, with the header, the organization picker
and the tabs. Like the current Spend page, the title has the
experimental badge. **Detailed report** stays disabled with a
`TODO(AIGOV-731)`.
- Add a date picker that only picks days, reusing `DateRangePicker`.
Every day is a UTC day, since the endpoint aggregates spend per UTC day:
the days are kept in the URL as `startDate`/`endDate` (`YYYY-MM-DD`),
and the default and the picker's today follow the current UTC day. The
default is the last 7 days, including today.
- Handle the paywall, AI Gateway setup, organization loading and access,
and overview error states.
- Add `MockOrganizationAISpendOverview`, unit tests for the day
conversions and the page's requests, and stories for the view states,
including mobile.
Related to AIGOV-732
Figma designs
[link](https://www.figma.com/design/6TkixpkUIM5Qv6I7qhM3xZ/AI-Gov---user-spend?node-id=12-5152&t=KQwENGjcQvVT9qkh-4)
> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
|
||
|
|
cf68914831 |
fix(coderd): let only one request create the first user (#32417)
Prevent multiple Owner accounts from being created during concurrent first-user setup requests. Refs https://linear.app/codercom/issue/CORE-853 Use a transaction-scoped PostgreSQL advisory lock shared by password setup and GitHub/OIDC first sign-ins. Recheck the user count under the lock to ensure only one account receives the Owner role, while preserving existing responses for subsequent requests. - Add a stable, backport-safe lock ID and shared first-user setup helper. - Apply locking only when no users exist, leaving normal sign-ins unaffected. - Use `READ COMMITTED` isolation to ensure accurate counts regardless of database defaults. - Keep validation and trial licence requests outside the lock. - Preserve existing API responses, status codes, and telemetry behavior. **Testing** - Add concurrent password, OAuth, and mixed-path tests verifying exactly one Owner. - Cover lock contention, cancellation, isolation levels, telemetry, and lock bypass. - Verify tests fail when locking is removed. - Pass targeted race tests, 124 related tests, lint, and `intxcheck`. **Known limitation:** A burst of concurrent OAuth sign-ins on an empty deployment could exhaust the database connection pool while waiting for the lock. This remains unverified and is outside the scope of this fix. **Note:** Stacked on #32324; will be rebased onto `main` after it merges. |
||
|
|
d807abc2e3 |
feat: honor --use-keyring together with --global-config (#32392)
An explicit --use-keyring flag or CODER_USE_KEYRING value now selects the keyring backend even when --global-config points at a custom directory. When --use-keyring is left at its default, a custom --global-config still selects file storage so existing callers keep finding <dir>/session. Removes the test-only RootCmd.UseKeyringWithGlobalConfig override and the duplicate clitest.NewWithDefaultKeyringCommand helper. Closes CLI-1, #29105 |
||
|
|
9ef61e5797 |
feat: add wsrelated tags to Workspace and its sub-structs (#32437)
Adds `wsrelated` struct tags to `codersdk.Workspace` and every struct it contains, recording which `include_related` path populates each field. These tags will drive generated API docs; nothing in production reads them yet, so there is no behavior change. RFC: https://app.notion.com/p/coderhq/Lite-Workspace-API-Requests-3aad579be5928060b5e7cc65c539717f?source=copy_link#3acd579be592808a84dace3da215b099 Tag conventions: - `wsrelated:""`: always returned. - `wsrelated:"a,b"`: requires every listed path. Only `Workspace.Outdated` (`template,latest_build`) uses this. - Subtree tags: when every field of a struct would carry the same tag, only the parent field is tagged, so doc generation can stop descending there. Deprecated, unset fields count as covered. - No tag on a field of a tagged struct: not returned as part of a workspace. This covers `ProvisionerJob.WorkerName`, `AvailableWorkers`, `Metadata`, and `WorkspaceAgent.Metadata` (only set by the list endpoint's `include_agent_metadata`). --- _Generated by Coder Agents on behalf of @spikecurtis._ |
||
|
|
6a132aee6c |
fix(site/src/pages/LoginPage): give the login page a non-empty document title (#32327)
The login page's browser title was empty, which axe flags as
`document-title` (WCAG 2.4.2).
`<title>Sign in to {applicationName}</title>` gives `<title>` two JSX
children. React 19 only sets `<title>` text from a single string child,
so it hoisted an empty `<title>` ahead of `index.html`'s
`<title>Coder</title>`, and `document.title` was `""`. A documented
`getLoginPageTitle(): string` helper now builds the title, so `<title>`
gets one string child. The visible text is unchanged.
<img width="263" height="99" alt="Screenshot 2026-11-17 at 11 27 08 AM"
src="https://github.com/user-attachments/assets/8558f76d-a649-458f-b8be-4a4bee9f8e40"
/>
Closes DEQ-254
| Ticket | Surface | Screenshots |
|---|---|---|
| DEQ-254 | `/login` document title | n/a: no rendered UI change |
<details><summary>Grouping and decision log</summary>
- DEQ-254 is the only ticket with the `document-title` label. The issue
is not global: `site/index.html` already ships `<title>Coder</title>`.
- I reproduced it with jsdom and the repo's react-dom 19.3.1. Main gives
`<title></title><title>Coder</title>` and `document.title === ""`. The
branch gives `"Sign in to Coder"`.
- axe-core 4.11.1 `document-title` against the rendered login page: 1
violation on main, 0 on the branch.
- I scanned every `site/src/**/*.tsx` file with the TS AST for `<title>`
elements without exactly one child. LoginPage was the only one.
- I did not use `pageTitle()`, because it appends " - Coder" and would
change the title text.
- I did not add a repo-wide lint rule for multi-child `<title>`. It is a
possible follow-up.
- Review round: per untra and aqandrew, I dropped the JSX comment and
moved the title into a helper with a JSDoc and an explicit `string`
return. It is a function, not a module const, so it reads the
application name `<meta>` at render time. The test keeps the literal
`"Sign in to Coder"` instead of importing the helper, so a change to the
title text still fails it. It does not assert a single `<title>`: with
the fix, production has two (React's ahead of `index.html`'s), and the
browser uses the first.
- Self-review (frontend-review, frontend-deep-review,
frontend-accessibility, test-audit) found no blocking or should-fix
findings. I applied one nit, the test name.
</details>
🤖 Generated by Coder Agents on behalf of @jeremyruppel.
---------
Co-authored-by: Samuel Volin <sam.volin@coder.com>
|
||
|
|
dbb096a02f |
fix(site/src/components/Filter/FilterCombobox): build chip changes on the last emitted query (#32484)
`FilterCombobox` built the next query from the chips in the rendered `value`, but took free text and typed-text chips from the last query it emitted. When the parent applies `onChange` asynchronously (react-router `setSearchParams` with a data router), a second action in that window worked from stale chips: removing a chip dropped the one just added, re-picking a just-removed option removed it again, and Backspace skipped a widened chip's scope pill. This flaked `TemplatesFilter.test.tsx` in CI ([run](https://github.com/coder/coder/actions/runs/44610836249/job/135866917466)), which received `""` instead of `deprecated:true`. Handlers that change chips now read `lastEmittedChips()`, the chips of the last emitted query, and the scope helpers take those chips where a handler decides scope. Render-time reads (selected state, scope switch, pill, highlight) still use the rendered `value`. When the parent replaces `value` externally, the existing layout effect resets the last emitted query, so external changes still win. <details> <summary>Investigation and decisions</summary> - **Root cause of the CI flake:** the `TemplatesFilter` test harness calls `onChange` before `setSearchParams`. `waitFor` could pass before `FilterCombobox` re-rendered, so the remove click ran on a stale render. Reproduced every time by delaying `setSearchParams` 30ms. With this fix, the original test passes under that delay with no test change. - **Rejected:** a `findByRole` wait guard in the test, or a harness that reports `onChange` from an effect. Both hide the race without fixing it in the hook. - **Scope:** every handler that builds a query from chips (remove, Backspace, inline, category, and suggestion picks and toggles, `selectCategory`, the scope switch and pill, typed Enter). Clicked option-row tokens are still built at render time; they are compared only with other render-time tokens. - **Contract note:** a parent that rejects a change by leaving `value` unchanged now has the hook keep building on the rejected query until the next external `value`. No caller in this repo does that (`useFilter`, `ConnectionLogFilter`, and `UsersPageFilter` were checked). - **Tests:** one regression test renders `FilterCombobox` with a fixed `value` (a parent that has not applied `onChange`), adds a chip, removes another, and expects the added chip to survive. It fails on `main`. The other handlers share the same fix, so they have no separate tests. - **Unrelated:** under the 30ms delay, "keeps template options separate from cached workspace attributes" also fails, on `main` too. The delayed `setSearchParams` lands after that test navigates, so the failure comes from the injected delay itself. </details> > Generated by Coder Agents on behalf of @jeremyruppel. |
||
|
|
91eb5ed6ed |
fix(site/src/pages/WorkspacesPage): move selection checkboxes out of table header cells (#32322)
The Workspaces table put the "Select all workspaces" checkbox inside the Name column header and each row checkbox inside its row header, so screen readers announced the control as part of the header (axe `table-data-not-header`, WCAG 1.3.1). The checkboxes now live in their own leading column of `td` cells; the Name column header and row headers contain only their labels. Closes DEQ-233 | Ticket | Surface | Screenshots | |---|---|---| | DEQ-233 | Workspaces table (`WorkspacesTable.tsx`) | [before/after](https://linear.app/codercom/issue/DEQ-233/data-cell-is-marked-as-a-header-cell#comment-37faac27) | Visible change: the checkbox-to-avatar gap shrinks from about 25px to 17px (the Table primitive's checkbox-cell padding), and Template/Status shift a few pixels. Vertical alignment and table borders are unchanged. **Dropped review finding:** axe's experimental `td-has-header` flags the new checkbox cells because no header labels them. Experimental rules are out of the audit scope, and labelling the column with a `th` would put the control back inside a header cell, which is this ticket's issue. Each checkbox keeps its own accessible name. <details> <summary>Grouping and decision log</summary> - Batch `table-data-not-header` had one eligible ticket (DEQ-233), one root cause. - Options: (a) `th` with sr-only text plus the checkbox: still a control in a header cell, rejected; (b) separate leading column of `td` cells: chosen. - The header checkbox cell is a `td` inside `thead`; `TableHeader` already removes `td` borders there. - Each checkbox is wrapped in `<div className="flex">` so it sits centred like before; without it, the inline-block checkbox sat about 2px low and the header grew 3px. - Loading skeleton row split to match the new column count. - Pre-existing, not touched: `aria-valid-attr-value` on the filter combobox input; `aria-progressbar-name` / `button-name` in the loading skeleton. - Checks: Vitest regression test fails on `main` and passes here; `pnpm check`, `pnpm lint`, `pnpm format`; axe run on AllStates, Loading, OwnerHasNoWorkspaces and SelectAllMixedEligibility, before and after (no new violations); frontend-review, frontend-deep-review and frontend-accessibility self-review. </details> 🤖 Generated by Coder Agents on behalf of @jeremyruppel. |
||
|
|
74943336c6 |
fix(site/src): show build reason tooltip when the build link is focused (#31988)
In the workspace History sidebar and the build page sidebar, a build's reason (for example "CLI") was only shown in a tooltip that opened when you hovered the info icon. The icon sits inside the build row's link, so it can't be its own focusable trigger without nesting interactive controls, and sighted keyboard users had no way to see the reason (WCAG 2.1.1). The build row link is now the tooltip trigger. On the build page, a new `SidebarItem` takes an optional `tooltip` (the build reason from `getDisplayBuildReason`); the History sidebar wraps its link in `WithBuildReasonTooltip`. Focusing or hovering the row shows the reason to the right of the row. The icon is decorative, the reason stays in the link's accessible name, and no tab stops are added. Closes DEQ-493. The ticket's other elements were fixed earlier: the breadcrumb, timeline stage info icons and resource bars in #31656, and the log source icons in #30819. | Ticket | Surface | | --- | --- | | DEQ-493 (element 2) | Workspace History sidebar and build page sidebar: build reason tooltip on the focused link. [Screenshots](https://linear.app/codercom/issue/DEQ-493/function-cannot-be-performed-by-keyboard-alone#comment-b5e70ab4) | <details> <summary>Decision log</summary> - Element 3 (log source icons in "All logs") needed no change: #30819 already makes the first icon of each run of lines from one source a focusable button with a tooltip, covered by `AgentLogs.test.tsx`. - Options considered for element 2: make the link the trigger (chosen), open the tooltip from DOM focus listeners on the closest link (rejected as coupling), show the reason only on the build page header (rejected: needs navigation and leaves the interaction unchanged), or show the reason as visible text (changes sidebar density). - Self-review findings applied: tooltip opens to the right so it doesn't cover the next row on hover; the Vitest test asserts the focused link's accessible description; a `FocusedLinkWithReason` story covers the visual state for Pixel. - Known: screen readers hear the reason twice on focus (name and description), which keeps it available to virtual cursor users. </details> 🤖 Generated by Coder Agents on behalf of @jeremyruppel. |
||
|
|
490bb5f85a |
fix: return an empty list from the AI Gateway models and clients endpoints (#32517)
## Description `GET /api/v2/ai-gateway/models` and `GET /api/v2/ai-gateway/clients` return `null` when nothing matches. The frontend filters call `.map()` on the response, so a search with no match fails instead of showing no results. This affects the AI Gateway sessions filters, the Spend page filters, and the AI spend Detailed report filter. ## Changes - Return `[]` from both endpoints when the result is empty, like `aiBridgeListProviders`. - Add tests that a search with no match returns `[]`. Related to AIGOV-731 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
61aec9ba93 |
refactor: share the search params update in a hook (#32518)
## Description Several pages update search params the same way: copy the latest params, change them, and replace the history entry. This moves that into a shared `useUpdateSearchParams` hook. ## Changes - Add `useUpdateSearchParams`. - Use it in `ModelsPageView` and `SpendPage`. `AISpendPage` will use it once its stack merges. `agentSidebarFilters` is left as is, since it receives `setSearchParams` as an argument and passes navigation state. Follow-up to review feedback on #32337. > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
5d5d8b1723 |
fix(agent/agentssh): report ssh disconnect when the connection closes (#32353)
Non-PTY SSH sessions keep their process running after the client leaves, so the disconnect was only reported when that process exited and connection log rows stayed "Ongoing". - Report the disconnect with reason client_closed when the SSH connection closes, or when the handler returns, whichever comes first. - Guard the report with sync.Once so it happens once and finishes before the handler returns. - Keep non-PTY process lifetime unchanged (OpenSSH-compatible, #18519). - Add TestSSHShutdownReason/ClientDisconnectWhileProcessRuns. Closes CLIENT-1112 |
||
|
|
cba1647cdf | fix(aibridge): correlate other client-run tool result types (#32390) | ||
|
|
35bd24ee3b |
feat(site/src): show organizations on the AI Gateway session summary (#32313)
Adds an **Organization** row to the Session summary card on the AI Gateway session detail page, using the `organizations` field added to the session response in #32057. Each organization is a badge linking to `/organizations/<name>` and showing `display_name || name`, as in the Connection Logs details popover. Sessions with no organization recorded, which only exist from before v2.39, show "Not recorded". The row is shown only when `useDashboard().showOrganizations` is true, so single-organization deployments see no change. The AI Gateway audit docs mention the new row. Refs AIGOV-754. Stacked on #32260. ## Notes for reviewers - **Several organizations:** all are listed, wrapping like the Provider row. The label stays singular ("Organization"), matching "Provider". - **Cost** is still the whole session's cost, as agreed for AIGOV-754. - **Tests:** stories only, since the change is visual. `SessionSummaryTable` has `OneOrganization`, `MultipleOrganizations` and `OrganizationNotRecorded`; `Default` covers the hidden row. `SessionThreadsPageView` has `WithOrganizations`, which covers the page passing the organizations through. New shared fixtures: `MockAIBridgeSessionOrganization` and `MockAIBridgeSessionOrganization2` in `testHelpers/entities.ts`. <details> <summary>Decisions and plan</summary> - **Scope (Sas, 16 Nov):** the detail page organization row is a separate PR after the list filter, built this sprint if time allows. There is no design, so it follows existing patterns. - **Behavior:** no row on single-org deployments; "Not recorded" for an empty list; one linked badge per organization. - **Badge link:** `<Badge asChild hover>` around the router link, as in `WorkspacesTable.tsx`, so the focus ring is not clipped and long names truncate with an ellipsis and a `title`. - **Stack:** #32057 (backend) → #32260 (list filter) → this PR. - **Checks run:** `pnpm lint:types`, Biome, `frontend-deep-review` (all findings fixed), and doc-check on `audit.md` (no blocking findings). </details> --- Code written by @mollymaefraser, with Coder Agents used as a guide: explaining the existing code path, reviewing each step, and running reviews. |
||
|
|
88d3494b9a |
feat: require a setup token to create the first user on a tunnel (#32324)
fix(security): require setup token for first user on tunnels Prevent unauthorized users from claiming Owner access on public `try.coder.app` tunnels before initial setup. - Generate a setup token at startup when using a tunnel with no existing users. - Require the token for first-user creation via the API, web UI, and CLI. - Block GitHub/OIDC first-user signup until setup is complete. - Support custom tokens via `--setup-token` / `CODER_SETUP_TOKEN` and non-interactive CLI setup. - Update development scripts, documentation, and tests. - Preserve existing behavior for deployments with an access URL or existing users. Validated with automated tests and 23/23 manual scenarios using a real tunnel. Refs CORE-784 |
||
|
|
3248dc073e |
fix: generate per-instance dev passwords and remove the shared default (#32283)
CORE-784: Generate unique passwords for development environments Replace the shared, publicly documented default password with randomly generated credentials for admin and member users across `scripts/develop.sh`, Docker Compose, and ephemeral deployments. - Generate separate 32-character passwords, stored in permission-restricted files (`0600`) and reused across restarts and database resets. - Automatically replace legacy default passwords on existing instances without overwriting passwords changed manually. - Reject the old default as an override. Limit `--password` and `CODER_DEV_ADMIN_PASSWORD` to the admin user and persist successful overrides. - Improve login banners, password recovery errors, and Compose bootstrap token recovery. - Update ephemeral deployment tooling and documentation to use stored credentials instead of hardcoded passwords. - Add Go tests covering password generation, migration, persistence, overrides, and error handling. **Validation:** Go tests, linting, and shell checks pass. All 20 original manual scenarios passed, although several were run before subsequent changes. Additional unit, stub, and integration tests cover the updated behavior; some final Compose changes have not been retested against a live environment. Refs CORE-784 |
||
|
|
73bbbe5b7d | ci: use shared signing setup action (#32486) | ||
|
|
f9867168ad |
fix(site/src/modules/notifications): make inbox mark as read buttons distinguishable (#32466)
Each unread inbox notification's "Mark as read" button now gets `aria-describedby` pointing at the notification content, the same way the action links do since #32317. Screen reader users can now tell which notification each button marks. The label also changes to sentence case to match "Mark all as read". The sr-only "Unread" text used to sit inside the dot, which is `display: none` on hover and focus-within. Screen readers lost the unread state while a user was in the item. The text is now a sibling of the dot. The button was already keyboard reachable on main (#31656), so this was the part of DEQ-610 still open. Closes DEQ-610 Closes DEQ-633 | Ticket | UI surface | | --- | --- | | [DEQ-610](https://linear.app/codercom/issue/DEQ-610) | Navbar bell > Inbox popover, unread item "Unread" indicator (screen reader only, no visual change) | | [DEQ-633](https://linear.app/codercom/issue/DEQ-633) | Navbar bell > Inbox popover, unread item "Mark as read" button ([screenshots](https://linear.app/codercom/issue/DEQ-633#comment-dcc113c9)) | <details> <summary>Grouping and decision log</summary> - Both tickets cover the same element in `InboxItem.tsx`, so they ship in one PR. - DEQ-610's keyboard reachability (`not-group-hover:not-group-focus-within:sr-only`) is already on main from #31656. Verified in Storybook (`InboxItem` / `UnreadFocused`): on main, `Unread` has no layout box while the item has focus; on this branch it stays in the accessibility tree. - DEQ-633 reuses `aria-describedby={contentId}` from #32317 and keeps "Mark as read" as the name. Every button has the same name, and the description tells them apart. - Self-review (frontend-review, frontend-deep-review, frontend-accessibility): the only should-fix was a test whose keyboard assertions can't fail in jsdom. I cut it down to the accessible-description assertion. No findings were dropped. </details> 🤖 Generated by Coder Agents on behalf of @aqandrew. |
||
|
|
55fd0ab1f5 | fix: keep dynamic parameter edits after a submit attempt (#32355) | ||
|
|
485f678053 | fix: let popovers scroll with the wheel inside dialogs (#32412) | ||
|
|
eb4fde8429 |
fix(site/src): stop announcing parent breadcrumb links as the current page (#32460)
`BreadcrumbLink` wrapped React Router's `NavLink`, which sets `aria-current="page"` on any link whose target is an ancestor of the current URL. Breadcrumb links always point at ancestors, so on template and workspace settings pages screen readers announced the parent crumb as the current page (WCAG 4.1.2). `BreadcrumbLink` now renders a plain `Link`. The same two layouts also nested `BreadcrumbPage` (the non-link label) inside `BreadcrumbLink`; the layout classes now go on the link directly. As a side effect, the link's hover colour now applies to the crumb text, which the nested span used to override. The new test asserts on `aria-current` directly, since that attribute is invisible to visual regression screenshots. Closes DEQ-609 <details> <summary>Review notes</summary> - Commits: (1) `NavLink` to `Link` plus regression test, verified to fail without the fix; (2) remove `BreadcrumbPage` nesting in `TemplateSettingsLayout` and `WorkspaceSettingsLayout`; (3) JSDoc on `BreadcrumbLink`, `LinkProps` type. - No caller uses `NavLink`-only props (`end`, function `className`/`children`) or `.active` / `aria-current` styling. - Self-review ran frontend-review, frontend-deep-review, frontend-accessibility (code audit) and test-audit: no blocking or should-fix findings. At-rest layout is unchanged (the link becomes the flex container the span used to be). - Pre-existing, out of scope: breadcrumb links rely on the browser default focus outline; Avatar fallback initials are not hidden from assistive tech. </details> > Generated by Coder Agents on behalf of @jeremyruppel. |
||
|
|
c004d655b9 |
fix(site): mark emoji picker category labels as headings (#32407)
The emoji picker's category labels ("Smileys & emotion", "Food & drink",
...) look like headings but were plain text. This bumps
`@coder/frimousse` to 0.4.2, which renders category headers as grid rows
(coder/frimousse#5), and wraps each label in an `h2`. The `h2` uses the
label's existing classes, so nothing changes visually.
Closes DEQ-130. Replaces #32189, which made the same change as a pnpm
patch.
The row-numbering test now searches a term that matches two categories.
It checks each heading, every row's `aria-rowindex`, and
`aria-rowcount`.
0.4.2 was published at 2026-11-18 17:08 UTC. Until 2026-11-19 17:08 UTC,
CI installs fail pnpm's minimum release age check
(`ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`). Re-run CI after that. There
is no temporary exclusion, per
https://github.com/coder/coder/pull/32298#discussion_r4593170186.
🤖 Generated by Coder Agents on behalf of @aqandrew.
|
||
|
|
feb6e809c4 |
docs: add provisioner metrics and a metrics signpost page (#31977)
## Summary Admins who start from the External provisioners docs had no way to find out which Prometheus metrics exist for provisioners, or how to turn them on for standalone provisioner daemons. This PR documents both, and turns the deployment metrics page into a signpost to the monitoring docs for each area. ## Changes - **`docs/install/operate/provisioners/index.md`:** expands the "Prometheus metrics" section. The heading and its `#prometheus-metrics` anchor are unchanged. - It explains which metrics each provisioner daemon reports and which the control plane reports. For built-in provisioners, the control plane also reports the daemon metrics. - Two tables list each metric's purpose and link to the generated [Available metrics](https://coder.com/docs/admin/integrations/prometheus#available-metrics) table for types and labels. - It explains how to read the queue wait metric. Jobs whose tags no provisioner matches don't appear in it until a provisioner acquires them. - It shows how to turn on the daemon's Prometheus endpoint with `--prometheus-enable` / `CODER_PROMETHEUS_ENABLE` and `--prometheus-address` / `CODER_PROMETHEUS_ADDRESS`. It corrects the stated default address from `localhost:2112` to `127.0.0.1:2112`. - It covers the `coder-provisioner` Helm chart: the fixed `0.0.0.0:2112` address, the `prometheus-http` container port, and the missing Service. It adds a Pod discovery example with `coder.podAnnotations` and a `PodMonitor` alternative. - **`docs/install/operate/provisioners/manage-provisioner-jobs.md`:** links from the troubleshooting section to the metrics section. - **`docs/admin/monitoring/metrics.md`:** becomes a signpost page. - It keeps the control plane setup links and the `#setting-up-metrics` anchor. - It adds a table of monitoring pages per area (provisioners, workspace proxies, prebuilt workspaces, AI Gateway, Agent Relay), and notes which areas serve metrics on their own endpoint. - It links to the full metrics list. No new pages, so `docs/manifest.json` is unchanged. ## Testing - `make lint/emdash`, `go run ./scripts/docshtmlcheck`, markdownlint, and `markdown-table-formatter` are clean on the changed files. - Vale reports 0 errors and 0 warnings. Its 4 suggestions are on lines this PR doesn't change. - The pre-commit hook (`pre-commit-light`, including `lint/docs-redirects`, `lint/markdown`, and `lint/style-claims`) passed. - A script resolved every relative link and anchor in the changed files. <details> <summary>Verified against</summary> - `provisionerd/provisionerd.go` (`NewMetrics`): names of the five provisioner daemon metrics. - `provisionerd/runner/runner.go`: where the job and build metrics are recorded. - `cli/server.go:1273-1296`: the control plane registers the daemon metrics only for built-in provisioners, and sets `num_daemons` to the built-in count. `cli/server.go:385-389` registers the provisioner server metrics. - `coderd/provisionerdserver/provisionerdserver.go:1011-1019`: `coderd_provisioner_job_queue_wait_seconds` is recorded only when a provisioner daemon acquires a job. `coderd/coderd.go:2602` and `enterprise/coderd/provisionerdaemons.go:365` pass the same metrics to built-in and external provisioners. - `coderd/jobreaper/detector.go:26-28`: a pending job that nothing acquires is failed after 30 minutes, without a queue wait observation. - `coderd/wsbuilder/metrics.go` and `coderd/wsbuilder/wsbuilder.go:357-373`: `coderd_workspace_builds_enqueued_total`. - `enterprise/cli/provisionerdaemonstart.go:204-218, 371-383`: the flags, env vars, and `127.0.0.1:2112` default. A standalone daemon sets `num_daemons` to 1 and registers the Go, process, and `promhttp` collectors. - `cli/agent.go:603-611`: the metrics handler serves every path, so the default `/metrics` scrape path works. - `helm/provisioner/templates/_coder.tpl:40-41, 81-96`: the fixed address, and the `prometheus-http` port that appears only when `CODER_PROMETHEUS_ENABLE` is `"true"`. The chart has no Service template. - `helm/libcoder/templates/_coder.yaml:24-33`, `helm/libcoder/templates/_helpers.tpl:20-22`, and `helm/provisioner/tests/testdata/labels_annotations.golden`: `coder.podAnnotations` and `coder.podLabels` land on the Pod template, which carries the `app.kubernetes.io/name` and `app.kubernetes.io/instance` labels. - `enterprise/cli/proxyserver.go:243-250`: workspace proxies serve metrics on their own listener. - Tests that pin these claims: `coderd/workspaces_test.go` (queue wait), `helm/provisioner/tests/testdata/default_values.golden` (fixed address), and `enterprise/cli/testdata/coder_provisioner_start_--help.golden` (CLI default). </details> <details> <summary>Decision log</summary> - **Kept the `## Prometheus metrics` heading.** Renaming it gained nothing and would break external links to `#prometheus-metrics`. The AI Gateway and Agent Relay pages that the signpost table links to use the same heading. - **Kept `<a id="setting-up-metrics"></a>` on `metrics.md`.** External links to that anchor keep working, and `scripts/docshtmlcheck` passes with it. - **Dropped the Type and Labels columns.** `scripts/metricsdocgen` fills one marked block in `prometheus.md`, so it can't generate these tables. Types and labels drift the most, so the page now points to the generated table for them. Extending the generator, or adding a check that metrics named in `docs/` exist in `scripts/metricsdocgen/generated_metrics`, would need a separate PR. - **Rewrote the queue wait guidance.** The earlier text said a rising value can mean no provisioner matches a job's tags. The code records the value only when a provisioner acquires a job, so unmatched jobs never reach the metric. The page now links to the existing troubleshooting steps for finding them, instead of restating a command. - **Reworded the signpost intro.** The workspace proxies page explains how to turn on metrics but doesn't list them, so the table describes each linked page as covering monitoring, not listing metrics. - **"Separate endpoint" column.** Checked in code for workspace proxies. Agent Relay has no server code in this repo, so its "Yes" comes from `docs/agent-relay/monitoring/index.md`. </details> <details> <summary>Related gaps not edited</summary> - `docs/admin/integrations/prometheus.md:14` and `docs/admin/networking/workspace-proxies.md:221` still say `localhost:2112`. The server and proxy default is `127.0.0.1:2112` (`codersdk/deployment.go:2658`). - `docs/workspaces/speed-up-templates.md:42-44` implies that control plane metrics include `coderd_provisionerd_job_timings_seconds`. That holds only for built-in provisioners. - `docs/admin/networking/workspace-proxies.md#observability` explains how to turn on the endpoint but doesn't list any proxy metrics. - `docs/admin/networking/` (DERP and tailnet, for example `coder_derp_server_*` and `coder_servertailnet_*`) has no metrics section. - `docs/admin/monitoring/health-check.md` links to the database metrics flag but doesn't list the `coderd_db_*` metrics. - `docs/admin/monitoring/notifications/` doesn't list the `coderd_notifications_*` metrics. - `docs/admin/users/` (`coderd_api_active_users_duration_hour`, license metrics) and `docs/admin/security/audit-logs.md` have no metrics sections. - `docs/templates/extending-templates/prebuilt-workspaces.md#available-metrics` lists metrics without types or labels, and doesn't say how to turn them on. </details> Disclosure: these changes were generated by Coder Agents. Closes DOCS-892 Supersedes #31804, reopened under a human author for attribution. --------- Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com> |
||
|
|
01b0a234e8 |
docs: add Verify Coder releases page (#31983)
Adds a how-to page, `docs/admin/security/verify-releases.md` (sidebar:
**Administration > Security > Verify releases**). It shows Coder
deployment administrators how to check release artifacts with the
evidence each release already publishes:
- GPG verification of `coder_<version>_checksums.txt` with its `.asc`
signature, then a SHA-256 check of the artifact (Linux `sha256sum`,
macOS `shasum`, Windows `Get-FileHash`).
- GPG verification of the standalone CLI binaries on
`releases.coder.com/coder-cli/<version>/` using their detached `.asc`
signatures.
- `gh attestation verify` for SLSA build provenance on release files,
Helm charts (including charts pulled from `oci://ghcr.io/coder/chart`)
and `oci://ghcr.io/coder/coder:v<version>`, pinned to `release.yaml` and
the release tag.
- `cosign verify-attestation --type spdxjson` for the image SBOM, with
the keyless certificate identity and steps to extract the SPDX document.
- Short macOS (`codesign`, `spctl`) and Windows
(`Get-AuthenticodeSignature`) code-signature checks.
The attestation steps in `release.yaml` use `continue-on-error`. The
page therefore calls provenance best-effort, does not promise every
artifact is attested, and gives a fallback when `gh attestation verify`
returns `HTTP 404: Not Found`.
Verified against:
- `.github/workflows/release.yaml`: build targets, attestation steps and
subject globs, the SBOM steps (`syft`, `cosign attest`), the `latest`
tag logic, the `releases.coder.com` upload, Helm publishing
- `scripts/release/publish.sh`: checksum file name and GPG signing of
the checksum file
- `scripts/sign_with_gpg.sh`: detached armored signatures
- `scripts/build_go.sh`, `scripts/build_windows_installer.sh`,
`scripts/archive.sh`, `scripts/sign_windows.sh`,
`scripts/sign_darwin.sh`, `scripts/notarize_darwin.sh`: which files are
code-signed and notarized
- `scripts/image_tag.sh`: image name and tag format
- `Makefile`: slim binary and `.asc` handling
- `mise.toml`: the release pipeline uses cosign 2.4.3
- `release.key`: the public key in the repo root
- Every command except the macOS and Windows code-signature checks was
run against release v2.38.6: Linux and macOS commands in a shell,
Windows commands in PowerShell 7 on Linux. GPG checksum and binary
signatures, `gh attestation verify` on files, Helm charts and the OCI
image, and Cosign 3.1.4 SBOM verification all succeeded. Cosign 2.4.3
without the flag also succeeded.
<details>
<summary>Decision log</summary>
- Placed under `admin/security/` because the Security section lists its
child pages automatically, and the page is meant to be linked from the
trust center.
- PowerShell variables are case-insensitive, so `${VERSION}` works in
both shells. Single-line commands are shared, and tabs appear only where
commands really differ.
- Cosign 3 needs `--new-bundle-format=false` to find the SBOM
attestation. Without it, it reports "none of the attestations matched
the predicate type: spdxjson". Cosign 2 rejects the flag, so the page
tells Cosign 2 users to remove it.
- The `gpg --import` example output uses `<key ID>` rather than the real
key ID, to stay consistent with the fingerprint placeholder.
- Dropped Cosign's first output line because it ends in a spaced `--`,
which the punctuation rules ban.
</details>
Open questions for the reviewer:
- **Security: GPG fingerprint.** The page has a `TODO(security)`
placeholder. For reference, `gpg --show-keys release.key` reports
primary key `21C9 6B1C B950 7188 74F6 4DBD 6A5A 671B 5E40 A3B9` (`Coder
Release Signing Key <security@coder.com>`, expires 2029-01-18,
encryption subkey expired). That key signed the v2.38.6 checksums.
Please confirm this is the fingerprint to publish, and whether
`raw.githubusercontent.com/coder/coder/main/release.key` is the right
place to download it.
- **Security: signing identities.** Placeholders remain for the Apple
Developer ID / Team ID and the Windows EV certificate subject. The page
publishes the Sigstore certificate identity
`https://github.com/coder/coder/.github/workflows/release.yaml@refs/tags/v<version>`
with issuer `https://token.actions.githubusercontent.com`. Both come
from the public workflow path and were seen in real verification output.
Please confirm that is acceptable to publish.
- **Not run:** the macOS `codesign -dvv` / `spctl --assess -t install`
steps and Windows `Get-AuthenticodeSignature` come from script comments.
They need a check on real macOS and Windows machines, including expected
output.
- **Cosign format risk:** the SBOM attestation uses the older cosign
format, which Cosign 3 has deprecated. Consider a release-workflow step
that runs the documented verify command so a format change gets caught.
- **Public URL:** is `releases.coder.com/coder-cli/<version>/` meant to
be a documented download location?
- **Trust center link:** the trust center is outside this repo, so
someone needs to add the link to this page there.
- **Likely merge conflict:** open PR #31806 also edits
`docs/manifest/admin/security.yml` and `docs/manifest.json`.
Generated by Coder Agents.
Closes DOCS-1219
Supersedes #31811, reopened under a human author for attribution.
---------
Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com>
|
||
|
|
5f61a045ab | docs: refocus sandbox agents intro on Coder's approach (#32451) | ||
|
|
8705d80fe0 |
feat: add provider, model, and client spend to the AI spend users endpoint (#32330)
## Description
Extends the experimental `GET
/api/experimental/organizations/{organization}/ai/spend/users` endpoint
with the per-user details behind the AI spend overview and the detailed
report. Each user now returns their spend per provider, model, and
client, and whether each has unpriced usage.
## Changes
- Rewrite `ListOrganizationAISpendUsers` with `GROUPING SETS`, returning
one row per user and provider, model, or client:
- Adds the `user_ids` and `group_id` filters.
- Pages, counts, and totals users, not their rows.
- Reads the provider display name, icon, and type from `ai_providers`,
including deleted providers. The live provider wins when a name was
reused, like `GetAIProviderFilterOptions`.
- Update the SDK and handler:
- Each user returns `provider_spend`, `model_spend`, and `client_spend`,
most expensive first, each with `has_unpriced_usage`.
- `totals` returns `has_unpriced_usage`.
- Remove the `providers`, `clients`, and `models` name arrays and
`unpriced_usage_count`.
- Accept `user_ids` (comma-separated, maximum 100) and `group_id`.
- Return more than 100 `user_ids` on the group members AI spend endpoint
as a validation error, like `/ai/spend/users`.
- Switch the Spend page to the new fields, with no UI changes.
- Update the query and handler tests.
<details>
<summary>Dogfood performance</summary>
- Benchmarked on **dogfood**, comparing the existing query on **main**
with the updated query in **this PR**.
- Tested **1, 7, 15 and 30-day windows**, ending at **November 18, 2026,
00:00 UTC**, exclusive.
- Each query ran **five times per window**, one at a time, with query
order and window order rotated across rounds to reduce ordering bias.
The table shows PostgreSQL execution time in **seconds, average
(min-max)**.
| Days | Main | This PR |
|------|-----:|--------:|
| 1 | 0.288 (0.199-0.501) | 0.223 (0.184-0.275) |
| 7 | 11.413 (4.076-40.003) | 4.107 (3.529-4.828) |
| 15 | 9.961 (8.053-16.917) | 7.253 (6.873-7.736) |
| 30 | 14.979 (12.276-23.177) | 8.499 (7.813-9.169) |
All five runs are included. Main's first seven-day run took **40.003s**
with unusually high read I/O time, which raises its average. Cache and
concurrent load can affect these results.
</details>
Closes AIGOV-734
> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
|
||
|
|
f0f00c3069 |
fix(site/src/pages/WorkspacesPage): open workspaces from the name link, not a role-less focusable row (#32196)
Workspace rows on `/workspaces` were `<tr tabIndex={0}>` with Enter and
Space handlers but no role (`WorkspacesRow` dropped the `role` that
`useClickableTableRow` returns). Each row was a keyboard stop that
navigated but did not tell assistive technology what it was, so the
Deque audit reported it as a link without a role (WCAG 4.1.2).
Rows are now plain table rows with a mouse-only click, the same pattern
as #31857 for the templates list. The workspace name, which was already
an `<a>`, now uses the shared `Link` (with `asChild` over the router
link), so keyboard and screen reader users open the workspace through a
real link with the standard focus ring. Table semantics and the
row-header name cell stay as they were.
- `my-0 py-0` on the name link keeps the focus ring off the owner line
below. The link stays 24px tall, which meets `target-size`.
- The name link stops `click` and `auxclick` propagation. Ctrl/Cmd-click
and middle-click no longer also run the row handler, which opened a
second tab or pushed a duplicate history entry.
Closes DEQ-209
| Ticket | Surface |
|---|---|
| [DEQ-209](https://linear.app/codercom/issue/DEQ-209) | Workspaces list
(`/workspaces`) rows. Screenshots:
[before/after](https://linear.app/codercom/issue/DEQ-209/link-link-does-not-have-a-role#comment-be9f7b7a)
|
The resting state does not change: the row height and the name's
position, color, and weight match `main`. The visible change is keyboard
focus, which moves from the whole row to the workspace name. The new
`WorkspaceNameFocused` story captures that state for Pixel.
<details>
<summary>Decision log</summary>
- I kept `useClickableTableRow` for the row's mouse handling, because
its portal guards stop clicks from the delete dialog from activating the
row. I pass only `onClick`, `onAuxClick`, and `className` to the row,
which drops `tabIndex`, `role`, and the key handlers.
- Test: a new case in `WorkspacesPageView.test.tsx`. Tab goes from the
select-all checkbox to the row checkbox and then to the name link, and
Enter opens the workspace. It fails on `main`, where the row takes focus
first.
- axe-core 4.11 in Storybook (`pages/WorkspacesPage` AllStates and
WorkspaceNameFocused) shows the same results on `main` and on this
branch. `link-missing-role` is a manual Deque checkpoint, so I checked
it by hand: no `tr` in the table body is focusable now.
- Dropped finding, frontend-deep-review RP6 (move the name link into a
named component): the diff edits the existing inline link in place and
adds 7 lines. That matches the inline `stopPropagation` on the Agent
badge link next to it and the #31857 precedent. Splitting the 1000-line
file is a separate refactor.
- Dropped nit, SA6 (ring offset color on a checked row):
`ring-offset-surface-primary` leaves a 2px band on a selected row's
`surface-secondary` background. This is the shared `Link` behavior
everywhere, so I left it.
- Pre-existing, not changed: the Agent badge link stops `click` but not
`auxclick`, so a middle-click on it also opens the workspace in a new
tab. The filter combobox has an `aria-valid-attr-value` violation
(`aria-controls` points to a closed popover).
</details>
🤖 Generated by Coder Agents on behalf of @jeremyruppel.
|
||
|
|
fddcc1a4ca |
fix(site/src): group role checkboxes under the Roles label (#32195)
The role checkboxes in `RoleSelector` sat under a visual "Roles" label
with no programmatic association, so screen readers announced each
checkbox without its group (WCAG 1.3.1).
`RoleSelectorLayout` now renders `role="group"` labelled by the "Roles"
text through `aria-labelledby`. When `hideLabel` is set (the "Edit
roles" and default roles dialogs), the label is visually hidden instead
of omitted, so the group keeps its name. The rendered UI does not
change.
Closes DEQ-585
| Ticket | UI surface |
|---|---|
| DEQ-585 | Create user form, Roles checkboxes (shared `RoleSelector`,
also used in the Edit roles and organization default roles dialogs) |
No visible change, so there are no screenshots.
<details>
<summary>Grouping and decision log</summary>
- One eligible ticket in the batch (DEQ-585). The root cause is in the
shared `site/src/modules/roles/RoleSelector.tsx`, so this one fix covers
every caller.
- Used `role="group"` + `aria-labelledby` rather than
`<fieldset>`/`<legend>`: the checkboxes are Radix `role="checkbox"`
buttons, and the layout also wraps the loading and error states, so a
group div avoids fieldset default styling and keeps the markup
unchanged.
- Coverage: a Vitest test finds the Auditor checkbox inside the `Roles`
group, submits the form, and asserts the submitted roles. It fails
without the fix.
- Verification: axe-core 4.11 (WCAG 2.0/2.1/2.2 A/AA + best-practice) on
the RoleSelector stories, `pages/CreateUserPage/WithRoles`, and
`UserActionDialogs/EditRolesLoading`: no violations. The accessibility
tree shows `group "Roles"` containing the 4 checkboxes.
- The ticket asks for "1 of 4" to be announced. Grouping alone does not
add set position for checkboxes, and NVDA gives no position for
checkboxes in a `group`. Adding list semantics would be speculative, so
this PR does not.
- Pre-existing, not changed: the loading and error branches do not pass
`hideLabel`, so the dialogs show a visible "Roles" label while loading.
- Self-review: frontend-review (FE1 to FE10) passes.
frontend-deep-review found one nit (a real email domain in the test),
which is fixed. frontend-accessibility: no blocking or should-fix
findings.
</details>
🤖 Generated by Coder Agents on behalf of @jeremyruppel.
|
||
|
|
11b33b4c26 |
chore: refresh AI model price book (#32436)
## Price book changes 17 models added, 0 models removed, 19 models changed. <details> <summary>Added</summary> - azure/gpt-6.2-astra - azure/gpt-6.2-sol - bedrock/global.openai.gpt-6.2-astra - bedrock/global.openai.gpt-6.2-sol - bedrock/openai.gpt-6.2-astra - bedrock/openai.gpt-6.2-sol - bedrock/us.openai.gpt-6.2-astra - bedrock/us.openai.gpt-6.2-sol - copilot/gemini-4-neon - copilot/gpt-6.2-astra - copilot/gpt-6.2-sol - copilot/mai-code-2 - copilot/mai-code-2-flash - google/gemini-4-neon - openrouter/google/gemini-4-neon - vercel/google/gemini-4-neon - vercel/scaledown/extract-1 </details> <details> <summary>Changed</summary> - openrouter/deepseek/deepseek-r1-0528 - openrouter/deepseek/deepseek-v4-flash-0731 - openrouter/deepseek/deepseek-v4.1-flash - openrouter/deepseek/deepseek-v4.1-flash-1017 - openrouter/google/gemma-3-27b-it - openrouter/google/gemma-4-26b-a4b-it - openrouter/minimax/minimax-m3.1-flash - openrouter/moonshotai/kimi-k2.7-code - openrouter/moonshotai/kimi-k3 - openrouter/moonshotai/kimi-k3.1-pro - openrouter/qwen/qwen3.5-27b - openrouter/qwen/qwen3.5-9b - openrouter/reflection/beam-1.0-501b-a23b - openrouter/xiaomi/mimo-v2.5-pro - openrouter/z-ai/glm-5.1 - openrouter/z-ai/glm-5.3-flash - openrouter/~deepseek/deepseek-flash-latest - openrouter/~deepseek/deepseek-v4-flash-latest - openrouter/~moonshotai/kimi-latest </details> ## Review notes Regenerated by `make gen/aibridge-prices` from the live [models.dev](https://models.dev) catalog. Both artifacts come from one snapshot, so they ship together: - `coderd/aibridge/prices/data/prices.json` - `site/src/modules/aiModels/knownModels/knownModelsGenerated.json` These are customer-visible cost numbers taken from upstream data, so this PR is never merged automatically. The summary above lists what moved; check the diff for exact figures before approving. Opened automatically by the [aigateway-prices-refresh workflow](https://github.com/coder/coder/actions/runs/44492971443). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
690d107fdb |
docs: explain how to keep a workspace running without a connection (#32315)
The answer to "how do I keep a workspace up while a long job or coding agent runs?" only lived in the [reference page](https://coder.com/docs/reference/#workspace-agents), which is hard to find. This adds a **Keep a workspace running without a connection** section to the scheduling page under Activity detection: - Background processes (Claude Code in `tmux`, Herdr, `nohup` jobs) don't count as activity. - `coder schedule extend` from the CLI, and `PUT /extend` from a script with a user token. - **Keep coding agents running:** template examples for Claude Code and Herdr. A `coder_script` uses the owner's build session token once to mint a token scoped to `workspace:read` + `workspace:update` and allow-listed to the workspace. It also installs a `coder-keepalive` helper. Claude Code calls the helper from `managed_settings` hooks, and Herdr calls it from a `post_start_script` loop. Neither needs a module change. Matching README examples: coder/registry#1262. This deliberately avoids app status / AgentAPI reporting. <details> <summary>Validation</summary> On a local v2.38.8 deployment, I used three Docker workspaces with no IDE, SSH, or terminal connection. Autostop was 2m, and Claude Code went through dogfood's AI Gateway running about 30 sequential tool calls over about 11 minutes. The template used the snippets from this page verbatim, with the unmodified modules from registry `main`. | Workspace | Result | | --- | --- | | Control (no keep-alive) | Stopped about 1 minute after its deadline while Claude worked | | Claude Code hooks | Deadline moved to now + 1h at 13:32, and again at 13:43. No changes after Claude finished | | Herdr loop | Deadline moved to now + 1h at 13:32. No changes after the agent went idle | The scoped token from inside the workspace: `PUT /extend` returns 200. Stopping or deleting the workspace returns 403. Other workspaces, `/users/me`, and token creation return 404. A full `GET /workspaces/{id}` is forbidden with the allow list, which is why the helper uses `?include_related=latest_build`. </details> --- 🤖 Generated with Coder Agents using Claude. |
||
|
|
7f245d8296 |
chore!: remove legacy AI Gateway metric aliases (#32381)
Removes the deprecated `coder_aibridged_*` and `coder_aibridgeproxyd_*` Prometheus metric aliases, which were scheduled for removal in v2.37. The embedded AI Gateway and AI Gateway Proxy now emit only `coder_ai_gateway_*` and `coder_ai_gateway_proxy_*`. - Replace `NewMetricAliasRegisterer` with `prometheus.WrapRegistererWithPrefix` in `cli/server.go` and `enterprise/cli/aibridgeproxyd.go`. - Delete `coderd/prometheusmetrics/metricalias.go` and its test (no remaining callers). - Drop alias support from the metrics docs scanner. - Update the AI Gateway monitoring and rebranding migration docs: legacy names are removed as of v2.40. **Breaking:** dashboards and alerts that still use the legacy names stop matching. The monitoring docs show a temporary `metric_relabel_configs` bridge. Closes AIGOV-447. <details> <summary>Implementation plan</summary> | File | Change | |---|---| | `cli/server.go` | Remove the `TODO(deprecation)` comment; register embedded gateway metrics with `prometheus.WrapRegistererWithPrefix(aibridgemetrics.PrometheusMetricPrefix, ...)`. | | `enterprise/cli/aibridgeproxyd.go` | Same swap with the `coder_ai_gateway_proxy_` prefix; drop the unused `prometheusmetrics` import. | | `coderd/prometheusmetrics/metricalias.go`, `metricalias_test.go` | Delete; the two call sites above were the only callers. | | `scripts/metricsdocgen/scanner/prefix.go` | Remove `NewMetricAliasRegisterer` from `prefixFuncs`. | | `scripts/metricsdocgen/scanner/scanner_test.go` | Remove the alias fixture and the legacy-alias assertion; the remaining literal-prefix case already covers plain `WrapRegistererWithPrefix`. | | `scripts/metricsdocgen/README.md` | Drop the `NewMetricAliasRegisterer` mention. | | `docs/ai-governance/ai-gateway/monitoring.md` | State that legacy names are no longer emitted as of v2.40; reword the relabel snippet as a temporary bridge and explain its cost. | | `docs/ai-governance/ai-gateway/rebranding-migration.md` | Mark metrics as "No (removed in v2.40)"; rewrite the Metrics section; remove the now-obsolete "dropping the old names" section. | Release note: the `!` title applies `release/breaking`, so the change is listed under breaking changes in the v2.40 release notes. Verification: `make gen` (no metrics reference changes), `make lint`, `pnpm run format-docs`, `pnpm run lint-docs`, doc-check and test-audit self-review, and targeted tests for `enterprise/cli` (AI Gateway / proxy), `cli` (AI Gateway), `scripts/metricsdocgen`, and `coderd/prometheusmetrics`. </details> Code written by @mollymaefraser, with Coder Agents used as a guide. |