Repository navigation
Conversation
Add create, update, enable, and run_now to the manage_automations chat tool, backed by CreateAutomation, UpdateAutomation, and RunAutomation with the chat owner as the actor, so owner-only checks stay in the service. - Turns an automation reached refuse all four write actions before any other work. - Containment: existing_chat automations must target the calling chat (create defaults to it); new_chat automations must use the calling chat's model config (the default) or one without provider tools. update and enable check the stored row and the merged result; run_now checks the stored row. - create returns the webhook secret only for a single-use webhook that targets the calling chat in a human turn; multi-use secrets are never returned. - create, update, and enable write automation audit entries with chat_id. run_now mirrors the run endpoint: a new_chat run writes the chat-create entry with created_by_chat_id, an existing_chat run writes nothing. auditAutomationCreatedChat gains an extra-fields parameter. - ARCHITECTURE.md describes the final behavior.
Share target merging between create and update through automationTarget.with, shorten comments that repeat ARCHITECTURE.md, and reuse requireNoWebhookSecret in the list/get/disable test. No behavior change.
Add one table subtest for the tool's field-rejection errors: create with automation_id, update without fields, and enable with a prompt. Mutation checks showed no test failed when any of these checkField branches was removed, and each call otherwise succeeds and silently drops the field. The other write-action tests were kept; mutation checks confirmed each containment, secret, and reached-turn guard is caught by its test.
…utomations-tool-writes
…utomations-tool-writes # Conflicts: # coderd/x/chatd/ARCHITECTURE.md # coderd/x/chatd/automations_tool.go # coderd/x/chatd/automations_tool_internal_test.go
|
@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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ecdf303781
ℹ️ 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".
…cked automation The manage_automations tool checked containment on the automation row it had read, then called UpdateAutomation or RunAutomation, which reload and lock the row themselves. An owner edit in between could make the tool update, enable, or run an automation that now targets another chat or a model config with provider tools. UpdateAutomation and RunAutomation now take an optional AutomationGuard. UpdateAutomation runs it on the locked stored row and on the row as the update would leave it, before the write. RunAutomation runs it on the row read before the send and, at admission, on the locked row whose input is accepted, which must still name the target the input goes to. The tool passes a guard that rechecks containment and reports a refusal with the same error text as before. HTTP callers pass nil, so their behavior is unchanged. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 455d206c00
ℹ️ 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".
|
@codex review |
|
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". |
…ions Tool results stay in the chat, where read-shared users, the model provider and compaction can see them, so a single-use secret returned to a human-started turn let a read-only viewer deliver an event first. create now returns the not-shown note for every webhook; the owner rotates the secret in the automations UI to get one.
|
Head is now d9dada7: security pass #2 S1 fixed (manage_automations never returns a webhook secret; the WebhookSecrets test asserts no plaintext for single- and multi-use webhooks). The locked-row containment nit was already fixed in 7f160e4. Minimum schedule interval tracked in CODAGT-1272. Full pre-push hook passed. CI dispatched on the exact head: https://github.com/coder/coder/actions/runs/36807127563 (headSha d9dada7). |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9dada7e35
ℹ️ 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".
…212b-automations-tool-writes 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 d9c13dc: no content conflicts; make gen produced no diff
Generated with |
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 write actions, the before and after containment checks, the locked-row guard in UpdateAutomation and RunAutomation admission, the reached-turn refusals, and the audit fields all match CODAGT-1212. I also traced the containment premise: a new_chat automation's chat gets only Force On MCP servers (MCPServerIDs: nil in publishAutomationNewChat), and the advisor and computer-use tools do not depend on the model config, so only provider tools can differ. No issues worth fixing were found in the code.
Verdict: no blocking issues
Severity: P0 0, P1 0, P2 0, P3 1 (folded below)
Nit:
coderd/x/chatd/automations_tool.go:378: the tool never returns a webhook secret, but CODAGT-1212 still lists the single-use, current-chat exception and a required check for it. The stricter rule makes sense for the reasons the PR description gives. Consider recording it in CODAGT-1212 (or CODAGT-1277) so the ticket matches the code.
Review coverage
- code-review Standards: 1 finding, dropped (ARCHITECTURE.md prose: the PR discloses the user asked an agent to draft it, so AGENTS.md treats it as the owner's work, and it adds no TODOs)
- code-review Spec: 1 finding, kept as a folded P3 nit
- Adjudicator pass over the Go hunks: no additional issues;
go test -run 'ManageAutomations|AutomationGuard' ./coderd/x/chatd/passes at e780533 - frontend-review: skipped (no files under site/)
- coder-frontend-review: skipped (no files under site/)
…212b-automations-tool-writes Resolved the manageAutomationsError conflict: kept this layer's method (verb-specific message, more mapped refusals) and gave it the parent's logger parameter, so the unexpected-error log keeps the chat and automation fields and is written once. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
sync with main 35abc22: merged #30214 (resolved manageAutomationsError: one Warn with chat and automation fields); no other changes for Mike's review (his ticket nit is recorded on CODAGT-1212)
Generated with |
…212b-automations-tool-writes 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 35abc22: merged #30214 to pick up 64cc207 (test-only); main not merged this pass
Generated with |
…212b-automations-tool-writes 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 d11809f: merged #30214
Generated with |
ibetitsmike
left a comment
There was a problem hiding this comment.
Xum re-reviewed this PR on behalf of @ibetitsmike using GPT-6.1 Sol (high) Exec subagents.
Locked update/run containment and secret withholding remain intact after the restack. New findings: Standards 0, Spec 0; Frontend is not applicable. Existing capability-drift, audit-before-image, list-argument and queue-full-error deferrals remain on their original threads. The introducing-layer payload is unchanged; fresh tool/guard/history, startup and unowned-promotion tests passed with six roots and 50 PASS entries. No fresh race, full-suite, browser or full-CI verdict is claimed.
ibetitsmike
left a comment
There was a problem hiding this comment.
Xum validated this PR and approved it on behalf of @ibetitsmike.
Validated head a92decbd6b92. The unchanged write-tool layer preserves the locked update/run containment fixes and secret withholding. Fresh real write-tool, guard, history and concurrent-retarget tests passed; exact-head CI run 36899158655 completed successfully, including required. Accepted capability/audit/error follow-ups remain tracked. Pixel remains pending; this layer has no frontend edits, and this is not Pixel or full-stack merge approval.
…212b-automations-tool-writes 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 #30214
Generated with |
…212b-automations-tool-writes No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
merged #30214
Generated with |
…212b-automations-tool-writes No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
merged #30214
Generated with |
…212b-automations-tool-writes 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 |
…212b-automations-tool-writes 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 |
…212b-automations-tool-writes No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
merged #30214
Generated with |
…212b-automations-tool-writes No conflicts. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
Merged #30214 (no conflicts).
Generated with |
…s-tool-writes Brings main ff158c0 into this layer. No conflicts. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
Adds the write actions of the
manage_automationschat tool:create,update,enable, andrun_now. They call the same management methods as the API (CreateAutomation,UpdateAutomation,RunAutomation) with the chat owner as the actor, so owner-only checks stay in the service.Part of CODAGT-1212 (slice 12b of 3). Part of CODAGT-1135.
Rules
existing_chatautomation must target the calling chat:createdefaultstarget_chat_idto it (a heartbeat) and refuses any other chat, even another root chat of the same owner. Anew_chatautomation may not give new chats more tools than the calling chat has. Until tool sets land, the only tools that differ between such a chat and the calling chat are the model config's provider tools, sonew_chat_model_config_iddefaults to the calling chat's config and any other config is accepted only when it has no provider tools. Force On MCP servers apply to both chats because the tool is offered only in root, non-explore chats.updateandenablecheck containment on the stored automation and on the result;run_nowchecks the stored automation.create,update,enable, andrun_noware refused before any other work.createof a webhook returns a note that the owner rotates the secret in the automations UI to get one.create,update, andenablewrite the automation audit entry withchat_id.run_nowrecords what the run endpoint records: nothing forexisting_chat(a run changes no configuration), and fornew_chatthe same chat-create entry withautomation_idandinput_id, pluscreated_by_chat_id.UpdateAutomationbefore the write,RunAutomationat admission), so a concurrent owner edit between the tool's read and the write cannot slip past it.listignoresautomation_idandrun_nowreports a full message queue as a generic error (CODAGT-1274).createrecords the calling chat ascreated_by_chat_id.kind,target_mode, andwebhook_usecannot be updated, like the API. Fields that do not apply to an action are rejected instead of dropped.Lower-layer changes:
auditAutomationCreatedChat(scheduler, 1211) takes an optional map of extra audit fields, andUpdateAutomationandRunAutomation(1209/1211) take an optionalAutomationGuard. The scheduler and the HTTP handlers passnil, so their behavior is unchanged.Size
About 780 hand-written lines (about 380 production, 390 tests, docs). No generated changes.
Validation
make pre-pushpassed before push.new_chatcontainment behaved as above. Audit entries are verified in Go tests only.Note
ARCHITECTURE.md prose was drafted by an agent at the user's request; the user will review it.
Stack
On top of slice 12a. Next: slice 12c (composer toggle).
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high