Skip to content

feat: add the user-scoped chat-automations experiment - #32064

Merged
ThomasK33 merged 2 commits into
mainfrom
tk/automations-experiment-gate
Nov 11, 2026
Merged

ThomasK33 merged 2 commits into
mainfrom
tk/automations-experiment-gate

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Why

The Automations RFC controls availability with one user-scoped experiment. Its text: "The user-scoped chat-automations experiment controls availability. Operators configure defaults with --experiments and 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, the manage_automations tool, 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

  • Registers chat-automations in ExperimentsKnown and ExperimentsUserScoped. An earlier experiment with this name was removed in chore!: remove the chat automations experiment #30412, and this PR restores none of its consumers.
  • Keeps it out of ExperimentsSafe, so --experiments=* does not turn it on. Automations act with their owner's authority, and a test pins the choice.
  • Adds the name to the userScopedExperimentStaticCheck ruleguard rule, so server code cannot decide it from the static list. TestExperimentsUserScopedRuleguard keeps the rule in step with ExperimentsUserScoped.
  • Regenerates the swagger files, docs/reference/api/schemas.md and typesGenerated.ts.
  • Adds tests for the real experiment name. The evaluator tests cover the startup default, stored on, off and 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 through api.ExperimentEvaluator and GET /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 through api.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/rules and coder exp experiment-rules list show a chat-automations row, and an administrator can store a rule for it. A deployment that already passes --experiments=chat-automations sees 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.sh deployment built from this head ran with no flag, with --experiments=* and with --experiments=chat-automations. GET /api/v2/experiments lists chat-automations for 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 rule user.username == "member" turned it on for the member and off for the owner without a restart, and reset restored the startup default.


Generated with xum • Model: anthropic:claude-sonnet-5-5 • Thinking: xhigh

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
@ThomasK33
ThomasK33 temporarily deployed to main November 11, 2026 21:30 — with GitHub Actions Inactive
@ThomasK33
ThomasK33 temporarily deployed to main November 11, 2026 21:30 — with GitHub Actions Inactive
@linear-code

linear-code Bot commented Nov 11, 2026

Copy link
Copy Markdown

CODAGT-1135

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T21:33:00.153934Z 03077b0 Manual request
🔒 Security Review ✅ Completed 2026-11-11T21:33:25.144975Z 03077b0 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

Copy link
Copy Markdown

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

Reviewed commit: 03077b05ed

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 03077b05ed

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 temporarily deployed to main November 11, 2026 22:24 — with GitHub Actions Inactive
@ThomasK33
ThomasK33 temporarily deployed to main November 11, 2026 22:35 — with GitHub Actions Inactive
@ThomasK33
ThomasK33 merged commit e307f1d into main Nov 11, 2026
102 of 107 checks passed
@ThomasK33
ThomasK33 deleted the tk/automations-experiment-gate branch November 11, 2026 22:54
@ThomasK33
ThomasK33 temporarily deployed to main November 11, 2026 22:54 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 11, 2026

This branch was previously deployed

1 inactive deployment
main — 03077b05 Deployed Nov 11, 2026 by ThomasK33 via cla #254543
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