Skip to content

feat: add the manage automations toggle, tool rendering and CODAGT-1217 tests - #30219

Merged
ThomasK33 merged 29 commits into
tk/codagt-1212b-automations-tool-writesfrom
tk/codagt-1212c-automations-tool-toggle
Oct 2, 2026
Merged

ThomasK33 merged 29 commits into
tk/codagt-1212b-automations-tool-writesfrom
tk/codagt-1212c-automations-tool-toggle

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

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 c6e503a. 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 • Model: anthropic:claude-opus-5-5 • Thinking: high

Adds a "Manage automations" item to the composer's More options menu.
It shows when the chat-automations experiment is on, for new chats and
for root chats the viewer owns. Existing chats update through an
optimistic PATCH with rollback and an error toast; new chats send
manage_automations_enabled only when the toggle is on.

The manage_automations tool now renders with a friendly label and icon,
and successful write actions invalidate the automation queries (run_now
also refreshes chat lists). "Plan first" and the new item share a small
checkbox menu item component.
…ations toggle on new chats

The new-chat composer gates the Manage automations toggle on the
chat-automations experiment, but only the enabled path had a test.
…tions toggle

- Always send manage_automations_enabled on create; the form gates the
  value on the chat-automations experiment.
- Make isError, disabled and manageAutomationsEnabled props required.
- Read tool call args through a useEffectEvent accessor.
- Share the optimistic single-field chat update between plan mode and
  manage automations.
- Inline single-use values, merge the label helper into its component,
  and drop comments that restate names.
…ations toggle as is

The toggle is only reachable while the chat-automations experiment is on
and starts off, so the extra experiment check on submit could not change
the sent value.
@linear-code

linear-code Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T22:35:42.341430Z 447c892 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd4c7cd856

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…manage_automations action from the durable tool call

The server persists the assistant tool-call message before its tools run
and the live stream state resets, so a streamed manage_automations result
usually has no live call. Fall back to the durable message to find the
action, so automation and chat list invalidations still run.
@ThomasK33

Copy link
Copy Markdown
Member Author

Head is now ddd2741 (fix for the Codex r1 P2: read the manage_automations action from the durable tool call). Full pre-push hook passed. CI dispatched on the exact head: https://github.com/coder/coder/actions/runs/36800736193 (headSha ddd2741).

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: ddd2741bc6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…n owner

Adds the remaining CODAGT-1217 acceptance tests: an input queued while
the chat was busy still runs after the owner's experiment is turned off,
a refused event creates no messages, queued inputs or chats, and a
refused delivery leaves a single-use webhook unused, so the same secret
delivers once after the experiment is back on.
@ThomasK33 ThomasK33 changed the title feat(site/src): add the manage automations toggle and tool rendering feat: add the manage automations toggle, tool rendering and CODAGT-1217 tests Oct 1, 2026
@ThomasK33

Copy link
Copy Markdown
Member Author

Head is now c217ed6: adds the remaining CODAGT-1217 acceptance tests (tests only, see the PR description). Full pre-push hook passed. CI dispatched on the exact head: https://github.com/coder/coder/actions/runs/36803364859 (headSha c217ed6).

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c217ed6392

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…s action like the server

The server trims the action before running it, so an action with
surrounding whitespace is still a write. Trim it before classifying the
result and before picking the label.
@ThomasK33

Copy link
Copy Markdown
Member Author

Head is now 206fc30 (fix for the Codex r3 P2: trim the manage_automations action like the server). Full pre-push hook passed. CI dispatched on the exact head: https://github.com/coder/coder/actions/runs/36804131763 (headSha 206fc30).

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 206fc307c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…e the experiment turns off

The experiments query refetches while the create form stays mounted, so
the chat-automations experiment can turn off after the user enabled the
toggle; the server then rejects the create request. Restore the
experiment check on submit and make the test cover that case.
@ThomasK33

Copy link
Copy Markdown
Member Author

Head is now 6801a1e (Codex r4: restored the experiment check on the create request; the other thread is answered as out of scope). Full pre-push hook passed. CI dispatched on the exact head: https://github.com/coder/coder/actions/runs/36805119781 (headSha 6801a1e).

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 6801a1eeb3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33

Copy link
Copy Markdown
Member Author

sync with main 35abc22: merged #30217 to pick up 64cc207 (test-only); main not merged this pass


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

…codagt-1212c-automations-tool-toggle

No conflicts. make gen produced no diff.

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

Copy link
Copy Markdown
Member Author

sync with main d11809f: merged #30217


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@ibetitsmike ibetitsmike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xum re-reviewed this PR on behalf of @ibetitsmike using GPT-6.1 Sol (high) Exec subagents.

Durable-call lookup, action trimming and the mounted-create experiment gate remain fixed after the restack. New findings: Standards 2, Spec 1, Frontend 2, overlapping into two inline findings: a P2 label-rendering crash and a P3 shared-fixture violation. Accepted menu/rollback and experiment-off scope remains unchanged, with no duplicate prior comments. Fresh validation passed two toggle-mutation unit tests, actual API/Axios transport controls and selected queued-input/webhook Go tests. The actual current label renderer reproduced nine failures with passing own-property controls. Full frontend/typecheck passes remain previous-pin evidence; browser, Pixel and UAT were not rerun.

isError,
}) => {
const parsed = parseArgs(args);
const labels = manageAutomationsLabels[asString(parsed?.action).trim()];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Restrict action-label lookup to own properties

Standards reviewer: "The normal object lookup accepts inherited keys." Here constructor, toString or __proto__ yields a truthy non-tuple, so line 95 throws TypeError: labels is not iterable, including for a failed or durable JSON call. Actual CURRENT React rendering reproduces all nine cases while ordinary unknown actions fall back correctly: the UI cannot show the rejected call or its promised fallback. Guard with Object.hasOwn or use a Map before destructuring, and add a prototype-action renderer regression.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ec194bf: the label lookup now uses Object.hasOwn, so inherited keys fall back to "Manage automations" like any unknown action. A new Tool.test.tsx case renders constructor, toString, __proto__ and hasOwnProperty (plus a plain unknown action) as failed calls; without the fix the four prototype cases throw labels is not iterable.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

const { toolResults } = createStreamState("manage_automations");

await act(async () => {
store.upsertDurableMessage({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Reuse the shared message fixture

Standards reviewer: "This new full literal duplicates the defaults outside their shared owner; updates to that fixture cannot reach this case." FE9 requires shared entity fixtures (FRONTEND_PATTERNS.md:248-250), and testHelpers/chatEntities.ts:121-127 already owns MockChatMessage with these ID/chat/timestamp defaults. Spread it and override role and content, preserving the valuable no-live-call regression without separately maintained entity defaults.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 447c892: the durable tool-call message now spreads MockChatMessage and overrides only role and content.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

…codagt-1212c-automations-tool-toggle

No conflicts. make gen produced no diff.

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

Copy link
Copy Markdown
Member Author

sync with main a328bee: merged #30217


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

…anage_automations calls

The tool label looked up the model-supplied action on a plain object, so
an action such as "constructor" or "__proto__" returned an inherited
value and destructuring it threw "labels is not iterable", crashing the
row. The lookup now accepts only own keys, so these actions fall back to
the generic "Manage automations" label like any other unknown action. A
Tool test renders prototype-named actions and fails without the fix.

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

The durable tool-call test now spreads the shared MockChatMessage fixture
and overrides only role and content, instead of repeating its ID, chat
and timestamp defaults.

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

Copy link
Copy Markdown
Member Author

merged #30217; review fixes: manage_automations labels ignore inherited keys such as constructor/proto (with a Tool regression test), and the durable tool-call test reuses MockChatMessage (Mike's P2 and P3)


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 447c892ff6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike ibetitsmike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xum validated this PR and approved it on behalf of @ibetitsmike.

Verified at 447c892ff6d01715a4ff04eb312c96ad1d798168: own-property lookup prevents inherited action keys from becoming label tuples; the authored five-case Tool regression is present; and the durable invalidation test now reuses MockChatMessage while preserving its no-live-call case. Bounded affected frontend/Standards/Spec checks reconcile with the complete prior audit; accepted menu, rollback, parser, extraction and hidden-toggle deferrals remain unchanged. This is not whole-stack approval.

Validation: 52 tests across four existing files passed; targeted Biome check/lint, Oxlint and TypeScript passed. The maintained regression fails four prototype cases with the exact old-source overlay and passes all five on current source. An independent actual-production renderer probe converts nine old TypeErrors into nine generic fallbacks while preserving known-action and ordinary-unknown controls. No browser/full-chat, Pixel, Go, full local suite or remote UAT claim. Current-head required CI and all observed checks were green at posting.

…codagt-1212c-automations-tool-toggle

No conflicts. make gen produced no diff.

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

Copy link
Copy Markdown
Member Author

merged #30217 (main 15382eb)


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

…codagt-1212c-automations-tool-toggle

No conflicts. make gen produced no diff.

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

Copy link
Copy Markdown
Member Author

merged #30217 (main dc07908)


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

…codagt-1212c-automations-tool-toggle

No conflicts. make gen produced no diff.

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

Copy link
Copy Markdown
Member Author

merged #30217


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

…codagt-1212c-automations-tool-toggle

No conflicts. Pointed the useAutomationsEnabled imports this layer adds in AgentChatPage.tsx and AgentCreateForm.tsx at automationsFlag.ts, where #30171 moved the hook.

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

Copy link
Copy Markdown
Member Author

Merged #30217; pointed this layer's useAutomationsEnabled imports at automationsFlag.ts.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@ibetitsmike ibetitsmike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xum validated this PR and approved it on behalf of @ibetitsmike.

Re-reviewed the exact introducing-layer source and inherited changes against the original Standards/Spec/frontend records and accepted deferrals.

Validation: 302 maintained unit cases, 219 actual Chromium Storybook cases, persisted switch and queued-input-after-experiment-off contracts, authored Biome/Oxlint and whole TypeScript.

This approval covers this PR's own scope, not whole-stack merge readiness. #30167 and #30171 test-contract findings and #30220 documentation wording remain held at their introducing layers. No fresh Pixel, remote UAT or full-suite run is claimed.

…tomations-tool-toggle

Brings main ff158c0 into this layer. No conflicts.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33
ThomasK33 merged commit a3b6881 into main Oct 2, 2026
29 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 2, 2026
@ThomasK33
ThomasK33 deleted the tk/codagt-1212c-automations-tool-toggle branch October 2, 2026 15:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants