Repository navigation
feat: add the user-scoped chat-automations experiment - #32064
Conversation
Registers `chat-automations` in `ExperimentsKnown` and `ExperimentsUserScoped`, so operators can set a default with `--experiments` and change per-user rules while Coder runs. It stays out of `ExperimentsSafe`, so `--experiments=*` does not enable it. Adds the name to the `userScopedExperimentStaticCheck` ruleguard rule, so server code cannot decide it from the static list, and updates the rule lists that now include a second entry. Part of CODAGT-1135
Later automation code calls `Evaluator.Enabled` with the caller, a chat's owner, or an automation's owner. These tests pin that call for `chat-automations`: the startup default, stored on, off, and condition rules per user, and an off decision on a rules read error, a malformed rule, an attribute read error, a condition error, and a nil subject. Part of CODAGT-1135
|
@codex review |
|
@codex security review |
Codex Review Summary: ✅ CompletedThis 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. 🎉 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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Why
The Automations RFC controls availability with one user-scoped experiment. Its text: "The user-scoped
chat-automationsexperiment controls availability. Operators configure defaults with--experimentsand can change per-user rules while Coder is running. Each surface checks the relevant caller or automation's owner, and experiment evaluation fails closed." The later backend PRs (management routes, themanage_automationstool,Publish) need that check first. This PR registers the experiment and proves the per-user, fail-closed check. Nothing consumes it yet.Part of CODAGT-1135
What changed
chat-automationsinExperimentsKnownandExperimentsUserScoped. An earlier experiment with this name was removed in chore!: remove the chat automations experiment #30412, and this PR restores none of its consumers.ExperimentsSafe, so--experiments=*does not turn it on. Automations act with their owner's authority, and a test pins the choice.userScopedExperimentStaticCheckruleguard rule, so server code cannot decide it from the static list.TestExperimentsUserScopedRuleguardkeeps the rule in step withExperimentsUserScoped.docs/reference/api/schemas.mdandtypesGenerated.ts.on,offand condition rules for two users, and an off decision on a rules read error, a malformed rule, an unknown mode, an attribute read error, a condition error and a nil subject. A coderd test with a real database checks the same per-user behavior throughapi.ExperimentEvaluatorandGET /api/v2/experiments.Scope
No routes, tool, UI or chatd change. I added no helper:
Evaluator.Enabled(ctx, userID, ex)already decides per user and fails closed, and API handlers reach it throughapi.ExperimentEvaluator. chatd has no evaluator handle on main, because #31327 removed the unused field. The first chatd consumer adds it together with its read.Blast radius
With the experiment off, which is the default, behavior on main does not change. Two things become visible.
GET /api/experimental/experiments/rulesandcoder exp experiment-rules listshow achat-automationsrow, and an administrator can store a rule for it. A deployment that already passes--experiments=chat-automationssees three small differences: the startup log reports an opted-in hidden experiment where it reported an unknown one, the deployment Overview page stops flagging the name as invalid, and the rules row shows the static default as on. Nothing reads the experiment yet, so no feature turns on.Live check
A local
./scripts/develop.shdeployment built from this head ran with no flag, with--experiments=*and with--experiments=chat-automations.GET /api/v2/experimentslistschat-automationsfor the owner and for a member only when the startup list or a rule turns it on, and--experiments=*does not turn it on. A condition ruleuser.username == "member"turned it on for the member and off for the owner without a restart, andresetrestored the startup default.Generated with
xum• Model:anthropic:claude-sonnet-5-5• Thinking:xhigh