Commit Graph
16784 Commits
Author SHA1 Message Date
dependabot[bot] d798ce4e5b chore: bump cloud.google.com/go/compute/metadata from 0.9.1 to 0.10.0 (#30089)
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cloud.google.com/go/compute/metadata&package-manager=go_modules&previous-version=0.9.0&new-version=0.10.0)](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>
2026-09-29 11:34:58 +00:00
dependabot[bot] cbdec07232 chore: bump google.golang.org/api from 0.298.0 to 0.299.0 (#30091)
Bumps
[google.golang.org/api](https://github.com/googleapis/google-api-go-client)
from 0.298.0 to 0.299.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/google-api-go-client/releases">google.golang.org/api's
releases</a>.</em></p>
<blockquote>
<h2>v0.299.0</h2>
<h2><a
href="https://github.com/googleapis/google-api-go-client/compare/v0.298.0...v0.299.0">0.299.0</a>
(2026-09-21)</h2>
<h3>Features</h3>
<ul>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3734">#3734</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/05c5fb0f4f9ea8063f2606ed90c781028a19ff21">05c5fb0</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3737">#3737</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/3b54280e94b227fc3b47639268d81018c8586e77">3b54280</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3738">#3738</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/7089c4032094bc77e67415c943e0570ccd4f515e">7089c40</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md">google.golang.org/api's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/googleapis/google-api-go-client/compare/v0.298.0...v0.299.0">0.299.0</a>
(2026-09-21)</h2>
<h3>Features</h3>
<ul>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3734">#3734</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/05c5fb0f4f9ea8063f2606ed90c781028a19ff21">05c5fb0</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3737">#3737</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/3b54280e94b227fc3b47639268d81018c8586e77">3b54280</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3738">#3738</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/7089c4032094bc77e67415c943e0570ccd4f515e">7089c40</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/38da4c87c2f63f47f7167d3b43bc6ec6423c19a8"><code>38da4c8</code></a>
chore(main): release 0.299.0 (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3735">#3735</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/87958bdc01936e4bbb2d41e8374d78acc7aa16b3"><code>87958bd</code></a>
chore(all): update all (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3740">#3740</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/7089c4032094bc77e67415c943e0570ccd4f515e"><code>7089c40</code></a>
feat(all): auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3738">#3738</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/3b54280e94b227fc3b47639268d81018c8586e77"><code>3b54280</code></a>
feat(all): auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3737">#3737</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/adf75d8bc6dd81bd815b9b9a54fc398723eb7896"><code>adf75d8</code></a>
chore(all): update all (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3721">#3721</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/62460e9883adb04270eebb31f96cd89d67ae5931"><code>62460e9</code></a>
chore: upgrade repo to use 1.27 latest, 1.26 earliest (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3736">#3736</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/05c5fb0f4f9ea8063f2606ed90c781028a19ff21"><code>05c5fb0</code></a>
feat(all): auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3734">#3734</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/237a7dd355e961db19de9c7a9b768c19b567e389"><code>237a7dd</code></a>
testing: refine vet checks (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3733">#3733</a>)</li>
<li>See full diff in <a
href="https://github.com/googleapis/google-api-go-client/compare/v0.298.0...v0.299.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=google.golang.org/api&package-manager=go_modules&previous-version=0.298.0&new-version=0.299.0)](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>
2026-09-29 11:19:55 +00:00
Sas Swart 813b8c151f feat: make AI Gateway content recording optional (#30031)
Add `--ai-gateway-disable-content-recording`, which stops user prompts,
tool
calls and model thoughts from being stored. Cost control reads none of
those
tables, so budgets, spend accounting and enforcement are unaffected.

A dropped record is still logged, so pairing the option with
`--ai-gateway-structured-logging-source=gateway` keeps the SIEM export
for
records that are never persisted. The gateway warns at startup when
content is
dropped while coderd is the only emitter, since those records then reach
neither
the database nor a SIEM.

Covered end to end for the embedded and the standalone gateway, and
documented
alongside cost controls.

<details>
<summary>Why the stack is ordered this way</summary>

The final design is a chain of recorder decorators:

    +---------------------+
    |    AsyncRecorder    |  all records except the interception start
    +---------------------+
    |     LogRecorder     |  emit the structured record
    +---------------------+
    | ValidatingRecorder  |  refuse malformed records
    +---------------------+
    |  caller middleware  |  record policy, e.g. drop content
    +---------------------+
    |    TraceRecorder    |
    +---------------------+
    |    DRPCRecorder     |  acquire client, send to coderd
    +---------------------+

Ordering constraints:

- The record type constants (1) are the vocabulary both emitters and the
  validator use, so they come first.
- Validation (5) rejects unset timestamps, so records must already be
stamped
where they are created (3). Stamping at creation leaves
`WrappedRecorder`
  doing nothing but client acquisition, which is why it is folded into
  `DRPCRecorder` (4) and not before.
- coderd's server-time fallback (2) is what keeps a gateway of an older
version
  from persisting zero times once the gateway owns stamping (3).
- PRs 1 to 5 change no user-visible surface. Each deployment option then
lands
with the code that reads it: the log source with gateway-side emission
(6),
content recording with the filter that drops the records (7). Pool
options are
plumbed to the serving pool in 6, where the first option that needs them
  arrives, rather than as an unused hook beforehand.

</details>

---
🤖 Raised by [Coder Agents](https://coder.com) on behalf of @SasSwart.
2026-09-29 11:48:53 +02:00
Sas Swart 23fb35d185 feat: let the AI Gateway emit the structured interception records (#30030)
coderd emitted the structured interception records as they arrived over
DRPC, so
a record the gateway never sends cannot be exported.

- Add `--ai-gateway-structured-logging-source` (`coderd`, `gateway`,
`both`) and
teach the gateway's `LogRecorder` to emit the same format where the
records
originate. Gateway lines omit `thread_parent_id` and `thread_root_id`,
which
  are resolved by a database lookup only coderd can perform.
- Reaching the serving pool required repairing the pool options: they
were
derived at construction sites and discarded, so the server always built
its
pool with the defaults. They are now derived from the deployment
configuration
in one place and passed to the pool that serves requests. The server
reports
those options, and its ownership of the `key_pool_state` collector, so a
second
  registration cannot silently reappear and panic startup.
- The standalone gateway inherits both structured logging options, since
it is
  now one of the processes that can emit.

This is the keystone of the stack: the flag, the mechanism that carries
it and
the behavior it selects land together, so
`TestAIGatewayStart_InheritedOptions`
and the gateway help output stay truthful at every commit.

<details>
<summary>Why the stack is ordered this way</summary>

The final design is a chain of recorder decorators:

    +---------------------+
    |    AsyncRecorder    |  all records except the interception start
    +---------------------+
    |     LogRecorder     |  emit the structured record
    +---------------------+
    | ValidatingRecorder  |  refuse malformed records
    +---------------------+
    |  caller middleware  |  record policy, e.g. drop content
    +---------------------+
    |    TraceRecorder    |
    +---------------------+
    |    DRPCRecorder     |  acquire client, send to coderd
    +---------------------+

Ordering constraints:

- The record type constants (1) are the vocabulary both emitters and the
  validator use, so they come first.
- Validation (5) rejects unset timestamps, so records must already be
stamped
where they are created (3). Stamping at creation leaves
`WrappedRecorder`
  doing nothing but client acquisition, which is why it is folded into
  `DRPCRecorder` (4) and not before.
- coderd's server-time fallback (2) is what keeps a gateway of an older
version
  from persisting zero times once the gateway owns stamping (3).
- PRs 1 to 5 change no user-visible surface. Each deployment option then
lands
with the code that reads it: the log source with gateway-side emission
(6),
content recording with the filter that drops the records (7). Pool
options are
plumbed to the serving pool in 6, where the first option that needs them
  arrives, rather than as an unused hook beforehand.

</details>

---
🤖 Raised by [Coder Agents](https://coder.com) on behalf of @SasSwart.
2026-09-29 11:48:52 +02:00
Seth Shelnutt 5c66606501 feat(site): configure Claude Platform for AWS in the provider form (#29050)
This PR adds the required UI changes for configuring Claude Platform for AWS.

- Adds a **Platform** dropdown to the Anthropic form, using the same
shared select component as Bedrock: **Anthropic API** or **Claude
Platform for AWS**. Claude Platform remains a settings variant, not a
new provider type.
- Marks Claude Platform **Experimental** and exposes region, workspace
ID, endpoint, and an optional workspace API key. There is no
authentication-mode selector or per-provider AWS access key, Role ARN,
or external ID.
- Explains credential precedence: allowed BYOK, then stored provider
keys, then the gateway's ambient AWS credentials. Rejected keys or an
exhausted pool do not fall back to IAM. Keyless providers share the
gateway's ambient identity, while retaining distinct workspace IDs and
Coder provider attribution.
- Preserves every stored key ID when an edit leaves the key field blank
or masked. Entering a replacement key retains the existing replacement
behavior. No new key-removal control or pool editor is introduced.
- Keeps generated endpoints aligned with region changes without
rewriting custom proxy URLs. The platform remains fixed during editing.
List/edit icons distinguish Claude Platform with the AWS glyph.
- Makes stored keys optional for ordinary Anthropic BYOK configuration
without relaxing other providers' requirements or adding anonymous
Messages support. Bedrock credential controls remain unchanged.

## Validation

- 114 Vitest form/mapping tests passed, including multi-key
preservation, optional keys, platform selection, validation, and
endpoint behavior.
- 37 browser-backed Storybook tests passed across the form and update
page.
- Smoke-tested against an AWS sandbox account.

Generated by Coder Agents on behalf of @johnstcn and @Shelnutt2.
Co-authored-by: Cian Johnston <cian@coder.com>
2026-09-29 09:52:18 +01:00
Sas Swart 5be9f16b6b feat(aibridge): refuse records with an unset timestamp (#30029)
Timestamps are stamped by the gateway. A record that arrives with an
unset one is
persisted as year one, which skews budget periods, retention and the
sessions
timeline. A `timestamptz` column cannot report that, so the record is
refused
where it is produced, and the reason logged: most records are dispatched
asynchronously and their errors are discarded.

Only timestamps are checked. Every other property is left to the
database, so
this recorder cannot diverge from it; the test asserts that directly by
delegating a record with a non-UUID ID and empty initiator, provider and
model.
Deciding where the other checks belong is #30045.

## Stack

| # | PR | Change |
|---|----|--------|
| 1 | #29916 | Share the structured log format definition |
| 2 | #29917 | coderd substitutes its own time for an unset one |
| 3 | #29918 | Stamp records where they are created |
| 4 | #29919 | Fold client acquisition into `DRPCRecorder` |
| 5 | #30029 | Refuse records that cannot be recorded correctly |
| 6 | #30030 | `--ai-gateway-structured-logging-source` + gateway
emission |
| 7 | #30031 | `--ai-gateway-disable-content-recording` + record filter
|

Each PR targets the one before it. Together they are #29664, which stays
open
until the stack is merged; the tip of the stack is byte-identical to its
tree.

<details>
<summary>Why the stack is ordered this way</summary>

The final design is a chain of recorder decorators:

    +---------------------+
    |    AsyncRecorder    |  all records except the interception start
    +---------------------+
    |     LogRecorder     |  emit the structured record
    +---------------------+
    | ValidatingRecorder  |  refuse malformed records
    +---------------------+
    |  caller middleware  |  record policy, e.g. drop content
    +---------------------+
    |    TraceRecorder    |
    +---------------------+
    |    DRPCRecorder     |  acquire client, send to coderd
    +---------------------+

Ordering constraints:

- The record type constants (1) are the vocabulary both emitters and the
  validator use, so they come first.
- Validation (5) rejects unset timestamps, so records must already be
stamped
where they are created (3). Stamping at creation leaves
`WrappedRecorder`
  doing nothing but client acquisition, which is why it is folded into
  `DRPCRecorder` (4) and not before.
- coderd's server-time fallback (2) is what keeps a gateway of an older
version
  from persisting zero times once the gateway owns stamping (3).
- PRs 1 to 5 change no user-visible surface. Each deployment option then
lands
with the code that reads it: the log source with gateway-side emission
(6),
content recording with the filter that drops the records (7). Pool
options are
plumbed to the serving pool in 6, where the first option that needs them
  arrives, rather than as an unused hook beforehand.

</details>

---
🤖 Raised by [Coder Agents](https://coder.com) on behalf of @SasSwart.
2026-09-29 10:47:23 +02:00
Sas Swart 868dcd9c75 refactor: fold AI Gateway recorder client acquisition into DRPCRecorder (#29919)
`WrappedRecorder` existed to resolve a client per record call and to
stamp
timestamps. With stamping moved to the creation sites, resolving a
client is all
it did, and `DRPCRecorder` is the only recorder that needs one.

Give `DRPCRecorder` the client function and delete `WrappedRecorder`, so
the
chain has one fewer layer and `NewRecorder` takes the recorder it
decorates.

Each PR targets the one before it. Together they are #29664, which stays
open
until the stack is merged; the tip of the stack is byte-identical to its
tree.

<details>
<summary>Why the stack is ordered this way</summary>

The final design is a chain of recorder decorators:

    +---------------------+
    |    AsyncRecorder    |  all records except the interception start
    +---------------------+
    |     LogRecorder     |  emit the structured record
    +---------------------+
    | ValidatingRecorder  |  refuse malformed records
    +---------------------+
    |  caller middleware  |  record policy, e.g. drop content
    +---------------------+
    |    TraceRecorder    |
    +---------------------+
    |    DRPCRecorder     |  acquire client, send to coderd
    +---------------------+

Ordering constraints:

- The record type constants (1) are the vocabulary both emitters and the
  validator use, so they come first.
- Validation (5) rejects unset timestamps, so records must already be
stamped
where they are created (3). Stamping at creation leaves
`WrappedRecorder`
  doing nothing but client acquisition, which is why it is folded into
  `DRPCRecorder` (4) and not before.
- coderd's server-time fallback (2) is what keeps a gateway of an older
version
  from persisting zero times once the gateway owns stamping (3).
- PRs 1 to 5 change no user-visible surface. Each deployment option then
lands
with the code that reads it: the log source with gateway-side emission
(6),
content recording with the filter that drops the records (7). Pool
options are
plumbed to the serving pool in 6, where the first option that needs them
  arrives, rather than as an unused hook beforehand.

</details>

---
🤖 Raised by [Coder Agents](https://coder.com) on behalf of @SasSwart.
2026-09-29 10:47:22 +02:00
Sas Swart a69d89bae6 refactor(aibridge): stamp records when they are created (#29918)
Timestamps were set in `WrappedRecorder`, on the goroutine that
delivered the
record, and in local time. A record could therefore be stamped after the
interception it belongs to had ended, and the value depended on delivery
scheduling rather than on when the event happened.

Stamp each record where it is created, in UTC. `WrappedRecorder` is left
resolving clients, which is all it now does.

Each PR targets the one before it. Together they are #29664, which stays
open
until the stack is merged; the tip of the stack is byte-identical to its
tree.

<details>
<summary>Why the stack is ordered this way</summary>

The final design is a chain of recorder decorators:

    +---------------------+
    |    AsyncRecorder    |  all records except the interception start
    +---------------------+
    |     LogRecorder     |  emit the structured record
    +---------------------+
    | ValidatingRecorder  |  refuse malformed records
    +---------------------+
    |  caller middleware  |  record policy, e.g. drop content
    +---------------------+
    |    TraceRecorder    |
    +---------------------+
    |    DRPCRecorder     |  acquire client, send to coderd
    +---------------------+

Ordering constraints:

- The record type constants (1) are the vocabulary both emitters and the
  validator use, so they come first.
- Validation (5) rejects unset timestamps, so records must already be
stamped
where they are created (3). Stamping at creation leaves
`WrappedRecorder`
  doing nothing but client acquisition, which is why it is folded into
  `DRPCRecorder` (4) and not before.
- coderd's server-time fallback (2) is what keeps a gateway of an older
version
  from persisting zero times once the gateway owns stamping (3).
- PRs 1 to 5 change no user-visible surface. Each deployment option then
lands
with the code that reads it: the log source with gateway-side emission
(6),
content recording with the filter that drops the records (7). Pool
options are
plumbed to the serving pool in 6, where the first option that needs them
  arrives, rather than as an unused hook beforehand.

</details>

---
🤖 Raised by [Coder Agents](https://coder.com) on behalf of @SasSwart.
2026-09-29 10:47:22 +02:00
Sas Swart 6054e46060 fix(coderd/aibridgedserver): use server time when a record reports no time (#29917)
Records arrive from a gateway process that may run a different version,
so a
record can arrive with no timestamp. Those were persisted verbatim as
the zero
time, placing the row in year one and skewing budget periods, retention
and the
sessions timeline.

Substitute the server's own time instead, and warn with the field and
interception so the substitution is visible. This is what keeps an older
gateway
correct once the gateway owns stamping, in the next PR.

## Stack

| # | PR | Change |
|---|----|--------|
| 1 | #29916 | Share the structured log format definition |
| 2 | #29917 | coderd substitutes its own time for an unset one |
| 3 | #29918 | Stamp records where they are created |
| 4 | #29919 | Fold client acquisition into `DRPCRecorder` |
| 5 | #30029 | Refuse records that cannot be recorded correctly |
| 6 | #30030 | `--ai-gateway-structured-logging-source` + gateway
emission |
| 7 | #30031 | `--ai-gateway-disable-content-recording` + record filter
|

Each PR targets the one before it. Together they are #29664, which stays
open
until the stack is merged; the tip of the stack is byte-identical to its
tree.

<details>
<summary>Why the stack is ordered this way</summary>

The final design is a chain of recorder decorators:

    +---------------------+
    |    AsyncRecorder    |  all records except the interception start
    +---------------------+
    |     LogRecorder     |  emit the structured record
    +---------------------+
    | ValidatingRecorder  |  refuse malformed records
    +---------------------+
    |  caller middleware  |  record policy, e.g. drop content
    +---------------------+
    |    TraceRecorder    |
    +---------------------+
    |    DRPCRecorder     |  acquire client, send to coderd
    +---------------------+

Ordering constraints:

- The record type constants (1) are the vocabulary both emitters and the
  validator use, so they come first.
- Validation (5) rejects unset timestamps, so records must already be
stamped
where they are created (3). Stamping at creation leaves
`WrappedRecorder`
  doing nothing but client acquisition, which is why it is folded into
  `DRPCRecorder` (4) and not before.
- coderd's server-time fallback (2) is what keeps a gateway of an older
version
  from persisting zero times once the gateway owns stamping (3).
- PRs 1 to 5 change no user-visible surface. Each deployment option then
lands
with the code that reads it: the log source with gateway-side emission
(6),
content recording with the filter that drops the records (7). Pool
options are
plumbed to the serving pool in 6, where the first option that needs them
  arrives, rather than as an unused hook beforehand.

</details>

---
🤖 Raised by [Coder Agents](https://coder.com) on behalf of @SasSwart.
2026-09-29 10:47:21 +02:00
Sas Swart 8a66160df9 refactor: share the AI Gateway structured log format definition (#29916)
The structured interception log format was defined by literals in
`coderd/aibridgedserver`: the log marker, the user agent metadata key,
and a
`record_type` string per record. Customer SIEM pipelines parse on those
values.

Move them to `aibridge/recorder`, beside the recorder chain, so that a
second
emitter of this format cannot drift from coderd's. The emitted values
are
unchanged.

## Stack

| # | PR | Change |
|---|----|--------|
| 1 | #29916 | Share the structured log format definition |
| 2 | #29917 | coderd substitutes its own time for an unset one |
| 3 | #29918 | Stamp records where they are created |
| 4 | #29919 | Fold client acquisition into `DRPCRecorder` |
| 5 | #30029 | Refuse records that cannot be recorded correctly |
| 6 | #30030 | `--ai-gateway-structured-logging-source` + gateway
emission |
| 7 | #30031 | `--ai-gateway-disable-content-recording` + record filter
|

Each PR targets the one before it. Together they are #29664, which stays
open
until the stack is merged; the tip of the stack is byte-identical to its
tree.

<details>
<summary>Why the stack is ordered this way</summary>

The final design is a chain of recorder decorators:

    +---------------------+
    |    AsyncRecorder    |  all records except the interception start
    +---------------------+
    |     LogRecorder     |  emit the structured record
    +---------------------+
    | ValidatingRecorder  |  refuse malformed records
    +---------------------+
    |  caller middleware  |  record policy, e.g. drop content
    +---------------------+
    |    TraceRecorder    |
    +---------------------+
    |    DRPCRecorder     |  acquire client, send to coderd
    +---------------------+

Ordering constraints:

- The record type constants (1) are the vocabulary both emitters and the
  validator use, so they come first.
- Validation (5) rejects unset timestamps, so records must already be
stamped
where they are created (3). Stamping at creation leaves
`WrappedRecorder`
  doing nothing but client acquisition, which is why it is folded into
  `DRPCRecorder` (4) and not before.
- coderd's server-time fallback (2) is what keeps a gateway of an older
version
  from persisting zero times once the gateway owns stamping (3).
- PRs 1 to 5 change no user-visible surface. Each deployment option then
lands
with the code that reads it: the log source with gateway-side emission
(6),
content recording with the filter that drops the records (7). Pool
options are
plumbed to the serving pool in 6, where the first option that needs them
  arrives, rather than as an unused hook beforehand.

</details>

---
🤖 Raised by [Coder Agents](https://coder.com) on behalf of @SasSwart.
2026-09-29 10:47:21 +02:00
TJ ede95b8581 feat(site/src/pages/AISettingsPage/SpendPage): put the spend search first and narrow the organization picker (#30080)
> 🤖 This PR was generated by Coder Agents on behalf of @tracyjohnsonux.

On the AI settings User spend page, the organization picker came first
in the filter row and grew to take up space. This PR moves the
provider/client/model search to the far left and puts the organization
picker second, with a fixed width (`w-full sm:w-60`, the same as the
Models page picker).

Only the order and sizing change. Permission gates and behavior are
unchanged: the search still shows only to users who can view every
session, and the picker still shows only when there is more than one
organization.

Verified with the existing SpendPage Vitest suite (30 tests), `pnpm
check`, `pnpm lint`, and by rendering the `Users` and `Mobile` Storybook
stories: on desktop the search is first and the org picker is 240px; on
mobile the picker wraps to full width.
2026-09-29 10:46:50 +02:00
Seth ShelnuttandCian Johnston faa9815cd6 feat: configure Claude Platform for AWS on Anthropic providers (#29049)
This PR adds configuration plumbing for Claude Platform on AWS

## Summary

Makes Claude Platform for AWS configurable as a settings variant of
`type=anthropic`, discriminated by `_type: "claude_platform_aws"`.
Settings contain only `region` and `workspace_id`, plus the schema
version. No new provider type or database enum is introduced.

The API persists and projects those settings to the gateway. Provider
keys can be added or removed independently: allowed BYOK takes
precedence, followed by stored keys, then ambient SigV4 when neither key
source applies. Model-availability hints and keyless provider
construction reflect that ambient capability. Rejected or exhausted keys
do not fall back to IAM.

Removes Claude Platform-specific AWS identity fields, secret
redaction/merge behavior, external-ID handling, and mode/key consistency
checks. Bedrock configuration remains intact. Environment-based provider
seeding was removed upstream and is not restored. The Claude Platform
form and Experimental label remain follow-up work in #29050.

## Authentication limitation

Each Claude Platform provider uses either the gateway's ambient AWS
credentials when no provider keys are stored, or its stored API-key
pool. In either case, a client credential takes precedence when BYOK is
enabled. Rejected BYOK or an exhausted provider key pool does not fall
back to ambient IAM.

There is no per-provider AWS identity selection: keyless providers on
the same gateway share its ambient AWS credential chain and cannot
configure separate AWS access keys or assumed roles. Each provider still
has its own Claude Platform workspace ID and separate provider
attribution in Coder's usage/cost records; this does not imply separate
AWS billing accounts.

## Validation

- Race tests passed for SDK, daemon projection, db2sdk, chatprovider,
and targeted CLI/API configuration tests.
- Installed pre-commit hook passed, including generation, frontend/Go
lint, and build.
- Tests cover settings round trips, validation, adding/removing the last
key without settings changes, keyless construction, model availability,
and Bedrock regressions.

Generated by Coder Agents on behalf of @johnstcn and @Shelnutt2

Co-authored-by: Cian Johnston <cian@coder.com>
2026-09-29 09:20:31 +01:00
Seth ShelnuttandCian Johnston 10a22c8302 feat: support Claude Platform for AWS on the Anthropic provider (#29048)
## Summary

Adds Claude Platform for AWS as a variant of the Anthropic provider,
preserving the native Messages protocol and model IDs. Builds on the
merged SigV4 extraction in #29047. Configuration and UI follow in #29049
and #29050.

A provider-owned transport handles both bridged and passthrough
requests, sets the configured workspace header, and re-signs SDK
retries. Credential precedence is allowed BYOK, then the stored key
pool, then ambient AWS SigV4 when neither key source applies. Rejected
keys or an exhausted pool do not fall back to IAM. AWS configuration
loads lazily, so key-authenticated requests do not require working AWS
credentials.

There are no explicit authentication-mode, static AWS credential, Role
ARN, or external-ID fields for Claude Platform. Bedrock behavior and PRM
attribution remain separate. Anonymous Anthropic Messages support is out
of scope.

## Validation

- Full offline `go test -race ./aibridge/...` passed on this PR tip.
- Installed pre-commit hook passed, including generation, lint, and
build.
- Tests cover workspace-header signing, retries, key
precedence/failover, lazy credential recovery/cache, cancellation, and
stream lifetime.
- `TestClaudePlatformLive` sends a small real request through the bridge
when explicitly enabled. It was not run against AWS.

Co-authored-by: Cian Johnston <cian@coder.com>
2026-09-29 09:06:00 +01:00
Ethan e0dce46087 test: fix TestConnectInline_RedactsSensitiveValues on Windows (#30028)
Closes https://linear.app/codercom/issue/CODAGT-1203

`TestConnectInline_RedactsSensitiveValues` fails every time on Windows
in the [nightly
gauntlet](https://github.com/coder/coder/actions/runs/36376854646/job/108784351863).
It asserted on `connection refused`, but Windows words a refused dial
differently. PR CI only runs the `cli` and `agent` packages on Windows,
so we didn't catch it there.

To fix, the test now uses a private IP that the dial guard rejects
before dialling, so the error is the same on every OS and there's no
closed port for another test to grab.

Whilst here, I made production build the persisted connect error through
the same function the truncation test uses, rather than its own copy.
2026-09-29 17:19:42 +10:00
Ethan e982227ab1 fix(site/src): forward abort signals in chat queries (#30079)
Closes CODAGT-1218

The Agents page cancels and refetches its chat queries whenever the chat
watch socket reports a change. None of those query functions passed
React Query's `signal` to axios though, so a cancel just dropped the
promise, whilst the `GET /api/v2/chats` request underneath stayed open.

Usually that's harmless, as the request finishes shortly after anyway.
However, when one user's Chrome stopped reading responses on its HTTP/2
connection, every refetch left another request open on coderd. We ended
up with about 250 open `GET /api/v2/chats` requests per connection (Go's
HTTP/2 stream limit), which OOM killed a coderd pod. I'm not sure yet
why Chrome stopped reading, that's still open on the issue, but the
client shouldn't be piling up requests it has already thrown away.

To fix, we'll forward the signal in every chat query the watch handler
cancels or invalidates. I've also moved them to
`queryOptions`/`infiniteQueryOptions`, like `chatSearch` and the board's
`boardChats` already are, so React Query types the `signal` for us.

Most of the diff is tests. `toHaveBeenCalledWith` checks every argument,
so each existing assertion on these API calls now needs
`expect.any(AbortSignal)`, the same as `boardChats.test.ts` does.

Most other queries in `site/src/api/queries` don't forward the signal
either. I've left them alone for now, as they aren't cancelled in a loop
like these are.
2026-09-29 16:54:13 +10:00
Jaayden Halko e294af2bd1 chore(site): add advisory design-system color linting (#29830)
Add opt-in `pnpm lint:design-system` in `site/` using
`@shadcn/lint@0.2.0`, with only `no-raw-colors` enabled at warning
severity. Existing `pnpm lint` and CI enforcement remain unchanged while
the 187 existing findings are evaluated.

Upgrade `cn` from 0.2.4 to 0.3.2 so the application and linter use the
same supported grammar, and correct UI component discovery.

<details>
<summary>Rollout decisions and verification</summary>

- Start advisory rather than changing UI colors or adding broad
exceptions: the scan finds 177 undeclared-token uses, 8 raw palette
uses, and 2 literal SVG colors across 102 files.
- Keep all other shadcn rules disabled. The advisory configuration
preserves existing lint errors and generated/vendor exclusions; it does
not suppress failures with `|| true`.
- Pin `cn` to 0.3.2, the minimum version supported by the plugin's
grammar, rather than taking unrelated later releases. [Upstream
changelog](https://github.com/shadcn-ui/cn/blob/main/packages/cn/CHANGELOG.md).
- Removed the lint fixture test and Knip comment per review. Rechecked
formatting, Biome, full lint/type checks, and the advisory scan after
those removals. The advisory scan exits successfully with 187 warnings
and no grammar/discovery warnings.
- The frontend build and full unit suite passed before the review-only
removals. GitHub Actions also passed for that revision; updated checks
run on the latest push.
- Promote the rule to blocking enforcement separately after reviewing
and resolving the backlog. This is design-system linting, not WCAG
certification.

</details>

Generated by Coder Agents on behalf of @jaaydenh.
2026-09-29 13:43:17 +07:00
Bobby Ho dffa890d8f ci: add macOS runner telemetry and a stall detector to test-go-pg (#30050)
Add telemetry to diagnose intermittent macOS `test-go-pg` stalls and preserve timeout diagnostics.

- Log runner details at startup; sample load, swap, and `vm_stat` every second and `top` every 10 seconds to identify runner-wide pauses.
- Add stall detection to `cli` and `agent` `TestMain`, logging heap, GC, and goroutine counts when ticks arrive more than 5 seconds late.
- Run artifact uploads with `always() && !success()` so canceled test steps do not skip diagnostics.
- Add a `TEST_TIMEOUT` override: use 20m on macOS to leave room for goroutine dumps within the 30m job, retaining the 25m default for the nightly gauntlet.

Validated with race tests, binary compilation, `actionlint`, local macOS checks, and Makefile timeout checks.
2026-09-29 03:41:18 +00:00
Andrew Aquino f7a8612ae1 chore(site): enable prefer-template oxlint rule (#30065)
Moves
[prefer-template](https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-template)
out of the Oxlint migration backlog and sets it to `error`.

Two violations, autofixed with `pnpm oxlint --fix`

Verified with:
- `pnpm oxlint --deny-warnings`
- `pnpm biome lint --error-on-warnings`
- `pnpm tsc -p .`
2026-09-28 17:59:52 -07:00
d1597a583b feat(site/src/components/Filter/FilterCombobox): add a Clear all button once three chips are applied (#29876)
## Summary

Adds a Clear all button to the chip row once three or more chips are
applied. It sits after the search input, wraps with the chips, and
shares their height through `chipRowItemHeightClassName`, so the two
cannot drift apart.

Clear all empties the whole query, chips and search text alike, so
`owner:alice status:running outdated:true dev` becomes empty. It matches
the Workspaces empty state's Clear all, and it also removes the default
`owner:me`. It is a real button. While the menu is open, Tab from the
search input completes the highlighted row, so keyboard users reach
Clear all with Escape and then Tab. Enter works through the
`FilterComboboxRoot` handler that turns Enter into a click for any
focused button in the combobox. Activating Clear all while it has focus,
by keyboard or mouse, moves focus to the search input; a mouse click
without focus leaves focus where it was, except that on wider viewports
it moves focus to the search input while a category is open, because
Clear all closes the category's search field.

Any emitted query that drops the highlighted category row from the menu,
such as Clear all or removing the chip that kept a single-option
Template listed (remove button or Backspace), moves the highlight to the
first row that stays, so Enter after reopening the menu still opens a
category. A `value` change from the caller that drops the highlighted
row, such as the Workspaces empty state's Clear all, is repaired when
the input gains focus or Filters opens the menu.

Stacked on #29875, split out of #29426 so it can be reviewed on its own.

---

Generated with Coder Agents on behalf of @tracyjohnsonux.

---------

Co-authored-by: Jake Howell <jacob@coder.com>
Co-authored-by: Jake Howell <jake@hwll.me>
2026-09-28 16:51:41 -07:00
9abbd1170d feat(site/src): let filter categories hide while they offer one option (#29875)
## Summary

Leaves a filter category out of the menu while it offers at most one
choice, since filtering by it would not narrow the results. For example,
a deployment with a single template or organization no longer shows the
Template or Organization rows. An applied chip keeps its category listed
so it can still be changed, a failed lookup keeps it listed so it can
offer Retry, and typed filters such as `template:docker` keep working.

Hiding is opt-in with `FilterCategory.hideWhenSingleOption`, which
Workspaces sets on Template and Organization. When `getOptions("")`
omits values the results can contain (deprecated templates,
organizations without `audit_log:read`), the row can hide while its one
option would still narrow the results; this tradeoff is accepted by the
author, since a deployment with one template or organization already
shows everything. Inline categories (Status, Workspace is…) are
unaffected.

Hideable categories load their options when the filter renders. If the
menu opens first, it shows one skeleton placeholder row per submenu
category until they load; the list that replaces them can be shorter.
Typed text still matches a category whose options are loading, and a
failed load keeps the category in the menu while its Retry runs; a Retry
that returns at most one option removes the row, like any other
single-option category. On Workspaces the Template list reuses the
templates query the page already runs, so the only new page-load
requests are for Organizations: `GET /api/v2/organizations` and one
`POST /api/v2/authcheck`.

A hidden category's options are not offered as typeahead suggestions and
do not hold typed text back from the workspace search. Its name and
`key:` prefix still work.

Stacked on #29426, split out so it can be reviewed on its own.

---

Generated with Coder Agents on behalf of @tracyjohnsonux.

---------

Co-authored-by: Jake Howell <jacob@coder.com>
Co-authored-by: Jake Howell <jake@hwll.me>
2026-09-28 15:56:15 -07:00
c1bcd07e5d feat(site/src): redesign the workspace filter menu with flyouts and inline options (#29426)
## Summary

Improves mouse and touch interactions for the workspace FilterCombobox
while preserving its keyboard navigation.

The filter control (icon only) now opens a compact main menu with inline
status and workspace-state options, pointer flyouts for Owner, User,
Template, and Organizations, and a single-panel mobile flow. Applied
chips always render lowercase. Selected workspace attributes remain
single-select to match the existing workspace filtering UI.

Stacked on #29874 (removes the workspace result previews). Follows
#29111, which has merged. Split out and stacked on this PR: #29875 (hide
single-option categories), #29876 (Clear all), and #29872 (Owner shared
workspaces toggle).

<details>
<summary>Implementation notes</summary>

- Keeps Up/Down, ArrowRight, ArrowLeft, Backspace, Escape, and Tab
keyboard behavior. Free-typed text no longer highlights the first row:
Enter applies it as a search and closes the menu, while arrow keys,
Home/End, cmdk's Ctrl+N/J/P/K, or the pointer pick a filter row. Tab
still completes the top row, and a typed `key:` prefix, the category
view, and the all-filters list keep the first match highlighted.
- Enter activates any focused button in the combobox (Filters, flyout
options, Retry, chip remove) through one `FilterComboboxRoot` handler.
- The menu's height is bounded only by the viewport, so it scrolls only
when it cannot fit.
- Uses right-opening pointer flyouts with hover forgiveness and
searchable, scrollable long lists. The flyout follows the cmdk
highlight, so keyboard navigation closes or switches it, and it resets
whenever the menu opens or closes.
- Inline categories (Status, Workspace attributes) never enter category
mode; a typed `status:` prefix narrows the inline group in place and is
withheld from the workspace search query. A failed inline load shows its
error and Retry under the category heading, since inline categories have
no flyout.
- Browsing and category mode share one main-panel renderer.
- Uses a persistent full-width mobile panel with touch scrolling. While
open on mobile the field pins below the navbar with CSS (`fixed`), with
no JS scroll positioning. Verified in Chrome device emulation, not yet
on a physical device with a software keyboard.
- Keeps free-text workspace searches separate from matching
filter-option text, including text typed before a `status:` prefix.
Typed text that could still match a filter (a category name, a loaded
option, or an option the category's search returns) is held back from
the workspace search, so results do not empty out mid-word. It is
applied when no lookup finds a match (a failed lookup counts as no
match, and the wait stops after 1s), on Enter, or when the menu is
dismissed or switched to all filters. The menu shows no separate cue for
held-back text; the author (@tracyjohnsonux) decided this, and also
rejected a `Search workspaces for "..."` row. That is why Enter-search
is built by suppressing cmdk's automatic first-row highlight
(`userNavigatingRef` and the `""`/`" "` reset in `FilterComboboxRoot`)
rather than by rendering a search row. Chip tokens in the typed text
become chips when it is applied.
- While typed text is debounced, loaded options are filtered locally so
matching rows stay visible until the loader's results arrive.
- Enter or Tab on an applied option that typed text located keeps it and
clears the text. Clicking a checked row removes it.
- Enter commits a typed inline value that is not a suggestion, such as
`status:starting`.
- Flyout searches go through the category loader, so owners beyond the
first page are found. The search field stays mounted while results load,
shrink, or are empty.
- Clicking a category row narrowed by typed text enters the category,
and focus returns to the input after picking a flyout option.
- Keeps selected options visible with Coder-standard checkmarks and
styling.
- `FilterCategory.chipLabelOnly` marks categories whose chips show only
the option label (Workspace attributes). Inline options load up front so
those chips are labelled before the menu is first opened.
- Pointer flyouts and category lists share one `OptionsPanel` shell
(search header, list, empty state).

</details>

Generated by Coder Agents.

---------

Co-authored-by: Jake Howell <jacob@coder.com>
Co-authored-by: Jake Howell <jake@hwll.me>
2026-09-28 15:37:07 -07:00
TJ 778f4e9ff8 refactor(site): remove workspace search results from the filter combobox (#29874)
## Summary

Removes the "Jump to workspace" previews from the Workspaces filter.
Typing free text no longer lists up to five matching workspaces in the
dropdown that you can click to open.

Typed text still searches workspaces by name: it is committed to the
filter query and narrows the workspace table as before. The dropdown now
only offers filters (categories and matching values), so it stays about
filtering rather than mixing in navigation. It still opens on focus and
while typing. For a name that matches no filter, the dropdown now shows
"No filters found." in place of workspace rows, and the table is still
filtered by the name.

Removes the generic search-result support from `FilterCombobox` as well,
since Workspaces was its only caller: the `getSearchResults`,
`onSearchResultSelect`, and `searchResultsLabel` props, the
`SearchResult` type, the search-results query with its loading and error
handling, and the related stories. Category row previews
(`categoryPreviews`) are unchanged here.

Split out of #29426 so this product change can be reviewed on its own.

Why remove rather than keep: the workspace rows added noise to a
dropdown that should be about filters, and the component has only been
dogfooded internally and has not shipped in a release, so no users lose
a feature they rely on.

---

Generated with Coder Agents on behalf of @tracyjohnsonux.
2026-09-28 14:28:25 -07:00
Paweł Banaszewski ce80607e17 fix: propagate cancellation and aborts in the in-memory transport (#29723)
Fixes cancellation and abort handling in the in-memory transport coderd
uses to call AI Gateway in-process.

Generated by Coder Agents on behalf of @pawbana.
2026-09-28 23:24:39 +02:00
Nick Vigilante d40e24cf7d docs: nest the CLI reference by subcommand (#29956)
## Summary

Nests the CLI reference by subcommand so the Command Line sidebar
collapses from 156 flat entries to 49 top-level verbs.
Each page's URL follows the invocation, its page title is the full
command as inline code, and its sidebar label is only its own verb as
inline code.

| | Before | After |
| --- | --- | --- |
| File | `docs/reference/cli/oauth2-provider_dcr_disable.md` |
`docs/reference/cli/oauth2-provider/dcr/disable.md` |
| URL | `/reference/cli/oauth2-provider_dcr_disable` |
`/reference/cli/oauth2-provider/dcr/disable` |
| Page title (front matter) | `oauth2-provider dcr disable` | `` `coder
oauth2-provider dcr disable` `` |
| Sidebar label (manifest) | `oauth2-provider dcr disable` | ``
`disable` `` |

Resolves DOCS-140 (coder/coder half). Also fixes the Makefile part of
DOCS-1073 / DOCS-912, which this change depends on.

## Changes

- `scripts/clidocgen`: pages nest by command path. A command with
visible subcommands becomes its directory's `index.md`, so
`oauth2-provider/index.md` and `oauth2-provider/dcr/index.md` sit above
`oauth2-provider/dcr/disable.md`. Subcommand table links are relative to
the parent page.
- `scripts/clidocgen`: the manifest "Command Line" section is built from
the command tree (nested, sorted by name, hidden commands skipped)
instead of a flat list. The redundant `coder` child that pointed back at
`reference/cli/index.md` is gone.
- `Makefile`: the CLI rule now replaces `docs/reference/cli/` wholesale,
so stale pages get removed. The manifest rule now runs `clidocgen
-manifest-only` on top of the API staging manifest, so the CLI nav is
generated instead of edited by hand. As a result, the nine pages that
had no nav entry (`ai-gateway*`, `secret enable/disable`, `server
fix-oidc-links`) now have one.
- `scripts/configdocgen` and 48 prose pages: links point at the new
paths (for example `reference/cli/server.md` is now
`reference/cli/server/index.md`).

## How to review/QA this PR

- `docs/reference/cli/**/*` (approximately 190 pages): Each of these
pages are generated automatically. Some pages appear deleted, and some
pages appear new. Every deleted page corresponds to a new page somewhere
else, so no information is being deleted. The docs in this section
should adhere to the following, so a test in the build preview for each
of these items should be satisfactory:
- [ ] Each subcommand of a command gets nested as a child instead of
being displayed as a flat list.
  - [ ] Each parent command is stored in an `index.md` file.
- [ ] The title of each page inside the page should now feature the full
`coder XYZ` command.
- [ ] The title of each page inside the page should now be formatted as
inline code.
- [ ] The title of each page in the sidebar should be the most granular
subcommand of the whole command string (if the page's title is `coder
ai-gateway keys create`, the sidebar label is `create`).
- [ ] The title of each page in the sidebar should now be formatted as
inline code.
  - [ ] The page slug for each page is now the most granular subcommand.
  - [ ] All links now point to the correct page.
- `docs/manifest.json`: The changes here reflect the updated structure
of the `docs/reference/cli` section.
- `docs/**/*.md` outside of `docs/reference/cli/**/*` (approximately 50
pages): The extent of the changes in these pages are just updating the
paths to point to the new page locations.
- [ ] The links on the page all point to the correct new path in
`docs/reference/cli`.
- `scripts/clidocgen` (4 files): This is the Go code responsible for
generating everything inside of `docs/reference/cli/**/*`. A typical
code review here should be satisfactory.
- `scripts/configdocgen` (2 files): these two files just have updates to
the raw `.md` path used by `docs/admin/setup/configuration-reference.md`
and updates the tests to reflect that.
- `Makefile`: This updates the `make` targets for generating the CLI
docs to fit the new structure.

## Merge ordering

Without the renderer PRs deployed, both docs sites show literal
backticks in titles and sidebar labels. Without the redirects, the old
flat URLs return 404.

1. Deploy before merging this PR: coder/docs-engine#176 (beta-docs
renders these titles as inline code) and coder/coder.com#1111 (classic
docs renders them as inline code). Both are safe to ship first, because
titles without backticks render as before.
2. Merge this PR.
3. Merge coder/coder.com#1112 (redirects from the old flat URLs) only
once this content reaches the mainline release branch that serves
unversioned `/docs`.

## Testing

- `go test ./scripts/clidocgen/ ./scripts/configdocgen/
./scripts/docshtmlcheck/`: pass. New tests cover page paths, subcommand
links, the nested manifest, and front matter quoting.
- `make docs/reference/cli/index.md docs/manifest.json
docs/admin/setup/configuration-reference.md`, then a forced rerun: the
second run produced no diff.
- Checked the manifest: all 164 CLI entries resolve to a file, no page
is missing a nav entry, and everything outside "Command Line" is
byte-identical.
- Relative `.md` links across `docs/`: 0 broken, same as `main`.
- `make pre-commit` and `make pre-push`: pass. On earlier pre-push
attempts, different unrelated vitest files timed out under host load.
Those files pass when run alone, and the final push passed with
`PARALLEL_JOBS=1`.

<details>
<summary>Implementation plan and decision log</summary>

**Goal (from DOCS-140 and the requester):** URLs follow the command
hierarchy. Pages are titled with the full command, and sidebar entries
with the last verb only. Both are formatted as inline code.

**Contract with the renderers:** a title wrapped entirely in one pair of
backticks (``^`[^`]+`$``) renders as inline code. Plain-text consumers
(`<title>`, meta, search, llms corpus) strip the backticks. Page title
comes from front matter `title`, and the sidebar label from the manifest
node `title`.

**Decisions**

- A parent command is `dir/index.md` rather than a sibling `dir.md`. The
root CLI page is already `index.md`, and both docs-engine and the legacy
coder.com renderer map `x/index.md` to `/x`.
- The manifest is built from the command tree, not from the written
files, so ordering is deterministic and the nesting matches the pages
exactly.
- The manifest discard bug (DOCS-1073 item 1) is fixed here, because
without that fix the generated nested manifest would never reach the
tree. DOCS-1073 items 2 through 4 (a prose fix and a hidden-command
policy) are out of scope.
- `-manifest-only` keeps the existing parallel `make gen` layout: the
API rule still owns `_gen/manifest-staging.json`, and CLI regeneration
doesn't retrigger swag.
- The renderer and redirect work lives in the companion PRs in
coder/docs-engine and coder/coder.com. It is linked above and not
duplicated here.

</details>

---

> [!NOTE]
> Generated by Coder Agents on behalf of @nickvigilante.
2026-09-28 15:44:10 -04:00
John T Skarbek 0733e8984c docs: use opencode auth login for OpenCode auth instead of editing auth.json (#30054)
OpenCode moved to an `opencode auth login` flow for storing provider
credentials rather than manually editing
`~/.local/share/opencode/auth.json`. Updates both the Centralized API
Key and BYOK sections of the OpenCode AI Gateway client docs to have
users run `opencode auth login`, select the provider, and paste the API
token/key they obtained in the earlier step.
2026-09-28 15:36:38 -04:00
Bobby Ho 631fe09e11 fix: narrow OAuth2 client registration scope to the catalog (#29952)
fix: filter unsupported scopes in OAuth2 dynamic client registration

- Filter scopes against the external catalog during registration and RFC 7592 updates, storing and returning only supported names.
- Reject non-empty lists with no supported scopes using `400 invalid_client_metadata` to avoid creating unrestricted allowlists.
- Preserve legacy scope lists when resent unchanged; leave existing records and the admin app API unchanged.
- Add filtering tests and verify stored scopes in registration tests.

Not a security fix: authorization already rejects unsupported scopes.

Closes PLAT-674.
2026-09-28 18:46:14 +00:00
Paweł Banaszewski c5a58b194a fix(aibridge/keypool): reuse request bodies during key failover (#29721)
Prepares key failover for the AI Gateway reverse proxy, which buffers
the request body before forwarding.

Generated by Coder Agents on behalf of @pawbana.
2026-09-28 18:16:23 +00:00
Matt Vollmer 3ea883b3e5 Merge pull request #28885 from coder/matt/style-guide-coder-workspaces
docs: capitalize Coder Workspaces as a named product
2026-09-28 13:41:34 -04:00
Nick Vigilante d43dd98baf docs: rewrite gerund-leading headings and page titles (#30049)
Rewrites the headings and page titles that `Coder.GerundHeading` flags
as gerund-leading, using the imperative for tasks and the noun form for
concepts.
This PR covers only changes that don't rename a page slug.

## Changes

- Rewrites 121 in-page headings, bringing `Coder.GerundHeading` findings
in `docs/` to zero.
- Adds an empty `<a id="old-slug"></a>` above each renamed heading, so
existing bookmarks and inbound deep links still land on the section.
The legacy IDs were computed with the same slugger the classic renderer
uses (`rehype-slug`), and all 115 that exist on production today match
the live `id` attributes; the other 6 are on pages not published yet.
- Updates the 18 in-docs links that targeted old anchors to use the new
slugs, and the link text that quoted the old heading.
- De-gerunds seven page titles (frontmatter and `manifest.json`) whose
slugs don't change, for example `Upgrading Best Practices` to `Upgrade
best practices`.
- Scopes a Vale exception around the glossary term `Coding agent`, where
"Coding" is an adjective.

## Not in this PR

- **Pages with gerund slugs** (`creating-templates`, `getting-started`,
`working-with-dev-containers`, `cloning-git-repositories`,
`configuring-okta`, and others) keep their current titles, so the title
and slug change together in the slug-rename PR.
  The redirects for those renames come in a third PR.
- **Links outside `docs/`** to old anchors (Go notification strings, an
applied SQL migration, golden files, and the generated `prometheus.md`)
still target old slugs.
They keep working through the legacy anchors, and updating them would
need code changes.

## Known limitation

`coder/docs-engine` prefixes raw-HTML `id` attributes with
`user-content-` (DOM-clobbering protection), and inbound deep links
aren't rewritten.
Once the docs move to docs-engine, these legacy anchors resolve only as
`#user-content-<old-slug>` unless docs-engine adds a fragment fallback.
They work on the current coder.com renderer and on GitHub.

## Testing

- `vale --filter='.Name=="Coder.GerundHeading"' docs`: zero findings,
down from 122.
- `make lint/markdown`, `make lint/docs-html`, `make lint/emdash`, and
the pre-commit hook: all pass.
- Scripted check that every relative `#fragment` link into a changed
file resolves to a heading slug or a legacy anchor (177 links).
- Scripted check that no legacy ID collides with a heading slug on the
same page, and that no untouched heading's duplicate-suffix slug
shifted.

<details>
<summary>Heading renames and legacy anchors (121)</summary>

| File | Old heading | New heading | Legacy anchor |
| --- | --- | --- | --- |
| `admin/integrations/opentofu.md` | Using a custom Terraform binary |
Use a custom Terraform binary | `#using-a-custom-terraform-binary` |
| `admin/monitoring/connection-logs.md` | Capturing/Exporting Connection
Logs | Capture and export connection logs |
`#capturingexporting-connection-logs` |
| `admin/monitoring/metrics.md` | Setting up metrics | Set up metrics |
`#setting-up-metrics` |
| `admin/networking/port-forwarding.md` | Accessing workspace ports |
Access workspace ports | `#accessing-workspace-ports` |
| `admin/networking/port-forwarding.md` | Sharing ports | Share ports |
`#sharing-ports` |
| `admin/networking/port-forwarding.md` | Configuring port protocol |
Configure port protocol | `#configuring-port-protocol` |
| `admin/networking/workspace-proxies.md` | Running on Kubernetes | Run
on Kubernetes | `#running-on-kubernetes` |
| `admin/networking/workspace-proxies.md` | Running on a VM | Run on a
VM | `#running-on-a-vm` |
| `admin/networking/workspace-proxies.md` | Running as a system service
| Run as a system service | `#running-as-a-system-service` |
| `admin/networking/workspace-proxies.md` | Running in Docker | Run in
Docker | `#running-in-docker` |
| `admin/networking/workspace-proxies.md` | Selecting a proxy | Select a
proxy | `#selecting-a-proxy` |
| `admin/security/audit-logs.md` | Capturing/Exporting Audit Logs |
Capture and export audit logs | `#capturingexporting-audit-logs` |
| `admin/security/audit-logs.md` | Purging Old Audit Logs | Purge old
audit logs | `#purging-old-audit-logs` |
| `admin/security/database-encryption.md` | Enabling encryption | Turn
on encryption | `#enabling-encryption` |
| `admin/security/database-encryption.md` | Rotating keys | Rotate keys
| `#rotating-keys` |
| `admin/security/database-encryption.md` | Disabling encryption | Turn
off encryption | `#disabling-encryption` |
| `admin/security/database-encryption.md` | Deleting Encrypted Data |
Delete encrypted data | `#deleting-encrypted-data` |
| `admin/security/secrets.md` | Displaying Secrets | Display secrets |
`#displaying-secrets` |
| `admin/setup/data-retention.md` | Keeping Data Indefinitely | Keep
data indefinitely | `#keeping-data-indefinitely` |
| `admin/setup/index.md` | Migrating from the built-in database to an
external database | Migrate from the built-in database to an external
database |
`#migrating-from-the-built-in-database-to-an-external-database` |
| `admin/setup/index.md` | Configuring Coder behind a proxy | Configure
Coder behind a proxy | `#configuring-coder-behind-a-proxy` |
| `admin/setup/telemetry.md` | Toggling | Turn telemetry on or off |
`#toggling` |
| `admin/templates/creating-templates.md` | Disabling the template
builder | Turn off the template builder |
`#disabling-the-template-builder` |
| `admin/templates/extending-templates/agent-metadata.md` | Managing the
database load | Manage the database load | `#managing-the-database-load`
|
| `admin/templates/extending-templates/docker-in-workspaces.md` |
Authenticating with a Private Registry | Authenticate with a private
registry | `#authenticating-with-a-private-registry` |
| `admin/templates/extending-templates/index.md` | Running scripts on
workspace lifecycle | Run scripts on workspace lifecycle events |
`#running-scripts-on-workspace-lifecycle` |
| `admin/templates/extending-templates/parameters.md` | Validating
parameters | Validate parameters | `#validating-parameters` |
| `admin/templates/extending-templates/prebuilt-workspaces.md` |
Invalidating prebuilds | Invalidate prebuilds |
`#invalidating-prebuilds` |
| `admin/templates/extending-templates/prebuilt-workspaces.md` |
Managing resource quotas | Manage resource quotas |
`#managing-resource-quotas` |
| `admin/templates/extending-templates/prebuilt-workspaces.md` |
Managing prebuild provisioning queues | Manage prebuild provisioning
queues | `#managing-prebuild-provisioning-queues` |
| `admin/templates/extending-templates/prebuilt-workspaces.md` |
Preventing resource replacement | Prevent resource replacement |
`#preventing-resource-replacement` |
| `admin/templates/extending-templates/prebuilt-workspaces.md` |
Preventing prebuild queue contention (recommended) | Prevent prebuild
queue contention (recommended) |
`#preventing-prebuild-queue-contention-recommended` |
| `admin/templates/extending-templates/process-logging.md` | Configuring
custom templates to use workspace process logging | Configure custom
templates to use workspace process logging |
`#configuring-custom-templates-to-use-workspace-process-logging` |
| `admin/templates/extending-templates/process-logging.md` | Viewing
workspace process logs | View workspace process logs |
`#viewing-workspace-process-logs` |
| `admin/templates/extending-templates/process-priority.md` | Verifying
the feature is enabled | Verify the feature is enabled |
`#verifying-the-feature-is-enabled` |
| `admin/templates/extending-templates/resource-metadata.md` | Hiding
resources in the dashboard | Hide resources in the dashboard |
`#hiding-resources-in-the-dashboard` |
| `admin/templates/extending-templates/resource-metadata.md` | Using a
custom resource icon | Use a custom resource icon |
`#using-a-custom-resource-icon` |
| `admin/templates/extending-templates/resource-ordering.md` | Using
"order" property | Use the "order" property | `#using-order-property` |
| `admin/templates/extending-templates/resource-persistence.md` |
Disabling persistence | Turn off persistence | `#disabling-persistence`
|
| `admin/templates/index.md` | Extending templates | Extend templates |
`#extending-templates` |
| `admin/templates/managing-templates/change-management.md` | Testing
and Publishing Coder Templates in CI/CD | Test and publish Coder
templates in CI/CD | `#testing-and-publishing-coder-templates-in-cicd` |
| `admin/templates/managing-templates/index.md` | Creating templates |
Create templates | `#creating-templates` |
| `admin/templates/managing-templates/index.md` | Editing templates |
Edit templates | `#editing-templates` |
| `admin/templates/managing-templates/index.md` | Updating templates |
Update templates | `#updating-templates` |
| `admin/templates/troubleshooting.md` | Debugging the startup script |
Debug the startup script | `#debugging-the-startup-script` |
| `admin/users/groups-roles.md` | Creating custom roles | Create custom
roles | `#creating-custom-roles` |
| `admin/users/index.md` | Configuring SSO | Configure SSO |
`#configuring-sso` |
| `admin/users/index.md` | Resetting a password on Kubernetes | Reset a
password on Kubernetes | `#resetting-a-password-on-kubernetes` |
| `admin/users/quotas.md` | Establishing Costs | Establish costs |
`#establishing-costs` |
| `admin/users/quotas.md` | Establishing Budgets | Establish budgets |
`#establishing-budgets` |
| `admin/users/sessions-tokens.md` | Creating tokens with scopes |
Create tokens with scopes | `#creating-tokens-with-scopes` |
| `ai-coder/agent-firewall/index.md` | Getting Started with Agent
Firewall | Get started with Agent Firewall |
`#getting-started-with-agent-firewall` |
| `ai-coder/agent-firewall/index.md` | Viewing Audit Logs | View audit
logs | `#viewing-audit-logs` |
| `ai-coder/agent-firewall/nsjail/k8s.md` | Running without user
namespaces | Run without user namespaces |
`#running-without-user-namespaces` |
| `ai-coder/agent-firewall/version.md` | Using Coder Before v2.30.0 with
Claude Code Module v4.7.0+ | Coder before v2.30.0 with Claude Code
module v4.7.0+ |
`#using-coder-before-v2300-with-claude-code-module-v470` |
| `ai-coder/agent-firewall/version.md` | Using Claude Code Module Before
v4.7.0 | Claude Code module before v4.7.0 |
`#using-claude-code-module-before-v470` |
| `ai-coder/agents/getting-started.md` | Providing feedback | Provide
feedback | `#providing-feedback` |
| `ai-coder/agents/models.md` | Managing personal API keys | Manage
personal API keys | `#managing-personal-api-keys` |
| `ai-coder/agents/models.md` | Removing a personal key | Remove a
personal key | `#removing-a-personal-key` |
| `ai-coder/agents/models.md` | Using an LLM proxy | Use an LLM proxy |
`#using-an-llm-proxy` |
| `ai-coder/agents/platform-controls/git-providers.md` | Checking logs |
Check logs | `#checking-logs` |
| `ai-coder/ai-gateway/audit.md` | Navigating the UI | Navigate the UI |
`#navigating-the-ui` |
| `ai-coder/ai-gateway/audit.md` | Conducting a forensic audit | Conduct
a forensic audit | `#conducting-a-forensic-audit` |
| `ai-coder/ai-gateway/clients/jetbrains.md` | Using the AI Assistant |
Use the AI Assistant | `#using-the-ai-assistant` |
| `install/operate/upgrade/best-practices.md` | Diagnosing liveness
probe issues | Diagnose liveness probe issues |
`#diagnosing-liveness-probe-issues` |
| `install/operate/upgrade/best-practices.md` | Recovering from failed
database migrations | Recover from failed database migrations |
`#recovering-from-failed-database-migrations` |
| `install/operate/upgrade/esr-2.24-2.29-upgrade.md` | Upgrading |
Upgrade recommendations | `#upgrading` |
| `install/operate/upgrade/esr-2.29-2.34-upgrade.md` | Upgrading |
Upgrade recommendations | `#upgrading` |
| `install/prepare/licensing.md` | Adding your license key | Add your
license key | `#adding-your-license-key` |
| `install/server/cloud/azure-vm.md` | Creating and Uploading Your First
Template | Create and upload your first template |
`#creating-and-uploading-your-first-template` |
| `install/server/cloud/compute-engine.md` | Configuring the control
plane | Configure the control plane | `#configuring-the-control-plane` |
| `reference/releases.md` | Installing stable | Install stable |
`#installing-stable` |
| `start/first-workspace.md` | Creating your first coder workspace |
Create your first Coder workspace |
`#creating-your-first-coder-workspace` |
| `start/local-deploy.md` | Setting up a Coder deployment | Set up a
Coder deployment | `#setting-up-a-coder-deployment` |
| `tutorials/best-practices/organizations.md` | Managing Organizations
at Scale | Manage organizations at scale |
`#managing-organizations-at-scale` |
| `tutorials/example-guide.md` | Adding Photos | Add photos |
`#adding-photos` |
| `tutorials/example-guide.md` | Setting the author data | Set the
author data | `#setting-the-author-data` |
| `tutorials/example-guide.md` | Setting up the routes | Set up the
routes | `#setting-up-the-routes` |
| `tutorials/persistent-shared-workspaces.md` | Finding shared
workspaces | Find shared workspaces | `#finding-shared-workspaces` |
| `tutorials/reverse-proxy-caddy.md` | Getting started | Get started |
`#getting-started` |
| `tutorials/reverse-proxy-caddy.md` | Generating wildcard certificates
| Generate wildcard certificates | `#generating-wildcard-certificates` |
| `tutorials/reverse-proxy-nginx.md` | Adding Coder deployment subdomain
| Add the Coder deployment subdomain |
`#adding-coder-deployment-subdomain` |
| `tutorials/testing-templates.md` | Creating the headless user | Create
the headless user | `#creating-the-headless-user` |
| `user-guides/desktop/desktop-connect-sync.md` | Accessing web apps in
a secure browser context | Access web apps in a secure browser context |
`#accessing-web-apps-in-a-secure-browser-context` |
| `user-guides/desktop/index.md` | Testing Your Connection | Test your
connection | `#testing-your-connection` |
| `user-guides/desktop/index.md` | Getting Help | Get help |
`#getting-help` |
| `user-guides/desktop/index.md` | Uninstalling | Uninstall Coder
Desktop | `#uninstalling` |
| `user-guides/devcontainers/index.md` | Getting started | Get started |
`#getting-started` |
| `user-guides/devcontainers/troubleshooting-dev-containers.md` |
Finding your dev container agent | Find your dev container agent |
`#finding-your-dev-container-agent` |
| `user-guides/devcontainers/troubleshooting-dev-containers.md` |
Getting more help | Get more help | `#getting-more-help` |
| `user-guides/devcontainers/working-with-dev-containers.md` | Using the
Coder CLI | Use the Coder CLI | `#using-the-coder-cli` |
| `user-guides/devcontainers/working-with-dev-containers.md` | Using
OpenSSH (config-ssh) | Use OpenSSH (config-ssh) |
`#using-openssh-config-ssh` |
| `user-guides/devcontainers/working-with-dev-containers.md` | Exposing
ports on the parent workspace | Expose ports on the parent workspace |
`#exposing-ports-on-the-parent-workspace` |
| `user-guides/devcontainers/working-with-dev-containers.md` |
Rebuilding dev containers | Rebuild dev containers |
`#rebuilding-dev-containers` |
| `user-guides/shared-workspaces.md` | Getting Started | Get started |
`#getting-started` |
| `user-guides/shared-workspaces.md` | Sharing your Workspace | Share
your workspace | `#sharing-your-workspace` |
| `user-guides/shared-workspaces.md` | Using a shared workspace | Use a
shared workspace | `#using-a-shared-workspace` |
| `user-guides/shared-workspaces.md` | Accessing workspace apps in
shared workspaces | Access workspace apps in shared workspaces |
`#accessing-workspace-apps-in-shared-workspaces` |
| `user-guides/workspace-access/emacs-tramp.md` | Connecting To A
Workspace | Connect to a workspace | `#connecting-to-a-workspace` |
| `user-guides/workspace-access/emacs-tramp.md` | Using SSH | Use SSH |
`#using-ssh` |
| `user-guides/workspace-access/index.md` | Running remote commands with
quoting | Run remote commands with quoting |
`#running-remote-commands-with-quoting` |
| `user-guides/workspace-access/jetbrains/gateway.md` | Configuring the
Gateway plugin to use internal certificates | Configure the Gateway
plugin to use internal certificates |
`#configuring-the-gateway-plugin-to-use-internal-certificates` |
| `user-guides/workspace-access/jetbrains/gateway.md` | Using an
existing JetBrains installation in the workspace | Use an existing
JetBrains installation in the workspace |
`#using-an-existing-jetbrains-installation-in-the-workspace` |
| `user-guides/workspace-access/port-forwarding.md` | Accessing
workspace ports | Access workspace ports | `#accessing-workspace-ports`
|
| `user-guides/workspace-access/port-forwarding.md` | Sharing ports |
Share ports | `#sharing-ports` |
| `user-guides/workspace-access/port-forwarding.md` | Configuring port
protocol | Configure port protocol | `#configuring-port-protocol` |
| `user-guides/workspace-access/vscode.md` | Using the public extensions
marketplaces | Use the public extensions marketplaces |
`#using-the-public-extensions-marketplaces` |
| `user-guides/workspace-access/vscode.md` | Adding extensions to custom
images | Add extensions to custom images |
`#adding-extensions-to-custom-images` |
| `user-guides/workspace-access/vscode.md` | Installing extensions using
its `vsix` file at the command line | Install extensions using a `vsix`
file at the command line |
`#installing-extensions-using-its-vsix-file-at-the-command-line` |
| `user-guides/workspace-access/vscode.md` | Installing from a
marketplace at the command line | Install from a marketplace at the
command line | `#installing-from-a-marketplace-at-the-command-line` |
| `user-guides/workspace-access/vscode.md` | Using VS Code Desktop | Use
VS Code Desktop | `#using-vs-code-desktop` |
| `user-guides/workspace-access/web-terminal.md` | Accessing the
Terminal | Access the terminal | `#accessing-the-terminal` |
| `user-guides/workspace-lifecycle.md` | Stopping workspaces | Stop
workspaces | `#stopping-workspaces` |
| `user-guides/workspace-lifecycle.md` | Deleting workspaces | Delete
workspaces | `#deleting-workspaces` |
| `user-guides/workspace-management.md` | Creating workspaces | Create
workspaces | `#creating-workspaces` |
| `user-guides/workspace-management.md` | Updating workspaces | Update
workspaces | `#updating-workspaces` |
| `user-guides/workspace-management.md` | Updating via the CLI | Update
with the CLI | `#updating-via-the-cli` |
| `user-guides/workspace-management.md` | Starting and stopping
workspaces | Start and stop workspaces |
`#starting-and-stopping-workspaces` |
| `user-guides/workspace-management.md` | Repairing workspaces | Repair
workspaces | `#repairing-workspaces` |
| `user-guides/workspace-scheduling.md` | Working hours | Work schedule
| `#working-hours` |
| `user-guides/workspace-scheduling.md` | Basing solely on activity
detection | Rely solely on activity detection |
`#basing-solely-on-activity-detection` |

</details>

<details>
<summary>Plan</summary>

The de-gerund work ships as three PRs:

1. This PR: in-page headings and page titles that do not require a page
slug rename.
1. Page slug renames for pages whose filenames are gerunds.
1. Redirects for the renamed slugs.

Heading rewrites follow the style guide section "No gerund-leading
headings": imperative for task headings, noun form for concept headings,
sentence case, and "turn on"/"turn off" instead of "enable"/"disable"
per word-choice guidance.
The legacy anchor sits on its own line above the heading (with a blank
line between) rather than inside the heading, so it does not leak into
heading text, TOC entries, or Fumadocs slugs.

</details>

---

_Generated by Coder Agents on behalf of @nickvigilante._
2026-09-28 13:40:07 -04:00
Bobby Ho 0058843a63 fix: ignore OAuth2 access tokens sent in the URL query string (#29878)
Ignore OAuth2 provider access tokens supplied only via `?access_token=` or
`?coder_session_token=`, enforcing OAuth 2.1 §5.1 (D6-05).

- Apply across all routes, including custom token readers. Protected routes
  return 401 with a Bearer challenge and no error code; optional-auth routes
  proceed unauthenticated.
- Continue accepting tokens via `Authorization`, `Coder-Session-Token`, or
  session cookies, ignoring any query copy.
- Log ignored tokens without updating `last_used` or `expires_at`.
- Leave Coder session and API tokens unchanged, preserving dashboard
  WebSocket authentication. **Breaking:** OAuth2-authenticated embedded
  dashboards lose WebSocket access; the only known use was the VS Code
  chat sidebar, removed in vscode-coder v1.14.6.
- Update docs and regression tests. No migration or new configuration.

Fixes PLAT-603.
2026-09-28 16:49:02 +00:00
Nick Vigilante 88aa2cc373 feat: enable Coder.UnitSpacing (#29944)
## Summary

Adds `Coder.UnitSpacing`, a Vale rule that enforces the style guide's
[non-breaking space between number and
unit](https://github.com/coder/coder/blob/main/docs/.style/style-guide/numbers-units-and-dates.md#non-breaking-space-between-number-and-unit)
policy.
Until now, the guide pointed at `Google.Units (planned)`, but that rule
accepts a regular space, so it can't enforce the policy.

Resolves [DOCS-1072](https://linear.app/codercom/issue/DOCS-1072).

## Changes

- **Cleanup commit**: replaces the regular space (or missing space) with
`&nbsp;` in 189 prose findings across 55 files. One config default,
`(default: 15s)`, moves to code font instead, as the guide requires for
configuration values. One table row that was realigned also swaps a
pre-existing en dash for a hyphen, since `lint/emdash` checks changed
lines.
- **Enable commit**: adds `docs/.style/styles/Coder/UnitSpacing.yml` at
`warning`, updates the enforcement footer in
`numbers-units-and-dates.md`, and updates the coverage tables in the
style guide README.
- **Reflow commit**: every hard-wrapped paragraph the cleanup touched
(45 paragraphs in 29 files) is rewrapped to one sentence per line.
Joining lines exposed units split across a line break, which now use
`&nbsp;`, and two em dashes on rewritten lines are reworded.
- **Rule fix commit**: the token now matches ASCII whitespace, including
a newline, between the number and the unit, so a hard-wrapped paragraph
can't hide a missing `&nbsp;`. The class is spelled out because Vale's
`\s` is Unicode and would match U+00A0. Vale can't locate a match that
spans list indentation or a blockquote marker, so splits there still go
unreported.
- **Rule count sync**: the tooling paragraph in the style guide README
now reads 79 rules, 9 tool-checked, to match the coverage table. The 79
corrects drift already on `main` since #29758; the 9 is this PR's new
rule.
- `.vale.ini` turns the rule off for pages generated from Go source:
`docs/reference/{api,cli}/*.md`, `configuration-reference.md`, and
`prometheus.md`. That text comes from flag descriptions, Swagger
comments, and metric help text, which also render outside Markdown,
where `&nbsp;` would show up literally.

<details>
<summary>Rule design decisions</summary>

- An `existence` rule matches `\d+(\.\d+)?` followed by a regular space
or no space, then a unit from a curated list (time, data size,
bandwidth, frequency, vCPU/CPU/cores).
- Vale renders Markdown before matching, so `&nbsp;` and a literal
U+00A0 both pass. Code spans and fences are skipped.
- Hyphenated compound modifiers (`12-hour clock`) don't match, because
the token allows only a space or nothing between the number and the
unit.
- Exceptions cover HTTP status plurals (`413s`) and decades (`1990s`).
- Severity is `warning`, because the unit list is curated and a count
followed by a unit-like word can still be a judgment call.
- Alternative considered: a `BlockIgnores` pattern for the `<!-- Code
generated ... -->` regions. I didn't use it because it would silence
every rule in those regions, not just this one.

</details>

## Testing

- Ran the rule against fixtures: `30 seconds`, `150ms`, `4 vCPU` in a
table, and `16` / `GB` split across lines in a paragraph all flag.
`30&nbsp;seconds`, literal U+00A0, `12-hour`, `413s`, `1990s`, and ``
`30s` `` don't.
- `vale docs/` reports 0 `Coder.UnitSpacing` findings, and the counts
for every other rule match `main`.
- A scratch config with `Coder.OneSentencePerLine` turned on reports 0
findings on changed lines.
- `make lint/markdown`, `make lint/style-claims`, `make lint/emdash`,
and the `pre-commit-light` hook pass.

<details>
<summary>CI flake note</summary>

`Storybook` failed on b3c53b6874 after capturing all 3,421 snapshots,
when the Pixel build was marked `failed` during finalization. This PR
changes no files under `site/`. The re-run failed the same way, and
`Storybook` is failing in the same Pixel step on the latest `main`
commits, so this isn't caused by this PR.

</details>

---

*Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on
behalf of @nickvigilante.*
2026-09-28 12:29:40 -04:00
Nick Vigilante b2b6d593a1 ci(.github/workflows): wake dormant doc-check workspaces before review (#30046)
doc-check reuses one `doc-check-pr-<N>` workspace per PR. After a few
idle days the workspace goes dormant, and a chat cannot start its own
dormant workspace, so the prepare step (added in #29209) failed the job
with `doc-check-pr-29913 is dormant since ...`.

The prepare step runs with the bot's own session token, and the bot owns
the workspace, which grants `update` on `workspace_dormant`
(`coderd/rbac/roles.go`). This clears dormancy with `PUT
/api/v2/workspaces/{id}/dormant` and `{"dormant": false}`. The existing
code then starts the stopped workspace and waits for it before the chat
runs. Clearing dormancy also resets `last_used_at`
(`UpdateWorkspaceDormantDeletingAt`), so the lifecycle executor does not
mark the workspace dormant again right away.

If clearing dormancy fails, for example because the token is scoped, the
job still fails with the same error and step summary as before.

Refs CODAGT-1025

<details>
<summary>Verification</summary>

- `actionlint` (with shellcheck) and `make lint/actions/zizmor` pass.
- Not run against dogfood, because the bot token is only available in
CI. The next doc-check run on a PR with a dormant workspace, such as
#29913, is the real test.

</details>

---
🤖 Built with AI assistance.
2026-09-28 11:05:11 -04:00
Jon Ayers 797dc6b2d1 feat: refresh header commands based on JWT expiration (#29760)
Adds opportunistic JWT parsing for values returned from the
`--header-command`. If a JWT is parsed we use the value of its `exp`
field to determine when we should re-run the command to refresh the
values.
2026-09-28 09:42:31 -05:00
Mathias Fredriksson 517897f4ec feat(site): extend board experiment for Coder Agents chats (#29472)
New chats can start on the board: a column's + or a card's menu opens
the regular create form in a floating window, and the chat is created
with the board labels, so it lands where it was started. A card's draft
can add the card's title, notes and chat statuses to its first message.

A board assistant joins the card assistants. It reads the whole board
and, only on the user's yes in its chat, edits labels; a card assistant
may edit only its own card's notes. Both verify live state before
proposing, including PR timelines and review threads, and treat
fetched text as data, never as approval. They use the Coder MCP when
the user has connected it and otherwise a shared workspace. Label
writes publish no watch event, so the board refetches its list when an
assistant ends a turn.

Efforts tag cards across columns, a card can carry several, and a
header filter narrows the board to one effort alongside search. A chat
started in a column under that filter takes the effort.

Each chat's line now shows its PR, last turn and age, with unread as a
dot on the chat icon and line counts in the details popover. A card
with an assistant shows it as a bot icon in its header.

Everything stays in site/src/pages/AgentsPage/exp/chatBoard behind the
same flag; no other files change.
2026-09-28 17:41:51 +03:00
Mathias Fredriksson f2e8afedb7 feat(site): add experimental board experiment for Coder Agents (#29425)
Adds an opt-in board for Coder Agents chats. Users sort chats into
columns, group related chats into cards, keep Markdown notes on a card,
open chats in floating windows beside the board, and give a card an
assistant chat that checks on its chats. It is off by default and
enabled per browser under Agents > Settings > General > Experiments.

It ships behind a flag to dogfood the workflow before deciding whether
any of it needs backend support. Durable state uses existing chat
labels with a board/ prefix; column order and window layout are kept in
browser storage.

The code lives in site/src/pages/AgentsPage/exp/chatBoard. Outside it,
the change adds a lazy route, the settings switch, a frame for grouped
chats in the sidebar, an optional chatId prop on AgentChatPage, and an
optional abort signal on getChats. With the flag off, the sidebar
renders as before.

Board writes reach the server one at a time in order. A transfer lands
on the receiving chat before any source changes, and regrouping offers
Undo.
2026-09-28 17:29:04 +03:00
John T SkarbekandJohn T Skarbek 535c882dbe docs(README.md): add DeepWiki badge (#30042)
Adds an "Ask DeepWiki" badge to the README, linking to
https://deepwiki.com/coder/coder.

DeepWiki refreshes its generated documentation for a repository more
frequently when the repo links back to its DeepWiki page, so this also
gets the coder/coder wiki indexed on a shorter interval.

---

*This PR was created by a Coder Agent on behalf of @jtslear.*

Co-authored-by: John T Skarbek <1965521+jtslear@users.noreply.github.com>
2026-09-28 09:43:37 -04:00
Ehab Younes 44b3a323d5 fix(codersdk): assert icon paths with path.Clean, not filepath.Clean (#30044) 2026-09-28 16:22:11 +03:00
Paweł Banaszewski 0e8521d41e refactor(aibridge): accept a pre-read payload in GuessSessionID (#29719)
Adds `client.GuessSessionIDFromPayload(client, r, payload)` for
reverse-proxy callers.

Generated by Coder Agents on behalf of @pawbana.
2026-09-28 10:55:44 +00:00
Thomas Kosiewski 8ff3175299 feat: prefill the Coder Agents composer from a prompt link (#29943)
Integrations and docs can now send users to a new Coder Agents chat with
a message already written: `/agents?prompt=<url-encoded text>`.

- The text fills the new-chat composer. Nothing is sent until the user
selects **Send**.
- The page moves `prompt` out of the address bar into the router's
history state, in the same navigation that already handles
`?debug_workspace_build=` (#29811). Other query parameters stay, and a
reload of that entry shows the prompt again.
- A warning inside the composer, with a warning ring, asks the user to
take care before running a prompt that came from a link, since any
website can build one. It clears once the user edits the prompt.
- The saved draft is untouched. New chat afterwards shows the draft,
including when New chat is clicked directly on the prefilled page. The
layout now reads the deep link state (shared `utils/deepLinkState.ts`)
so it no longer clears the draft in that case. Debug links keep the
existing behavior, because they can fall back to the draft-backed
composer.
- The debug link wins when both parameters are present. A blank `prompt`
is ignored.
- No experiment flag, because integrations need a stable URL. Documented
in `docs/ai-coder/agents/getting-started.md`.

Tests: Vitest coverage for prefill-then-send, URL cleanup with history
state, debug link precedence, and New chat keeping the draft after a
prompt link and clearing it after a debug link. The `PromptLink` and
`PromptLinkEdited` stories cover the warning visually.

Remote dogfood UAT through Coder Agents passed on the implementation
head (sign-in redirect, reload, draft handling, edge cases such as `+`,
malformed encoding and HTML-looking text).

Known pre-existing behavior on `main`, unchanged here: New chat on a
plain `/agents` page clears the saved draft but leaves its text on
screen, so a reload shows an empty composer.

---

<details>
<summary>📋 Implementation Plan</summary>

# Plan: `?prompt=` link for the Coder Agents new-chat page

**Goal.** Opening `/agents?prompt=<url-encoded text>` shows the new-chat
page with that text already in the message box (the composer). The user
reviews it and clicks Send. Nothing is sent automatically.

**Base.** Branch `agents-prompt-deeplink`, created from `origin/main` at
`702b13112d`. The change reuses the link code that #29811 added for
`?debug_workspace_build=<build-id>`.

## Decisions

1. **Name the parameter `prompt`, not `q`.** Elsewhere in Coder, `q`
means a search filter.
2. **Fill in only; never send.** There is no `submit` option.
3. **Reuse the #29811 flow.** It works in five steps:
   1. `AgentCreatePage.tsx` reads the parameter.
2. It removes the parameter from the address bar with a `replace`
navigation.
3. It carries the value in `location.state`, the router's per-entry
history state.
   4. It builds an `AgentCreatePrefill` from the value.
5. `useEmptyStateDraft(prefill.message)` puts the text in the editor. It
doesn't touch the user's saved draft.
4. **Show a one-line notice** above the composer: "This prompt came from
a link. Review it before you send it." Any website can put text in this
link, so the user should read it before sending. The debug link carries
only a build ID, so it has no notice.
5. **Set no length limit in the browser.** See the rationale below.
6. **Don't put it behind an experiment flag, and document it.**
Integrations need a stable URL. `/agents` itself has no flag today
(`site/src/router.tsx:828`).
7. **The debug link wins.** `prompt` applies only when no debug link is
active. Both parameters are removed from the URL in one navigation.
8. **Ignore an empty or whitespace-only `prompt`.** The page shows the
normal composer.

Out of scope: `workspace=` or `model=` parameters, the embed page, and
existing chat pages (`/agents/:id`).

## Steps

### 1. Tests first (they should fail)

Add two tests to `site/src/pages/AgentsPage/AgentCreatePage.test.tsx`.
Copy the setup of the #29811 tests: `renderWithAuth(<AgentCreatePage />,
{ path: "/agents", route, extraRoutes })` with
`vi.spyOn(API.experimental, ...)`.

- **"prefills the prompt from a prompt link and sends it only on
Send."** Use the route `/agents?prompt=${encodeURIComponent("Fix the
flaky test\nin a & b = c")}`.
  1. Check that the textbox named "Chat message" has that text.
2. Check that `createChat` has not been called and no file was uploaded.
  3. Click Send.
  4. Check that `createChat` was called once with that text.
- **"moves the prompt out of the URL so New chat gets a plain
composer."** Copy the debug-link test with the same name. Use the route
`/agents?archived=archived&prompt=hi`.
1. Check `router.state.location` against `{ search:
"?archived=archived", state: { prompt: "hi" } }`.
2. Navigate to `/agents`. Check that the composer has no prefilled text.

→ verify: both tests fail on the current code because the textbox is
empty and `prompt` is still in the URL.

### 2. Implement (the tests should pass)

In `site/src/pages/AgentsPage/AgentCreatePage.tsx`:

1. Add `promptSearchParam = "prompt"`.
2. Replace `DebugLinkState` and `readDebugLinkState` with `DeepLinkState
= { debugWorkspaceBuildId?: string; prompt?: string }` and one reader
function.
3. Set `linkPrompt` from the URL parameter, or from the value in
`location.state` after the parameter is removed. Keep it only if it
isn't blank and no debug link is active.
4. **Extend the existing effect** at lines 102 to 116 so one `navigate`
removes both parameters and saves both values in state. Don't add a
second effect: each effect would rebuild the URL from the same snapshot
and put the other parameter back. The frontend pattern FE8 also says to
avoid effects where possible.
5. Build the prefill as `debugPrefill ?? (linkPrompt ? { message:
linkPrompt } : undefined)`.
6. Give the form a `key`:
   - the build ID for a debug link;
   - `` `prompt:${linkPrompt}` `` for a prompt link;
   - `"draft"` otherwise.

   A new link then resets the form.
7. Show the notice when a prompt link is active. Reuse the `Alert`
component that `DebugWorkspaceBuildAlert` uses, and place it next to
that alert (line 221).

In `site/src/pages/AgentsPage/components/AgentCreateForm.tsx`:

1. Make `AgentCreatePrefill.attachment` optional (line 74).
2. Handle a missing attachment in the `prefillFile` initializer (lines
581 to 587).

Don't add `useMemo` or `useCallback`: the React Compiler handles that in
`AgentsPage`.

→ verify: `cd site && pnpm test
src/pages/AgentsPage/AgentCreatePage.test.tsx
src/pages/AgentsPage/components/AgentCreateForm.test.tsx` passes,
including the tests #29811 added.

### 3. Story for the visual check

Add a `PromptLink` story to
`site/src/pages/AgentsPage/AgentsPageLayout.stories.tsx`, next to
`DebugWorkspaceBuildLoading` (line 1100). It shows the notice and the
filled composer. Its `play` function has no assertions (frontend pattern
FE1).

→ verify: `pnpm test:storybook
src/pages/AgentsPage/AgentsPageLayout.stories.tsx` passes. Take a
screenshot of the story from `pnpm storybook --no-open`.

### 4. Docs

In `docs/ai-coder/agents/getting-started.md`, add a section "### Link to
a new chat with a prompt" after "Use the API for programmatic
automation" (line 204). Cover:

- the URL format, built with `encodeURIComponent`, and one example;
- that the link only fills in the message, and the user still clicks
Send;
- that the link survives sign-in;
- that links should not contain secrets, because URLs end up in logs and
browser history.

`docs/manifest.json` doesn't change.

→ verify: `pnpm run format-docs && pnpm run lint-docs` finish clean.
Check the section against `docs/.style/style-guide/README.md`.

### 5. Gates before commit

1. Run `cd site && pnpm check && pnpm lint && pnpm format`, plus the
tests above.
2. Review the diff with the `frontend-review` skill (FE1 to FE10).
3. Commit with the hooks on. `make pre-commit` runs from the hook.

## Dogfooding

1. **Start the server.** Run `CODER_DEV_PORT_OFFSET=true
./scripts/develop.sh` detached and save its PID.
   - Use the web UI (Vite) URL printed in the startup banner.
- Don't use `.coderv2/url`: it can serve an older build of the frontend.
2. **Set up the instance.**
   1. Log in as `admin@coder.com` / `SomeSecurePassword!`.
2. Add a provider at `/ai/settings/providers` and a model at
`/ai/settings/models`. Without a model, the composer is disabled.
3. On `/agents`, type "my draft" and leave the page, so a saved draft
exists.
3. **Check with agent-browser.**
1. Open `<vite>/agents?prompt=<encoded "Fix the flaky test\nline 2 &
more = ok 🚀">`. The snapshot should show:
      - the decoded text in the composer;
      - no `prompt` in the address bar;
      - the notice;
      - no new chat in the sidebar.

      Take a screenshot.
2. Reload the page. The prompt should appear again, because it is kept
in history state (the debug link behaves the same way).
3. Edit the text and click Send. The page should move to `/agents/<id>`,
and the first message should be the edited text.
   4. Click New chat. The composer should show "my draft".
5. Log out. In a fresh session, open the link, then log in. The composer
should show the prompt.
4. **Save the evidence.**
   - Screenshots of checks 1, 4 and 5, attached with `attach_file`.
- One short WebM video of checks 1 to 3, recorded in a fresh session.
agent-browser recordings freeze after about two navigations, so keep it
short.
5. **Clean up.** Stop `develop.sh` by its PID and confirm its ports are
free.

## Acceptance criteria

1. `/agents?prompt=<encoded>` shows the decoded text in the composer,
with newlines, `&`, `=` and emoji intact.
2. No chat is created until the user clicks Send.
3. `prompt` is removed from the address bar and other parameters stay.
New chat shows the normal composer, and the saved draft is unchanged.
4. A reload shows the link's prompt again, the same way the debug link
does.
5. The notice appears only for prompt links.
6. The link works after the sign-in redirect, for both password and
OAuth login.
7. An empty `prompt` shows the normal composer. The debug link works as
before and wins when both parameters are present.
8. The unit tests, story, docs checks and pre-commit all pass.

If a PR is requested, use the title `feat: prefill the Coder Agents
composer from a prompt link`. It has no scope because the change touches
both `site/` and `docs/`.

<details>
<summary>Why no length limit, and what the sign-in check
covers</summary>

- **No length limit.** A limit doesn't stop hidden text: even a short
prompt can push lines below the visible part of the box. The real
protections are that nothing sends without a click and that the notice
asks the user to read the text. Browsers and reverse proxies already
limit URL length. The server caps the create-chat request body at 256
KiB (`coderd/exp_chats.go:79`), so a very long prompt fails when sent.
- **Sign-in.** `RequireAuth` sends the user to `/login?redirect=<encoded
path and query>`. Password login returns through `sanitizeRedirect`, and
OAuth login returns through `SafeRedirectPath`. On both paths, the query
is decoded exactly once, so `%26` stays inside the prompt. Existing
tests cover query preservation (`site/src/utils/redirect.test.ts`,
`LoginPage.test.tsx`), so no new test is needed. Dogfooding check 5
confirms it end to end.

</details>


</details>

---
_Generated with [`xum`](https://github.com/coder/xum) • Model:
`anthropic:claude-opus-5-5` • Thinking: `high`_

---------

Signed-off-by: Thomas Kosiewski <tk@coder.com>
2026-09-28 12:51:15 +02:00
Jake Howell 3a69fab29e fix(site/src/pages/AgentsPage): reset status and source filters when the last option is cleared (#30010)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.

Unchecking the last `Status` or `Source` option in the agents sidebar
filter menu did nothing: the guard bailed out to avoid an empty result
set, so the checkbox silently refused to move. It now resets that group
to its default instead. Stacked on #30009.

- Clearing the last status selects every status again; clearing the last
source falls back to `Created by me`.
- Only the affected group resets, so other filters stay put.

<img width="836" height="720" alt="foo"
src="https://github.com/user-attachments/assets/56e892a5-0dce-4465-b75a-2e3dab654bf5"
/>
2026-09-28 20:22:55 +10:00
Jake Howell 407ed0d546 refactor(site/src/pages/AgentsPage): move git commit prompt into GitPanel (#29159)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

GitPanel already had the composer ref for diff comments, but Commit
still bubbled an `onCommit` callback up to `AgentChatPage` to insert the
canned prompt. The panel now inserts that prompt itself, so the page no
longer owns git-commit wording or the extra prop plumbing.
2026-09-28 10:10:56 +00:00
Jake Howell d853893e8a feat: filter agent chats by chat status (#30009)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.

The sidebar's `Chat status` filter only offered `Read`/`Unread`. This
turns it into a real status filter backed by the `chat_status` enum, the
same value the row icon already shows. Stacked on #30006.

- New `status:<waiting|running|error|requires_action|interrupting>`
search filter (repeated or comma-separated) plus a `chat_statuses` param
on `GetChats`.
- Sidebar `Status` submenu offers `Requires action`, `Error`, `Working`
and `Idle`; `Working` covers `interrupting`, since stopping a turn is
too brief to be worth its own option. A full selection emits no filter.
- `Unread` moves out to its own checkbox (`unread=true` in the URL), so
it narrows a status selection instead of competing with it.
- Grouping by status now sections by the five statuses instead of
`Unread`/`Read`, reusing `getChatStatusDisplay` for labels and icons.

<img width="439" height="177" alt="image"
src="https://github.com/user-attachments/assets/82ef2ef0-cde9-4169-bb29-caa7b9bfdb9e"
/>
2026-09-28 19:58:35 +10:00
Paweł Banaszewski 382a8763ff chore: move to be shared gateway types and helpers (#29718)
Moves client identification, credential handling, header
processing, and error categorization into shareable packages.

Generated by Coder Agents on behalf of @pawbana.
2026-09-28 09:49:56 +00:00
Jake HowellandMichael Suchacz 739c27f9b2 feat(site): adopt the workspaces-style filter combobox (#29274)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Replace the User spend page's provider, client, and model dropdowns with
the Workspaces-style `FilterCombobox`. Keep discrete URL parameters
canonical, reset pagination when dimensions change, and preserve the
current organization selector, permission gates, retention bounds, and
date/time picker.

Originally stacked on #28964. That work has landed with a redesigned
organization-scoped spend API, so this branch now merges `main` and
contains only the combobox changes, not the obsolete stack. The current
API has no user-name search: unsupported free text stays local with an
explicit validation message and does not change report requests or
pagination.

<details>
<summary>Implementation plan and conflict-resolution decisions</summary>

1. Use the current organization-scoped Spend page from `main` as the
baseline; discard obsolete stacked backend, generated API,
documentation, and drill-in changes.
2. Adapt provider/client/model URL parameters to the shared combobox
grammar, including quoted multi-word values.
3. Load options through the combobox's React Query integration using the
existing AI Gateway endpoints and icons. Only session viewers receive
dimension controls.
4. Preserve organization selection, date/time presets, retention limits,
and pagination. Keep unsupported free text local rather than restoring
removed API behavior.
5. Update existing interaction tests and stories for chip
selection/removal, permission gates, and narrow/mobile layouts.

</details>

---------

Co-authored-by: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com>
2026-09-28 19:46:26 +10:00
Jake Howell fb39b59380 fix(site/src/pages/AgentsPage): start stopped workspace from desktop panel (#29475)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Fixes CODAGT-155.

Clicking **Reconnect** in the Desktop panel of a chat whose workspace is
stopped did nothing: the desktop websocket rejects any agent that is not
connected, so every retry failed the same way. Worse, a stopped build
carries no agents, so the Desktop tab was hidden entirely in the exact
state where a start action is needed.

The Desktop tab now renders from the workspace alone, and both the panel
and the pop-out window (`DesktopPopoutPage`, which now resolves the
chat's workspace itself) share one set of rules via
`DesktopWorkspaceState`:

- The VNC connection is gated on `latest_build.status === "running" &&
agent.status === "connected"`, so the session is torn down when the
workspace stops and dials automatically once the agent is back, with no
manual Reconnect needed.
- While the workspace is stopped, the panel offers the build that brings
it back, mirroring the workspace page (`getDesktopStartAction`):
- **Update and start** via `API.updateWorkspace` when the template
requires its active version and the workspace is outdated, since the
backend rejects a plain start of the old version. A
`ParameterValidationError` toasts a link to the workspace parameters
page.
- **Start workspace** via `API.retryWorkspace` after a failed start
(cleanup stop first), or a plain start for `stopped`/`canceled`.
- A failed stop or delete links to the workspace page instead of
offering a Start button that would run the wrong transition.
- Build and agent transitions show a spinner with the current state; a
deleted workspace shows a static message.
- The pop-out renders an `ErrorAlert` when the chat or workspace query
fails (or the chat has no workspace) instead of spinning on
"Initializing desktop..." indefinitely.

Validated against a local dev instance with a docker workspace running
`portabledesktop`: stop via CLI while connected → panel switches to
"Start workspace"; click → "Workspace is starting..." → "Waiting for the
workspace agent..." → desktop connected in ~8s without any Reconnect
click. Same result on a cold page load while stopped, and in the pop-out
window (connected in ~4s). The update/retry/failed-stop dispatch is
covered by Vitest and Storybook.
2026-09-28 19:34:21 +10:00
Michael Suchacz f5092aaa4a feat: make chat limits configurable deployment options (#28927)
Adds deployment options for the chat limits that shape turn behavior and
API acceptance, replacing hardcoded constants in `coderd/x/chatd` and
the chat API. Defaults are unchanged.

| Option | Default | Limit |
|---|---|---|
| `CODER_CHAT_MAX_STEPS_PER_TURN` | 1200 | steps (model responses) in a
chat turn |
| `CODER_CHAT_MAX_GENERATION_RETRIES` | 25 | consecutive retries after a
model generation fails with a transient error |
| `CODER_CHAT_MAX_QUEUED_MESSAGES_PER_CHAT` | 20 | messages that can be
queued in a chat |
| `CODER_CHAT_MAX_ATTACHMENTS_PER_CHAT` | 50 | files linked to a chat;
linking more deletes the earliest uploads |
| `CODER_CHAT_MAX_PROMPT_BYTES` | 131072 | system prompt, plan mode
instructions, and each user's custom prompt |
| `CODER_CHAT_MAX_CONCURRENT_RECORDING_UPLOADS` | 25 | desktop
recordings each server stores at the same time |

`codersdk.DefaultChat*` constants remain the single source of truth.
Values below 1 fail startup validation, and each option's description
ends with "Must be at least 1." `chatd.New` fills any zero field in
`chatd.Config.Limits` with its default once, `LimitsFromConfig` is a
plain conversion, and the code that receives a limit as a parameter (the
`chatstate` queue and file link checks, the turn step check,
`chatretry.Retry`, and `chatadvisor.NewRuntime`) returns an error for a
limit below 1 instead of choosing a default or disabling the limit. The
options are documented in the generated configuration reference and in
the platform controls docs.

`CODER_CHAT_MAX_GENERATION_RETRIES` counts consecutive retries, and the
count resets after each successful step. The default allows 25 retries
(26 attempts) where the old constants allowed 24. The same limit now
applies to each nested advisor model call and to background title,
summary, and turn status label generation, which previously used fixed
`chatretry` budgets.

Chat creation and tool result bodies keep the fixed 256 KiB limit from
main. The prompt-saving endpoints accept bodies up to twice the prompt
limit, for JSON escaping and characters that sanitization removes, but
never less than 256 KiB, so small prompt limits still return the 400
length error. At the default this equals the 256 KiB limit on main.

Four settings from earlier revisions were removed, and the fixed limits
from main are back:

- `CODER_CHAT_MAX_TOOL_OUTPUT_BYTES`: the agent already keeps a 16 KiB
head and a 16 KiB tail of command output, so raising it had no effect
and lowering it cut the tail.
- `CODER_CHAT_MAX_DYNAMIC_TOOLS_PER_CHAT`: tool definitions share the
256 KiB chat creation body limit, so raising the count did little.
- `CODER_CHAT_DEBUG_MAX_BODY_BYTES`: one setting covered two unrelated
debug caps.
- `CODER_CHAT_DEBUG_MAX_TEXT_RUNES`: the name did not say what it
applied to.

Root and subagent concurrency caps stay fixed because they are licensing
behavior, and `MaxChatFileSizeBytes` stays fixed because the web UI
hardcodes the generated constant for client-side checks.
`codersdk.MaxChatFileIDs` is removed; the web UI's "Attachment expired"
tooltip no longer quotes the number because the cap is now per
deployment, and it says that attaching a file beyond the limit
permanently deletes the chat's earliest-uploaded attachments.

## Review record

| Round | Reviewed head | Result | Disposition |
|---|---|---|---|
| Codex 1 and 2 (Sep 2 to 3) | `7f10a1572f8`, `8ee09f8fa3b`,
`197bb78d5b` | 10 findings, then OK on `197bb78d5b` | all threads
resolved |
| Codex 3 (Sep 17) | `e4efac249a5` (pre-rebase) | 4 findings | advisor
retry limit confirmed and fixed in `9e462b7b3d0` (rebased from
`67341e458e8`); ARCHITECTURE.md TODOs added; JSON-escaping body sizing
and streamed-argument rune cap declined as pre-existing design (evidence
in threads) |
| Codex 4 (Sep 18) | `9e462b7b3d0` | 6 findings | recording evicted at
attachment cap 1 confirmed and fixed in `5b61895decb`; `Limits` field
docs and zero-value fallback documented; prompt retro-enforcement,
generated multi-sentence lines, and tool-output truncation metadata
declined as pre-existing design (evidence in threads) |
| Codex 5 (Sep 18) | `5b61895decb` | 1 finding | over-cap batch of
already-linked files accepted after lowering the cap: confirmed and
fixed in `f44063e74e5` |
| mafredri (Sep 23) | `f44063e74e5` | 24 threads, changes requested |
all fixed in `05e3e3d622a`, `c1f78e09e8b`, `709ddb67977`, `d0587a49829`,
`ca4347b24de`, and `1f6c9e2a46f`, then answered and resolved; the
ARCHITECTURE.md text was written at the author's direction and approved
by the author |
| Sibling sweep (Sep 24) | `1f6c9e2a46f` | author-requested audit of all
24 mafredri threads for sibling issues, plus a test refactor | fixed in
`37eaf07d34d` through `1f14ac041b7`: the advisor retry limit,
`chatretry.Retry`, and the turn step check reject values below 1 instead
of disabling retries or the limit; limit tests run against both the
default and configured values set through `chatd.Config` or
`DeploymentValues`; the expired-attachment tooltip is concrete. A
required coder-frontend-review run (8 roles in one agent, CD re-run
once) found a stale story comment, removed. |
| Codex 6 (Sep 27) | `a71383e3a31` | OK, no findings | requested after
the rebase at the author's direction, past the six-pass review budget |

The branch was rebased onto main `4851c7b60c8` on Sep 27; the previous
head was `91b84000adb`, and the earlier SHAs in the review record
predate the rebase. Conflicts in the `chatstate` transitions and
`CreateChat` keep both main's `InitialStatus` and this PR's
`MaxFileLinks`, and main's rewrite of `advisor_internal_test.go` in
#28754 keeps main's version plus this PR's limit tests. Two tests added
on main needed the new retry arguments:
`TestGenerateStructuredTitleWithUsage_FallsBackToTextWhenToolChoiceRejected`
and `TestAdvisorRunStreamsReasoningDeltasSeparatelyFromAdvice`.
Validation on `a71383e3a31`: the pre-commit hook (generation,
golangci-lint, build), the full `coderd/x/chatd/...` suite (20
packages), the chat tests in `codersdk`, `coderd`, and
`enterprise/coderd`, the CLI help tests, race-detector runs of the
`chatd`, `chatstate`, `chatadvisor`, and `chatretry` packages, and `go
build` plus `go vet` on each of the 27 commits. No remote UAT was run.

> Xum acted on behalf of @ibetitsmike for this pull request.
2026-09-28 09:25:01 +00:00
Jake Howell 4f2fd36e8f feat: add pr_status:none filter for chats without a pull request (#30006)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.

Adds `none` to the `pr_status` chat filter, matching chats with no
linked pull request. Stacked on #30005.

- `none` means no diff-status row, or a row whose `pull_request_state`
is null/empty (so chats whose PR was cleared still match), and it ORs
with the other statuses, e.g. `pr_status:none,open`.
- Frontend picks it up from the shared `CHAT_LIST_PR_STATUS_ORDER`,
shown as `No PR`; `searchQuery.ts` now derives its valid set from that
list instead of a duplicated literal.
- Swagger, API docs and the `list_chats` tool schema
regenerated/updated.

<img width="508" height="464" alt="image"
src="https://github.com/user-attachments/assets/bd6c70e3-c634-499d-ae16-e7953f6da2f9"
/>
2026-09-28 19:14:12 +10:00
Jake Howell 8f9b8b7386 fix(site/src/modules/aiModels): keep effort label width static (#30013)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.

The reasoning effort label next to the slider resized with the selected
value (`Minimal`/`Medium` are the widest), which shifted the slider
track while dragging.

Every label now renders in the same CSS grid cell, with all but the
selected one `invisible`, so the slot always reserves the width of the
longest label without hardcoding a pixel value. The badge keeps hugging
its own text and is right-aligned inside that slot.

Measured slider track width across all seven effort values in the
`ModelSelector` `EffortRow` story:

- before: 149, 134, 155, 133, 153, 154 px
- after: 133 px for every value

<img width="720" height="720" alt="bar"
src="https://github.com/user-attachments/assets/d0327500-84f1-4396-8ffe-882dccb0dcc2"
/>
2026-09-28 19:02:27 +10:00
Jake Howell 3b5f7e472d feat(site): rework agents sidebar filter into a dropdown menu (#30005)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Replaces the agents sidebar filter popover (staged filters + search +
`Apply`/`Clear all`) with a dropdown menu that applies changes
immediately.

- Grouping is a radio group at the top; PR status, chat status and
source live in submenus with icons, and `Archived` is a single checkbox.
- Selections apply on click instead of being staged, so `Apply` is gone;
`Reset` clears filters while keeping the current grouping (grouping is
no longer treated as an "active filter").
- Submenus stay open while toggling multiple options, and the existing
guards remain: at least one chat status and one source must stay
selected.
- Adds `DropdownMenuLabel` to the `DropdownMenu` primitives; stories and
tests updated to the menu interaction model.

| Old | New |
| --- | --- |
| <img width="298" height="543" alt="AGENTS_FILTER_OLD"
src="https://github.com/user-attachments/assets/1b1a3bf2-981a-4dac-848d-8659f970e2be"
/> | <img width="428" height="373" alt="AGENTS_FILTER_NEW"
src="https://github.com/user-attachments/assets/c4e56421-91fc-4b4f-bf95-63515875fc88"
/> |
2026-09-28 18:58:27 +10:00
Jake Howell cdf50f8b2c feat: add mark as read and unread to agent chat menus (#30015)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.

The chat read cursor only moved when a chat's stream connected or
disconnected, so there was no way to clear an unread dot without opening
the chat, or to flag a chat to come back to.

`UpdateChatRequest` gains a `read` field that either advances the
owner's read cursor to the latest assistant message or clears it, and
the agents sidebar exposes it as a **Mark as read** / **Mark as unread**
item directly under **Show subagents** in both the right-click and the ⋮
menus.

Notes:

- The cursor is owner-scoped, so `PATCH /api/v2/chats/{chat}` returns
403 for `read` when the caller is not the owner, even when they may
otherwise update the chat.
- The item is hidden for the chat that is already open, because opening
a chat marks it read and would immediately undo the toggle. That also
matches the sidebar, which never shows an unread dot for the active
chat.

<img width="292" height="215" alt="image"
src="https://github.com/user-attachments/assets/31e9e249-70ea-4582-9391-66c4c51621b9"
/>

<details>
<summary>Implementation notes</summary>

Backend:

- `UpdateChatLastReadMessageID` takes a nullable `last_read_message_id`;
`NULL` clears the cursor so every assistant message counts as unread
again.
- `markChatAsRead` (stream connect/disconnect) now wraps
`advanceChatReadCursor`; `clearChatReadCursor` is the new unread path.
Both return errors so the HTTP handler can report failures instead of
only logging them.

Frontend:

- `markChatRead` / `markChatUnread` mutations mirror `pinChat` /
`unpinChat`: optimistic `has_unread` update, rollback plus invalidation
on error, invalidation on settle.
- `onMarkChatRead` / `onMarkChatUnread` thread from `AgentsPageLayout`
through `ChatsSidebar` → `ChatsPanel` → `ChatTreeContext` →
`ChatTreeNode`. `ChatTopBar` deliberately does not pass them, since it
only ever renders the active chat's menu.

Checks run: `make gen`, `make fmt`, `golangci-lint run ./coderd/...`,
`go test ./coderd -run TestChatReadState`, `go test ./coderd -run
'TestSharedReaderStreamChat|TestChatPinOrder'`, `go test
./coderd/database -run TestChatHasUnread`, `go test
./coderd/database/dbauthz -run TestMethodTestSuite`, `tsc --noEmit`,
`biome check`, and the AgentsPage Vitest unit and Storybook projects.

</details>
2026-09-28 18:57:57 +10:00