Repository navigation
Conversation
Add the management API for chat automations under
/api/experimental/organizations/{organization}/chat-automations
(list, create, get, PATCH, delete). There is no /api/v2 alias.
- Register chat-automations as a user-scoped experiment (ExperimentsKnown,
ExperimentsUserScoped, and the ruleguard rule). Routes decide it per
caller through the experiment evaluator and return 404 when it is off,
including after a runtime rule change without a restart.
- Add --chat-max-automations-per-owner (default 50). Creating one more
automation than the cap, counted across all organizations, fails with
409.
- Add chatd CreateAutomation, UpdateAutomation, DeleteAutomation, and
AutomationNextRuns with per-field validation shared by create and
PATCH. Only the owner can PATCH; org admins and site owners can list,
get, and delete. Kind and target mode cannot change.
- Webhook secrets are returned only by create; only their SHA-256 hash
is stored.
- Add cron.Standard for general five-field specs in an IANA time zone.
- Add queries GetChatAutomationsByOrganizationID,
CountChatAutomationsByOwnerID, and UpdateChatAutomationByID with
dbauthz, SDK types, and experimental client methods.
Refs CODAGT-1209, CODAGT-1217
Add a chatAutomationResponse helper for the four handlers that convert a row with its upcoming runs, and drop a redundant deleted check on model configs: GetChatModelConfigByID already filters deleted rows. Signed-off-by: Thomas Kosiewski <tk@coder.com>
…rectly Strengthen the chat automation route tests where assertions passed for the wrong reason or left branches unexercised: - Compare the stored webhook secret hash with an independent SHA-256 of the returned secret instead of only checking the plaintext is absent. - Create as the site owner, who can read the member's chat and a model config in another organization, so the ownership and organization checks are reached instead of the lookup denial. - Assert an automation is not found under another organization's path. - Assert a prompt change bumps schedule_revision.
The 409 for the per-owner cap no longer repeats wrapped internal errors; it states the configured limit. Document that restricting both day fields matches either one, as in standard cron. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
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. Can't wait for the next one! 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". |
…guard' into tk/codagt-1209-automations-mgmt-routes
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1e1686cd8
ℹ️ 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".
An empty reasoning_effort in PATCH clears the override, so new chats use the model default again. Before, null was ignored and an empty string was rejected, so the override could not be removed. --- _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. 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". |
|
Readiness record (agent): ready, with follow-ups tracked.
Generated with |
…dagt-1209-automations-mgmt-routes codersdk/deployment.go conflicted where main added the chat-board and chat-stage-metrics experiments next to chat-automations. The resolution keeps all three in the Experiment constants, DisplayName and ExperimentsKnown, with main's entries first. Generated files (apidoc, API schema docs, typesGenerated.ts) were regenerated with make gen instead of being merged by hand. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
sync with main d9c13dc: hand-resolved codersdk/deployment.go (kept main's chat-board and chat-stage-metrics experiments plus chat-automations); generated apidoc/schemas/typesGenerated regenerated with make gen
Generated with |
|
@codex review Scope: only the conflict resolution in merge commit 3f4cd08 (sync with main d9c13dc). Please do not re-review main's code or the unchanged stack code.
Generated with |
|
Codex Review: Didn't find any major issues. 👍 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". |
…dagt-1209-automations-mgmt-routes 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: 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 management service and routes match the CODAGT-1209 part 1 scope. The experiment gate fails closed, PATCH is owner-only, the cap uses a per-owner advisory lock, only the secret hash is stored, and the earlier Codex thread on clearing reasoning_effort is fixed. One small naming nit remains.
Verdict: no blocking issues
Severity: P0 0, P1 0, P2 0, P3 1
Review coverage
- code-review Standards: 1 finding kept (P3 naming). Its note that delete has no owner-only check was dropped: CODAGT-1209 says admins can delete.
- code-review Spec: 0 findings. Disable/enable, delete-runs-disable, secret rotation and schedule preview are deferred to #30117 as the description states.
- frontend-review (generated
site/src/api/typesGenerated.tsonly): FE2 PASS, FE1 and FE3 to FE10 N/A. - coder-frontend-review types-and-naming: PASS. Other roles N/A (generated file only).
- Adjudicator checks: the automation prompt size is bounded by the same 4 MiB
httpapi.Readlimit aspostChatMessages, so it is not a new gap. Pagination of the list route and the cap message when the flag is 0 are not raised. The other deferred hardening items are tracked in CODAGT-1226.
| } | ||
| // Work computed from an older prompt or schedule is stale once | ||
| // either changes. | ||
| scheduleChanged := false |
There was a problem hiding this comment.
P3: scheduleChanged is also set by prompt edits
This flag becomes true when only the prompt changes (line 309) and then drives the ScheduleRevision bump at line 384. Someone reading line 384 will assume prompt edits leave pending scheduled work alone, but they invalidate it. The comment above the declaration explains this; the name does not. The code is unchanged through the top of the stack.
Fix: Rename it to something like revisionChanged or invalidatesPendingRuns at lines 297, 309, 332 and 384.
…dagt-1209-automations-mgmt-routes No conflicts. make gen produced no diff. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
…gRuns A prompt edit also sets the flag, and it drives the schedule revision bump that invalidates pending scheduled work, so name it for that. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
sync with main d11809f: merged #30096; renamed scheduleChanged to invalidatesPendingRuns (Mike's review)
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.
Verified the four-use invalidation rename and preserved reasoning-effort clearing; the naming thread is fixed in source with an author reply but remains open on GitHub. New findings: Standards 0, Spec 0, Frontend 0, with no duplicate inline comments. Fresh targeted management/gating, queue-guard/locking, capacity and repeated concurrency tests passed, and generated contracts match. Storybook CI failed on Pixel snapshot-reporting HTTP 500, leaving visual validation incomplete; full suites, local frontend typecheck and remote UAT were not run.
…dagt-1209-automations-mgmt-routes
Resolved conflicts:
- coderd/coderd.go: kept this layer's /organizations/{organization}/chat-automations
route group and main's new /organizations/{organization} group that mounts the
chat projects routes. Chi matches the static chat-automations segment first,
so both route groups stay reachable.
- dbauthz_test.go: kept both sides.
- Generated apidoc and API docs were regenerated with make gen.
---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
sync with main a328bee: merged #30096 (kept the chat-automations route group next to main's new organization chat routes)
Generated with |
ibetitsmike
left a comment
There was a problem hiding this comment.
Xum validated this PR and approved it on behalf of @ibetitsmike.
Validated head e022601d5730. The naming and reasoning-effort fixes remain intact, and the restack preserves the management contracts. Fresh management/gating, queue/provenance/locking and interruption tests plus generated-contract checks passed. Current required CI passed. Accepted management and downstream follow-ups remain unchanged.
…dagt-1209-automations-mgmt-routes No conflicts. make gen regenerated docs/admin/setup/configuration-reference.md: main's new configuration reference generator now also lists this layer's chat max-automations-per-owner option in its format. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
merged #30096 (regenerated main's new configuration reference for this layer's option)
Generated with |
ibetitsmike
left a comment
There was a problem hiding this comment.
Xum reviewed this PR on behalf of @ibetitsmike.
One newly reproduced integration finding blocks approval at ecc2bacdd3e4. Original accepted follow-ups remain unchanged. No source fix was applied.
| ExperimentEnableAIWorkspaceDebug, | ||
| ExperimentChatBoard, | ||
| ExperimentChatStageMetrics, | ||
| ExperimentChatAutomations, |
There was a problem hiding this comment.
P2: Extend the display-name test map for the new experiment
This adds the twentieth known experiment, but TestExperimentDisplayNames still expects only the inherited 19 entries. Both current Ubuntu and PG17 CI jobs fail at codersdk/deployment_test.go:61; the exact uncached test fails locally too. Add codersdk.ExperimentChatAutomations: "Chat Automations" to that existing expected map. A scratch-only one-entry overlay makes the test pass; the production display-name mapping is already correct.
There was a problem hiding this comment.
Main's TestExperimentDisplayNames requires an expected display name for every known experiment. This layer adds chat-automations as the twentieth, so the expected map now includes it. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
fix: TestExperimentDisplayNames now expects the Chat Automations display name (Mike's P2; main's new test)
Generated with |
ibetitsmike
left a comment
There was a problem hiding this comment.
Xum validated this PR and approved it on behalf of @ibetitsmike.
The missing ExperimentChatAutomations display-name expectation is fixed at ee760de9c8d36910a88d6aa738a47583a88cdea6. Fresh uncached tests pass for display names, chat-limit validation, safe experiments, and user-scoped experiment rules: four roots and 39 test/parent outcomes, with no skips.
The remaining 33 own-file blobs and patch payloads, base, and PR body are unchanged from the completed review. Prior management/runtime validation and independent Standards, Spec, and generated-FE dispositions are retained for that unchanged source, not reported as newly executed checks. Accepted deferrals remain accepted.
Current exact-head required CI and all observed checks passed at the approval gate. This is a layer-local approval, not approval of the whole stack; the lower #30096 CI race failure and outstanding upper-layer review issues are not waived. No full local SDK/repository suite, new runtime/race suite, lint/generation, UI/Pixel, or remote UAT was run for this test-only fix.
…dagt-1209-automations-mgmt-routes 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 |
…ations-mgmt-routes 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 management API for chat automations under
/api/experimental/organizations/{organization}/chat-automations, behind the new user-scopedchat-automationsexperiment. This is the first of two PRs for RFC step 3; nothing publishes automation messages yet.chat-automationsis inExperimentsKnown,ExperimentsUserScoped, and the ruleguard list inscripts/rules.go. Every route askschatd.AutomationsEnabled(ctx, api.ExperimentEvaluator, callerID), which fails closed on a missing subject or evaluator; the routes stay mounted and return 404 when the experiment is off for the caller, so a runtime rule for one user applies on the next request without a restart. There is no/api/v2alias.PATCH, delete (204), with Swagger annotations and audit entries. List returns the automations in the organization the caller can read (members see their own, organization admins see all).coderd/x/chatd/automations.go): create validates kind and target shape, a non-empty prompt, a five-field cron and IANA time zone, model access, and that anexisting_chattarget is a root chat of the owner in the same organization. It defaultswhen_busytoskipfor schedules andqueuefor webhooks and computes the first schedule cursor.PATCHruns the same per-field validation on each changed field, rejectskindandtarget_mode, bumpsschedule_revisionon prompt, cron, or time zone changes, and recomputes the cursor on cron or time zone changes.PATCHan automation, even with organization-admin or site-owner roles (403); admins can list, read, and delete.coder_automation_prefix) is returned once in the create response. Only its SHA-256 is stored, and it appears in no list, get, audit, or log output.--chat-max-automations-per-owner(default 50) caps automations per owner across all organizations; creating one more returns 409. Creates serialize on a per-owner advisory lock.cron.Standard(spec, timeZone)accepts any standard five-field expression (the existingWeeklyrejects day-of-month and month restrictions). Responses include the next five run times of an enabled schedule.PR 3b (stacked on this one) adds disable and re-enable with the queue cutoff, makes delete run disable first, and adds secret rotation and the schedule preview route. Until then, the queue promotion guard from #30096 discards queued rows whose automation was deleted.
Dogfood UAT ran on a real dev instance and passed: create/list/get/patch/delete via curl, owner-only 403s for an organization admin and the site owner, the cap (including concurrent creates and cross-organization counting), a runtime rule turning the experiment off for one user without a restart, and
/api/v2404s.Part of CODAGT-1209 (PR 3b closes it)
Part of CODAGT-1135
Refs CODAGT-1217
Stack: PR 3 of the Automations for Coder Agents stack, on top of #30096 (which is on top of #30085).
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high