mirror of
https://github.com/coder/coder.git
synced 2026-12-01 19:08:01 +08:00
c8fe5ccfdd9fc62795dcd4e1d12864c273f1c003
18190
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c8fe5ccfdd |
fix(aibridge): write a separate API dump per upstream call (#32600)
Bridged API dumps used one path per interception, so key failover
attempts overwrote each other. Each upstream call now gets its own file:
`<ts>-<interceptionID>-<seq>.{req,resp}.txt`.
Fixes AIGOV-333
## Things to know
- The sequence number guarantees unique names even when two calls land
in the same millisecond.
- SDK retries on BYOK and non-pool paths likely get separate files too
(unverified).
- Agentic loop iterations are out of scope: they only come from
deprecated injected MCP tools. `responses/blocking.go` rebuilds the
middleware per iteration, so numbering restarts there and only the
timestamp separates iterations.
- No docs changes; the docs don't describe the file name pattern.
<details>
<summary>Design notes</summary>
- The bridge middleware owns the sequence counter. All failover attempts
of one call go through the same middleware.
- Both new tests fail without the fix.
</details>
---
_Generated by Coder Agents on behalf of @roothorp._
|
||
|
|
329c60fffc |
chore: bump next from 15.5.28 to 15.5.29 in /offlinedocs (#32496)
Bumps [next](https://github.com/vercel/next.js) from 15.5.28 to 15.5.29. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/vercel/next.js/releases">next's releases</a>.</em></p> <blockquote> <h2>v15.5.29</h2> <p>This release contains security fixes for the following advisories:</p> <h2>Moderate</h2> <ul> <li><a href="https://github.com/vercel/next.js/security/advisories/GHSA-pc58-hwjq-p385">Cross-client response injection and disclosure in self-hosted Next.js applications forwarding fetched responses</a></li> <li><a href="https://github.com/vercel/next.js/security/advisories/GHSA-7qx7-33qx-rqx2">SVG rejection bypass in Next.js image optimization</a></li> <li><a href="https://github.com/vercel/next.js/security/advisories/GHSA-f3mh-rxg3-f5g2">HttpOnly cookie exposure through internal response header on Next.js Edge runtime routes</a></li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/vercel/next.js/commit/17014e9cf7891cc353ebfd8fb4a407f9e4cbbf47"><code>17014e9</code></a> v15.5.29</li> <li><a href="https://github.com/vercel/next.js/commit/9fc04bd869ded4900bed7d069832aa2c5f56fa29"><code>9fc04bd</code></a> [lts-maintenance] Strip internal middleware cookie headers from edge response...</li> <li><a href="https://github.com/vercel/next.js/commit/848ec29a3fbe68c02edb022efe19b04356997c32"><code>848ec29</code></a> [lts-maintenance] Fix stale compressed framing for forwarded fetch responses ...</li> <li><a href="https://github.com/vercel/next.js/commit/4f133352e639589ad9872b9b55307b89b258e41b"><code>4f13335</code></a> [lts-maintenance] [next/image] Fix false-positive AVIF/HEIC detection (<a href="https://redirect.github.com/vercel/next.js/issues/272">#272</a>)</li> <li><a href="https://github.com/vercel/next.js/commit/df196a80326b41cae5841dc996161a2b713134cc"><code>df196a8</code></a> [lts-maintenance] [ci] Pin deploy test deployments to Node.js 22.x (<a href="https://redirect.github.com/vercel/next.js/issues/100887">#100887</a>)</li> <li><a href="https://github.com/vercel/next.js/commit/2829b57fa8e584f43689aebcce9002e50153004e"><code>2829b57</code></a> [lts-maintenance][cd] Move release un-draft to a follow-up job in bot-autonom...</li> <li><a href="https://github.com/vercel/next.js/commit/2810b5b60b942a07327c59b416c445a3f4e3979d"><code>2810b5b</code></a> [lts-maintenance][cd] Gate release bot credentials behind GitHub environments...</li> <li>See full diff in <a href="https://github.com/vercel/next.js/compare/v15.5.28...v15.5.29">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lisa Fiander <lisa@coder.com> |
||
|
|
a38c27377a |
fix(agent/agentssh): report client_closed when a session ends after the client disconnects (#32759)
Fixes CLIENT-1120 |
||
|
|
fa891c8d38 |
chore(site): pin postcss-selector-parser to 6.1.5 (#32810)
`@tailwindcss/typography` pins `postcss-selector-parser` to exactly `6.0.10`, including in its latest release (0.5.20), so the transitive dependency can't be updated through the parent. This adds a pnpm override to move it to `6.1.5`, the same major version. <details> <summary>Verification</summary> - `pnpm why postcss-selector-parser`: only `6.1.5` is resolved. - Lockfile: integrity hash matches the npm registry. Dependencies (`cssesc`, `util-deprecate`) are unchanged, so no new packages enter the tree. - `pnpm build`: passes. Built CSS is byte-identical to a build with `6.0.10`, including the typography plugin's `prose` rules. - `pnpm lint:types` and `pnpm test` (403 files, 6160 tests): pass. </details> --- _Generated by Coder Agents._ |
||
|
|
69a1ce4d6e | fix(site/src/pages/AgentsPage/components/ChatElements/tools): keep wide content inside ToolCall.Scrollable (#32809) | ||
|
|
74cafeb29a |
fix(agent/agentcontext): enforce symlink boundary for single-file sources (#31919)
`discoverIn` checked scan roots with `os.Stat`, so a single-file source (for example `/repo/AGENTS.md`) that is a symlink looked like a regular file and skipped the symlink boundary check in `resolveReadTarget`. Directory roots were already covered because they use `ReadDir` entries. `discoverIn` now uses `os.Lstat`. A symlinked single-file root is validated against the link's parent directory: targets outside it return `StatusInvalid` with an empty payload, matching directory-root behavior, and broken links return `StatusUnreadable`. Symlinks to directories are still scanned as directory roots. Fixes CODAGT-1510. > Generated by Coder Agents on behalf of @deansheather. |
||
|
|
688a0f9b3e |
refactor: use go-jose for all JWT handling (#31931)
Closes ENG-1510. First-party code used two JWT libraries: `go-jose/v4` (workspace apps, jwtutils, tailnet resume, agent hooks, chats) and `golang-jwt/jwt/v4` (licenses, Azure OIDC PKI, test signers, and `jwt.MapClaims` in idpsync). This moves everything to go-jose and removes `golang-jwt/jwt/v4` from `go.mod`. - `enterprise/coderd/license`: verification uses `jwt.ParseSigned` with an EdDSA allowlist and `kid` lookup. Time claims are validated with zero leeway, matching golang-jwt's previous behavior instead of go-jose's 1 minute default. `ParseClaimsIgnoreNbf` still returns `ErrMultipleIssues` for any verification or time-claim failure other than `nbf`. `Claims` now embeds `jwtutils.RegisteredClaims`, so `ExpiresAt` becomes `Expiry` and `NumericDate` uses `.Time()`. - `coderd/oauthpki`: the Azure client assertion is signed with go-jose and keeps the `typ: JWT` and `x5t` headers that the existing test asserts. - Test helpers (`coderdtest`, `oidctest`, `coderdenttest`) sign with go-jose. - `jwt.MapClaims` is replaced with `map[string]any`. No callers used its methods. - A depguard rule (`single_jwt_library`) rejects new `github.com/golang-jwt/jwt` imports. `golang-jwt/jwt/v5` stays as an indirect dependency through `SherClockHolmes/webpush-go`. <details> <summary>Decision log</summary> - **Why go-jose over golang-jwt:** `coderd/jwtutils/jwe.go` needs JWE, which golang-jwt doesn't support, so only go-jose can be the single library. go-jose was already used for the more security-sensitive token paths, and `coreos/go-oidc` depends on it anyway. Its `ParseSigned` requires an explicit algorithm allowlist. Moving the golang-jwt usages, which were mostly `MapClaims`, was the smaller change. - **Expiry edge case:** golang-jwt treated a license as expired at `now >= exp`, and go-jose treats it as expired at `now > exp`. With whole-second timestamps the difference is at most one second. - **Not evaluated:** a comparison of CVE history or maintenance pace between the two libraries. </details> Validation: `make pre-commit`. Tests: `enterprise/coderd/license`, `enterprise/coderd` (license, trial, OIDC, and sync tests), `enterprise/trialer`, `enterprise/coderd/usage`, `enterprise/coderd/enidpsync`, `coderd/oauthpki`, `coderd/idpsync`, `coderd/coderdtest/oidctest`, `coderd` (OIDC, login, Google instance identity, and OAuth2 tests), `coderd/externalauth`, `coderd/provisionerdserver`, `cli`. I confirmed the depguard rule flags a `golang-jwt/jwt/v5` import. > Generated with Coder Agents on behalf of @deansheather. |
||
|
|
6993824dd1 |
feat: allow scoped tokens to manage AI resources (#32653)
Closes CORE-916
A token can only be created with scopes from a hand-kept list of
requestable names, and that list has nothing for most Coder Agents
resources. As a result, a CI job that manages AI providers, MCP servers,
models or the system prompt, or one that just starts a chat, has to hold
an unscoped token.
This PR adds the names for `chat`, `ai_provider`, `mcp_server_config`
and `deployment_config`, the rest of `chat_model_config`, plus
`organization_member:read` and `assign_role:read`, which our Terraform
jobs also need.
I've tested locally that the calls of our dogfood Terraform plan and
apply jobs, and of `triage-via-chat-api.yaml`, all work with tokens that
hold only the scopes each job needs. That caught one bug, where `GET
/api/v2/organizations/{organization}/chats/models` returned a 403 to a
`chat_model_config:*` token, as the handler only accepted the exact
`chat_model_config:read` scope. It now accepts any scope that covers it.
Whilst here, I've corrected the description of
`deployment_config:update`, which the scopes reference gave as "Updating
health information."
|
||
|
|
ac92143dbe |
refactor!: remove the AI Gateway provider list route (#32651)
Relates to AIGOV-824 Stacked on #32650. `GET /api/v2/ai-gateway/providers` was added in #28966, in September, and first shipped in v2.38.0. It was a fix for the provider filter on the AI Gateway sessions page. That filter called `GET /api/v2/ai/providers`, which only owners could read, so the dropdown was empty for auditors. Rather than open up the provider config, #28966 added a second route that returns just the `name`, `type`, `display_name` and `icon` of every provider, deleted ones included, to anyone who can read sessions, i.e. owners and auditors. Now that `GET /api/v2/ai/providers` answers every signed-in user with those same fields (#32650), the second route has no caller that it alone can serve. Jake, who added it, and I agree that we should remove it rather than keep two routes that list providers, so this PR does that. The one thing only the old route did was return deleted providers, so that sessions and spend recorded under a provider that has since been deleted keep their label. So, `GET /api/v2/ai/providers` gains an `include_deleted` query parameter. A deleted provider can share its name with a live one, so each name appears once, as its live provider if there is one, otherwise the most recently updated deleted one. Unlike the old route, any caller can pass it, so members can now see the names of deleted providers. A deleted provider comes back without its configuration, for owners too. The sessions provider filter and the Spend page now call `GET /api/v2/ai/providers?include_deleted=true`, and show the same thing as before. `codersdk.AIBridgeProvider`, `Client.AIBridgeListProviders` and the `GetAIProviderFilterOptions` query go with the route. ## For changelog - `GET /api/v2/ai-gateway/providers` has been removed (#32651) > `GET /api/v2/ai-gateway/providers` has been removed, along with `codersdk.AIBridgeProvider` and `Client.AIBridgeListProviders` in the Go SDK. It listed providers only for users who can read AI Gateway sessions, i.e. owners and auditors. `GET /api/v2/ai/providers` replaces it, and now answers every signed-in user. Owners still get each provider's full configuration from it, and everyone else gets the same list with an empty `base_url`, an empty `api_keys` array, `null` `settings` and no `status`. > > Migration: Call `GET /api/v2/ai/providers?include_deleted=true` instead. Each provider keeps its `name`, `type`, `display_name` and `icon` fields, and `display_name` now holds the provider name when no display name is set. In the Go SDK, `Client.AIProviders` now takes a `codersdk.AIProvidersFilter`. Set its `IncludeDeleted` field to list deleted providers too. An API token with an allow list needs `ai_provider` in that list to call `GET /api/v2/ai/providers`, where the removed route needed `aibridge_interception`. |
||
|
|
fd74a160ec |
feat: let all users list AI providers (#32650)
Closes AIGOV-824
`GET /api/v2/ai/providers` now answers every signed-in user. Before, it
returned a 403 to anyone who isn't an owner.
Owners get exactly what they did before. Everyone else gets the same
list without each provider's configuration, i.e. `base_url`, `api_keys`,
`settings` and `status` come back empty:
```json
[
{
"id": "90f4a82a-c945-4598-93be-be9dde57c38d",
"type": "openai",
"name": "corp-openai",
"display_name": "Corp OpenAI",
"icon": "/icon/openai.svg",
"enabled": true,
"base_url": "",
"api_keys": [],
"settings": null,
"created_at": "2026-11-24T11:56:44.789072Z",
"updated_at": "2026-11-24T11:56:44.789072Z"
}
]
```
Clients need the list to find out what a provider is called. They reach
a provider through AI Gateway at `/api/v2/ai-gateway/<provider-name>/`,
and the name is whatever an admin chose. Mux, for example, lists
providers with `GET /api/v2/ai/providers`, so a member's Mux only finds
providers that happen to have a default name.
To do this, I've split the permission in two. `ai_provider:read` now
only covers the fields that are filled in above, and every member holds
it, the same way they can read OAuth2 apps and workspace proxies. A
provider's base URL, keys and settings sit behind a new
`ai_provider:read_secret` permission, which only owners hold. `GET
/api/v2/ai/providers/{idOrName}` and the dashboard's AI settings pages
now check `ai_provider:read_secret`, so they're still owner only.
This doesn't show members much that's new. They can already read the
name, type, display name, icon and enabled state of every enabled
provider from `GET /api/v2/users/{user}/ai-provider-keys`, so the
additions are disabled providers and the two timestamps.
The next PR in the stack removes `GET /api/v2/ai-gateway/providers`,
which `GET /api/v2/ai/providers` replaces.
|
||
|
|
056043b306 |
fix(site): make create-user error story independent of autofocus (#32778)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.
The `FormError` story depended on Username autofocus to reveal its API
validation error. Removing autofocus left the field untouched and caused
its existing error assertion to fail.
Click Username and tab away explicitly before the existing assertions.
This marks the field touched without submitting the empty form or
opening a native validation tooltip. Production form behavior and both
assertions are unchanged.
Closes DASH-151
<details>
<summary>Verification notes</summary>
Reproduced the missing `Username taken` failure on main. The revised
story passed 20/20 fresh-browser runs across dark/light themes at
desktop and 320px, with both assertions retained and no native
validation tooltip. Passed 24 Create/Edit User stories, 33 form/helper
unit tests, `pnpm check`, `pnpm lint`, and `pnpm format`. Accessibility
checks found no violations in dark desktop and light 320px. Screenshots
are attached in the agent chat rather than uploaded to the PR.
</details>
|
||
|
|
b6e7e96fec |
chore: bump github.com/coder/wgtunnel to v0.2.1 (#32808)
Bumps `github.com/coder/wgtunnel` from v0.2.0 to v0.2.1.
Other modules in `go.mod`/`go.sum` also move up because wgtunnel v0.2.1
requires newer versions of them under minimal version selection, for
example `golang.org/x/{crypto,net,sys,mod}`, `go-chi/httprate`,
`riandyrn/otelchi`, and `urfave/cli/v2`. `go mod tidy` also drops
`go.opentelemetry.io/contrib` and adds `golang.org/x/crypto/openpgp`,
because `x/crypto` v0.59.0 moved `openpgp` into its own module.
<details>
<summary>Verification</summary>
- `go build ./...`
- `go test ./coderd/devtunnel/...`
- `go vet ./coderd/devtunnel/... ./codersdk/... ./cli/...`
- Built `./enterprise/cmd/coder` with `-tags embed` and the frontend,
then ran `coder server` with no access URL. The server got a
`https://<id>.pit-1.try.coder.app` tunnel URL. `/api/v2/buildinfo`
returned 200 over the tunnel, and in a browser the root URL redirected
to `/setup` and the setup page rendered correctly.
</details>
> Generated by Coder Agents on behalf of @deansheather.
|
||
|
|
34c8bda1a8 |
ci: use backport app token in cherry-pick workflow (#32803)
The cherry-pick workflow can no longer open PRs. Since coder/github-org-terraform#76 (Nov 17), the org disables "Allow GitHub Actions to create and approve pull requests", so `gh pr create` with `GITHUB_TOKEN` fails: ``` GraphQL: GitHub Actions is not permitted to create or approve pull requests (createPullRequest) ``` Example: [run 45991857596](https://github.com/coder/coder/actions/runs/45991857596/job/140481380335) for #32793. That run had already pushed `backport/32793-to-<version>`, and because the workflow exits as soon as the branch exists, re-running it can't open the PR. `backport.yaml` already opens its PRs with the backporter App token (#32352). This brings `cherry-pick.yaml` in line with it. **App token** - Runs the job in `environment: main` with only `contents: read` and `id-token: write` for the job token. - Mints the token with the same pinned `coder/github-app-token-action` step and `BACKPORT_APP_*` inputs (contents, pull_requests, workflows and issues write on coder/coder). - Uses the App token for both `git push` and `gh`, and commits as the App bot, as backport does. **Recovery on re-runs, as in `backport.yaml`** - Checks for an existing PR first (`--state all`) and exits only if there is one. - If the branch already exists, reuses it and goes on to open the PR. If its tip is the conflict placeholder commit, the PR keeps the ` (conflicts)` title suffix. - Otherwise cherry-picks and pushes as before. **Best-effort extras, as in `backport.yaml`** - `gh pr create` only sets base, head, title and body. Label, assignee and reviewer are added afterwards with separate `gh pr edit` calls that warn instead of failing. - `gh label create` warns instead of failing. Branch naming, the conflict placeholder, the PR body and the comment on the original PR are unchanged. **Side effects** - Cherry-pick PRs are now opened by the App, not `github-actions[bot]`, so they trigger CI like any other PR. - They also trigger `pr-cherry-pick-check.yaml`, which comments when a title doesn't start with `fix:`. Conflicts are therefore marked with a ` (conflicts)` suffix, as in `backport.yaml`, instead of a `[CONFLICT]` prefix. - With `workflows: write`, cherry-picks that touch `.github/workflows/` can now be pushed too. - Approvals: the requester is still asked to review the cherry-pick, so they can approve and merge their own cherry-pick. That isn't new, and backport works the same way. The proposal to require a `release-managers` approval on bot-opened release PRs isn't in `coder.yaml` yet ([discussion](https://codercom.slack.com/archives/C0CHP8J479T/p1795510371505229)). > [!IMPORTANT] > The backporter App's Cloud KMS key only signs for `/.github/workflows/backport.yaml@refs/heads/main` (`coder-backporter-app` in coder/gcp `projects/production/coder-github-apps/apps.tf`). coder/gcp#497 adds `/.github/workflows/cherry-pick.yaml@refs/heads/main`; merge and apply it first, or the token step fails to sign. Validated with `actionlint` (with shellcheck) and `zizmor --offline` (no findings). I also ran the script locally with a stubbed `gh` against a local remote: existing PR → skip; fresh run → PR opened, failing label/reviewer calls only warn; stranded placeholder branch → reused and opened with the ` (conflicts)` suffix. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
51ef489112 |
chore: add script to bump bundled terraform (#31463)
Part 1 of 2 for automating Terraform bumps. This PR adds the bump script. #31461 is stacked on top and adds the weekly workflow that runs it. Today these bumps are done by hand (#30516, #31301, #31438 and their backports). ## `scripts/update_terraform_version.sh [--skip-fixtures] <version>` Run from the repo root. It updates every file that pins the bundled Terraform version. Files a branch doesn't have are skipped, so the same script works on `main` and on older release branches: - `provisioner/terraform/install.go`: `TerraformVersion`. `maxTerraformVersion` changes only on a minor/major bump (it moves to `X.Y.9`). - `provisioner/terraform/terraform_SHA256SUMS` (from #31600), when the branch has it: replaced with the verified SHA256SUMS. `scripts/Dockerfile.base` and `install.sh` read the version and checksums from that file, so neither is edited. - Otherwise (older branches): `install.sh` and `scripts/Dockerfile.base` are edited directly, as before. - `dogfood/coder/Dockerfile`, airgap docs (`docs/install/airgap.md` or `docs/install/prepare/airgap.md`), `.github/actions/setup-tf/action.yaml`, `testdata/{,resources/}version.txt` - `mise.toml`, `mise.lock` (per-platform checksums), `flake.nix` (per-platform SRI hashes, old and new layouts) - `provisioner/terraform/testdata/generation.sha1`: re-fingerprinted with `generate.sh --if-needed` using the new binary Every checksum comes from `terraform_<v>_SHA256SUMS`, and the script fails unless that file carries a valid signature from HashiCorp's release key (`C874 011F 0AB4 0511 0D02 1055 3436 5D94 72D7 468F`). It refuses downgrades and fails if a touched file still points at another release, or if a branch that pins `TERRAFORM_VERSION` in `install.sh` didn't end up on the new version. It doesn't source `lib.sh`, so CI can run `main`'s copy against a release branch checkout. ## Testing Run in a dogfood workspace: - **`main`, 1.16.7 to 1.17.1:** byte-identical to #31438, including `maxTerraformVersion` and `generation.sha1`. - **`release/2.38`, 1.16.7 to 1.17.1:** byte-identical to #31441. - **`release/2.29`** (1.16.6 to 1.16.7) **and `release/2.34`, `release/2.36`** (to 1.17.1): same file sets as the earlier manual backports (#30555, #30554, #30553). - Rerunning on an already-bumped tree makes no changes. Downgrades, unknown versions and bad flags fail with a clear error. - **Checksum-file layout** (#31600 head, 1.16.7 to 1.17.1, `--skip-fixtures`): `terraform_SHA256SUMS` is byte-identical to HashiCorp's signed file, `install.sh` and `Dockerfile.base` are untouched, the new `TestTerraformChecksumFileMatchesVersion` passes, and `mise.toml`, `mise.lock`, `flake.nix`, the airgap doc and the `install.go` versions are byte-identical to #31438. Rerunning changes nothing. - **Old layout** (`main`, 1.16.7 to 1.17.1, `--skip-fixtures`): output is byte-identical to the previous revision of this script. - `shellcheck` (v0.10.0) and `shfmt -d` (v3.12.0) are clean on the updated script. - `make lint/shellcheck fmt/shfmt lint/emdash lint/typos` pass. ## How #31600, #31463 and #31461 fit together - **#31600** makes `provisioner/terraform/terraform_SHA256SUMS` (a verbatim copy of HashiCorp's signed file) the one place the bundled Terraform checksums live. `Dockerfile.base` reads it, and `install.sh` downloads it from the Coder repo at install time. - **#31463** adds `scripts/update_terraform_version.sh`. On branches with the checksum file it just replaces that file. On older branches it edits `install.sh` and `Dockerfile.base` directly. - **#31461** (stacked on #31463) runs the script weekly for `main` and the supported release branches. It needed no changes for the checksum file. None of the three touch the same files, and merging all three onto `main` is conflict-free. On that combined tree, the bump script took 1.16.7 to 1.17.1 by replacing the checksum file, the new Go test passes, and `actionlint` and `shellcheck` pass. They can merge in any order. Merge #31461 after #31463, retargeted to `main`. Opened by Superblink on behalf of @droopy4096. --------- Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> Co-authored-by: Dmitry Makovey <dmakovey@yahoo.com> Co-authored-by: Jakub Domeracki <jakub@coder.com> |
||
|
|
bc4a573535 |
ci: isolate depot caches from pull request writes (#32756)
## Description Secure depot caches shared across branches by preventing pull requests from restoring cached artifacts that could contain malicious code. This ensures that trusted runs (pushes to main, scheduled jobs) only look up cache keys without restoring pull request-written content, while pull requests can still benefit from caches written by trusted runs. ## Changes - **ci.yaml**: Add `lookup-only` flag to golangci-lint and coder-e2e cache restore steps for non-pull-request runs. Invert pnpm cache condition to only restore on pull requests. - **setup-mise/action.yml**: Add `lookup-only: true` to cache step on main branch; change restore condition from `github.ref != 'refs/heads/main'` to `github.event_name == 'pull_request'`. - **pnpm-install/action.yml**: Add `lookup-only: true` to cache step on main branch; change restore condition from `github.ref != 'refs/heads/main'` to `github.event_name == 'pull_request'`. - **eval-coder-agents.yaml**: Disable caching in setup-mise and setup-uv for the eval job, which holds secrets and must not restore pull request artifacts. - **embedded-pg-cache/download/action.yml**: Restrict cache restore to pull request runs only. - **test-cache/download/action.yml**: Restrict cache restore to pull request runs only. All changes include explanatory comments documenting the security rationale. ## Test Plan CI workflows will validate the changes. The logic ensures: - Pull requests can restore caches from trusted runs - Trusted runs only look up keys without restoring pull request content - Secret-holding jobs disable caching entirely Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
861f57a5eb |
fix: handle the AI Gateway retention on the Spend page and match its title (#32790)
## Description Fixes on the AI Spend page and the AI Gateway Sessions pages. The Spend page title matches the sidebar, and the page handles the AI Gateway data retention correctly. The Sessions pages no longer request data when AI Gateway is disabled. ## Changes - Rename the page header and title from "AI spend" to "Spend", to match the sidebar. - Disable the date picker on both tabs and Run report until the data retention loads, so only retained days can be picked and reported. - Show a notice instead of the tabs when the data retention is shorter than a day. Both tabs pick whole UTC days. The overview reads daily aggregates, and the detailed report reads raw data that is purged by request time. With a retention shorter than a day, raw data doesn't cover a full day, so the tabs could disagree. - Only request sessions and session threads when AI Gateway is enabled. Note: The page files and components are renamed to match the Spend title in #32797. > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
26d2802630 |
docs: document the AI Gateway Spend page (#32798)
## Description Documents the Spend page under **Admin settings** > **AI**, which replaced the experimental AI spend page. The page is described once, in AI Governance cost controls, and the Coder Agents docs link to it. Related to AIGOV-685 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
f4067e2684 |
fix: check AI spend access against the dashboard organizations (#32794)
## Description The AI spend access check fetched every organization and then checked access to each one, two requests in a row. It now checks the organizations the dashboard already has, so it makes one request. This also shortens the AI settings sidebar loading state from #32793. ## Changes - `permittedOrganizations` takes optional organizations to check instead of fetching them. - `aiSpendOrganizations` takes the dashboard organizations. The sidebar, navbar, AI settings redirect and Spend page pass them. - Test the new `permittedOrganizations` argument, and use the dashboard organizations in the page tests instead of mocking the organizations request. Related to #32793 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
2f99e51247 |
fix: show the AI settings sidebar links together once they load (#32793)
## Description The AI settings sidebar showed some links only after their access checks finished, so Coder Agents, Instructions and Spend popped in late and pushed the links below them down. The sidebar now shows a loading skeleton until every check finishes, then all its links at once. ## Changes - `AISettingsSidebar` waits for every query a link depends on before showing the links. A new link that needs a request joins the same list. - `AISettingsSidebarView` shows a skeleton of nav rows while it loads, with a `Loading` story. - Seed the chat models query in a story that renders the container. Closes AIGOV-720 > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira. |
||
|
|
cf7267e970 |
feat: add response processing to AI Gateway proxy mode for Anthropic (#32628)
Add recording for blocking Anthropic Messages responses in AI Gateway proxy mode. Response facts and interception completion are recorded asynchronously under a shared timeout. Shutdown waits for recording to finish. Upstream error responses are classified and recorded in the interception end record. Restored early cancellation replies for stalled HTTP/1 requests that were removed by mistake. > Generated with Coder Agents. |
||
|
|
273adb2a2b |
chore: refresh AI model price book (#32783)
## Price book changes 28 models added, 62 models removed, 71 models changed. <details> <summary>Added</summary> - azure/fw-deepseek-v4.1-flash - azure/fw-glm-5.3 - azure/fw-glm-5.3-flash - azure/fw-kimi-k3 - azure/fw-kimi-k3.1-pro - azure/fw-nemotron-3-ultra-nvfp4 - azure/fw-nemotron-lightning-3.5-30b-a3b - azure/gpt-oss-120b - azure/grok-4.7 - azure/kimi-k3.1-pro - bedrock/ca.anthropic.claude-haiku-5-5 - bedrock/ca.anthropic.claude-sonnet-5-5 - bedrock/in.moonshotai.kimi-k3 - bedrock/in.moonshotai.kimi-k3.1 - bedrock/writer.palmyra-vision-7b - openai/gpt-6-astra-healthcare - openai/gpt-6.1-sol-healthcare - openai/gpt-6.2-astra-healthcare - openai/gpt-6.2-sol-healthcare - openrouter/mistralai/pixtral-large-2502 - openrouter/radixark/daisyrose-27b - openrouter/thinkingmachines/inkling-2-mini - openrouter/tngtech/deepseek-r1t2-chimera - openrouter/upstage/solar-mini-4-5 - openrouter/upstage/solar-pro-4-contributor - openrouter/xiaomi/mimo-v2.6-flash-mopd - vercel/google/gemini-4-neon-fast - vercel/thinkingmachines/inkling-2-mini </details> <details> <summary>Removed</summary> - azure/claude-mythos-5 - azure/codex-mini - azure/o1 - azure/o3 - azure/o3-mini - azure/o4-mini - azure/phi-4-reasoning-plus - bedrock/apac.anthropic.claude-sonnet-4-20250514-v1:0 - bedrock/eu.anthropic.claude-fable-5 - bedrock/eu.anthropic.claude-sonnet-4-20250514-v1:0 - bedrock/global.anthropic.claude-sonnet-4-20250514-v1:0 - bedrock/jp.anthropic.claude-opus-5 - bedrock/jp.anthropic.claude-sonnet-5 - bedrock/us.amazon.nova-premier-v1:0 - bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0 - copilot/claude-opus-4.7 - copilot/claude-opus-5 - copilot/gemini-3.5-flash - copilot/gemini-3.6-flash - copilot/gemini-3.7-flash - copilot/gpt-5-mini - copilot/gpt-5.4 - copilot/gpt-5.4-mini - copilot/gpt-5.5 - copilot/gpt-5.6-terra - copilot/kimi-k2.7-code - google/gemini-2.5-computer-use-preview-10-2025 - google/gemini-3.1-flash-lite-preview - google/gemini-omni-flash-preview - google/lyria-3-clip-preview - google/lyria-3-pro-preview - openai/gpt-3.5-turbo - openai/gpt-4 - openai/gpt-4-turbo - openai/gpt-4.1-nano - openai/gpt-4o-2024-05-13 - openai/gpt-5.3-codex-spark - openai/gpt-realtime-2.1 - openai/o1 - openai/o1-pro - openai/o3-mini - openai/o4-mini - openrouter/cohere/north-mini-code:free - openrouter/dots-studio/dots-3-note-preview:free - openrouter/meituan/longcat-2.0 - openrouter/meta-llama/llama-3.2-1b-instruct - openrouter/mistralai/mistral-medium-3 - openrouter/mistralai/mistral-medium-3.1 - openrouter/moonshotai/kimi-k2 - openrouter/moonshotai/kimi-k2-0905 - openrouter/moonshotai/kimi-k2-thinking - openrouter/tencent/hy3-preview - openrouter/thinkingmachines/inkling-2-small:free - openrouter/unbiased/pareto-26.10 - openrouter/unbiased/pareto-26.10-preview - openrouter/unbiased/pareto-26.9 - openrouter/x-ai/grok-build-0.1 - openrouter/xiaomi/mimo-v2.5 - openrouter/xiaomi/mimo-v2.5-pro - openrouter/~unbiased/pareto-latest - vercel/alibaba/qwen3-max-thinking - vercel/spacexai/grok-build-0.1 </details> <details> <summary>Changed</summary> - azure/deepseek-v4-flash - azure/deepseek-v4-pro - azure/grok-4-20-non-reasoning - azure/grok-4-20-reasoning - azure/kimi-k2.5 - azure/kimi-k2.6 - bedrock/amazon.nova-2-lite-v1:0 - bedrock/amazon.nova-lite-v1:0 - bedrock/amazon.nova-micro-v1:0 - bedrock/amazon.nova-pro-v1:0 - bedrock/anthropic.claude-fable-5 - bedrock/anthropic.claude-fable-5-1 - bedrock/anthropic.claude-fable-5-2 - bedrock/anthropic.claude-haiku-4-5-20251001-v1:0 - bedrock/anthropic.claude-haiku-5-5 - bedrock/anthropic.claude-opus-4-5-20251101-v1:0 - bedrock/anthropic.claude-opus-4-7 - bedrock/anthropic.claude-opus-4-8 - bedrock/anthropic.claude-opus-5 - bedrock/anthropic.claude-opus-5-5 - bedrock/anthropic.claude-sonnet-4-5-20250929-v1:0 - bedrock/anthropic.claude-sonnet-5 - bedrock/anthropic.claude-sonnet-5-5 - bedrock/global.amazon.nova-2-lite-v1:0 - bedrock/us.amazon.nova-2-lite-v1:0 - bedrock/us.amazon.nova-lite-v1:0 - bedrock/us.amazon.nova-micro-v1:0 - bedrock/us.amazon.nova-pro-v1:0 - google/gemini-2.5-flash-image - openrouter/deepseek/deepseek-chat-v3-0324 - openrouter/deepseek/deepseek-v4-flash-0731 - openrouter/deepseek/deepseek-v4-flash-vision-exp - openrouter/deepseek/deepseek-v4-pro - openrouter/deepseek/deepseek-v4.1-flash - openrouter/deepseek/deepseek-v4.1-flash-1017 - openrouter/google/gemma-3-4b-it - openrouter/gryphe/mythomax-l2-13b - openrouter/inclusionai/ling-3.1-flash - openrouter/meta-llama/llama-3.1-8b-instruct - openrouter/meta-llama/llama-3.2-3b-instruct - openrouter/minimax/minimax-m2.5 - openrouter/minimax/minimax-m2.7 - openrouter/minimax/minimax-m3 - openrouter/minimax/minimax-m3.1-flash - openrouter/moonshotai/kimi-k2.7-code - openrouter/moonshotai/kimi-k3.1-pro - openrouter/nvidia/nemotron-3.5-super-vl - openrouter/openai/gpt-oss-120b - openrouter/openai/gpt-oss-20b - openrouter/particle-ai/particle-1 - openrouter/qwen/qwen3-coder-30b-a3b-instruct - openrouter/qwen/qwen3.5-27b - openrouter/qwen/qwen3.5-397b-a17b - openrouter/qwen/qwen3.5-9b - openrouter/qwen/qwen3.6-35b-a3b - openrouter/qwen/qwen3.8-27b - openrouter/reflection/beam-1.0-501b-a23b - openrouter/z-ai/glm-4.5-air - openrouter/z-ai/glm-4.7 - openrouter/z-ai/glm-5.1 - openrouter/z-ai/glm-5.2 - openrouter/~deepseek/deepseek-flash-latest - openrouter/~deepseek/deepseek-pro-latest - openrouter/~deepseek/deepseek-v4-flash-latest - openrouter/~z-ai/glm-flash-latest - vercel/alibaba/qwen3.8-27b - vercel/amazon/nova-lite - vercel/amazon/nova-micro - vercel/amazon/nova-pro - vercel/deepseek/deepseek-v4-pro-0813 - vercel/minimax/minimax-m2.7 </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/45808292131). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
13e1f466f7 |
fix(site/src/pages/AgentsPage/components): keep hidden attachment controls tabbable and click-through (#31366)
On `main`, the attachment controls that show on hover or focus mishandle
keyboard and pointer input:
* The transcript's Download link hides with `visibility`, so Shift+Tab
skips it. Tab from View reaches it only because focus on View shows it
first.
* The composer's hidden Remove button overhangs the top of its chip.
Pointing at the overhang lands on the invisible button, which shows the
buttons, and a click there hits Remove.
* WebKit gives each hidden Download link a compositing layer for its
backdrop blur.
The composer's attachment card and the transcript's attachment frame now
set custom properties from their own hover and `focus-within`, and their
controls read them for opacity, pointer events and, on the Download
link, the blur. Hidden controls stay in the tab order in both directions
and take no pointer input. The blur applies only while the link shows
and fades with it, so hidden links add no compositing layers: with four
hidden links in view, WebKit composites 5 layers on `main` and 1 here.
Devices without hover now show the composer's buttons at rest, as the
transcript already did for the Download link.
The new stories capture each focus state, including Shift+Tab onto the
hidden Download link, Remove and Paste inline.
> 🤖 This PR was created with the help of Coder Agents.
|
||
|
|
c69a58e596 |
fix(site/src/pages/AgentsPage/components/ChatElements/tools): label a running command "Running" (#32545)
While a shell command ran, its tool row already read "Ran `<command>`".
It now reads "Running `<command>`…" until the command finishes, then
"Ran" or "Failed to run" as before. A backgrounded command also reads
"Running" until its result arrives, since only the result says it went
to the background; it then reads "Started … in the background" as
before.
Refs CODAGT-1586
> 🤖 This PR was created with the help of Coder Agents.
|
||
|
|
970ec0ccd3 |
fix: drop gated Azure claude-mythos-5 from the known models catalog (#32781)
The scheduled `aigateway-prices-refresh` workflow [failed](https://github.com/coder/coder/actions/runs/45788506647/job/139801293933) with `azure/claude-mythos-5: model missing from upstream`. models.dev removed the model from its Azure provider because it is a gated research preview in the Foundry partner catalog ([anomalyco/models.dev#14607](https://github.com/anomalyco/models.dev/pull/14607)), but `curation.json` still listed it. This removes the Azure entry from `curation.json` and from the generated known-models catalog, which `TestCurationMatchesGeneratedCatalog` requires to stay in sync. The Anthropic `claude-mythos-5` entry is unchanged. The price update itself will be handled by the `aigateway-prices-refresh` workflow, which will be rerun manually after this PR is merged. > [!NOTE] > Generated with Coder Agents on behalf of @ssncferreira. |
||
|
|
d783c6c48d |
fix(site/src): reconcile the scroll position before paint when the timeline regroups (#32546)
With collapsed assistant steps, when a turn that has a reply between its
steps ends, the grouping folds the turn's blocks and the reply into one
block in a single commit. The timeline shrinks, the browser clamps the
scroll position, and the anchored prompt drops until the scroller's
resize pass runs, which its ResizeObservers defer to a later animation
frame. In a Chromium Storybook probe on current main (600px transcript,
about 2,000 characters of reply between two steps), the prompt sat 118px
low in the commit and in the first animation frame, and was back in
place by the second. With a one-line reply the drop was 10px.
`ConversationTimeline` now runs the scroller's resize pass, the
context's `handleResize`, from a layout effect, before paint, when a
commit removes or replaces a timeline item key. The vendored scroller
exports `useMessageScrollerContext` for it, a LOCAL CHANGE.
The sync is limited to removals because an append cannot shrink the
timeline, and in following mode the resize pass scrolls to the end: on
an append it would scroll to the end before the scroller anchors a newly
sent prompt. `SendingFromHistoryDoesNotSnapToBottom` passed 10 of 10
runs.
Refs CODAGT-1586
> 🤖 This PR was created with the help of Coder Agents.
|
||
|
|
3fea25447a | test(coderd): deflake queued reasoning effort test (#32782) | ||
|
|
a81eecdb71 |
fix(site/src): name MultiSelectCombobox remove and clear-all buttons (#32763)
The per-badge remove button and the clear-all button in
`MultiSelectCombobox` rendered only an `XIcon`, so they had no
accessible name and axe reported `button-name` (WCAG 4.1.2). They are
now named "Remove <option label>" and "Clear all", matching `TagInput`
and `FilterCombobox`. The `data-testid` attributes are removed, and
every caller now queries the buttons by role and name.
Enter already activates each button once, not twice as the ticket
suspected: cmdk's root `onKeyDown` prevents the default of Enter, so the
native click never fires and the button's own Enter handler is the only
path. A short comment now explains why those handlers must stay, and a
new test guards it.
Closes DEQ-664
| Ticket | UI surface |
|---|---|
| DEQ-664 | `MultiSelectCombobox` badge remove and clear-all buttons:
IdP organization, group, and role sync; OAuth2 app form scopes;
multi-select dynamic parameters. Accessible names only, no visual
change. |
**Dropped review findings**
- Focus is lost after a keyboard removal (frontend-accessibility manual
focus check, SA6). When Enter removes a badge or clears all, the focused
button unmounts and focus falls to `<body>`. This happens on `main` too
and is not caused by this diff. Fixing it would mean new focus
management (for example, moving focus to the input), which is a behavior
change outside this ticket. It should be its own ticket.
<details>
<summary>Decision log</summary>
- **Names:** I followed the existing `Remove ${value}` pattern
(`TagInput`, `FilterCombobox` chips) and the "Clear all" copy
(`FilterCombobox`). `aria-label` is correct here because the buttons
have no visible text.
- **Enter behavior:** In jsdom and in real Chromium (Vitest browser
mode), Enter on either button calls `onChange` exactly once on `main`.
Removing the button's Enter handler makes Enter do nothing (0 calls),
because cmdk calls `preventDefault()` on Enter. So the handlers stay.
Space and Backspace/Delete in the input are unchanged.
- **Tests:** They extend the existing "Multi-Select Parameter" block in
`DynamicParameter.test.tsx`, which renders `MultiSelectCombobox` (same
place as #32678). "handles option deselection" now clicks "Remove Option
1" and expects `onChange` exactly once. A new `it.each` presses Enter on
"Remove Option 1" and "Clear all" and expects one call with
`["option2"]` and `[]`. All three fail on `main` (no named buttons). The
Enter cases also fail with 0 calls when the Enter handlers are removed.
- **Callers:** `OAuth2AppForm.test.tsx` and the `OAuth2AppForm` and
`MultiSelectCombobox` stories now use the role queries. The clicked
badge is the same one as before, so screenshots are unchanged. Nothing
under `site/e2e` used the test IDs.
- **Story cleanup:** `ClearAllComboboxItems` no longer ends with a
`waitFor(... toBeInTheDocument())` assertion, because play functions
must not assert (FE1) and this diff edits that play.
- **Commit scope:** The scope is `site/src` because the changed tests
live under `modules/` and `pages/`.
- **Self-review:** frontend-review (FE1 to FE10 pass);
frontend-deep-review (two findings fixed, the story assertion and the
Enter rationale comment, then a clean second pass);
frontend-accessibility: a full axe run in Chromium on the component with
badges selected, closed and open, gives `button-name` 3 violations on
`main` and 0 on this branch.
- **Pre-existing, untouched:** axe reports `aria-valid-attr-value` on
the closed cmdk input (`aria-controls` points at the unmounted list) on
both `main` and this branch.
</details>
🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.
|
||
|
|
4e82a34246 |
fix(site/src/modules/dashboard/DeploymentBanner): let pointer input reach the health tooltip (#32762)
The deployment banner's health tooltip set `pointer-events-none` on its content. Once #32747 caps tooltips to the viewport height and lets them scroll, a long list of health errors gets clipped, and with that class the wheel and pointer can't reach the list. Low-vision users at 400% zoom can't read the hidden errors. This PR removes the class. Radix tooltips are hoverable by default, so the tooltip stays open while the pointer moves from the trigger into the content (WCAG 1.4.13). The class dates back to the original MUI styles (#10193), carried over unchanged in #19477. No reason is recorded, and nothing in the current Radix tooltip depends on it. The redundant `border` class goes too, because the base tooltip styles already include it. The `WithHealthIssues` story now moves the pointer onto the tooltip content after opening it. That step throws "element has `pointer-events: none`" on the old code, so the story guards the fix. It replaces a play-function `toBeInTheDocument` assertion (FE1). A Vitest test can't catch this regression, because jsdom doesn't load Tailwind CSS. Depends on #32747 for the short-viewport scroll. This PR is the last piece of the ticket. Closes DEQ-660 | Ticket | UI surface | Screenshots | |---|---|---| | DEQ-660 | Deployment banner health tooltip (`modules/dashboard/DeploymentBannerView`, `WithHealthIssues`) | pending | **Dropped review findings** - Make the tooltip `interactive`: dropped. The trigger is a RouterLink to `/health`, and an interactive tooltip's trigger click calls `preventDefault` and pins the tooltip open. `Tooltip.tsx` documents not to use it on link triggers. The content has nothing focusable, so `interactive` wouldn't help keyboard users either. - Add a health fixture with several errors and a short-viewport story: dropped. This PR doesn't change the rendered UI, and #32747's `TallerThanViewport` story already covers the capped, scrolling tooltip. - Vitest test for hovering the content: dropped. It would pass on the old code (test-audit gate), because jsdom doesn't apply `pointer-events`. **Notes (pre-existing, out of scope)** - axe `link-name` (serious): the health trigger link with errors is icon-only and has no accessible name. - Once #32747 is merged, a clipped health tooltip becomes a scroll region with no focusable content (`scrollable-region-focusable`). Keyboard users can still reach the full list through the trigger, which links to `/health`. <details> <summary>Decision log</summary> - Based on `main` rather than stacked on #32747: removing `pointer-events-none` is correct on its own, and together with #32747 the clipped list becomes scrollable. - Kept the plain Radix tooltip instead of `<Tooltip interactive>` or a Popover. That keeps the `/health` link on the trigger and its focus-shows-description behavior, and Radix already keeps the content open on hover. - Verified: the `WithHealthIssues` story fails with `pointer-events-none` restored and passes without it. With the pointer resting on the content, the tooltip is still open 1 s later, so Pixel still captures it. An axe-core 4.11.1 run on the hovered state found only the pre-existing `link-name` note above. - Checks: `pnpm check`, `pnpm lint`, `pnpm format`, `pnpm lint:types`, Vitest and story tests for `DeploymentBanner`. </details> 🤖 Generated by Coder Agents on behalf of @bartekgatzcoder. |
||
|
|
deadf82295 |
fix(site/src): return focus after workspace error and cancel build dialogs close (#32761)
When a workspace action fails, or after a build cancel, the follow-up dialog sent focus to `<body>` on close (WCAG 2.4.3). These dialogs render no `DialogTrigger`, so Radix has nothing to return focus to. #32682 fixed the confirm dialogs in the "Workspace actions" menu with `onCloseAutoFocus`; this extends the same pattern to the dialogs it missed. `WorkspaceErrorDialog`, `UpdateBuildParametersDialog`, and `WorkspaceBuildCancelDialog` now accept an optional `onCloseAutoFocus` and forward it to Radix. `WorkspaceMoreActions` passes its existing `returnFocusToTrigger` to the delete error dialog and the update parameters dialog. In the Workspaces table, the "Cancel build" button records itself in the existing `confirmReturnFocusElement` state, and its dialog uses the existing `returnFocusFromConfirm`. Closes DEQ-662 Closes DEQ-663 | Ticket | UI surface | |---|---| | DEQ-662 | "Workspace actions" menu (Workspaces table and workspace page): "Error deleting workspace" dialog and "Update workspace parameters" dialog. Focus returns to the menu trigger (not visible) | | DEQ-663 | Workspaces table row "Cancel build" button: "Cancel workspace build" dialog. Focus returns to the button on Cancel or Escape (not visible) | Review findings dropped: none. Known gaps, left out of scope: - After you confirm a build cancel, focus still lands on `<body>`. The "Cancel build" button becomes disabled and then unmounts, and the row's "Workspace actions" trigger is disabled while the build is still running, so nothing in the row can take focus. The Stop and Restart confirms in #32682 behave the same way. - The workspace page renders `WorkspaceBuildCancelDialog`, its restart `WarningDialog`, and its own `WorkspaceErrorDialog` from `WorkspaceReadyPage` without focus return. The Workspaces table's update and start `WorkspaceUpdateDialogs` also lack it. Fixing those means passing the trigger through `Workspace`, `WorkspaceTopbar`, and `WorkspaceActions`, which is a separate change. <details> <summary>Grouping and decision log</summary> - DEQ-662 and DEQ-663 share one root cause: these dialogs have no `DialogTrigger` and no `onCloseAutoFocus`. That is why they ship in one PR. - I fixed each caller instead of the shared `Dialog` primitive, as #32682 did. A primitive-level fix would change focus behavior for every dialog in the app. Each new prop is optional because other callers still omit it (`WorkspaceReadyPage`, `WorkspaceUpdateDialogs`). - `PrimaryAction`'s `onClick` type now receives the click event, so the "Cancel build" handler can read `event.currentTarget`. `Button` already passed the event, so the other callers are unchanged. - Tests: I added three cases next to the #32682 focus test in `WorkspacesPageView.test.tsx`: - focus returns after Escape on the delete error dialog; - focus returns after Cancel on the update parameters dialog; - focus returns after Cancel on the cancel build dialog. With the production changes reverted, all three fail with focus on `<body>`. - Self-review: frontend-review (FE1 to FE10), frontend-deep-review (all eight roles, sequential), and frontend-accessibility (code audit plus manual focus check). The only finding was TS3: a test fixture variant was inlined, so I made it a named `mockCancelableWorkspace` constant. I skipped the Storybook axe pass because the diff changes no markup or ARIA, only focus handlers. - Checks: `pnpm test` (`WorkspacesPage`, `WorkspacePage`, `modules/workspaces`), `pnpm check`, `pnpm lint`, `pnpm format`, `pnpm lint:types`. </details> 🤖 Generated by Coder Agents on behalf of @bartekgatzcoder. |
||
|
|
3ba7199fde |
fix(site/src/pages/CreateUserPage): show and link the organization field error (#32768)
On Create user, the Organization field was a hand-built `Label` and
`OrganizationAutocomplete`, so validation errors were never shown next
to it or linked to it. This PR routes the field through `FormField` with
a `control` render prop, the same pattern `TemplateCustomizationsStep`
and `ChatProjectDialog` use:
- The trigger gets `aria-invalid` and an `aria-describedby` that points
at the current error.
- The error text renders under the field, and the trigger gets the
destructive border like the other fields.
- A client-side `required` rule shows "Please select an organization."
when the user submits without one. Before, the request went to the
server with an empty ID.
- Backend `organization_ids` validation errors map to the field.
- The label shows the required asterisk like the other required fields.
The e2e `createUser` helper already looks up `getByLabel("Organization
*")`.
Closes DEQ-658
| Ticket | UI surface | Screenshots |
|---|---|---|
| DEQ-658 | `/deployment/users/create` with multiple organizations,
story `pages/CreateUserPage` | [DEQ-658
screenshots](https://linear.app/codercom/issue/DEQ-658#comment-a0c5d533)
|
Changes:
- `CreateUserForm.tsx`: use `FormField` for the organization field, add
the `required` rule, and map the `organization_ids` backend field.
- `CreateUserForm.test.tsx`: submitting without an organization
describes the trigger with the error and does not call `onSubmit`. This
test fails on `main`.
- `CreateUserForm.stories.tsx`: add an `OrganizationRequired` story for
the error state. The `WithOrganizations` combobox query becomes
`/^Organization/`, because the accessible name now includes the
asterisk.
<details>
<summary>Decision log and notes</summary>
- `FormField` with `control` was chosen over hand-wiring `aria-*`. It is
the existing primitive, and two other organization pickers already use
it.
- The hard-coded `id="organization"` was dropped in favor of the ID that
`FormField` generates. Nothing referenced it.
- Dropped review findings:
- DF5 nit: when the permitted organizations query fails, the field shows
the required error over an empty picker. That load-error handling is
pre-existing and out of scope for this ticket.
- TS1 nit: `WithOrganizations` still has two `aria-expanded` assertions
in its `play`. They are pre-existing, and this diff only changes the
query.
- axe on the error state finds no violations.
</details>
🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.
|
||
|
|
0fc090ae40 |
fix(site/src): remove the undefined highlight-grey theme color (#32767)
`@theme` mapped `--color-highlight-grey` to
`hsl(var(--highlight-grey))`, but no theme block defines
`--highlight-grey`, so any `*-highlight-grey` utility would render no
color. Nothing in `site/` uses it, so this PR removes the entry.
Closes DEQ-657
| Ticket | UI surface |
|---|---|
| DEQ-657 | None. `site/src/index.css` theme tokens, with no rendered
change |
<details>
<summary>Decision log and notes</summary>
- Removal was chosen over defining `--highlight-grey` in every theme.
The token has no users and no design value to match, and inventing
per-theme values would need contrast review for a color nothing renders.
- `grep -rn highlight-grey site/` (excluding `node_modules`) returns
nothing on this branch.
- No screenshots, because nothing renders differently.
</details>
🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.
|
||
|
|
51676cbc2d |
fix(site/src/pages/CliInstallPage): use the theme text color for the link underline (#32766)
The CLI install page's "Go to workspaces" link set its underline to a hardcoded `hsla(0,0%,100%,0.7)`, which is almost invisible on the light theme background. This PR drops the override, so the underline uses the link's `text-content-primary` color in every theme. `underline-offset-[3px]` also becomes the equivalent `underline-offset-3`. Closes DEQ-656 | Ticket | UI surface | Screenshots | |---|---|---| | DEQ-656 | `/cli-install` page, story `pages/CliInstallPage` | [DEQ-656 screenshots](https://linear.app/codercom/issue/DEQ-656#comment-076ff66c) | <details> <summary>Decision log and notes</summary> - The link's own text color was chosen over a separate `border-*` token. The underline then always matches the link text, and the link stays distinguishable in every theme with no new token. - Self-review: frontend-review, frontend-deep-review, and frontend-accessibility found no blocking or should-fix issues. axe on the story finds no violations on `main` or this branch. </details> 🤖 Generated by Coder Agents on behalf of @bartekgatzcoder. |
||
|
|
4e45baa790 |
fix(site/src/modules): keep one scroll region in the user menu org list and port forward popover (#32765)
The user menu's organization list (`max-h-64 overflow-y-auto`) and the port forward popover's listening-ports section (`max-h-80 overflow-y-auto`) each had a fixed-height scroll box inside a popup that already caps at `--radix-popper-available-height` and scrolls. At 200% zoom or on short viewports this nested a second scroll region in the first. This PR removes the inner caps, so the popup is the only scroll region. The approach matches the Proxy menu fix in #32746. Closes DEQ-659 | Ticket | UI surface | Screenshots | |---|---|---| | DEQ-659 | Navbar user menu organization picker, workspace port forward popover | [DEQ-659 screenshots](https://linear.app/codercom/issue/DEQ-659#comment-4fe7d972) | Measured in Storybook at 720x450 (`desktopZoom200` size) with 20 listening ports and 14 organizations: - Port forward popover: on `main`, a 320px inner scroller sits inside the 380px popover. On this branch the only scroller is the popover. - User menu: on `main`, a 256px inner scroller sits inside the 388px menu, and axe reports `scrollable-region-focusable` on it. On this branch the menu is the only scroller and that violation is gone. Arrow keys move through the organizations and scroll the menu. The `PortForwardButton.tsx` diff is mostly re-indentation from removing the wrapper (`git diff -w` shows 2 lines). <details> <summary>Decision log and notes</summary> - Removing the cap was chosen over a flex `min-h-0` layout. Both popups already scroll, and the Proxy menu fix used the same approach, so the user menu and port forward popover now behave alike. - Trade-off: on a tall viewport, a long listening-ports list now grows the popover up to the available height instead of 320px, so "Shared ports" can sit below the fold until the user scrolls. One scroll region beats a nested one for keyboard and low-vision users, and the popover still never overflows the viewport. - axe reports `aria-dialog-name` on the port forward popover on both `main` and this branch. That is pre-existing and not touched here. - No new tests. The change is layout only and jsdom can't measure it. Existing PortForwardButton and UserDropdown tests pass. - Self-review: frontend-review, frontend-deep-review (8 roles), and frontend-accessibility found no blocking or should-fix issues. One reviewer asked whether this should match DEQ-661's approach, which keeps a capped list inside a flex tooltip. The two differ on purpose. Tooltips have a heading and a footer link that must stay visible, while these popups are menus and forms, where the whole surface should scroll. </details> 🤖 Generated by Coder Agents on behalf of @bartekgatzcoder. |
||
|
|
f65ff35c48 |
fix(site/src): give the spend page organization picker a visible label (#32698)
On AI settings > AI spend with more than one organization, the organization picker in the page header showed only the selected organization's name. Its purpose existed only in `aria-label`, so sighted users had no visible label (WCAG 3.3.2). `OrganizationAutocomplete` gets an optional `label` prop. It renders a visible `Label:` prefix before the value, like `DateTimeRangePicker`'s `valuePrefix`. Unless `ariaLabel` is set, it also names the trigger "Label: value" (or "Label" with nothing selected), so the visible label is part of the accessible name (2.5.3). The value and the placeholder both truncate, so the prefix never pushes the chevron out of the trigger. `AISpendPageView` passes `label="Organization"` instead of its hand-built `ariaLabel`, and the trigger widens from `w-60` to `w-80 max-w-full` so the prefix fits next to the name or the placeholder. Closes DEQ-649 | Ticket | UI surface | |---|---| | DEQ-649 | AI settings > AI spend, organization picker in the page header (2+ organizations, or an unavailable organization). [Screenshots](https://linear.app/codercom/issue/DEQ-649#comment-06c5f38c) | Verification: - **Rendering (Storybook `AISpendPageView`):** Overview reads "Organization: My Organization", and the accessible name is the same. OrganizationUnavailable reads "Organization: Select an organization…" and is named "Organization". At 1280px neither is truncated. - **320px:** in both Overview and OrganizationUnavailable, the trigger stays inside the viewport (273px), its content fits (`scrollWidth` equals `clientWidth`) and the chevron stays inside the border. The organization name or placeholder truncates by a few characters; the full name stays in the accessible name. The page's horizontal overflow at 320px comes from the overview cards and also happens on `main`. - **Tests:** `AISpendPage.test.tsx` now finds the trigger as "Organization: My Organization". The AI spend and `OrganizationAutocomplete` tests pass. - **Checks:** pre-commit (`lint/ts`, `pnpm check`) passes. <details> <summary>Decision log</summary> - **Moved to the redesign by a merge from `main`:** #32686 deleted `SpendPage`, `SpendFilters` and their tests, which this PR first changed. The deletions are kept; the same `label` prop now applies to the redesigned page's single picker. The earlier `SpendFilters` flex-basis change went away with that file. - **Prefix inside the trigger, not a separate `<Label>`:** this keeps the header layout, and it matches `DateTimeRangePicker`'s `valuePrefix`, the closest existing visible-prefix API. `OrganizationField`'s stacked label is meant for forms. - **Name built from `label`:** callers that pass `ariaLabel` are unchanged, and callers that pass neither still get no `aria-label`. - **`w-80`:** at `w-60`, "Organization:" plus "Select an organization…" didn't fit. That was the reason the first round left the old fallback picker alone. The redesign uses one picker for both states, so it is widened instead. `max-w-full` keeps it inside narrow viewports. - **Size:** about 20 non-test lines. </details> 🤖 Generated by Coder Agents on behalf of @bartekgatzcoder. |
||
|
|
1bba8b7089 |
fix(site/src/components/Filter): name the select filter dropdown dialog (#32693)
When a `SelectFilter` opens, its popover renders `role="dialog"` with no
accessible name, so screen readers announce an unnamed dialog. axe
reports `aria-dialog-name` (serious). This passes the filter's `label`,
already the trigger's accessible name (for example "Select provider"),
to the dropdown as `aria-label`. Radix puts it on the dialog element.
Closes DEQ-636
| Ticket | UI surface |
|---|---|
| DEQ-636 | Every `SelectFilter` dropdown: audit log, AI Gateway
sessions, AI spend provider, model and client filters |
No screenshots: the change only adds an accessible name, so nothing
changes visually.
Verification:
- **Unit test:** a new `SelectFilter` test checks the dialog's
accessible name. It fails without the change.
- **Storybook axe (Spend page "Select provider" dropdown):**
`aria-dialog-name` fails on `main` and passes on this branch.
- **`components/SelectFilter` stories:** their meta args now pass the
required `label` ("Select an option"), as real callers do, so the story
the ticket cites opens a named dialog. The label is only an
`aria-label`, so nothing changes visually.
- **Checks:** `pnpm check` and `pnpm lint` pass.
Notes (pre-existing, not changed here):
- **`scrollable-region-focusable`**, which the ticket mentions, still
fires on the no-search list. Keyboard users can still scroll it: focus
moves into the list on open, and cmdk handles the arrow, Home and End
keys.
- **The other 8 `ComboboxContent` callers** also render unnamed dialogs
(for example `WorkspacesButton`, `ChangeWorkspaceVersionDialog`, the IdP
sync forms). Review filed DEQ-653 for them.
<details>
<summary>Decision log</summary>
- **Fix in `SelectFilter`, not `ComboboxContent`:** `ComboboxContent`'s
only `label` prop names the search input, and its other callers have
different triggers. Changing the primitive would touch 8 more surfaces
beyond this ticket. A follow-up could have `Combobox` generate a trigger
id and default `aria-labelledby` to it.
- **`aria-label` vs `aria-labelledby`:** the trigger is named by its own
`aria-label`, not visible text, so there is no element to reference.
Reusing the same string keeps the trigger and dialog names identical.
- **Size:** 1 source line plus a comment fix and 1 story arg; the rest
is test.
</details>
🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.
|
||
|
|
b922c9db92 |
fix(site/src): raise light theme error text contrast (#32692)
In the light theme, `--content-destructive` (red-600, `#DC2626`) is 4.83:1 on white but 4.39:1 on `--surface-secondary`, under the WCAG 1.4.3 minimum of 4.5:1. Error text on highlighted or secondary rows failed, for example a critical latency in the highlighted row of the navbar region menu. In the `light-protan-deuter` theme the token was orange-500, which fails even on white (2.85:1). This raises the text token only, the same split #32047 made for warnings: | Theme | Before | After | On primary / secondary / tertiary / surface-red | |---|---|---|---| | light | red-600 `0 72.2% 50.6%` | red-700 `0 73.7% 41.8%` | 6.46 / 5.89 / 5.09 / 5.27 | | light-protan-deuter | orange-500 `24 95% 53%` | `17 88% 37%` (`#B13A0B`) | 6.01 / 5.48 / 4.73 / 5.26 | - `light-tritan` inherits the light value. The dark themes already passed and are unchanged. - `--border-destructive` (icons, borders) is unchanged. - In `light-protan-deuter`, the new value is a shade darker than the light theme's orange-700 warning text, but that theme's warning is fuchsia, so destructive and warning stay distinct. - The existing warning contrast test in `theme/cssVariables.test.ts` now also checks `--content-destructive` at 4.5:1 on the primary, secondary, tertiary and red surfaces in every theme. It fails on the old values. Tertiary covers error text in tertiary chips, such as the upload error in `WorkspaceUploadPreview`. Closes DEQ-631 | Ticket | UI surface | |---|---| | DEQ-631 | All light-theme error text (`text-content-destructive`), e.g. navbar region menu critical latency, form field errors. [Screenshots](https://linear.app/codercom/issue/DEQ-631#comment-17f5637a) | Verification: Storybook axe on `modules/dashboard/ProxyMenu` (critical latency, highlighted row, light theme) reports `color-contrast` (serious, 4.39:1) on `main` and passes on this branch. The pixel diff of that menu changes only the latency text and icon color (`#DC2626` to `#B91C1C`). `FormField` WithError changes only the error line. `pnpm check` and `pnpm lint` pass. Notes (pre-existing, not changed here): - `DeploymentBannerView` draws a near-black icon on `bg-content-destructive`. The darker red lowers that to 3.07:1 (light) and 3.31:1 (light-protan-deuter), still above the 1.4.11 minimum of 3:1. - Filed by review: DEQ-654 (`--content-success` under 3:1 in the protan-deuter and tritan light themes) and DEQ-655 (protan-deuter destructive border and badge contrast). <details> <summary>Decision log</summary> - **Red-700:** the closest Tailwind red that passes on every surface error text renders on, including `--surface-red` (alerts, log error rows). Red-650 would pass secondary (5.30) but leave little margin. - **Protan-deuter:** the variant overrode the token with orange-500, which failed everywhere. Orange-700 (`17 88% 40%`) was the first choice, but review found it is 4.18:1 on `--surface-tertiary`, so it is darkened to `17 88% 37%`, as the reviewer suggested. The theme moves warning to fuchsia, so the two states stay apart by hue. - **Graphics token untouched:** following #32047, only text needs 4.5:1. Icons and borders use `--border-destructive` and need 3:1. That holds in light, but in `light-protan-deuter` it is 2.85:1 on white, a pre-existing gap tracked in DEQ-655. - **Test:** merged into the existing parametrized contrast table instead of a near-duplicate block, per review. - **Size:** 2 CSS lines; the rest is test. </details> 🤖 Generated by Coder Agents on behalf of @bartekgatzcoder. |
||
|
|
74a77063a1 |
fix(site): announce the highlighted inline autocomplete option (#32691)
In inline search mode, `Autocomplete` points the input's `aria-controls`
and `aria-activedescendant` at ids it passes to `CommandList` and
`CommandItem`. cmdk writes its own generated `id` after spreading props,
so neither id ever rendered. Screen readers announced nothing as the
user arrowed through suggestions (AI settings > Models > Add model,
model identifier field).
The repository already patches cmdk 1.1.1 so an Item's `aria-selected`
prop wins. This extends that patch so an `id` prop on `Command.List` and
`Command.Item` replaces cmdk's generated id. An Item uses that id
internally too, so cmdk's highlight recovery and score sort keep
working. `Autocomplete` now derives each option id from the option value
rather than its index, because cmdk requires an Item id to stay the same
while the item is mounted.
`ModelSelector` was the only other caller passing an `id` to
`CommandList`. cmdk used to drop it, so the trigger's `aria-controls`
pointed nowhere. With the patch, that id would also break
`CommandInput`'s own `aria-controls`. The trigger now points at its
popover instead, the same as `OrganizationAutocomplete`, and no longer
overrides Radix's `aria-haspopup="dialog"` with `"listbox"`, so the
announced popup type matches the popup.
Closes DEQ-627
| Ticket | UI surface |
|---|---|
| DEQ-627 | AI settings > Models > Add model, model identifier
suggestions (and any `inlineSearch` `Autocomplete`); `ModelSelector`
trigger `aria-controls` |
No screenshots: the change only fixes ARIA id references, so nothing
changes visually.
Verification:
- **Unit tests:** the new `Autocomplete` tests fail without the patch
and pass with it. One checks that `aria-controls` and
`aria-activedescendant` resolve to the listbox and the highlighted
option. The other is an `it.each` that keeps a highlighted match after
typing filters options out; it caught a regression in an earlier,
index-based version of this fix. A new `ModelSelector` test checks that
the trigger's `aria-controls` and `aria-haspopup` match the opened
popup; it fails on `main`.
- **Storybook axe (`components/Autocomplete` InlineSearch, AI Models add
form):** `aria-valid-attr-value` (critical) fails on `main` and passes
on this branch. `scrollable-region-focusable` on the model identifier
listbox is also gone, because the listbox is now owned by the combobox.
- **Checks:** `pnpm check` and `pnpm lint` pass.
Dropped review findings:
- **Drop `ModelSelector`'s own `aria-controls` and let Radix wire it:**
`aria-haspopup="listbox"` is removed as suggested, but the explicit
`aria-controls` and `PopoverContent` id stay. oxlint's
`jsx-a11y/role-has-required-aria-props` requires `aria-controls` on
`role="combobox"` and can't see the one Radix adds at runtime. Our props
override Radix's on both elements, so the reference still resolves
(covered by the new test).
- **`encodeURIComponent` throws on a lone UTF-16 surrogate:** option
values are catalog model ids, so this is not reachable today.
<details>
<summary>Decision log</summary>
- **Root cause:** cmdk 1.1.1 renders `{...props, id: generatedId}` on
both List and Item, so any `id` prop is silently overwritten. FE6
already warns about cmdk overwriting `aria-*` props.
- **Chosen fix: extend the existing pnpm patch.** It is the smallest
change at the source, and the repo already uses this patch for the same
kind of override. Alternatives rejected:
- Reading cmdk's generated ids back from the DOM: needs refs and effects
(FE8) and races cmdk's own rendering.
- Rendering a separate listbox outside cmdk: duplicates the primitive
(FE3).
- **Item id is also cmdk's internal id:** the first version only
replaced the DOM id. A reviewer traced that cmdk's unmount cleanup
compares the DOM id with its registration id, so filtering out the
highlighted option left nothing highlighted and Enter did nothing. The
patch now feeds the prop into cmdk's own `useId` slot.
- **Value-based option ids:** index-based ids changed when an earlier
option was filtered out while the option stayed mounted. cmdk registers
an item only once, so its bookkeeping went stale ("No results found"
next to a live option, lost highlight). The ids now come from
`encodeURIComponent(optionValue)`; values are already unique React keys.
- **List id override:** a List with its own id no longer matches
`Command.Input`'s `aria-controls`. The patch header says to give a List
an id only when it has no `Command.Input`. `ModelSelector` was the only
caller doing both, and it was updated. Per review, the `CommandList` and
`CommandItem` wrappers in `Command.tsx` now document these caller rules
too.
- **Size:** about 30 non-test lines plus the regenerated patch and
lockfile hash.
</details>
🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.
|
||
|
|
8b112f3748 |
fix(site): standardize keyboard shortcut hints (#32776)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. Stacked on #32655. Review this PR against that rule branch. - Use shared `Kbd` and `KbdGroup` in the agent send tooltip/menu and inline diff-comment footer. - Match Command/Control and Option/Alt labels to the platform, including the native template Build title. - Make the queued-message hint follow the existing send preference and coarse-pointer behavior without changing key bindings or mobile visibility. <details> <summary>Audit and validation</summary> A fresh agent received the new rule and production frontend scope, without the known candidate files. It found all three previously identified cases and a fourth: the queued-message hint incorrectly advertised Enter when the handler required a modifier. The cleanup reuses the shared key primitives, platform helpers, and send-preference helper. Native titles and accessibility metadata remain strings. Four visual stories cover default, modifier, coarse-pointer, and macOS states. The queue hint owns its media-query subscription in a small child component. Validation completed: frontend lint, 185 focused unit tests, and 135 Storybook tests passed before the final component-boundary cleanup. The final diff passes `pnpm check`, TypeScript, and `git diff --check`. Eight frontend review roles and the test-value audit ran; their code findings were addressed. No public docs change is needed because keyboard behavior is unchanged and the existing agent guide describes these bindings. The browser/accessibility comparison was interrupted by a workspace disconnect and is not claimed complete. No screenshots are uploaded in this PR. </details> |
||
|
|
2b777a99d1 |
docs(.claude): standardize keyboard shortcut hints (#32655)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell. Add an FE3 rule for keyboard shortcut hints and wire it into both frontend review checklists. Require shared key badges and platform-aware labels that match the actual bindings, while preserving native string attributes, accessibility metadata, and shortcut behavior. Refs #32654. <details> <summary>Rule validation</summary> Ran an independent read-only audit of `site/src` using the new rule without supplying candidate files. It identified the send-button tooltip/menu, diff comment Esc hint, incorrect macOS Build tooltip, and a queued-message hint that ignores the send preference. Product fixes are kept in a separate stacked PR. Markdown lint, table formatting, rule links, punctuation, and diff checks passed. </details> |
||
|
|
856a8684cb |
fix: prevent channel shutdown send races (#29658)
Workspace update subscriptions and VPN tunnels could close a channel
while another goroutine was still sending on it, panicking with `send on
closed channel`. VPN senders could also block forever once nothing read
the channel.
- `coderd`: `sub.Close` no longer closes the updates channel, so a
pubsub callback still running cannot send on a closed channel.
- `vpn`: after Stop, the tunnel no longer closes the shared send
channel. The writer exits after writing the Stop response, so Stop is
the final frame, and its exit is what ends the senders below.
- `vpn`: a speaker send context ends when the speaker is canceled or the
writer exits, for example on a write error. RPCs, RPC replies, updates
and logs wait on it, so they return instead of blocking on a channel
nothing reads. Before, an update holding the updater mutex could block a
Stop the tunnel had already read. The updater context derives from it,
so the updater also stops after Stop when Start never succeeded.
- `vpn`: RPC response channels are buffered, so delivering a response no
longer deadlocks against a caller canceled at the same moment. That
deadlock exists on main for a canceled caller context, and the send
context adds a cancellation at shutdown. A response received before EOF
or writer exit is returned instead of an error.
<details>
<summary>Decisions and regression evidence</summary>
- Nothing observes the subscription channel closing: its only reader,
`WorkspaceUpdates` in `tailnet/service.go`, also stops on its stream
context and calls `Close` itself.
- The tunnel does not cancel its speaker after Stop. Senders return once
the writer has finished the Stop response rather than when it is handed
over, and a request the manager sends after Stop stays parked until
`Tunnel.Close`, as on main.
- `updater.stop` is unchanged: it cancels after closing the conn, so
logs the conn emits while closing reach the manager (the tunnel is the
only log sink with `UseAsLogger` on macOS).
`TestTunnel_StopForwardsCloseLogs` guards that ordering.
- RPCs wait on the send context directly instead of relying on
`recvLoopDone`. The receive loop cannot exit while it is handing a
request to a busy `requestLoop`, and closing a blocking file descriptor
may not interrupt its read. `recvFromSerdes` still delivers requests
after the writer exits, so a Stop it has already read is not dropped.
When only the writer has exited, RPCs return `io.ErrUnexpectedEOF`, as
for EOF. Every RPC return removes its response channel, so RPCs that
fail after the writer exits do not accumulate entries.
- Against main's production code:
- `TestWorkspaceUpdatesClose/{QueryInFlight,CallbackAfterClose}` and
`TestTunnel_StopConcurrentSenders` panic with `send on closed channel`.
- `TestSpeaker_ResponseDuringCancellation` deadlocks.
- `TestSerdes_StopClosesAfterResponse` receives a frame after Stop.
- `TestTunnel_StopAfterWriterExits` and
`TestSpeaker_RPCAfterWriterExits` stay blocked after the writer exits.
- `TestSpeaker_ResponseBeforeEOF`,
`TestSpeaker_ResponseBeforeWriterExits` and
`TestTunnel_StopForwardsCloseLogs` pass on main. They guard ordering the
fix depends on: each fails when that ordering is changed or the matching
part of the fix is removed.
- The regression tests pass 50 runs with `-race`. The `vpn` and
`tailnet` race suites pass.
</details>
> This PR was created with the help of Coder Agents for @mafredri and
will be reviewed by a human.
|
||
|
|
f6fe51a852 |
docs: warn that chats sharing a workspace are not isolated (#32754)
Chats attached to the same workspace share its files and don't know about each other. If two chats use the same path, one overwrites the other, so content from a private repository can end up in another repository, including a public one. This adds a short section on the risk and how to avoid it to the Coder Agents architecture page, and links to it from the overview where it mentions choosing a workspace. |
||
|
|
78f744c959 |
chore(site): enable no-autofocus oxlint rule (#32740)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell. Moves [no-autofocus](https://oxc.rs/docs/guide/usage/linter/rules/jsx_a11y/no-autofocus.html) out of the Oxlint migration backlog and sets it to `error`. Disables the equivalent Biome rule in `site/`. Removes autofocus from page forms and lets Radix handle initial focus in dialogs where the intended field is already first. Keeps targeted suppressions for focus restoration and deliberate focus moves after user interaction. Related to #31146 and #31148. |
||
|
|
a5367f6a2e |
chore(site): enable iframe-has-title oxlint rule (#32741)
> 🤖 This PR was written by Codex on behalf of Jake Howell. Moves [iframe-has-title](https://oxc.rs/docs/guide/usage/linter/rules/jsx_a11y/iframe-has-title.html) out of the Oxlint migration backlog and sets it to `error`. Disables Biome’s equivalent for `site/`. Both callers already supply titles. The shared workspace iframe now requires the title prop and passes it explicitly to the native iframe. Related to #31148 and #32740. |
||
|
|
f2b60844c5 |
fix: verify bundled terraform against a checksum file in the Coder repo (#31600)
`scripts/Dockerfile.base` and `install.sh --with-terraform` download the
bundled Terraform zip from `releases.hashicorp.com` and use it without
checking it. This verifies that zip against a checksum file kept in the
Coder repo. The only thing trusted is the Coder repo, which is where the
`Dockerfile` and `install.sh` themselves come from. Everything fetched
from HashiCorp is checked against it.
The other download paths are already covered:
`provisioner/terraform/install.go` uses `hc-install`, which checks the
GPG-signed SHA256SUMS, and `mise.lock` / `flake.nix` already carry
per-platform hashes.
## Source of truth
`provisioner/terraform/terraform_SHA256SUMS` is a verbatim copy of
HashiCorp's `terraform_1.17.2_SHA256SUMS`, the version `main` ships,
verified against their signing key (`C874 011F 0AB4 0511 0D02 1055 3436
5D94 72D7 468F`). Being verbatim, you can diff it against the published
file or check it with the published `.sig`. Its hashes match the
Terraform entries in `mise.lock` on `main`. Both the Terraform version
and the checksums are read from it, so neither consumer pins a version.
## Consumers
* `scripts/Dockerfile.base` copies the file in and reads the version and
its architecture's checksum from it. It checks the zip with `sha256sum
-c` before unzipping. The build fails if there's no entry for the
architecture or the download doesn't match. All three build contexts
include the file: `docker-base.yaml`, `release.yaml` and
`scripts/build_docker.sh`. `docker-base.yaml` also runs when the file
changes.
* `install.sh` no longer has a `TERRAFORM_VERSION` or any hashes.
`--with-terraform` downloads `terraform_SHA256SUMS` from the Coder repo
at `refs/tags/v${VERSION}`, the tag of the release being installed. Only
if that tag doesn't have the file (a 404, for releases from before it
existed) does it fall back to `refs/heads/main`, with a note in the
output. Any other error fails. Fully qualified refs mean a branch named
like the tag, or a tag named `main`, can't be read instead. It then:
* only accepts lines with exactly two fields: 64 lowercase hex
characters and `terraform_X.Y.Z_<os>_<arch>.zip`. It picks the line for
`${OS}_${TERRAFORM_ARCH}`, validates the Terraform version and builds
the zip name from validated parts rather than using the one in the file.
It refuses to install if there's no such line;
* downloads the zip from HashiCorp and checks it with `sha256sum`,
`shasum -a 256` or `sha256`, including a zip reused from the cache. On a
mismatch it deletes the zip so a rerun downloads it again;
* skips the check under `--dry-run`, since nothing is downloaded. The
checksum file is still fetched so the version can be printed.
* `install.sh` **command handling** (security review): `sh_c` runs its
arguments directly instead of re-parsing them with `sh -c`, and
`sudo_sh_c` passes them to `sudo` or `doas` as-is. The `su` fallback
single-quotes every argument (`quote_args`). The resolved Coder version
must be `X.Y.Z` or `X.Y.Z-rc.N` before it's used in URLs, file names or
commands. As a side effect, install prefixes and cache paths with spaces
now work.
* `provisioner/terraform/checksums_test.go` fails if the file isn't in
SHA256SUMS format, is for a different version than `TerraformVersion`,
or lacks the `linux_{amd64,arm64,arm}` entries that `Dockerfile.base`
needs.
Also fixes `install.sh` unzipping `${ARCH}` instead of
`${TERRAFORM_ARCH}`, which broke `--with-terraform` on armv7 (`armv7` vs
`arm`).
## Bumping after this
Replace `terraform_SHA256SUMS` with the new verified file and update
`TerraformVersion` (plus `mise.toml`, `mise.lock`, `flake.nix` and the
airgap doc, as today). `Dockerfile.base` and `install.sh` need no edits.
`scripts/update_terraform_version.sh` (coder/coder#31463) does all of
this, and the `TerraformVersion` note in `install.go` points at it.
`main` is merged into this branch, including coder/coder#31438
(Terraform 1.17.1) and coder/coder#32110 (Terraform 1.17.2), so the
checksum file and `TerraformVersion` are at 1.17.2.
## Testing
After merging `main` (Terraform 1.17.2), I re-ran the Go test, `go vet`,
`gofmt`, `shellcheck`, `shfmt` and `actionlint`, and checked that the
`Dockerfile.base` extraction resolves 1.17.2 for amd64, arm64 and arm.
The `docker-base` build and the `install.sh` and `Dockerfile.base` runs
below were done before that merge, against 1.16.7 and 1.17.1, and I
haven't repeated them at 1.17.2. The `docker-base` workflow rebuilds the
image from the 1.17.2 file in CI.
* The `docker-base` workflow built all three platforms from the checksum
file: `terraform_1.16.7_linux_{amd64,arm64,arm}.zip: OK`, then Terraform
v1.16.7 on each.
* Ran the `Dockerfile.base` Terraform step under BusyBox 1.35 `sh`. It
fails with a changed hash or no entry for the architecture. With the
verified 1.17.1 file it installs 1.17.1 with no Dockerfile edit.
* `install.sh` `with_terraform` under `dash` on linux/amd64:
* fetched the real file over `raw.githubusercontent.com` from this
branch (standing in for `main`), then verified and installed 1.16.7;
* with the 1.17.1 file it installs 1.17.1;
* a changed hash is rejected and the cached zip is deleted;
* an unsupported platform and a garbage response are both refused;
* `--dry-run` prints the commands.
* Today neither the release tags nor `main` have the file, so
`--with-terraform` fails with "Could not download the Terraform
checksums" until this merges. After that, older releases use `main`'s
file.
* Security review fixes, under `dash` and `bash --posix`:
* checksum lines with `$(...)`, backticks, `;`, `../`, an extra field,
an uppercase or 65-character hash, or a malformed Terraform version are
refused before any command runs. The previous version of the script ran
the `$(...)` one. A file with an injected line followed by the real ones
installs only the real zip;
* with a `curl` stub, a tag hit reads `refs/tags/v2.39.0`, a 404 falls
back to `refs/heads/main`, and a 500 or a network error fails without
trying `main`;
* `sh_c`, and `sudo_sh_c` through `sudo`, `doas` and `su` stubs, pass
arguments with spaces, quotes, `;` and `$(...)` through unchanged and
run nothing else. `--dry-run` runs nothing;
* `--version v2.28.0`, `2.28.0;id` and `../../x` are refused. `--version
2.39.0`, `--version 2.33.0-rc.1`, `--stable` and the default mainline
still work;
* real installs of Terraform into a prefix with a space (no sudo) and
into a root-owned prefix (through `sudo`), and of Coder 2.39.0 with
`--method standalone` into a prefix with a space.
* `go test ./provisioner/terraform -run
TestTerraformChecksumFileMatchesVersion` passes with the 1.17.2 file,
and fails with the 1.17.1 file in place (`expected: "1.17.2", actual:
"1.17.1"`). `go vet` and `gofmt` are clean.
* `shellcheck --external-sources` (v0.10.0) and `shfmt -d` (v3.12.0) are
clean on `install.sh` and `scripts/build_docker.sh`, and `actionlint`
(v1.7.7) is clean on the workflows. Local git hooks were skipped.
## How coder/coder#31600, coder/coder#31463 and coder/coder#31461 fit
together
* coder/coder#31600 makes `provisioner/terraform/terraform_SHA256SUMS`
(a verbatim copy of HashiCorp's signed file) the one place the bundled
Terraform checksums live. `Dockerfile.base` reads it, and `install.sh`
downloads it from the Coder repo at install time.
* coder/coder#31463 adds `scripts/update_terraform_version.sh`. On
branches with the checksum file it just replaces that file. On older
branches it edits `install.sh` and `Dockerfile.base` directly.
* coder/coder#31461 (stacked on coder/coder#31463) runs the script
weekly for `main` and the supported release branches. It needed no
changes for the checksum file.
None of the three touch the same files, and merging all three onto
`main` is conflict-free. On that combined tree, the bump script (run
before `main` moved to 1.17.2) took 1.16.7 to 1.17.1 by replacing the
checksum file, the new Go test passes, and `actionlint` and `shellcheck`
pass. They can merge in any order. Merge coder/coder#31461 after
coder/coder#31463, retargeted to `main`.
Opened by Superblink on behalf of @droopy4096.
---------
Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Co-authored-by: Dmytro Makovey <dmitry@coder.com>
Co-authored-by: Lisa Fiander <lisa@coder.com>
Co-authored-by: Dmitry Makovey <dmakovey@yahoo.com>
|
||
|
|
19da85b5d3 |
docs: turn the install landing pages into cards (#32405)
## Summary Rework the install landing pages so a reader can see where to go at a glance, without reading the planning material first. The install landing page is now a hub of ten cards in three groups that point to the high-impact and most searched pages, modeled on the GitLab and Mattermost install pages, and the planning material moves to a new Production deployment process page. Every existing page URL stays the same; the sidebar gains two pages. #31869 (the air-gapped K3s tutorial), which this PR links to, has merged, and this branch is rebased onto `main`. The cards need coder/docs-engine#388 to render as cards; without it, the docs engine, GitHub, and the classic offline docs render the same block as a plain link list, so the two PRs can merge in either order. The docs home page cards moved to #32714. Refs [DOCS-1568](https://linear.app/codercom/issue/DOCS-1568) and [DOCS-1570](https://linear.app/codercom/issue/DOCS-1570). ## Changes - `install/index.md`: a one-sentence intro, a tip that points to the Quickstart and the CLI download, and three groups of cards. - Install the control plane: Installation requirements, Air-gapped K3s quickstart, Install on Kubernetes, and Installation methods. - Run Coder in production: Production deployment process and Upgrade Coder. - Common tasks: Air-gapped deployments, Use an external database, TLS and reverse proxies, and Image pull secrets. - New `install/production-deployment.md` (Production deployment process), the first child of Install: the five phases table with its "When you can skip it" column, Move from evaluation to production, Decisions worth making deliberately, and Who does the work, all moved from the landing page. Move from evaluation to production keeps the setup token sentence from #32324. - New `install/server/requirements.md` (Installation requirements), the first child of Install the control plane: control plane CPU and memory, PostgreSQL, platform versions, network, internet access, and license, each traced to code or the existing platform pages. - `install/server/index.md`: takes the three platform questions, the offline notes, and the first air-gapped workspace build note from the landing page. The platform table gains a "Where the control plane runs" column, with Rancher and OpenShift listed as Kubernetes. - `install/server/kubernetes/index.md`: intro names EKS, AKS, GKE, K3s, and OpenShift, and points offline clusters to the air-gap page and the K3s tutorial. - `install/server/cloud/index.md`: sends existing EKS, AKS, and GKE clusters to the Kubernetes guide, notes that the AWS Marketplace guide creates a new EKS cluster, and fixes the Azure tab, which said GKE instead of AKS. - `install/plan/index.md` and `install/prepare/index.md`: planning reads as a recommendation, not a requirement, and Prepare links to the requirements page. ## Decisions for review 1. **Card syntax.** Each card is one item in a plain link list, `[Title](link): one-sentence description`, inside `<div class="cards">`. The corpus compiles as `.md`, so it can't use JSX; this is the same approach as `<div class="tabs">`, and it degrades to a readable list wherever the plugin isn't present. 2. **The first six cards** come from the Nov 20 review with Ben. Two card titles are shorter than their target page titles: "Air-gapped K3s quickstart" opens "Install Coder on K3s in an air-gapped environment", and "Installation methods" opens "Install the control plane". The 1-hour target from the Nov 4 review still isn't stated, because it needs a timed run. 3. **The Common tasks cards come from search data, not page views.** No page-view source was available (Search Console is on a personal account, and Vercel analytics needs credentials). The four cards are the install pages with the most result impressions in Algolia over the 30 days to Nov 18: image pull secrets, air-gapped deployments, the external database, and the NGINX and Apache reverse proxy pages, which match the frequent `proxy` and `certificate` searches. Semrush also shows "nginx reverse proxy" at 4,400 searches a month. The TLS card opens the TLS & Reverse Proxy section of the control plane setup page, which links Apache, Caddy, and NGINX, instead of one proxy page. Docker is left out because the Installation methods card already covers it. Swap any card if page views tell a different story. 4. **"Choose your path" is gone.** Every row now has a card or the tip, and Move from evaluation to production is a section of the new page. The Architecture link that row carried now lives only on Plan your deployment. 5. **Classic offline docs get no card styling.** They render the plain list until the offline docs move to the docs engine. 6. **Rancher and OpenShift read as Kubernetes options.** This reverses what I proposed in the Nov 4 install review (Rancher with container runtimes, OpenShift with Linux). Both guides install the Helm chart on a cluster, so a reader looking for Kubernetes needs to find them. This PR only changes the table labels; no pages move. ## Previews Both previews are built from this branch at `e1d00f4f10`. A screenshot of the docs engine version of the install page is on coder/docs-engine#388. - **Docs engine:** check out coder/docs-engine#388 (`vigilante/coder-docs-cards`), and in `apps/docs` run `DOCS_VERSION_ID=main DOCS_VERSION_REF=e1d00f4f10 DOCS_VERSION_ROOT=1 DOCS_ROOT=<this checkout>/docs pnpm sync`, then the same variables with `pnpm exec next dev -p <port>`, and open `/install/`. The cards sit in a two-column grid and stack to one column on a phone. - **Classic offline docs:** in `offlinedocs/`, run `pnpm install`, `pnpm copy-images`, and `pnpm exec next dev -p <port>`, and open `/install/`. The cards render as a bulleted link list with descriptions, and the tip renders as an alert. ## Not in this PR - Cards on the docs home page: #32714 ([DOCS-1904](https://linear.app/codercom/issue/DOCS-1904)). - New pages that need a tested run first: create your first template ([DOCS-1783](https://linear.app/codercom/issue/DOCS-1783)), an air-gapped Helm install on EKS or AKS ([DOCS-1798](https://linear.app/codercom/issue/DOCS-1798)), and a small reference architecture ([DOCS-1572](https://linear.app/codercom/issue/DOCS-1572)). - Sidebar moves and renames ([DOCS-1569](https://linear.app/codercom/issue/DOCS-1569)). - Pre-existing issues on `prepare/airgap.md`, which this PR links to: it says the built-in database downloads PostgreSQL from `repo1.maven.org`, but `cli/server.go` uses `repo.maven.apache.org`, and its first sentence says all features are supported offline without the hosted-service exception this PR adds to the requirements page. Known tradeoff: platform versions (Kubernetes 1.19, Helm 3.5, and so on) appear on both the requirements page and each platform page, so a version bump has to update both. ## Testing - `make gen/docs-manifest` and `make fmt/markdown`. - `make lint/emdash lint/docs-html lint/docs-manifest lint/markdown lint/docs-redirects`: all pass. - Vale on the changed pages: 0 errors and 0 warnings on added lines. - Links and anchors on the changed pages resolve, including `admin/setup#tls--reverse-proxy` on the docs engine, and no page in `docs/` links to an anchor this PR removed from the landing page. - The docs engine single-version sync of this branch passes strict. - In headless Chromium, the docs engine renders ten cards on the install page with the expected titles and links, in light and dark at 1440px and in one column at 390px; the classic offline docs render the same links as lists. - doc-check skill in author self-check mode at `eaab2994c4`, with fixes in `e1d00f4f10`: - Fixed: the requirements page and the platform chooser said every feature works without internet access; both now say Coder runs offline, and that features that call a hosted service, such as a hosted AI provider, need it reachable. - Fixed: the phase 5 "When you can skip it" cell now reads "Never", like phase 3. - Rejected: a finding that no setup token exists. #32324 adds it (`cli/setuptoken.go`, the `Setup token:` prompt in `cli/login.go`, and `setup_token` in `SetupPageView.tsx`). - Not applied: renaming the "Air-gapped K3s quickstart" card, which is the name from the Nov 20 review. - An earlier run flagged the Helm chart default resources on the requirements page as wrong, but `helm/libcoder/templates/_coder.yaml` sets 2 CPU cores and 4 GiB as both requests and limits when `coder.resources` is empty, so the sentence stands. <details> <summary>Plan and decision log</summary> **Request.** Add pages where they're needed, and update the existing landing pages so it's obvious where to go to install the control plane right away. Don't rearrange the sidebar or rename pages. **Inputs.** - The install section skeleton IA draft in Notion (Docs proposals), which recommends Kubernetes as the golden path and air-gap first. - Feedback from the Nov 4 install docs review with Stephen Kirby and Ben, the Nick and Ian 1:1 (Nov 4), and the Nick and Ben 1:1 (Nov 5). - The Nick and Ben weekly (Nov 20): the landing page still read as text-heavy and didn't tell a reader where to go. The bar is the GitLab and Mattermost install pages. Agreed: cards at the top, the text moved to an intro page, and air-gapped and production paths visually distinct. **What the feedback changed.** - Kirby's three questions (network-gapped, cloud or on premises, VMs or containers) open the platform chooser, Install the control plane. - Kirby's point was "plan once, deploy once": planning matters, but most of the lost time comes after IT approval. So readers can install first, and Plan and Prepare stay visible as recommendations, with a "When you can skip it" column, on the Production deployment process page. - The review called out the missing path from evaluation to production, which is now a section of the Production deployment process page. - Kirby's golden path is an enterprise past approval installing with Helm on air-gapped EKS or AKS. The K3s tutorial covers single-node evaluation only, so that gap is filed as DOCS-1798 instead of being written here without a tested run. - Nov 20: the landing page became six cards in two groups, following GitLab's install page (requirements, methods, offline, reference architectures, upgrades) and Mattermost's evaluate-to-production journey. The prose moved inward rather than being cut: planning to the new page, platform choice and offline notes to the chooser. - Nov 24: Nick asked for cards for the high-traffic pages on the install landing page. With no page-view data reachable, a third group, Common tasks, follows the install pages with the most Algolia result impressions, and Ben's caution against card sprawl keeps it to four. Cards for the docs home page, built first by mistake, moved to their own PR, #32714. #31869 had merged, so the branch is rebased onto `main` without its commits. **Choices made.** - Requirements traced to code: Helm chart default resources (`helm/libcoder/templates/_coder.yaml`), Kubernetes version (`helm/coder/Chart.yaml` `kubeVersion`), built-in PostgreSQL download (`cli/server.go`), and the Kubernetes starter template's code-server install (`examples/templates/kubernetes/main.tf`). - Cards are a docs-engine remark plugin over a plain link list (DOCS-1795, coder/docs-engine#388), not JSX, so the page reads the same on GitHub and in the classic offline docs. Each card description is one sentence and avoids abbreviations that would need expanding. - The new page is the first child of Install, so the sidebar reads as the process followed by its five phases. - Ian's suggestion to use includes for repeated content (such as the air-gap Dockerfile) is deferred. This PR repeats only short routing sentences. </details> --- _This PR was generated by Coder Agents on behalf of @nickvigilante._ --------- Co-authored-by: Ian Evans <5760366+ianjevans@users.noreply.github.com> |
||
|
|
5f4bb0ddc1 |
docs: add side padding to Agent Relay architecture diagram (#32694)
The labels on the left of the Agent Relay architecture diagram sit right against the frame on [the Agent Relay page](https://coder.com/docs/ai-coder/agent-relay). The image had only 4px of margin on the sides, so the docs frame clipped close to the text. This adds 36px of background on the left and right of `agent-relay-stack.png` to match the top margin. No markdown changes. | Before | After | | --- | --- | |  |  | "After" is the live page with the new image swapped in. --- _Generated by Coder Agents on behalf of @bpmct._ |
||
|
|
c7b144cc76 |
fix(coderd/x/chatd): prevent a chat stream relay deadlock on repeated episode selection (#31187)
Stacked on #31196, which must merge first. When a chat's worker runs on the same replica as the stream, the chat stream relay can deadlock with the in-process parts endpoint. Live model output then stops on that stream until the client reconnects, while saved messages, status and queue updates keep arriving. The stream loop configures the relay forwarder after every newer snapshot, and queueing a message, deleting or promoting a queued one, interrupting, and recording a retry keep the episode. The forwarder sent a selection each time, and the endpoint answers each one by sending the episode again from `seq` 1, so K updates on an N-part episode moved about K times N parts. While the stream loop reads slowly, the resent parts fill the buffers and the endpoint's serve loop waits to send. Three unread selections fill the pipe's one-slot channel, the endpoint's selection reader and its one-slot channel to the serve loop, and the forwarder's next `WriteControl` never returns. - The forwarder sends a selection only on a new connection or when the target changes. Before #31196, only a repeated selection restarted live output after the part buffer dropped a slow subscriber. - The endpoint's selection reader replaces an unread selection instead of waiting, so the endpoint does not depend on how a client sends selections. After the first change the forwarder cannot practically reach the cycle, since it drops other episodes' parts without waiting. Dropping one loses nothing, because every selection starts again from `seq` 1. <details> <summary>Investigation and decision log</summary> ### Evidence `TestStreamRelayForwarderSelectsOnlyChangedTargets` configures one 200-part episode 10 times: before the forwarder change it sees 10 selections and 2000 parts, after it 1 selection and 200 parts. `TestStreamPartsEndpointLatestSelectionWinsWhileBlocked` fails in 10 of 10 runs without the reader change and with a 15-slot queue that replaces nothing. `TestStreamRelayForwarderDeliversLivePartsAfterSameEpisodeReconfigures` stalls the stream loop until the buffers fill, configures the same episode 1000 times, then requires a new part to arrive; it fails in 20 of 20 runs with both changes reverted and passes with either one alone. All three pass with `-race -count=20`. A goroutine dump taken with the world stopped, from a test that used the real forwarder, local dialer and part buffer with a 2000-part episode, shows the four goroutines at the waits described above and every buffer full. The deadlock formed in 20 of 20 runs under `-race`, after 4 to 384 same-episode selections. After the test read every buffered part, added live parts, configured the relay 11 more times (once for a new episode) and fired the buffer's send timeout, no part arrived. ``` F goroutine 73 [select]: streamPartsChannelClientTransport.WriteControl stream_parts_transport.go:142 <- (*streamRelayForwarder).loop.func4 stream_relay.go:148 <- loop stream_relay.go:207 R goroutine 74 [select]: streamPartsEndpoint.serve.func1() stream_parts.go:84 E goroutine 83 [select]: streamPartsChannelServerTransport.WriteEvents stream_parts_transport.go:120 <- streamPartsEndpoint.serve stream_parts.go:169 L goroutine 84 [select]: (*streamPartsTransportSession).readLoop stream_parts_transport.go:236 f.parts=128/128 s.parts=128/128 eventsCh=128/128 controlCh=1/1 SelectEpisode started=13 returned=12 ``` A test goroutine in place of the stream loop dropped repeated parts and spent a fixed sync time on each hint before it selected the same episode again (200 hints, 3 runs per row, real clock): | Sync time per hint | Hint interval | Deadlock formed | |--------------------|---------------|-----------------| | 1 ms | 1 ms | 1 of 3 | | 5 ms | 5 ms | 1 of 3 | | 1 ms | 2 ms or 5 ms | 0 of 6 | | 5 ms | 10 ms | 0 of 3 | The deadlock formed only when selections arrived about as fast as the stream loop handled them. How often that happens in production is not measured. Selecting a new episode every time under the same pressure did not deadlock in 300 of 300 iterations, because the forwarder drops parts of other episodes without waiting for the stream loop. Over the WebSocket transport with the pipeline full, 1263 selections over 2999 iterations all returned; when the stream loop then stopped reading, the server heartbeat closed the parts connection about 35 seconds after it opened, and the forwarder dialed again once the stream loop read again. ### Decisions - `WriteControl` keeps its waiting send: the reader no longer waits after reading the pipe, so the send returns, and replacing there changed no test result. - Replaced `TestStreamRelayLivePartsAfterSameEpisodeReselects`, which waited for full buffers before every selection and so relied on the replays the forwarder change removes, with a test that fills the buffers once by stalling the stream loop. - Rejected: having the serve loop read selections while it waits in `WriteEvents`. The serve loop would have to abandon a send in progress and drop its part, a larger change with the same result. </details> > 🤖 This PR was created with the help of Coder Agents. |
||
|
|
1d488fca54 |
test(agent): remove startup script from TestAgent_ReconnectNoLifecycleReemit (#32737)
## TL;DR `TestAgent_ReconnectNoLifecycleReemit` failed once on a Windows nightly run. The test checks that an agent does not report its lifecycle states a second time after it reconnects. Before that check, it waited up to 10 seconds for a startup script, `echo hello`, to finish. On the Windows runner the shell process took 11 seconds, so the test failed during setup and never reached the reconnect check. The script is not needed for what the test checks, so this PR removes it. The test no longer depends on how fast the host shell starts. Refs https://linear.app/codercom/issue/CORE-665/flake-testagent-reconnectnolifecyclereemit-windows-startup-readiness <details> <summary>How to navigate this PR</summary> - Test code only. One file, 5 lines deleted, no production change. - `agent/agent_test.go`: the `Scripts` entry is removed from the manifest in `TestAgent_ReconnectNoLifecycleReemit`. Check that nothing later in the test reads the script or its output. </details> <details> <summary>Implementation</summary> - `agent/agent_test.go`: removed the `echo hello` startup script from the manifest passed to `agenttest.NewClient`. - The wait for the `ready` state is unchanged. With no start scripts the agent still reports `starting` then `ready`, so the wait now depends on the agent alone. - The wait was not raised to a longer timeout. That would make the failure less likely but leave the dependency on the host shell in place. - No reconnect coverage is given up. The agent reports `ready` only after start scripts return, so the script had always exited before the test disconnected. The only script work that could overlap the reconnect was its completion report, and the test has no assertion on it. </details> <details> <summary>Expected Output</summary> - The test reaches the `ready` state without starting a shell process. - After a disconnect and reconnect, the reported lifecycle states are the same list as before: `starting`, `ready`. - If the agent reports its states again after a reconnect, the test still fails with "lifecycle states should not be re-reported after reconnect". </details> <details> <summary>Testing</summary> - `TestAgent_ReconnectNoLifecycleReemit` in `agent/agent_test.go` is the only test changed. - `go test ./agent -run '^TestAgent_ReconnectNoLifecycleReemit$' -count=3` passes on macOS. - Checked that the test still catches the bug it guards. With the agent temporarily changed to report its states again on every reconnect, the test without the script failed with the expected states `starting`, `ready` and the actual states `starting`, `ready`, `starting`, `ready`. This check was run on an earlier `main` commit with the same test change, and the agent change was reverted. - Forced the original failure locally to confirm the cause. With the script changed to `sleep 11` the old test failed at the same wait with the same message as the nightly run. With `sleep 9` it passed. - Not run on Windows locally. The Windows CI job on this PR is the first Windows run of the change. </details> |
||
|
|
59e3889656 |
docs: redirect Customize your template pages to Template Fundamentals course (#31639)
Removes the four Quickstart "Customize your template" pages, their sidebar entries, and their seven screenshots, and redirects the old URLs to the Get started page. Closes DOCS-1476. coder/coder#31133 was closed for this reason. The Get started page's **What's next?** section now has two cards: one for the Template Fundamentals course at `https://coder.com/learn/coder-quickstart`, which replaces the removed pages, and one for the full course catalog at `https://coder.com/learn`. The cards use the `<div class="cards">` syntax from coder/docs-engine#388, and GitHub renders the same source as a plain link list. The image-management guide links to the course too. | Old page | Destination | |---|---| | `/docs/get-started/customize-your-template` | `/docs/get-started` | | `/docs/get-started/customize-your-template/add-a-language` | same | | `/docs/get-started/customize-your-template/install-command-line-tools` | same | | `/docs/get-started/customize-your-template/authenticate-to-github` | same | The rules use the relative format from #30805 (`get-started/customize-your-template...` to `get-started`), which also blocks removed routes without a redirect. The course defers the private-repository (`coder_external_auth`) lesson, so the Get started page keeps a short numbered procedure for it: edit the template, add the data source, publish, authenticate on the create-workspace form, and clone over HTTPS. Generated by Coder Agents on behalf of @nickvigilante. --------- Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> |
||
|
|
2a30d45465 | feat(helm): add optional NetworkPolicy to charts (#31792) |