Repository navigation
Conversation
Add the interim chats.manage_automations_enabled switch (default off).
POST /api/v2/chats and PATCH /api/v2/chats/{chat} set it. Only the
chat owner may change it after creation, enabling it requires the
chat-automations experiment for the chat owner, sub-agent chats cannot
enable it, and disabling is always accepted.
Offer the built-in manage_automations tool only to root chats outside
plan and explore mode whose switch is on and whose owner has the
experiment, and check every rule again at each call. The tool supports
list, get, disable, and delete, scoped to the chat owner and
organization. A turn an automation reached only sees automations that
target the chat or created it. disable and delete write audit entries
with the chat ID and, in reached turns, the triggering automation and
input IDs.
Simplify the manage_automations tool without changing behavior: inline the single-use reached() helper, collapse the turn walk-back loop, use slices.Contains for later actions, drop a redundant root-chat check at the offer site, and tighten comments and ARCHITECTURE.md prose. Make the explore-mode recheck case use a root chat so it exercises the explore rule instead of the sub-agent rule, and merge the two create subtests of the switch API test.
…r' into tk/codagt-1212-automations-tool
…r' into tk/codagt-1212-automations-tool
…ook-editor' into tk/codagt-1212-automations-tool
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…mit delete in automation turns Tool results stay in the chat, which may be shared, so list leaves prompts out. In a turn an automation started, delete only removes the triggering automation; others can still be disabled.
|
@codex review |
|
CI for head cd575ed was dispatched manually because pushes to existing stacked PRs start no pull_request run: https://github.com/coder/coder/actions/runs/36789662215 |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…ook-editor' into tk/codagt-1212-automations-tool
|
Merged 11b (#30207) final head e10022a into this branch; head is now 0bb6fd5 (clean merge; affected chatd/coderd automation tests and AgentAutomationsPage vitest pass; full pre-push hook passed). CI dispatched on the exact head: https://github.com/coder/coder/actions/runs/36795978517 (headSha 0bb6fd5). |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…tk/codagt-1212-automations-tool No content conflicts. The parent now carries the automation migrations as 000606 and 000607 after main's 000605, so 000607_chat_manage_automations_enabled moves to 000608 unchanged. Main did not change chats_expanded, so the view this migration recreates still matches. make gen produced no diff beyond the rename. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
sync with main d9c13dc: no content conflicts; 000607_chat_manage_automations_enabled renumbered to 000608; make gen produced no diff
Generated with |
Documentation CheckUpdates Needed
Automated review via Coder Agents |
ibetitsmike
left a comment
There was a problem hiding this comment.
Xum (an AI coding agent) prepared and posted this review on behalf of Mike. Each finding came from automated review passes and was re-verified against the code; please push back on anything that looks wrong.
The switch, offering rules, per-call recheck, owner and organization scoping, reached-turn visibility, and audit wiring all check out against CODAGT-1212 and the code. One small observability gap is left in the tool's read paths.
Verdict: no blocking issues
Severity: P0 0, P1 0, P2 1, P3 1
Nits:
- PR description: "Migration
000607adds..." no longer matches the migration file (currently000608_chat_manage_automations_enabled, and the in-progress main merge will shift it again); update the number once the stack is restacked.
Review coverage
- code-review Standards: 3 findings; 1 kept (P2 unlogged DB errors), 2 dropped (ARCHITECTURE.md prose is the owner's work per AGENTS.md Chatd and adds no TODOs; raw action strings are a style preference with no defect)
- code-review Spec: 1 finding dropped (reached-turn delete limit stays within the spec's "may only" bound and is documented in the PR, tool description, and ARCHITECTURE.md)
- frontend-review (generated
site/src/api/typesGenerated.tsonly): FE2 PASS, FE1 and FE3 to FE10 N/A - coder-frontend-review types-and-naming: PASS, no findings
| chat, err := p.db.GetChatByID(chatdCtx, chatID) | ||
| if err != nil { | ||
| return nil, xerrors.New("failed to load this chat") | ||
| } |
There was a problem hiding this comment.
P2: Tool database errors are discarded without logging
Every failure path in runManageAutomations replaces the error with a fixed string and never logs it: GetChatByID (L135), automationOwnerSubject (L147), GetChatMessagesByChatID (L153), the list query (L163), GetChatAutomationByID (L187), and the manageAutomationsError fallback (L251). The model gets the generic text, which is fine, but operators see only a tool error with no cause; p.logger is used only for the audit helper. Compare subagent.go, which logs before returning failed to load parent chat. #30217 adds a Warn to the write fallback, but the read paths stay silent through the top of the stack.
Fix: Keep the generic messages, and log the original error first, for example p.logger.Warn(ctx, "manage_automations failed to load chat", slog.F("chat_id", chatID), slog.Error(err)), at each of these sites (or once in a small helper).
There was a problem hiding this comment.
Fixed in 57d6d94: runManageAutomations builds one logger with chat_id and action (plus automation_id once it parses) and logs the underlying error at Warn before returning the fixed message, on the chat, chat history, list and automation-load paths and in the manageAutomationsError fallback. An inactive chat owner is an expected refusal, so it logs at Debug. Not-found and not-authorized automation lookups, and the refusals manageAutomationsError already maps, are not logged. No test: the tool tests run against a real database fixture with no cheap way to inject a failure.
Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high
…tk/codagt-1212-automations-tool Renumber 000608_chat_manage_automations_enabled to 000609 because main added migration 000606 and the parent layers moved to 000607 and 000608. No content conflicts. make gen produced no other diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
The tool returns fixed messages to the model, so log the underlying error with chat ID, action, and automation ID first for operators. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
sync with main 35abc22: merged #30207; renumbered the manage_automations_enabled migration to 000609; addressed Mike's review (log the underlying error on each manage_automations failure path)
Generated with |
…tk/codagt-1212-automations-tool No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
sync with main a328bee: merged #30207 (migration renumbered to 000610_chat_manage_automations_enabled; chats_expanded views and column lists carry main's project_id); dropped the testpackage suppression from the tool test
Generated with |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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
left a comment
There was a problem hiding this comment.
Xum validated this PR and approved it on behalf of @ibetitsmike.
The reported test-package suppression is removed. Earlier logging and migration-description fixes remain intact. The project-aware schema and generated scanner changes preserve the tool's offering, owner/organization, persisted switch, reached-turn, and child boundaries.
Fresh, uncached focused Go checks passed on this head: 7 roots and 38 PASS entries across the tool, switch/storage, archive query, child, and guarded queue paths. Current-head CI is green, including required. The unchanged generated frontend contract was checked; no new browser/Pixel, full local suite, or remote UAT was run.
The existing public tool-inventory omission remains a nonblocking documentation follow-up and is not claimed fixed. Accepted ticket deferrals remain accepted. This approval covers this layer, not unresolved findings elsewhere in the stack.
…tk/codagt-1212-automations-tool No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
merged #30207 (story and test review fixes only)
Generated with |
…tk/codagt-1212-automations-tool No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
merged #30207 (story follow-up only)
Generated with |
…tk/codagt-1212-automations-tool No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
Generated with |
…tk/codagt-1212-automations-tool No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
Generated with |
…tk/codagt-1212-automations-tool No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
merged #30207
Generated with |
…tk/codagt-1212-automations-tool No conflicts. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
Merged #30207 (no conflicts).
Generated with |
|
Documentation Check: Generated with |
…automations-tool Brings main ff158c0. Main added migration 000608_chat_title_source and the lower layers moved to 000609 and 000610, so this layer's migration is now 000611_chat_manage_automations_enabled. Its chats_expanded view keeps main's title_source and title_updated_at columns before automation_id and manage_automations_enabled, and its down migration restores the 000609 view. Resolved conflicts: - chats.sql: column lists take main's title columns, then automation_id and manage_automations_enabled. UpdateChatByID and UpdateChatTitleByIDIfTitle are gone on main. UpdateChatManageAutomationsEnabledByID is kept. - chatd.go CreateOptions and chatstate CreateChatInput: main's TitleSource replaces TitleDerivedFromContent; ManageAutomationsEnabled stays. - exp_chats.go patchChat: the manage_automations_enabled checks stay before main's title normalization. - ARCHITECTURE.md: both new paragraphs are kept, main's first. - Generated files come from make gen. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
…automations-tool Brings the new_chat automation title source fix from #30134. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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
left a comment
There was a problem hiding this comment.
Xum validated this PR and approved it on behalf of @ibetitsmike.
Revalidated head d7d04342c9c1 against base 95cb3b3bb258. Independent Standards and Spec renewal found no new blockers; the original accepted exclusions remain unchanged.
Re-reviewed migration 611 and preserved title/provenance/switch projections. Tool offering, authorization, schema/switch/SDK, native migration-chain and inherited title-persistence checks passed.
Approval is scoped to this layer and the reviewed inherited interactions. No full-repository suite, fresh Pixel screenshots or remote UAT claimed.
Adds the
manage_automationschat tool with its read and stop actions (list,get,disable,delete), gated by an interim per-chat switch. Tool sets have not landed, so this shipschats.manage_automations_enabledas the RFC describes for that case; tool sets later replace it and migrate its values.Part of CODAGT-1212 (slice 12a of 3). Part of CODAGT-1135.
What changes
000611addschats.manage_automations_enabled(default off). It is set throughPOST /api/v2/chatsandPATCH /api/v2/chats/{chat}. After creation only the chat owner may send the field (403 otherwise). Turning it on returns 400 when thechat-automationsexperiment is off for the chat owner (POST checks the resolvedowner_id, not the caller) or when the chat is a sub-agent chat. Turning it off is always accepted. The audit table tracks it.mcp-tool-search). It is not on the plan-mode or explore allowlists, and sub-agent chats are created with the switch off.automation_id, so the prompt window is not enough). In such turns only automations that target the chat or created it (chats.automation_id) are visible.listleaves out prompts (tool results stay in the chat, which may be shared);getreturns the prompt of the automation it names. In a turn an automation reached,deleteonly removes the triggering automation; the others can still be disabled.disableanddeletego through the management service and write a background audit entry withchat_id, plus the triggeringautomation_idandinput_idin reached turns. Results use the API shape and never contain a secret or secret hash.create,update,enable, andrun_nowcome in the next PR and return "not available in this version" here.Follow-up: CODAGT-1270 (bound the history read that reached-turn detection does on each call).
Size
About 1,380 hand-written lines: about 460 production, 680 tests, and 240 SQL that has to be there (the
chats_expandedview rebuilt in both migrations and the 17 inline column lists). Generated: +649/-280 (sqlc, dbmock, dbmetrics, dump.sql, apidoc, API and audit docs,typesGenerated.ts).Validation
make pre-pushpassed before push.Note
ARCHITECTURE.md prose was drafted by an agent at the user's request; the user will review it.
Stack
Stacked on the Automations for Coder Agents stack (30085 ... 1214b). Next: slice 12b (write actions), then 12c (composer toggle).
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high