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)
|
|---|---|
| 
| 
|
| **Coder Agents page, no instructions card** | **Unavailable `?org=`:
warning and read-only fallback** |
| 
| 
|
## 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.