Commit Graph
17093 Commits
Author SHA1 Message Date
Michael Suchacz 90948802e2 test(site/src/pages/AISettingsPage/MCPServersPage): prefix the OAuth2 resource form fixture 2026-10-12 14:01:34 +00:00
Michael Suchacz 50ecadf953 fix: scope the MCP OAuth2 resource help text to auto-discovery
An empty resource sends none unless auto-discovery fills it while
registering the client, so say that instead of promising none. Shorten the
create request doc to match, drop a class that has no effect on the
single-field row, and use an example.com resource in the form test.
2026-10-12 13:53:42 +00:00
Michael Suchacz 45ff791c61 docs: note MCP OAuth2 reconnects and the resource fallback form
Say which OAuth2 settings delete stored user tokens, and describe the
normalized server URL that discovery stores when no Protected Resource
Metadata entry matches.
2026-10-12 13:47:36 +00:00
Michael Suchacz b1bf4afd74 fix: align and clarify the MCP OAuth2 resource field
Label the form input "Resource URL" like its sibling endpoint fields, say
that an empty value sends no resource parameter, and match the sibling row
grid so the field lines up with the column above. Describe the API field's
discovery and clear semantics precisely, and cover clearing a stored
resource from the edit form.
2026-10-12 13:43:13 +00:00
Michael Suchacz b23e377218 fix(coderd): reject MCP OAuth2 callbacks whose resource changed since connect
RFC 8707 binds an authorization code to the resource named in the
authorization request. Record that resource in a callback-scoped cookie at
connect, and fail the callback with the existing 409 before the code
exchange when an admin changed oauth2_resource in between, so the code is
never redeemed for a resource the user did not authorize.
2026-10-12 13:26:43 +00:00
Michael Suchacz f4516862df test(coderd): tighten MCP OAuth2 resource indicator coverage
Assert invalid resources are rejected before auto-discovery, cover
clearing on every non-oauth2 auth type, check whitespace trimming on
update, and restore the bodyclose directive on TestMCPServerOAuth2PKCE.
2026-10-12 13:10:11 +00:00
Michael Suchacz 8d02836295 refactor(coderd): reuse parsed resource indicator in MCP OAuth2 discovery 2026-10-12 12:37:55 +00:00
Michael Suchacz 2b875068e0 feat: send RFC 8707 resource parameter on MCP server OAuth2 flows
Store an oauth2_resource indicator on MCP server configs. Auto-discovery
fills it from the Protected Resource Metadata entry that covers the
server URL (else the canonical server URL); admins can set or clear it.
When set, Coder sends it as the resource parameter on authorization,
code exchange, and refresh requests. Manual configs without it send no
resource parameter, so providers that reject it keep working.
2026-10-12 11:23:57 +00:00
Danielle Maywood c735c1dd1d fix(site): keep agent chat scroll on tool toggles and log streams (#29354)
Help keep position better in Coder Agents chat transcript during active
scrolling

<details>
<summary>LLM slop description</summary>

In the agent chat, a tool call that expands or collapses can make the
transcript jump. The clicked row can scroll out of view, or the next
streamed output can pull the view to the bottom. The scroller cannot
tell a layout change from new output, so it reacts to a toggle as if the
reply grew.

`ToolCall` now tells the scroller before it toggles. The scroller then
holds the view in place until the reader scrolls, a scroll command runs,
or a new turn starts. The changes are `LOCAL CHANGE` edits to the
scroller source that #29473 vendored.

The `create_workspace` and `start_workspace` rows also made the
transcript jump while the workspace built. Their log boxes used
`scrollIntoView` to show new lines, and that also scrolls the
transcript. At the end of the build, the view could stop following the
reply. Now each box scrolls only itself, and only while the reader is at
its end, so a reader who scrolls up in the box keeps their place. Other
pages use the scroll in the shared `WorkspaceBuildLogs` component, so
that component does not change.

Four behavior changes are intentional. While a turn is anchored, a large
block of output no longer pulls the view to the bottom. The reader stays
on the turn and can use the jump-to-bottom button. Collapsing a tool
while the view follows the reply also stops following, so the rows near
the pointer stay put for the next click. A press on the scrollbar now
counts as a scroll, so it releases the held view like a wheel or key
scroll. Space on a button does not count as a scroll, because Space
activates the button.

Related upstream bug reports, all open with no upstream fix:
shadcn-ui/ui#11175, shadcn-ui/ui#11577, shadcn-ui/ui#11224

</details>

> [!NOTE]
> Generated with [Coder Agents](https://coder.com/docs/ai-coder/agents)


---


https://github.com/user-attachments/assets/deb75f78-5f4e-49b8-baa3-9e2196234756



https://github.com/user-attachments/assets/0f03c526-d60d-4533-8098-1f200e8f11c1



https://github.com/user-attachments/assets/4a014fd6-a3f0-42cd-b5fc-7a61b8f783f5



https://github.com/user-attachments/assets/25d7fb5f-51f1-412d-95ab-a4f3dbeeb167



https://github.com/user-attachments/assets/a1e08441-8d87-4779-96f0-cd676ae217a7



https://github.com/user-attachments/assets/81577372-3e07-4d5a-b732-8ea756d7b604



https://github.com/user-attachments/assets/7dd03bc3-f5f7-4ea9-b602-0369ad120575



https://github.com/user-attachments/assets/41393122-85a8-4e4d-b0f2-1e392ccc4cb9


https://github.com/user-attachments/assets/38caf176-2cb5-4920-9cbc-0262c2157a35



https://github.com/user-attachments/assets/5606106a-2466-4cdf-9fcf-4df38f45d20f



https://github.com/user-attachments/assets/03b1060d-82c5-4844-aaf2-12c29572ae8c



https://github.com/user-attachments/assets/4b966412-0278-4d41-ac2e-91de2a61d803



https://github.com/user-attachments/assets/64ff8cce-0491-46c6-a563-afcb726b2dd1



https://github.com/user-attachments/assets/5c005789-ce82-4d7c-a918-ce2d5ec819c4



https://github.com/user-attachments/assets/0b9bfcda-4971-47c6-802b-3ed4e78a2f75



https://github.com/user-attachments/assets/683ac4ef-cd02-470f-b301-8a80554b9122



https://github.com/user-attachments/assets/dc8da762-b4c3-42ef-93d9-d1a3b13eb7eb
2026-10-12 09:03:44 +01:00
Ethan 4afd834ad2 fix(coderd/x/chatd): return database errors from turn preparation (#30492)
Relates to CODAGT-1330

When chatd prepares a turn, it reads a bunch of things from the
database: the user's custom prompt, plan mode instructions, personal
skills, the advisor config, the user's compaction threshold override,
MCP server configs, inline MCP servers, MCP user tokens and the pinned
workspace MCP tools. If any of those reads failed, we'd log a warning
and run the turn without them, so the model would quietly ignore the
user's instructions or be missing tools for that turn.

To fix, we'll just return the error instead, so the prepare retry runs,
and the chat shows an error if the reads keep failing. The provider
switch history sanitizer and the cancel of deleted tool calls also
return their database errors now. A model config that's unavailable,
e.g. deleted, is still treated as foreign by the sanitizer like it is
today.

An inline MCP server with invalid stored headers still shows up as a
failed connect in the chat debug panel, but a failed read of the inline
MCP servers themselves now fails the turn.

This PR is in a stack on top of #30449.
2026-10-12 09:53:45 +11:00
Ethan 807878c1ab fix(coderd): return database errors at chat create and subagent spawn (#30449)
Relates to CODAGT-1330

chatd stores the deployment and organization system prompts in a chat
when it's created. If either read failed, we'd log it and use the
built-in default, or skip the organization prompt, so the chat ignored
the admin's instructions for its whole life. The subagent model override
had the same problem, and the compaction and advisor overrides quietly
fell back to the chat model for that turn.

To fix, we'll just return the database error instead. Overrides that
can't be used, e.g. the model was deleted or the user has no API key for
its provider, still fall back like they do today.
2026-10-12 09:53:44 +11:00
Thomas Kosiewski f923f4a525 chore!: remove the chat automations experiment (#30412)
Removes the experimental Chat Automations feature (`chat-automations` experiment) from main. This reverts the 16-PR stack that added it and adds two forward migrations that undo its schema and credential changes.

> [!WARNING]
> **Upgrade consequences**
>
> - **Automation data is deleted.** Migration 000615 drops the `chat_automations` table and deletes every queued message an automation delivered. Chats, their messages and ordinary queued messages stay. Messages lose their automation provenance (`automation_id`, `input_id`).
> - **Automation-only credentials are revoked.** Migration 000616 deletes API keys, OAuth2 codes and OAuth2 tokens whose only scopes (or allow-list entries) were `chat_automation:*`. Mixed credentials keep their other scopes. Custom roles lose their `chat_automation` permissions. OAuth2 apps that allowed only `chat_automation` scopes get the whitespace allowlist that grants nothing, as in 000595.
> - **A coordinated restart is required.** Stop all old replicas before the new version runs the migrations. Old replicas read the dropped table and columns, so a rolling deploy is not supported.
> - **Remove `--chat-max-automations-per-owner` before upgrading.** The flag, the YAML key `chat.maxAutomationsPerOwner` and the env var `CODER_CHAT_MAX_AUTOMATIONS_PER_OWNER` are removed. A deployment that still sets the flag or the YAML key will not start (`unknown flag` / `unknown option`). The env var is ignored. This includes dogfood. No release or tag contains the flag.
> - **Down migrations restore the schema only.** 000616 down and 000615 down recreate the 000611 schema with empty tables. They do not restore deleted automations, webhook secrets, provenance, queued deliveries, revoked credentials, stripped permissions or the deleted experiment rule.

## What is removed

- The `chat-automations` experiment and its stored runtime rule (`experiment_rule:chat-automations`).
- The `--chat-max-automations-per-owner` deployment option.
- The `chat_automation` RBAC resource, its member and chatd grants, and the `chat_automation:*` API key scopes.
- The automation sqlc queries, dbauthz wrappers and audit table entries.
- The management routes under `/api/experimental/organizations/{organization}/chat-automations`, and the webhook route `POST /api/experimental/chat-automations/{automation}/events` with its rate limiter.
- The chatd management service, webhook publish, schedule loop, the `manage_automations` tool, and the chatstate admission seam and queue promotion guard that only automations used.
- The Agents Automations page, editor, nav entry, chat labels, the Manage automations toggle and the API client.
- The `archived:any` chat search value that the automations "View chats" dialog added.
- `docs/ai-coder/agents/automations.md`, its manifest entry, the glossary entry and the related rows.

Reverted PRs: #30085, #30096, #30112, #30117, #30127, #30134, #30160, #30166, #30167, #30171, #30187, #30207, #30214, #30217, #30219, #30220.

## What stays, and why

- Migrations 000609, 000610 and 000611, their fixture, and the #30297 lock fix with `migration000609_test.go` stay unchanged. Deployments such as dogfood already ran them.
- New migration **000615** reverses the schema changes of 000609 and 000611 against the current schema. It uses the same short-wait lock-and-retry block as 000609, and it rebuilds `chats_expanded` from main's current definition minus the two automation columns. New migration **000616** follows the 000595 Tasks removal for credentials and recreates `api_key_scope` without the five `chat_automation:*` values. It keeps the `chat_project_memory:*` values from 000612.
- The `chat_automation` value stays in the `resource_type` enum, and `codersdk.ResourceTypeChatAutomation` stays. Old audit log rows stay readable, as with `task` after the Tasks removal.
- The 000615 delete fires the existing queue-version trigger, so `queue_version` moves to `snapshot_version` for each affected chat. `snapshot_version` is not bumped: the coordinated restart restarts every stream loop from an empty state, and the site does not read the version fields.
- `coderd/x/chatd/ARCHITECTURE.md` drops the sections the stack added and gets back its pre-stack wording, merged with the later main edits to the same file.

## Notes for reviewers

- #30379 (chat project page) merged while this PR was in progress. It passed `manageAutomationsEnabled` in `AgentCreatePage.test.tsx` and listed an `automations` route in `AgentsPageLayout.test.tsx`. Later main commits also added automation props in `ConversationTimeline.test.tsx` and `ConversationTimelineWorkingBlocks.stories.tsx`. This PR removes all of them.
- Remaining `automation` matches under `coderd`, `codersdk`, `enterprise`, `site/src` and `docs` are intended:
  - migrations 000609 to 000611, their fixture and `migration000609_test.go`;
  - the new 000615 and 000616 migrations and `migration000615_test.go`;
  - the `chat_automation` resource type in `dump.sql`, `models.go`, `codersdk/audit.go`, the generated API docs, `swagger.json` and `typesGenerated.ts`;
  - unrelated uses of the word "automation" (docs, `chatlabels_test.go`, `ratelimit.go`, `autostop.go`, `subagent_catalog.go`, `WorkspaceSharingSection.tsx`, `AgentChatPage.stories.tsx`).

Remote UAT on an isolated dev deployment passed. It upgraded a populated pre-removal database, then checked chats, queued messages, tokens, the 404 routes, the removed page and nav entry, and the experiments list.

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

![Agents sidebar after the upgrade, with no Automations entry](https://github.com/user-attachments/assets/bd446035-7fc8-4ca4-a735-3a4f36380738)
2026-10-11 19:57:49 +02:00
dfa72df9aa docs: remove references to unsupported SAML authentication (#30507)
## Summary

Coder doesn't support SAML, but a few docs pages implied it did.
This PR removes those mentions.

Resolves
[DOCS-1194](https://linear.app/codercom/issue/DOCS-1194/remove-saml-mentions-from-docs-coder-doesnt-support-saml).

## Changes

- `docs/install/index.md` and `docs/install/prepare/index.md`: "OIDC or
SAML application" is now "OIDC application".
- `docs/.style/style-guide/audience-and-scope.md`: the example snippets
no longer mention SAML or link to a `./saml.md` page that doesn't exist.
The hub-page example now lists headless authentication instead, and the
persona "Coder surface" lines say "OIDC" in place of "OIDC/SAML".

<details>
<summary>Evidence that Coder doesn't support SAML</summary>

Checked against `main`:

- No SAML library in `go.mod`, `go.sum`, or `site/package.json`.
- The `login_type` enum in `coderd/database/dump.sql` and
`codersdk.LoginType` only cover `password`, `github`, `oidc`, `token`,
`none`, and `oauth2_provider_app`.
- No SAML handlers, endpoints, or deployment options in `coderd/` or
`enterprise/`.
- The only code mention is a comment in `coderd/userauth.go` about
SAML-to-OIDC bridges sending `email_verified` as a string.

</details>

## Testing

- `pnpm run lint-docs`: 0 errors.
- The pre-commit hook passed.
- `git grep -i saml -- docs` returns nothing.

---

*Generated by Coder Agents on behalf of @nickvigilante.*

---------

Co-authored-by: Ben Potter <me@bpmct.net>
Co-authored-by: Ben Potter <ben@coder.com>
2026-10-11 08:36:17 -07:00
Michael Suchacz 2d96e88ebe fix(site/src/api): abort chat history requests when the query is cancelled (#30542)
Chat history requests now honor React Query's abort signal.
`getChatMessages` takes an optional `signal`, and
`chatMessagesForInfiniteScroll` passes the query's signal to the first
page request and to every turn fill request.

## Stack context

Stacked on #30524, which loads whole chat turns per history page by
following the first page request with fill requests back to the turn's
prompt.

## Why

A review question on #30524 asked whether the fill loop bypasses React
Query. It does not (the merged page is cached under `chatMessagesKey`
and a refetch reruns the queryFn per page), but no history request
received the abort signal, so a cancelled query kept its HTTP requests
running. With this change, leaving a chat or `cancelChatMessages` in the
edit mutation aborts the in-flight page and fill requests. An aborted
fill is caught by the existing catch/break, and React Query discards the
result.

Behavior change: because the queryFn now reads `signal`, unmounting the
last observer cancels and reverts an in-flight history fetch instead of
letting it finish in the background.

## Testing

- `pnpm exec vitest run src/api/queries/chats.test.ts`: 247 passed.
- New test `aborts the page and fill requests when the query is
cancelled`; the existing first-request and per-page-cap assertions now
expect the signal.
- Red-green: removing the signal from the first request, from the fill
request, or from the queryFn each fails the new test.
- `pnpm lint:types`, `biome check --error-on-warnings`, `oxlint
--deny-warnings` on touched files: clean. Pre-commit hook passed.

## Frontend review

- `frontend-review` FE1 to FE10: all pass.
- `coder-frontend-review` round 1: SD1 (single-use `history` binding in
the new test) fixed. TN3 (wrap the factory in `infiniteQueryOptions`)
declined: the hand-typed queryFn context is pre-existing on main, and
converting it would change the factory's type and every direct `queryFn`
call in tests, which is outside this change. All other roles: no
findings.

> Xum opened this PR on behalf of @ibetitsmike.
2026-10-11 12:13:46 +02:00
Michael Suchacz c28ae0dc9b feat: trigger compaction independently for the chat and compaction models (#28568)
> [!NOTE]
> Xum (an AI agent) authored this pull request on Mike's behalf.

## Summary

Automatic compaction now fires at whichever of two independent triggers
is reached first, and the UI shows when the organization override's
trigger applies.

- **Chat trigger**: the chat owner's personal threshold (or the chat
model's) against the chat model's window. A threshold of 100 turns off
only this trigger.
- **Organization trigger**: a fixed 80% of the organization compaction
override model's window. The override model's own compression threshold
is ignored. The other 20% is a target margin for the summary prompt and
the summary, not a guarantee, because the trigger reads the previous
step's prompt size.

On main, the chat threshold was applied to the smaller of the two
windows, and nothing in the UI showed it. Example: with a 20K chat model
at 70% and an 8K override, main compacts at 5,600 tokens; this PR
compacts at 6,400 (80% of 8K, shown as 32%).

## Changes

Backend (`coderd/x/chatd`):

- The trigger with the lower token point binds (ties go to the chat
trigger). It drives the automatic compaction gate and the
still-over-limit check, and every summary, automatic or manual, records
it.
- An override that is unset, deleted, disabled, on a disabled provider,
or without credentials for the chat owner is treated as absent: the chat
model summarizes and only the chat trigger applies.
- The summary's output cap is bounded by the summarizer's own window,
not the trigger's.
- The still-over-limit error names what can clear it: the compaction
threshold (chat trigger), an override model with a larger window
(organization trigger), or both when usage is over both points.
- The still-over-limit check compacts once more when the latest summary
was recorded under a different threshold or trigger window. The
`chat_summarized` result gains `trigger_context_limit_tokens`, and
`context_limit_tokens` now records the chat model's window (main
recorded the smaller window). On main, lowering a threshold after a
compaction ended every later turn with the error.
- The still-over-limit check skips a 0% threshold ("always compact"),
which on main ended the run with the error after every compaction.
- `ARCHITECTURE.md` documents the two triggers, the summary cap, and the
still-over-limit rules.

Frontend (`site`), through a shared `compactionTriggers` helper that
mirrors the backend rules (no new API):

- Coder Agents settings: the compaction override row warns when the
organization trigger undercuts chat models' default triggers ("the
organization override compacts chats at 80% of {model}'s {N}-token
window").
- Personal thresholds page: an Effective column shows the trigger that
applies, with a popover when the organization override binds. "Compacts
at" follows the same trigger, and a point the chat model's window cannot
reach shows as Off. The header's 100% sentence, and the row warning when
a member types 100, say an organization override may still compact chats
when one is set or its organization's overrides failed to load (the
header also while they load).
- Chat context gauge: the compact-at percent follows the binding trigger
and is annotated when the organization override binds. If the overrides
request fails, it shows the chat-only value with "(organization override
not loaded)", or "Compaction off (organization override not loaded)"
when the chat trigger is off.
- An override whose provider the user cannot use is ignored on the gauge
and the personal page, matching chatd.
- The shared `formatContextLimit` prints counts below 1,000 exactly (an
800-token compaction point showed "~1K") and 999,500 to 999,999 as
"1.0M" instead of "1000K". It also labels the model pickers; their other
values are unchanged.
- `HelpPopoverIconTrigger` lets callers set their own `aria-label`; only
the Effective column's popover does.

Known v1 limits: the Coder Agents settings alert is organization-scoped,
so it can warn about an override that some members fall back from for
lack of provider credentials. The gauge checks the viewer's provider
access, so on a shared chat its label can differ from the owner's
runtime trigger (Codex P2, declined). Compaction itself is unaffected.

## Screenshots

From remote UAT round 13 on 093076f402: an isolated test deployment
with a local fake LLM. The models are test fixtures named for their
context windows: Chat model 20K (own threshold 70%), Chat model 5K
(40%), and Chat model 8K (50%). Chat model 8K is also the organization
compaction override, so the organization trigger is 80% of 8,000 = 6,400
tokens, which is 32% of Chat model 20K's window. Chat model 8K's own 50%
applies only to chats that use it as the chat model; changing it to 10%
or 100% left every value below unchanged.

**Coder Agents settings:** the organization trigger undercuts Chat model
20K's 70% default.

![Override warning: 80% of Chat model 8K's window undercuts Chat model
20K](https://github.com/user-attachments/assets/188c92e6-faaa-4e9a-a563-567cbf98af85)

**Personal thresholds:** the organization trigger binds Chat model 20K
at 32%. Chat model 5K (40%) and Chat model 8K (50%) keep their own chat
triggers.

![Effective column: 32% from the organization trigger on Chat model
20K](https://github.com/user-attachments/assets/9949be4e-9417-4cfc-a683-f1367a1dd77a)
![Organization override popover: 80% of Chat model 8K's window, about
32% of this model's
window](https://github.com/user-attachments/assets/4bc3e002-0be1-46fd-91f0-aa27503034af)

**Personal thresholds, organization settings request failed** (the first
red line is the injected error). Rows fall back to chat-only values.

![Organization settings load failure above usable chat-only
rows](https://github.com/user-attachments/assets/dcf48546-aa47-4f82-a6eb-85f106b4bf45)

**Chat context gauge:** organization trigger binds (Chat model 20K),
chat trigger binds (Chat model 5K), overrides request failed (injected).

![Gauge: Compacts at 32% (organization
override)](https://github.com/user-attachments/assets/cd5402d9-9849-4254-a7a7-6623c4006a2a)
![Gauge: Compacts at
40%](https://github.com/user-attachments/assets/f372c9e9-72ef-41c8-950c-e77d74965f65)
![Gauge: Compacts at 70% (organization override not
loaded)](https://github.com/user-attachments/assets/ab829746-2ab5-4743-848f-dce4e806de3a)

**Still-over-limit errors from real runs:** organization trigger, chat
trigger, both.

![Organization-only over-limit
error](https://github.com/user-attachments/assets/f210807a-a2cc-47a0-807c-f1404373bb28)
![Chat-only over-limit
error](https://github.com/user-attachments/assets/eecec38e-97de-49b6-8670-b32090103bbb)
![Combined over-limit
error](https://github.com/user-attachments/assets/459a6d08-7215-492d-93f5-96a4f767a09e)

## Testing

- Go: `TestBindingCompactionTriggerSource`,
`TestCompactionStillOverLimitError`, `TestCompactionStatusFromHistory`,
and `TestActiveServer_CompactionModelOverride` cover the 80% point
(fails if the override's own threshold is read again), user threshold
100 leaving the organization trigger on, the summary cap for automatic
and manual compaction, the over-limit messages, and recompaction after a
trigger change. The site binding tests mirror the Go table row for row.
- Site: `compactionTriggers` unit tests and Storybook stories for the
three surfaces, including the overrides fetch failure.
- On c6f8750479: `go vet`, the `chatd` and `chatloop` tests, and the
AgentsPage, AISettingsPage, and HelpPopover unit tests (2,274 passed, 2
skipped) pass, and CI is green. On 987cefe399, tsc, the five affected
story files (109 passed), and `make pre-commit` also passed. 093076f402
only changes `ARCHITECTURE.md`; the pre-commit hook's markdown format
and lint checks pass on it.
- On 3cd5b08f1f: tsc, the new `formatContextLimit` test (fails on the
old helper for 800 and 999,999), the `compactionTriggers` and `aiModels`
unit tests (224 passed), and the affected story files pass, and the
pre-commit hook passed on all three commits.

## Review record

- Earlier heads: 12 Codex passes and 3 human reviews, all threads
answered. Rebased onto main several times, most recently ff3fa22f68
(kept #30274, #29892, and #29890 in conflicted files).
- coder-agents-review rounds 1 to 18: findings fixed; approved since
round 15. The round 1 `ARCHITECTURE.md` finding was left for the
maintainer, who asked for the update in the last commit.
- coder-frontend-review (eight roles): all pass. Splitting the PR (RO6)
was declined because it is reviewed as one unit; the
`organizationTriggerFor` story helper stays because its three fields
must match the model.
- Design change after UAT round 11: the organization trigger is a fixed
80% of the override window instead of the override model's own threshold
(171d5f568e, 21d2ce7fce, 987cefe399).
- coder-agents-review round 19: copy, naming, and an unreachable
zero-window gate fixed (6e8efb9054, c6f8750479). A summary-time fit
check with chat-model fallback (CRF-156) was declined: the previous-step
lag applies to every trigger, including main's. Round 20 approved
c6f8750479 with no findings.
- Codex: one P2 on 987cefe399 declined (see known limits); no major
issues on c6f8750479.
- Remote UAT on dogfood (fake LLM, isolated test deployment): rounds 8
to 13 PASS. Round 12 on c6f8750479 first failed one criterion that was
written wrong (the admin alert correctly lists an override model that is
also a chat model at 100%); the reviewer endorsed PASS on the same
evidence after the correction. Round 13 on 093076f402 retook the
screenshots with neutral model names and confirmed that the override
model's own threshold (10%, 50%, 100%) does not move the organization
trigger.
- UAT round 13 notes: the header after a failed or pending overrides
load and the sub-1K labels are fixed in 4e172ab5ff and d5888ce15dc;
coder-agents-review round 21 found the same gap in the row warning
(CRF-167, fixed in 3cd5b08f1f). Left as on main: a summary's
`usage_percent` is measured against the binding trigger's window, so it
can exceed 100 (nothing reads it), and the 100% help text shows only for
an unsaved edit.
- Codex: no major issues on d5888ce15d and 3cd5b08f1f.
coder-agents-review round 22 approved 3cd5b08f1f with no open findings.
- coder-frontend-review on those commits: all roles pass after the
fixes. Declined: moving the formatter fix to its own PR (RO5; the owner
asked for it here), adding "tokens" to sub-1K labels (TN6; "~800" reads
like "~16K"), and splitting the component (RP6).
2026-10-11 12:10:59 +02:00
George K 50c785cc6d refactor(provisioner/terraform/scriptorder): stage script order resolution (#30481)
Runtime resolution needs to know which scripts are selected by
ordering rules. The previous monolithic resolver required runtime data
up front, forcing callers to either resolve every script or resolve
ordering rules twice.

Introduce a staged API:

```
  NewProgram
    -> FilterDataSources
    -> Prepare
    -> resolve selected script runtimes
    -> Finalize
```

`NewProgram` builds reusable state and configuration indexes and records
script lifecycle attributes. `Prepare` resolves declarations, selectors,
and lifecycle phases, and records the selected script addresses needed
for runtime resolution. `Finalize` accepts only caller-resolved runtime
bindings and constructs the dependency graphs.

Filtering remains caller-controlled so plan-time consumers can remove
destroyed coder_script_order instances using the saved-plan graph
before preparation. Existing validation, diagnostics, limits,
warnings, and deterministic graph construction are preserved.

This change establishes the API boundary required by later
Terraform-backed runtime resolution without wiring it into
provisioning.

Refs:
https://linear.app/codercom/issue/PLAT-545
https://linear.app/codercom/issue/PLAT-715
2026-10-09 19:12:38 -07:00
George K e2abd0f01d refactor(provisioner/terraform): extract script ordering (#30337)
refactor(provisioner/terraform): extract script ordering

Move the existing script-order declaration, selector, phase and
runtime resolution, and dependency-graph logic into a focused
`scriptorder` subpackage.

_Reviewer note: Although the diff is large, it is mechanical. Existing
code and tests are moved into a subpackage, split by pipeline stage,
and renamed; behavior is unchanged._

_Reviewer note 2: The next PR in the stack is going to be another
refactor of this code, but it will not be purely mechanical. To make
review easier, I'm keeping the 2 PRs separate so that renamed/moved
code is not mixed with functional changes. I apologize for the
churn 🙏._

Split the monolithic implementation and tests by pipeline stage,
simplify names now that the package supplies the script-order context,
and document the declaration- to-graph pipeline. Preserve existing
validation, limits, deterministic output, diagnostics, and cycle
detection.

This refactor does not change provisioning behavior or wire the
package into provisioning. It establishes the package boundary needed
by later Terraform-backed runtime-resolution work.

Refs:
https://linear.app/codercom/issue/PLAT-545
https://linear.app/codercom/issue/PLAT-711
2026-10-09 19:01:03 -07:00
George K 652ae952a2 feat(provisioner/terraform): query Terraform graphs (#30334)
Add query operations over Terraform graph indexes for later
agent-runtime resolution.

Resolve Terraform value references to their most specific indexed
configuration nodes, then follow dependencies to caller-defined
boundary nodes. Return deterministic, deduplicated results while
honoring context cancellation and cumulative limits on lookups, node
visits, and traversed edges.

Cover config-derived and saved-plan graph shapes, including module
inputs, module outputs, repeated resource instances, and converging
paths.  Provisioning behavior remains unchanged until later commits
add consumers.

Refs:
https://linear.app/codercom/issue/PLAT-545
https://linear.app/codercom/issue/PLAT-710
2026-10-09 18:32:14 -07:00
George K a2686cd747 feat(provisioner/terraform): index Terraform graphs (#30277)
Script ordering needs deterministic address lookups and dependency
topology across Terraform's config-derived plan graphs and saved-plan
apply graphs. Add a `tfgraph` package that normalizes graph nodes into
configuration and instance addresses, preserves operation metadata,
assigns index-scoped node IDs, and stores forward dependencies in an
immutable index.

Bound parser work and retained data for template-controlled DOT,
reject edge forms outside Terraform's emitted subset, and honor
cancellation between synchronous parsing and indexing phases. The
package is not wired into provisioning yet, so this change does not
alter existing behavior. Its API intentionally covers only script
ordering for now and can be expanded separately to consolidate
`ConvertState`'s legacy graph processing.

Refs:
https://linear.app/codercom/issue/PLAT-545
https://linear.app/codercom/issue/PLAT-709
2026-10-09 18:18:36 -07:00
TJ 8697b91870 feat(site/src/pages/AgentsPage): quieter read-only view for other users' chats (#30483)
When a user opens a chat owned by someone else, the page showed an
orange warning band and a full composer whose controls were all
disabled. This replaces that with a quieter read-only view.

- Top bar: no warning band. The share button is shown only to the chat
owner, so viewers with share permission (admins) no longer get it. The
shared-chat icon by the title is unchanged, and the kebab stays (it
holds Copy ID).
- Composer: the "This chat is owned by X. It is read-only." message
moves inside as a neutral info line. The editor is not rendered, so the
composer is short, and it gets the default border.
- Composer controls: `+`, mic, send/stop and the `x` on workspace, MCP
and planning pills are hidden. Model, workspace and MCP pills and the
context indicator stay; the model shows as a plain label rather than a
disabled picker.

The compact view is driven by a new `readOnlyNotice` prop on
`AgentChatInput`, so the new-chat form, which also uses `isReadOnly`, is
unchanged. Sidebar rows and message action rows are out of scope.

Fixes CODAGT-1355

Follow-ups (cleanup tracked in
[CODAGT-1384](https://linear.app/codercom/issue/CODAGT-1384/read-only-chat-view-follow-up-cleanup-from-30483)):

-
[CODAGT-1385](https://linear.app/codercom/issue/CODAGT-1385/split-the-read-only-composer-out-of-agentchatinput):
split the read-only composer out of `AgentChatInput` (replaces
`readOnlyNotice`).
-
[CODAGT-1386](https://linear.app/codercom/issue/CODAGT-1386/use-one-viewer-permission-check-across-the-chat-page):
use one viewer-permission check across the chat page.
-
[CODAGT-1387](https://linear.app/codercom/issue/CODAGT-1387/audit-read-only-treatment-for-sidebar-rows-and-message-actions):
audit read-only treatment for sidebar rows and message actions.
- [CODAGT-1308](https://linear.app/codercom/issue/CODAGT-1308):
read-only viewers still see an enabled "Remove from queue" button
(existing).

<details>
<summary>Design decisions</summary>

From design review with Tracy:

- Remove the red warning band.
- Remove the share button for non-owners. A lock and then a moved shared
icon were tried; the existing shared icon by the title was kept instead.
- Move the warning message into the chat area.
- Make the chat area smaller and outline it so it looks different.
- Remove disabled action buttons in the chat area (only show content the
user can interact with): `+`, mic, send, and the pill `x` buttons. The
spinner in the mockup is the existing context indicator, which stays.

Verified in Storybook (`AgentChatPageView` / `OtherUserChatReadOnly`):
the composer shows the notice, has no editor, its only button is the
context indicator, and the orange band is gone. New visual story:
`AgentChatInput` / `ReadOnlyNotice`.

</details>

---

_Generated by Coder Agents._
2026-10-09 17:23:41 -07:00
Jake Howell 3364368657 fix(site): exclude disabled workspaces from bulk selection (#30517)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

“Select all workspaces” selected pending and deleting workspaces even
though their individual checkboxes were disabled. Reuse the row
eligibility predicate for bulk selection and its checked/disabled state,
including when no rows are eligible. Keep existing selections clearable
if polling makes every selected row pending or deleting.

Preserve pagination and selection-count semantics: stopped, pending, and
running rows now produce “Selected 2 of 3.” Extend existing Vitest
coverage for mixed/all/no eligibility and deselection, with focused
Storybook states.

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

The parent already derives bulk-action inputs and counts from the
selection callback, so the production change stays in the table.
Selection remains page-scoped, and the denominator remains all displayed
rows.

Passed: 24 WorkspacesPage unit tests, 3 focused Chromium Storybook
tests, `pnpm format`, `pnpm check`, full `pnpm lint` including
TypeScript, `git diff --check`, and FE1–FE10 self-review. Browser
automation verified mixed eligibility, clearing/reselecting, and the
disabled no-eligible state, and clearing stale disabled selections;
screenshots were returned in chat only. `EdgeCaseAudit` was absent in
this checkout. Test runners emitted non-failing shutdown/version
warnings. Independent visual review was blocked by agent authentication.

</details>
2026-10-10 10:45:16 +11:00
McKayla はな 86ebc72236 chore: remove unused autofill-parameters endpoint and experiment (#30525) 2026-10-09 16:42:41 -06:00
Asher 7829b8f924 refactor: move ssh upgrade listener to the corresponding serve (#30532)
Move the upgrade listener close to where it is actually used rather than
smushing it with the reconnecting pty listener close.

Also add a comment explaining why we close it even though the ssh server
is supposed to do that.
2026-10-09 14:16:03 -08:00
Andrew Aquino 89d9492b02 refactor(site/src/pages/CreateTokenPage): use NANO_DAY instead of multiplying NANO_HOUR by 24 (#30575)
I saw during #30564 that everywhere we use `NANO_HOUR` it's multiplied
by 24. I was going to suggest replacing `24 * NANO_HOUR` with
`NANO_DAY`, but that PR merged before I could post the comment lol (This
PR does that)

Also changes `NANO_HOUR` to an internal constant since it's no longer
used anywhere, and also adds a comment explaining `NANO_HOUR` since I'd
never seen that number before
2026-10-09 20:41:20 +00:00
Jeremy Ruppel 408cc8ec02 chore: enable exhaustive-deps oxlint rule (#30569)
Enables oxlint's `exhaustive-deps` rule as an error and turns off the
overlapping Biome `useExhaustiveDependencies` rule (6/6). Stacked on
#30568.

The earlier PRs in the stack fix all 13 violations, so this PR only
changes config. It also updates an `AgentChatInput` comment that
referred to Biome's hooks lint.

<details>
<summary>Implementation plan and findings</summary>


### Findings

- With `"exhaustive-deps": "error"`, oxlint 1.80 reported 13 violations
in 11 files under `site/`.
- No `biome-ignore lint/correctness/useExhaustiveDependencies`
suppressions remained, so the work was fixing the places where oxlint is
stricter than Biome.
- oxlint treats `useEffectEvent` results as stable.
- Formik's `setFieldValue` and `setFieldTouched` are stable
(`useEventCallback`), but the `form` object from `useFormik` is not.
Method calls like `form.setFieldValue(...)` make the rule require
`form`.
- `AgentsPage` and `TemplateBuilder` use React Compiler, so "changes
every render" reports there are false positives at runtime.
`site/AGENTS.md` rules out adding `useMemo` or `useCallback` there.

### Stack

| PR | Fixes |
|---|---|
| #30564 Formik setters | `CreateTokenForm`, `CreateWorkspacePageView`
(two effects): destructure the stable setters |
| #30565 `useEffectEvent` | `TerminalPanel` ready fallback,
`useWorkspaceFileUploads` unmount abort and scope reset |
| #30566 TemplateBuilder | `ModuleSelectStep`,
`TemplateCustomizationsStep`: module-level empty arrays instead of `??
[]` |
| #30567 `useMemo` deps | `CreateWorkspacePage`: `readonly` module-level
`emptyPresets`. `DeploymentBannerView`: `formatLastAggregated` helper
replaces a memo whose only dep was a recompute trigger |
| #30568 effect deps | `NotificationsPage` (`searchParams`),
`RenameChatDialog` (`[prevChatId]`), `WorkspaceMoreActions`
(`[disabled]`) |
| This PR | Enable the rule. Biome `useExhaustiveDependencies` off |

### Decisions

- Fixes come first and the rule is turned on last, so every PR passes
lint on its own.
- `ModuleSelectStep`: dropping the manual `useMemo` made `lint:compiler`
flag `handleToggle`, so it uses the module-level constant like
`TemplateCustomizationsStep`.
- `emptyPresets` is shared across renders and instances. `presets` is
typed `readonly` through the view, so the compiler rejects mutation.
Every use only reads it, and loaded query data is already shared across
consumers.

### Tests

- Added: `CreateTokenPage` default lifetime submission,
`DeploymentBannerView` "last aggregated" countdown. Both were checked to
fail against a broken implementation.
- Existing coverage: `useWorkspaceFileUploads` (unmount, StrictMode,
scope changes), `CreateWorkspacePage` presets.
- Not covered by Vitest: `TerminalPanel`, `RenameChatDialog`,
`NotificationsPage`, `WorkspaceMoreActions` (needs a hand-built
`DashboardContext`), and the TemplateBuilder steps.

### Validation

`lint:oxlint`, `lint:check`, `lint:types`, `lint:compiler`,
`lint:circular-deps`, `knip`, Biome format, and 283 Vitest tests across
the affected files.

</details>

_Generated by Coder Agents on behalf of @jeremyruppel._
2026-10-09 16:00:17 -04:00
Jeremy Ruppel 697d7387b9 fix(site/src): add missing effect dependencies (#30568)
Prepares for enabling oxlint's `exhaustive-deps` rule (5/6). Stacked on
#30567.

Gives three effects complete dependency lists:

- `NotificationsPage`: depends on `searchParams` instead of
`searchParams.delete`. `searchParams` is memoized on the location, and
the `disabledId` guard is unchanged.
- `RenameChatDialog`: the `useLayoutEffect` that had no dependency array
now depends on `[prevChatId]`. Its body already returned early unless
`prevChatId` changed, and the ref guard stays for StrictMode replays.
- `WorkspaceMoreActions`: the effect that had no dependency array and
closes the menu now runs on `[disabled]` and only closes it. The trigger
is disabled with the same flag, so the menu can't reopen while disabled.

None of these three components has Vitest coverage. A
`WorkspaceMoreActions` test needs a hand-built `DashboardContext`, so I
didn't add one here.

<details>
<summary>Stack</summary>

1. #30564 Formik setters
2. #30565 `useEffectEvent` in AgentsPage
3. #30566 TemplateBuilder fallback arrays
4. #30567 `useMemo` dependencies
5. **This PR**: Missing effect dependencies
6. #30569 Enable `exhaustive-deps`

</details>

_Generated by Coder Agents on behalf of @jeremyruppel._
2026-10-09 16:00:16 -04:00
Jeremy Ruppel 8797ca50e4 fix(site/src): correct useMemo dependencies (#30567)
Prepares for enabling oxlint's `exhaustive-deps` rule (4/6). Stacked on
#30566.

Fixes two `useMemo` calls outside React Compiler directories, where the
reports reflect real behavior:

- `CreateWorkspacePage`: `presets` falls back to a module-level
`readonly` empty array instead of a new `[]`. While presets load, the
view's `[presets]` effects no longer rerun on every parent render.
`presets` is typed `readonly` through `CreateWorkspacePageView`, so the
shared fallback can't be mutated. Every use only reads it, and loaded
query data is already shared across consumers.
- `DeploymentBannerView`: `lastAggregated` listed `timeUntilRefresh` as
a dep only to recompute on each countdown tick. Each tick already
re-renders, so the value now comes from a small `formatLastAggregated`
helper with no memo.

Adds a `DeploymentBannerView` test with fake timers that the relative
"last aggregated" text advances as the countdown ticks.

<details>
<summary>Stack</summary>

1. #30564 Formik setters
2. #30565 `useEffectEvent` in AgentsPage
3. #30566 TemplateBuilder fallback arrays
4. **This PR**: `useMemo` dependencies
5. #30568 Missing effect dependencies
6. #30569 Enable `exhaustive-deps`

</details>

_Generated by Coder Agents on behalf of @jeremyruppel._
2026-10-09 16:00:16 -04:00
Jeremy Ruppel dfeea82325 refactor(site/src/pages/TemplateBuilder): avoid per-render fallback arrays in hook deps (#30566)
Prepares for enabling oxlint's `exhaustive-deps` rule (3/6). Stacked on
#30565.

`data ?? []` creates a new array every render while a query has no data,
so hook deps that include it look changed on every render.
`ModuleSelectStep` and `TemplateCustomizationsStep` now fall back to
module-level `readonly` empty arrays (`emptyModules`, `emptyOrgs`),
following the existing pattern in `CreateTemplateForm` and
`CreateUserForm`. The `readonly` type keeps the shared fallback from
being mutated.

<details>
<summary>Decision notes</summary>

- Under the React Compiler these reports are false positives at runtime,
but the lint can't tell. `site/AGENTS.md` rules out `useMemo` in
compiler directories.
- I tried dropping the manual `useMemo` in `ModuleSelectStep` and
computing `conflicts` inline. That made `lint:compiler` flag
`handleToggle` as an unmemoized closure, so I used the constant instead.

</details>

<details>
<summary>Stack</summary>

1. #30564 Formik setters
2. #30565 `useEffectEvent` in AgentsPage
3. **This PR**: TemplateBuilder fallback arrays
4. #30567 `useMemo` dependencies
5. #30568 Missing effect dependencies
6. #30569 Enable `exhaustive-deps`

</details>

_Generated by Coder Agents on behalf of @jeremyruppel._
2026-10-09 16:00:15 -04:00
Jeremy Ruppel 7439225b1a refactor(site/src/pages/AgentsPage): read latest callbacks in effects with useEffectEvent (#30565)
Prepares for enabling oxlint's `exhaustive-deps` rule (2/6). Stacked on
#30564.

Some effects in React Compiler directories call per-render functions.
The compiler keeps those functions stable, but the lint can't see that,
and `site/AGENTS.md` rules out adding `useCallback` there. These effects
now call the latest function through `useEffectEvent`:

- `TerminalPanel`: the ready fallback timer uses
`useEffectEvent(signalReady)`, the same pattern as the existing
`detachTerminal`. `signalReady` stays a plain function because an event
handler also calls it.
- `useWorkspaceFileUploads`: the unmount abort and the scope-change
reset are effect events, so their effects depend on `[]` and
`[scopeKey]`. The returned `reset` is unchanged.

The existing `useWorkspaceFileUploads` tests cover both paths: unmount,
StrictMode replay, and chat or workspace changes.

<details>
<summary>Stack</summary>

1. #30564 Formik setters
2. **This PR**: `useEffectEvent` in AgentsPage
3. #30566 TemplateBuilder fallback arrays
4. #30567 `useMemo` dependencies
5. #30568 Missing effect dependencies
6. #30569 Enable `exhaustive-deps`

</details>

_Generated by Coder Agents on behalf of @jeremyruppel._
2026-10-09 16:00:15 -04:00
Jeremy Ruppel 71f468b2e0 refactor(site/src/pages): depend on stable Formik setters in effects (#30564)
Prepares for enabling oxlint's `exhaustive-deps` rule (1/6 in a stack).

Effects that call `form.setFieldValue(...)` make the rule require the
whole `form` object from `useFormik`, which changes identity every
render. Formik's `setFieldValue` and `setFieldTouched` are stable
(`useEventCallback`), so these effects now destructure the setters and
depend on them instead. Affects `CreateTokenForm` and both preset
effects in `CreateWorkspacePageView`.

Adds a `CreateTokenPage` test that a 10-day max token lifetime submits
the 7-day default. It fails if the lifetime sync effect is removed.

<details>
<summary>Stack and context</summary>

1. **This PR**: Formik setters
2. #30565 `useEffectEvent` in AgentsPage
3. #30566 TemplateBuilder fallback arrays
4. #30567 `useMemo` dependencies
5. #30568 Missing effect dependencies
6. #30569 Enable `exhaustive-deps`

With the rule on, oxlint 1.80 reported 13 violations in 11 files. No
Biome suppressions for `useExhaustiveDependencies` remained, so the work
is fixing the places where oxlint is stricter than Biome. Each PR fixes
one category, and the last flips the rule.

</details>

_Generated by Coder Agents on behalf of @jeremyruppel._
2026-10-09 16:00:15 -04:00
TJ 2b5c0f3569 fix(site/src/pages/AgentsPage/components/ChatConversation): keep the live working timer width stable (#30485)
The live "Working for" label changed width on every tick, moving the
chevron. It now uses tabular digits and a zero-padded trailing unit (`1m
06s`, `1h 05m`), so width only changes when a unit or leading digit is
added.

Fixes CODAGT-1356

---

Generated by Coder Agents on behalf of @tracyjohnsonux.
2026-10-09 10:42:11 -07:00
Michael Suchacz d28a433b23 perf(coderd/database): index chat message pagination (#30562)
Loading a chat's history can take seconds when its messages sit far from
the end of the `chat_messages` id space, because no index returns one
chat's live messages in id order. Given the `LIMIT`, the planner chooses
`chat_messages_pkey` instead and filters by `chat_id`, so it reads other
chats' messages until it reaches this chat's.

On dogfood, the newest page of one idle long chat took 21 s: `Index Scan
Backward using chat_messages_pkey` discarded 614,776 rows and did 78,749
disk reads. Over the past 7 days, 108 of 33,745
`GetChatMessagesByChatIDDescPaginated` calls took more than 1 s, and 10
took more than 10 s. `GetChatMessagesByChatIDAscPaginated` has the same
problem in the other direction: for `after_id = 0, limit 1`, which chatd
uses as a first-turn probe, dogfood's plan scans forward from the
table's oldest row. 305 of its 2,863 calls took more than 1 s.

This PR adds migration 000614: `CREATE INDEX idx_chat_messages_chat_id
ON chat_messages (chat_id, id DESC) WHERE deleted = false`. No queries
change.

**Migration cost:** a plain `CREATE INDEX` inside the migration
transaction, which blocks writes to `chat_messages` until the upgrade
commits. Reads continue. On a 1.01M-row fixture (641 MB heap) the build
took 0.8 s and the index is 39 MB. Dogfood has 5.85M rows and a 5.7 GB
heap, so expect seconds and about 230 MB.

## Testing

Remote UAT through Coder Agents (round 1 PASS) on the 1.01M-row fixture,
Postgres 13.21. It ran base f8e053e385, upgraded in place to
9abea171ba, then ran the same queries. Result rows and HTTP bodies were
identical.

| Query (fixture chat) | Without the index | With the index |
|---|---|---|
| Newest page, idle chat | pkey backward, 83,471 buffers, 391 ms | new
index, 13 buffers, 0.13 ms |
| Ascending `after_id=0, limit 1`, recent chat | pkey forward, 80,843
buffers, 404 ms | new index, 5 buffers, 0.06 ms |
| `POST /messages` to a default-title chat | about 0.5 s | about 0.02 s
|

- A sweep of every `chat_id`-filtered `chat_messages` query in
`chats.sql`, plus the two soft-delete updates and the chat-list
`has_unread` checks, found no query more than 2x worse.
- The UI loaded older pages of long chats, an empty chat, and a chat
with soft-deleted messages correctly.
- Running the down migration restores the base plan.
- Local tests: `TestMigrate`, `TestMigrateUpWithFixtures`,
`TestMigrationChain`, `TestCheckLatestVersion`,
`TestGetChatMessagesByChatIDOrdersByID`,
`TestGetChatMessages_Pagination`, `TestGetChatMessages_TurnStartID`, and
the pre-commit hook (`make gen` changed only `dump.sql`).
- No plan test is added. The repo has none, and the bad plan needs
production-shaped data: on a 200k-row local fixture with rows under
about 250 B, the planner kept the pkey even with the index. Dogfood rows
average about 1 KB, which by the same cost model favors the index for
any chat under about 3% of the table (the largest is under 0.4%).

## Review record

- Polish pass: no changes.
- Codex review: no findings on 9abea171ba.
- Test audit: no tests in scope. The audited tree is the head commit
9abea171ba.
- Remote UAT round 1: PASS on 9abea171ba. Two informational notes: the
write lock described above, and no `IF NOT EXISTS` (only 11 of 111 index
migrations use it).

> Xum opened this PR on behalf of @ibetitsmike.
2026-10-09 19:23:25 +02:00
coder[bot] f8e053e385 docs: document VS Code SSH keepalive and reconnection settings (#30501) 2026-10-09 18:43:18 +05:00
Lisa Fiander 4276b93551 chore: Adjust security policy to explicitly exclude volumetric DDoS (#30548)
## Context

Updating security policy to be more explicit about volumetric DDoS being
out-of-scope for findings, but application level with single requests
being accepted
2026-10-09 14:31:42 +01:00
Michael Suchacz 782fb30f09 feat: load whole chat turns per history page (#30524)
Closes
[CODAGT-1372](https://linear.app/codercom/issue/CODAGT-1372/load-whole-turns-per-history-page-so-collapsed-working-blocks-fill-in).

With collapsed working blocks, a long agent turn renders as one row, but
chat history pages hold a fixed 50 messages. A 400-step turn took about
eight sequential page loads to fill, and its block showed partial labels
("at least", "or more") until then.

`GET /api/v2/chats/{chat}/messages` now returns `turn_start_id` on
newest-first pages: the ID of the user prompt that starts the turn
containing the page's oldest message. It comes from a new
`GetChatTurnStartID` query on the existing
`idx_chat_messages_user_prompts` index, so there is no migration.
Soft-deleted prompts and model-only user rows never start a turn.

The history query then fills each page back to that prompt with requests
of up to 200 messages, capped at 1000 messages per page, so a page holds
whole turns and a complete block renders without partial labels. Past
the cap, or when a fill request fails or returns no messages, the page
keeps what loaded and ends mid-turn, and the next page continues it, as
before. Because the fill runs inside the page fetch, a chat now waits
for its fill requests (one to five) before it first renders: with an
injected 500 ms per-request delay, a chat whose newest turn hits the cap
appeared after 3.8 s instead of 1.1 s.

## Screenshots

From the dogfood UAT, the same 200-step turn with its next history
request held, so each label shows only what loaded before it:

**Before**, on the base commit `29e876df4da`, after two 50-message
pages: "Worked for at least 1m 35s (48 steps or more)", partly hidden by
the loading indicator.

![Before: partial label for a 200-step
turn](https://github.com/user-attachments/assets/6b4e4abf-4bc6-4476-8ed5-52c39c8eebe6)

**After**, on `186a9b053a0`, after the first page: "Worked for 6m 39s
(200 steps)".

![After: exact label for the same 200-step
turn](https://github.com/user-attachments/assets/22ec1900-1e7b-4c98-87a9-0463e1d852c2)

A 750-step turn, larger than one 1000-message page, is exact once the
next page loads:

![After: 750-step turn,
expanded](https://github.com/user-attachments/assets/f927a848-62b1-4eb7-a548-fbdff61fc9c4)

A malformed fill response keeps the loaded messages and the partial
label instead of showing "Failed to load chat", as `ecdfb27ec29` did:

![Malformed fill response: partial label, no error
screen](https://github.com/user-attachments/assets/6d393df9-15a2-471e-9bb6-71e919aca570)

## Testing

- Go: `TestGetChatMessages_TurnStartID` (pages spanning turns, deleted
prompts, model-only user rows, polling and empty pages) and the dbauthz
suite entry.
- Vitest: fill request parameters, the 1000-message cap, failed,
malformed, and empty fill responses, and servers without
`turn_start_id`.
- Dogfood UAT through Coder Agents: PASS on `186a9b053a0` (round 4):
whole-turn first pages, the 1000-message cap and its continuation, fill
failures, a live turn, and API checks for deleted prompts and model-only
user rows. Round 3 on `ecdfb27ec29` failed: a malformed fill failed the
chat load, and an empty fill reporting `has_more` repeated forever.
`7266f468290` fixes both, with regression tests.

## Review record

- Test audit with mutation checks: the Go test now covers a page
spanning two turns, which catches a lookup keyed on the newest message.
A re-audit of later test changes changed nothing; the one surviving
mutation drops the `!older.has_more` stop, costing one extra request
when the prompt is deleted mid-fill.
- Frontend review (8 roles, 5 rounds): fixed doc, naming, loose-type,
and test findings. Its suggestions to catch only the fill request (DF5)
and drop the empty-page stop (SD4) caused the round 3 failures and are
reverted. Kept: SD1 (`MAX_MESSAGES_PER_REQUEST` is used once, named like
`MESSAGES_PAGE_SIZE`) and round 5 SD4 (`!older.has_more` is the
endpoint's pagination signal). Declined DF6: the `queued_messages`
refetch race predates this change, and a failed refetch fill only
unloads older history that reloads on scroll.
- Codex: no findings on `186a9b053a0`.
- Known: a hung fill delays the first render (no client timeout); fills
are not cancelled when the user leaves; the top of history costs one
extra empty request; injected malformed fill rows break the page as they
do on the first page.

> Xum opened this PR on behalf of @ibetitsmike.
2026-10-09 13:32:39 +02:00
Danielle Maywood ff3fa22f68 feat(site): count every PR in the chats sidebar (#29832)
Part 6 of 6. Depends on #29831. Supersedes #29547, which merged with a
flattened head by mistake.

The chats sidebar and search results now count every PR in
`diff_statuses`, not only the primary ref. A chat with one PR shows that
PR's state icon and line stats, even when the primary ref is a newer
branch without a PR. A chat with several PRs shows a PR count instead of
a single state icon, with no line stats. Screen readers hear "N pull
requests".

In the sidebar tree, the kebab menu and the right-click menu of a chat
list its PRs in a group between "Copy" and "Archive agent". One PR is a
direct link. Several PRs open an "N PRs" submenu. The entries use the
same rows as the top bar PR menu. Viewers of a shared chat also see the
links. PRs without a URL are not listed.

These menus replace the hover tooltip from earlier commits. The tooltip
did not open on touch and had no links to the PRs.

Generated by Coder Agents.
2026-10-09 11:27:23 +01:00
Danielle Maywood 051eb587d4 feat(site): list every PR in the top bar (#29831)
Part 5 of 6. Depends on #29544. Supersedes #29545, which merged with a
flattened head by mistake.

The top bar PR chip now reads `diff_statuses` instead of the single
primary. With one PR it stays a direct link. With several it shows "N
PRs" and opens a menu with one link per PR. When the PRs span multiple
origins, each entry is prefixed with `owner/repo` so equal PR numbers
stay distinct. Refs without a PR number (branch-only refs) are left out.

Each menu entry shows the PR state icon, the PR number, the title on one
line, and an external-link icon. Screen readers hear the PR state. The
menu is 288px wide and shows five entries before it scrolls.
`PRMenuLinks` renders the entries.

`originRepoLabel` moves from the git panel to `utils/originRepoLabel.ts`
so both places share it.

Generated by Coder Agents.
2026-10-09 11:27:22 +01:00
Danielle Maywood 86013c253e feat(site): per-ref views in the git panel (#29544)
Part 4 of 6. Depends on #29543.

The git panel's view switcher now has one entry per tracked ref from
`diff_statuses`. A PR ref shows its state and number; a ref without a PR
shows its branch name. When refs come from more than one origin, each
entry is prefixed with `owner/repo`. Selecting an entry fetches that
ref's diff using its `origin`/`branch` selector. The header, PR title
and stats follow the selection.

Refs without a PR now load their branch diff, and the "View PR" link is
hidden for them. The remote tab appears once the chat tracks any ref. If
the selected ref disappears, the panel falls back to the primary.
Switching refs remounts the diff viewer, so an open inline comment draft
cannot carry over to another PR. A legacy row with no origin or branch
can only be selected when it is the primary, because an empty selector
always returns the primary's diff.

Generated by Coder Agents.
2026-10-09 11:27:22 +01:00
Michael Suchacz 6bae268487 fix: move organization instructions to the Instructions page (#30428)
Moves organization instructions (#30272) from the Coder Agents page to
**AI Settings** > **Coder Agents** > **Instructions**, so every Coder
Agents instruction is managed on one page. The API and stored data are
unchanged.

- **Deployment admins** see a "Deployment instructions" section with the
existing system prompt and plan mode form, then an "Organization
instructions" section. The organization section has an organization
picker when there is more than one organization.
- **Organization admins and auditors** who can read an organization's
chat model configuration get an Instructions entry in the AI settings
sidebar and see only the organization section. Auditors get it
read-only.
- The selected organization is kept in `?org=`, and the sidebar link
carries it over from the other AI settings pages.
- The Coder Agents page goes back to its layout from before #30272. Its
sections and the new page's sections share new `SettingsSection` and
`OrganizationSettingsSection` components.
- Three docs pages point to the new location.

Other behavior changes:

- The deployment section shows a loader while loading and an error alert
when loading or refreshing fails. Before, the page rendered nothing
until both settings loaded.
- The deployment forms no longer have their own accessible names,
because each section is named by its heading.

## Testing

- Vitest for the Instructions page and sidebar link, and stories for the
new states. Breaking each of the 9 main code paths, or removing the
instructions field's accessible name, fails its test.
- The branch merges `main` for #30402, which made the organization
picker a combobox.
- CI passes on `a0cc6a98660`.
- Remote dogfood UAT, [evidence
chat](https://dogfood.cdr.dev/agents/1cbf9da4-9671-4890-ade1-c151a1a69cd7):
**PASS** on `a0d9c3fca46`, 14 scenarios across every role, `?org=`
handling, injected load failures, keyboard use, and a 390 px layout. The
remote agent's FAIL (a double-click on Save sends 2 PUTs) also happens
on the merge base, so it predates this PR. Delta round on `a0cc6a98660`:
**PASS**. When the permission re-check fails, the owner and an
organization admin see the alert above the organization section, and the
unsaved draft stays and saves.
- UAT notes left as is: the fallback for an unreadable `?org=` is
read-only, as on the Coder Agents page; `?org=` matching is
case-sensitive, as on the Models and Spend pages; the old
`/agents/settings/instructions` redirect drops `?org=`; the permission
alert shows the server's error message without saying which check
failed, as on the Models pages.

## Screenshots

From UAT on a test deployment.

| Organization admin | Owner, after a failed refresh (unsaved edit kept)
|
|---|---|
| ![Organization admin sees only the organization
section](https://gist.githubusercontent.com/ibetitsmike/1027eba97c252d6f3e921d2f46debd01/raw/8c6baf5a5b4784cdfecd066fae54af7f4f3c4881/r3-org-admin-instructions.png)
| ![Error alert above the deployment
form](https://gist.githubusercontent.com/ibetitsmike/1027eba97c252d6f3e921d2f46debd01/raw/8c6baf5a5b4784cdfecd066fae54af7f4f3c4881/r3-owner-refresh-error-draft-kept.png)
|
| **Coder Agents page, no instructions card** | **Unavailable `?org=`:
warning and read-only fallback** |
| ![Coder Agents
page](https://gist.githubusercontent.com/ibetitsmike/1027eba97c252d6f3e921d2f46debd01/raw/8c6baf5a5b4784cdfecd066fae54af7f4f3c4881/r3-coder-agents-page.png)
| ![Unavailable organization
warning](https://gist.githubusercontent.com/ibetitsmike/1027eba97c252d6f3e921d2f46debd01/raw/8c6baf5a5b4784cdfecd066fae54af7f4f3c4881/r3-unavailable-org-fallback.png)
|

## Review record

1. `coder-frontend-review` (8 reviewer agents) on `3dd65e828f9`: fixed
in `a0d9c3fca46` (deployment refetch errors were dropped, plus naming,
prop types, test waits, and a single-organization story). Declined:
`SettingsHeader` in `SettingsSection` and merging the sidebar groups
(both change existing layout), and restructuring the moved card (git
would stop detecting the move).
2. `frontend-review` (FE1 to FE10) on `a0d9c3fca46`: every rule passes,
no changes.
3. Codex,
[review](https://github.com/coder/coder/pull/30428#pullrequestreview-5431118231)
on `a0d9c3fca46`: 1 P2, a docs sentence wrote "more than 1" where the
numbers guide spells out "one". Fixed in `0e71b8f16b9`.
4. Codex,
[review](https://github.com/coder/coder/pull/30428#pullrequestreview-5431285875)
on `0e71b8f16b9`: 2 findings, each confirmed by a failing test and fixed
in `a0cc6a98660`. A failed background re-check of organization
permissions showed no alert, unlike the old Coder Agents page and the
Models pages (P2). The page tests found the instructions field by its
value, so removing its accessible name went unnoticed (P1).
5. `coder-frontend-review` (8 reviewer agents) and `frontend-review`
(FE1 to FE10) on `a0cc6a98660`: everything passes, no changes. The round
1 `findByDisplayValue` suggestion is reversed, because FE10 asks for
role and name queries.
6. Codex on `a0cc6a98660`: [no major
issues](https://github.com/coder/coder/pull/30428#issuecomment-6020794170).

> Xum, an AI coding agent, implemented, tested, and opened this PR on
behalf of @ibetitsmike.
2026-10-09 11:14:59 +02:00
Mathias Fredriksson befda9b29f docs: mention chat reasoning_tokens is part of output_tokens (#30500)
Document that reasoning_tokens is included in the output_tokens on
ChatMssageUsage, which is the case for all known providers.

Refs CODAGT-1350
2026-10-09 12:12:08 +03:00
christin eb73068273 fix(site/src): raise contrast of selected resources sidebar item (#30464)
Fixes axe issue 2871654 (WCAG 1.4.11, state of an active component) on
the workspace page Resources sidebar. The selected resource was marked
only by a `bg-surface-tertiary` fill, which measured 1.33:1 against the
sidebar in dark mode (`#27272A` on `#09090B`).

`SidebarItem` in `FullPageLayout/Sidebar.tsx` now uses:

- Unselected: `text-content-secondary`, `font-medium` (same as
`SettingsSidebarNavItem`).
- Selected: `text-content-primary`, `font-semibold`, the existing
`bg-surface-tertiary` fill, and a 2px `content-primary` left bar. The
bar is the existing selected-item pattern from the AI settings sub-nav
(`AISettingsSidebarView.tsx`).
- Hover: `bg-surface-secondary`.

The bar measures about 15:1 against the selected fill and about 20:1
against the sidebar in both themes. Left padding is reduced by 2px so
content stays 16px from the edge. This also removes the 75% opacity on
unselected items (secondary text faded to about 4.0:1 in light mode) and
a no-op `hover:divide-surface-tertiary` class. `ResourcesSidebar.tsx`
moves `font-medium` from the wrapper to the type line so only the
resource name picks up the selected weight.

| Theme | Before | After |
| --- | --- | --- |
| Dark | <img
src="https://raw.githubusercontent.com/coder/coder/pr-assets-resources-sidebar-contrast/img/before-dark.png"
width="256"> | <img
src="https://raw.githubusercontent.com/coder/coder/pr-assets-resources-sidebar-contrast/img/after-bar-dark.png"
width="256"> |
| Light | <img
src="https://raw.githubusercontent.com/coder/coder/pr-assets-resources-sidebar-contrast/img/before-light.png"
width="256"> | <img
src="https://raw.githubusercontent.com/coder/coder/pr-assets-resources-sidebar-contrast/img/after-bar-light.png"
width="256"> |

<details>
<summary>Decision log and verification</summary>

Cues measured against the adjacent unselected rows (which show the
sidebar background):

| Cue | Dark | Light | 3:1? |
| --- | --- | --- | --- |
| `surface-tertiary` fill | 1.34:1 | 1.27:1 | No |
| `surface-secondary` fill (considered) | 1.12:1 | 1.10:1 | No |
| `content-primary` vs `content-secondary` text | 2.56:1 | 2.57:1 | No |
| 2px `content-primary` left bar | about 15:1 / 20:1 | about 15:1 / 20:1
| Yes |

No existing surface token reaches 3:1 against the page background, so a
fill change alone cannot pass. A `content-link` (blue) bar was rejected
because it is not an existing pattern for this kind of navigation. The
admin settings nav (`SettingsSidebarNavItem`) has the same text-only
selected state and is out of scope here.

Verification:

- Computed styles on the dev server: selected border `2px rgb(255, 255,
255)` on `rgb(39, 39, 42)` (dark), `2px rgb(9, 9, 11)` on `rgb(228, 228,
231)` (light); content offset 16px in both.
- `make pre-commit` and `make pre-push` pass.
- Frontend review (FE1 to FE10): all pass. Class-only change in an
existing component; visual states are covered by existing Workspace page
stories.

</details>

> Generated by Coder Agents.
2026-10-09 11:01:13 +02:00
christin 5b51a276aa fix(site/src): make text-only tooltip triggers keyboard focusable (#30403)
> 🤖 This PR was created by Coder Agents on behalf of @chrifro.

Several tooltips used non-focusable triggers (`div`, `span`, bare
`svg`), so keyboard and screen reader users could never open them or
hear their content. Radix only links tooltip content to its trigger via
`aria-describedby` while open, and it opens on hover or focus. These
triggers are now native `<button type="button">` elements with a focus
ring, following the existing `NetworkCallBadges` and #30342 pattern.

Addresses the text-only tooltips from the Deque audit (`custom-tooltip`
rule, WCAG 4.1.2):

| Ticket | Element |
| --- | --- |
| DEQ-579 | Deployment banner: status icon, Transmission, data sent
to/from workspaces, latency, last aggregated |
| DEQ-283 | Notification delivery method icons (SMTP, webhook) |
| DEQ-226 | AI Gateway sessions: Threads info icon |
| DEQ-287 (partial) | AI Gateway session: Session summary info icon,
in/out token badges |

DEQ-393 (`+N more` roles) was already fixed by #30342. The tooltips in
DEQ-287, DEQ-473 and DEQ-378 that contain links need a popover/toggletip
pattern and will follow in a separate PR.

## Before / after (keyboard Tab)

| | Before | After |
| --- | --- | --- |
| Footer: Tab after the last workspace status link |
![before](https://raw.githubusercontent.com/coder/coder/assets/a11y-focusable-tooltip-triggers/pr/pr-before-footer.png)
Focus skips to VS Code |
![after](https://raw.githubusercontent.com/coder/coder/assets/a11y-focusable-tooltip-triggers/pr/pr-after-footer.png)
Focus lands on Transmission, tooltip opens |
| Notifications: Tab after a template switch |
![before](https://raw.githubusercontent.com/coder/coder/assets/a11y-focusable-tooltip-triggers/pr/pr-before-notifications.png)
Focus skips to the next switch |
![after](https://raw.githubusercontent.com/coder/coder/assets/a11y-focusable-tooltip-triggers/pr/pr-after-notifications.png)
Focus lands on SMTP, tooltip opens |

<details>
<summary>Implementation notes and verification</summary>

- The token badges button has no `aria-label`, so its visible counts
stay in the accessible name (WCAG 2.5.3 Label in Name). The full
breakdown is exposed through the tooltip description.
- Icon-only triggers get names: "Deployment status", "About threads",
"About sessions", and the delivery method label.
- In the AI Gateway sessions list, the token badge sits inside a
clickable row, so Enter on the badge now opens the row, matching what a
mouse click already did.
- Layout: element positions in the footer and notifications page match
`main` exactly. Converted triggers are 16px tall (was 12 to 14px) with
the same vertical center, matching the existing Active Connections
buttons.
- Tabbing through the footer in a real browser, every trigger from the
audit now takes focus and its `aria-describedby` resolves to the tooltip
text.
- AI Gateway pages are paywalled in the dev deployment, so those
triggers were verified by rendering their Storybook stories in Vitest
and checking focus plus accessible description.
- Added a Vitest regression test in `DeploymentBannerView.test.tsx`. It
fails on `main` and passes here.

</details>
2026-10-09 10:53:42 +02:00
christin cc4b0de9a9 fix(site): raise scrollbar thumb contrast (#30461)
Fixes DEQ-45

Scrollbar thumbs used `--surface-quaternary`, which is 1.91:1 against
the dark background and 1.48:1 against white, failing WCAG 1.4.11 (3:1).
They now use `--surface-invert-secondary`, the token the `ScrollArea`
component already uses, so native and `ScrollArea` scrollbars match.

The change is in the global `scrollbar-color` rule and the xterm
terminal thumb. It also removes five per-container overrides that
hard-coded the old color.

| Theme | Before | After |
|---|---|---|
| Dark | `#3F3F46` on `#09090B`: 1.91:1 | `#A1A1AA`: 7.76:1, at least
4.07:1 on every surface token |
| Light | `#D4D4D8` on white: 1.48:1 | `#3F3F46`: 10.44:1, at least
7.07:1 on every surface token |

### Before / after (build timeline)

Screenshots from @aqandrew's review; the scrollbar thumb is at the
bottom of each image.

| | Before | After |
|---|---|---|
| Dark | <img width="565" alt="Dark theme before"
src="https://github.com/user-attachments/assets/b74dc283-0d84-42c9-99d7-3bbd31056168"
/> | <img width="565" alt="Dark theme after"
src="https://github.com/user-attachments/assets/24e77339-bbb0-41ee-9f40-69293f611cb0"
/> |
| Light | <img width="565" alt="Light theme before"
src="https://github.com/user-attachments/assets/cb32e0ea-9671-4e62-91bd-fdeb5110c461"
/> | <img width="565" alt="Light theme after"
src="https://github.com/user-attachments/assets/dcf4342c-b8ac-402e-a3ba-b3e796a85cae"
/> |

<details>
<summary>Decision log</summary>

- An earlier revision also moved the build timeline and build logs onto
`ScrollArea` and set Monaco scrollbar colors. That was dropped to keep
the change minimal: the global color change already fixes the reported
surfaces. Migrating native scroll containers to `ScrollArea` and
Monaco's scrollbar colors can follow separately.
- Uses an existing design-system token instead of adding a
scrollbar-specific one.

</details>

---

_Generated by Coder Agents on behalf of @chrifro._
2026-10-09 10:52:51 +02:00
dependabot[bot] 2aef86feba chore: bump next from 15.5.26 to 15.5.27 in /offlinedocs (#30535)
Bumps [next](https://github.com/vercel/next.js) from 15.5.26 to 15.5.27.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/next.js/releases">next's
releases</a>.</em></p>
<blockquote>
<h2>v15.5.27</h2>
<p>This release contains security fixes for the following
advisories:</p>
<p>Medium:</p>
<ul>
<li><a
href="https://github.com/vercel/next.js/security/advisories/GHSA-f87g-xv8r-7p7x">Information
disclosure in Next.js App Router metadata image routes via dynamicParams
bypass</a></li>
<li><a
href="https://github.com/vercel/next.js/security/advisories/GHSA-4jqv-mc3x-m676">Cache
poisoning of SSG and ISR pages in self-hosted Next.js
applications</a></li>
<li><a
href="https://github.com/vercel/next.js/security/advisories/GHSA-mcj8-r9mp-w47p">Cache
poisoning in Next.js SSG/ISR rendering leads to cross-user content
substitution and persistent denial of service</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/next.js/commit/def7eff9063f79cf58610c15fe58dd78b967c885"><code>def7eff</code></a>
v15.5.27</li>
<li><a
href="https://github.com/vercel/next.js/commit/52c94abdd2ea5f416f5e8353ea8a2edd3fe311b8"><code>52c94ab</code></a>
[lts-maintenance] Scope response cache keys to their source route (<a
href="https://redirect.github.com/vercel/next.js/issues/219">#219</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/785f4c2397f25690edf02b5a9f1cd7deaa1abb6d"><code>785f4c2</code></a>
[lts-maintenance] Match Next data paths case-sensitively (<a
href="https://redirect.github.com/vercel/next.js/issues/197">#197</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/7217d63db316f1650cab9c2a15833155b540766c"><code>7217d63</code></a>
[lts-maintenance][webpack] Ensure <code>dynamicParams</code> is
respected in `opengraph-...</li>
<li><a
href="https://github.com/vercel/next.js/commit/d5979baa545099473b9fde8b6e03f06b3167242f"><code>d5979ba</code></a>
[lts-maintenance][ci] Remove PR creation from deploy test workflow (<a
href="https://redirect.github.com/vercel/next.js/issues/99093">#99093</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/812ae7db8453c0aa65859ea7b2810007e033487c"><code>812ae7d</code></a>
[lts-maintenance][test] Adjust deploy assertions for platform drift and
the e...</li>
<li>See full diff in <a
href="https://github.com/vercel/next.js/compare/v15.5.26...v15.5.27">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=next&package-manager=npm_and_yarn&previous-version=15.5.26&new-version=15.5.27)](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)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/coder/coder/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-09 08:08:56 +00:00
Atif Ali 2810038f82 ci: add coder[bot] to CLA allowlist (#30502)
This is preventing `coder[bot]` aka Superblink from passing CI as in
coder/coder#30501
2026-10-09 13:02:39 +05:00
Ben Potter af8fb5977b fix(site/src/pages/AgentsPage/components/ChatElements): add copy button to chat code blocks (#29447) 2026-10-09 06:56:27 +02:00
Jake Howell 276683b3ce fix(site): fall back to canonical template organization names (#30520)
> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.

Organization cells in the Templates table could show only developer
usage when the organization display name was empty. Fall back to the
canonical organization name and use the same resolved label for the
avatar fallback when its icon is missing or fails to load.

<details>
<summary>Implementation decisions</summary>

Localized to template organization rendering; navigation, permissions,
and the shared Avatar component are unchanged. The added fallback story
and fixture were removed at Jake’s request. Existing Templates stories
remain unchanged.

</details>
2026-10-09 12:16:42 +11:00
Jake Howell f766be77d2 fix(site): honor workspace sharing permission (#30510)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

A custom role with workspace read/share permission but no workspace
update permission can open Sharing, yet cannot add members, change
roles, or remove access. Both the settings page and the workspace Share
popover incorrectly gate these controls on `workspace:update`, although
the ACL endpoint authorizes `workspace:share`.

Use the sharing permission in both entry points and rename the prop to
`canShareWorkspace` throughout the workspace-sharing components and
callers. Backend authorization is unchanged.

<details>
<summary>Verification notes</summary>

Browser verification confirmed sharing controls in both entry points
with share permission enabled and update permission disabled. Temporary
regression checks failed before the fix and passed afterward; the added
tests and story were removed at the author’s request. No new automated
regression coverage is included.

All 15 existing workspace-page tests, 34 existing affected stories,
frontend check, lint (including TypeScript), and formatting pass.
Screenshots and local stress fixtures are excluded.

</details>
2026-10-09 12:15:08 +11:00
Bobby Ho b27e158fd9 feat(provisioner/terraform): carry script addresses and prepare dependency attachment (#30491)
feat(provisioner): populate script addresses and add dependency attachment

Second PR in PLAT-547, building on #30451.

- Set `resource_address` on every converted `coder_script`, including
  module and devcontainer scripts. Legacy inline startup/shutdown
  scripts retain empty addresses and no dependencies.
- Add `attachScriptOrderDependencies` to translate validated order edges
  into per-script `success` or `completion` dependencies, sorted by
  prerequisite address. Preserve explicit edges and reject unknown
  addresses or requirements without modifying scripts.
- Update conversion tests and goldens; add a module fixture and coverage
  for dependency mapping, sorting, graph isolation, and validation errors.

Only script addresses change in provisioner output. The helper has no
production caller yet; the next PR on the PLAT-545 integration branch
wires it in. PLAT-548 handles persistence in coderd.

Tests: `go test ./provisioner/terraform/`

Refs PLAT-547.
2026-10-08 15:47:36 -07:00
Atif Ali 261269aff0 fix: support path-aware OAuth discovery for remote MCP (#30168)
## Problem

VS Code discovers Coder's MCP endpoint as a path-qualified OAuth
resource, but Coder advertises the deployment root. Accepting MCP-bound
tokens also requires keeping REST-backed tool calls within the
originating MCP resource rather than granting those tokens direct REST
access.

## Fix

- Publish path-aware protected resource metadata and authentication
challenges; keep authorization-server metadata at the root.
- Validate the MCP audience and delegate tool requests through a private
in-process transport that retains identity, scopes, expiry, revocation,
and streaming cancellation.
- Reject unsupported MCP path aliases and validate SDK path components
before URL resolution.
- Add discovery, audience, authorization, endpoint-isolation, and
transport lifecycle regression tests and update integration docs.

## Validation

VS Code completed OAuth and returned the authenticated user through a
real MCP tool. Official MCP SDK 1.30.1 completed discovery,
registration, PKCE, tool execution, and refresh. These live checks
preceded the final path hardening; the hardened paths are covered by
automated regressions.

Affected Go package tests, targeted race tests, backend/SDK lint, and
targeted documentation checks passed during self-review. The exact PR
commit was also checked separately from the uncommitted consent-scope
fix.

> [!NOTE]
> Tokens are MCP-audience-bound, but grants still include `coder:all`;
least-privilege scopes remain a separate requirement
([PLAT-639](https://linear.app/codercom/issue/PLAT-639)).

Preview:
https://coder.com/docs/@fix/mcp-internal-delegation/ai-coder/mcp-server

<details>
<summary>Implementation decisions and review context</summary>

1. Treat `/api/experimental/mcp/http` and its single-trailing-slash form
as supported MCP resource paths; reject other aliases and descendants
before route authentication.
2. Preserve deployment-root discovery and authorization-server metadata
for existing REST integrations.
3. Bind private delegation to the authenticated API-key ID. Revalidate
the original credential and enforce normal RBAC/scopes on every internal
REST request; do not derive delegation from HTTP headers.
4. Keep internal HTTP, streaming, and WebSocket traffic in-process with
no network fallback. Close the transport on outer-request cancellation
and normal completion.
5. Validate workspace owner/name path segments before SDK URL
construction, including tool-level tests that malformed arguments cannot
select a different REST endpoint.
6. Keep compatibility and delegated tool execution together:
discovery-only changes would allow authentication while leaving real MCP
tool calls broken.

</details>

> 🤖 This PR was created with the help of Coder Agents, and needs a human
review. 🧑💻
2026-10-09 00:58:39 +05:00