Files
coder/coderd
Thomas Kosiewski a3b6881aea feat: add the manage automations toggle, tool rendering and CODAGT-1217 tests (#30219)
Adds the "Manage automations" toggle to the composer's tools menu, so
the interim `manage_automations_enabled` switch can be set from the UI,
and gives the `manage_automations` tool a readable rendering.

Closes CODAGT-1212 (slice 12c of 3). Part of CODAGT-1135.

## What changes

- **Toggle.** A "Manage automations" checkbox item in the composer's +
menu, next to "Plan first". It shows for new chats and for existing root
chats the viewer owns, and only when the `chat-automations` experiment
is on for the viewer. Existing chats update through an optimistic PATCH
(`updateChatManageAutomations`) with rollback and an error toast; new
chats send `manage_automations_enabled` in the create request. The
optimistic single-field update is shared with `updateChatPlanMode`.
- **Tool rendering.** `manage_automations` calls get a label and icon
that name the action (for example "Created automation ..."), with the
generic fallback for unknown actions.
- **Invalidation.** After a successful write action (create, update,
enable, disable, delete, run_now) the automation queries are
invalidated, so the Automations page reflects agent changes; `run_now`
also refreshes chat lists.

## CODAGT-1217 acceptance tests

Adds the remaining CODAGT-1217 acceptance tests (tests only; no bug
found):

- `TestAutomationQueuedInputRunsAfterExperimentOff` (chatd): a webhook
input queued into a busy chat still runs after a stored rule turns the
experiment off for the owner (no restart); new inputs are refused.
- `TestChatAutomationEvents/ExperimentOffForOwner` now also asserts that
refused events for an existing-chat and a new-chat webhook create no
messages, queued inputs or chats.
- `TestChatAutomationEvents/SingleUseExperimentOff`: with the owner's
experiment off, a single-use webhook delivery is refused (404) and
`webhook_consumed_at` stays NULL; after the rule is back to inherit, the
same secret delivers once and then gets 409.

## Validation

- Vitest tests assert the PATCH body, optimistic update and rollback,
the create request field, the owner, sub-agent and experiment rule, and
the invalidations. Stories cover the checked menu state and three tool
renderings for Pixel. Full `make pre-push` passed before push.
- Frontend self-review with `coder-frontend-review` (8 roles) and the
project `frontend-review` (FE1 to FE10) ran before this PR; all blocking
and should-fix findings were fixed. A second `coder-frontend-review`
pass (8 roles) on the final slice, after the Codex fixes, raised
comment, type and readability items; the should-fix ones were fixed in
c6e503a692. Still open, with reasons: SD7/RO4 as above; SA6 as above;
DF6 (the optimistic helper restores the whole entity snapshot on error,
like every other chat mutation in `chats.ts`); RO3 (the
manage_automations action names appear in both the invalidation hook and
the label table; a shared parser is a follow-up refactor). Remaining,
with reasons: SA6 (the + menu's `menuitemcheckbox` items sit in a
popover without menu semantics; this follows the existing "Plan first"
item), CD2 (story banner matches the file's convention), RO4/SD7 (the
`canToggleManageAutomations` util stays so the owner, sub-agent and
experiment rule keeps a unit test; `AgentChatPage` has no test harness),
RP6 (splitting the chat-settings mutations out of `AgentChatPage` is a
separate refactor).
- Remote dogfood UAT passed on `375048cdfe` (before the self-review
fixes, which changed no user-visible behavior except that the create
request now always carries the field): turning the toggle on for a new
chat creates it with the switch on and the tool in use; toggling an
existing chat off and on changes whether the tool is offered; the toggle
is hidden for non-owners, sub-agent chats, and with the experiment off;
a PATCH failure shows a toast and rolls back.

## Stack

On top of slice 12b (write actions). Last PR of CODAGT-1212.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model:
`anthropic:claude-opus-5-5` • Thinking: `high`_
2026-10-02 15:54:56 +00:00
..