Skip to content

[Feat] Add opt-in launch criteria to custom automations - #3159

Merged
daniel-lxs merged 12 commits into
developfrom
feature/custom-automation-run-conditions-1ic82um4i96le
Sep 25, 2026
Merged

daniel-lxs merged 12 commits into
developfrom
feature/custom-automation-run-conditions-1ic82um4i96le

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

​Opened on behalf of @daniel-lxs. Follow up by mentioning @roomote-roomote, in the web UI, or in Telegram.

What changed

  • Added optional plain-language launch criteria and typed runWhen conditions to custom automations in Settings, the REST API, and manage_custom_automations.
  • Classified custom automation launch criteria as an internal-nightly experiment. Admins can see its control on Settings → Nightly Experiments only when the deployment opts into nightly experiments; launch evaluation remains off until the experiment itself is enabled. When off, the editor hides criteria, write endpoints reject them, MCP schemas omit the fields, and runtimes ignore saved conditions.
  • Kept channel-based launch criteria independent. If a criteria-bearing Discord or Teams run was queued before the custom experiment was disabled, Fast restores its deferred destination root before replying; row-level enable/disable edits also omit saved criteria while disabled.
  • Persisted launch criteria and per-run launch-gate results. This adds migration 0117_black_titania.sql; develop uses 0116_overrated_romulus.sql for task-run completion/cancellation indexes.

Why this change was made

Launch criteria change whether scheduled work begins, so their control and runtime behavior should be available only on deployments explicitly enabled for internal nightly experiments. Saved conditions and queued destination replies must remain safe when the experiment is off.

Impact

  • The experiment defaults off. Existing saved conditions remain stored but inert while it is off, and channel-based launch criteria remain independent. Public automation documentation no longer points to the internal control.
  • A bounded live smoke at PR head 8af03c33c7f86b8755fb16a131d8125ec637b1a1 confirmed the Nightly route is unavailable and criteria writes are rejected when the deployment opt-in is off. With the environment opt-in on but the experiment off, saved criteria survived four row toggles and a schedule update, and runtime ignored them. With the experiment on, real Jev returned a confident skip at 0.04 (saved privately and hidden from Results), a pass at 0.80 (continued to a shared result), and uncertain results at 0.65/0.66 (continued).
  • A follow-up recovery check used synthetic pass and uncertain rows recorded through the PR-head result helper. The shared control was enqueued immediately and prepared in about four seconds. The private rows had no job at insertion; the scheduled five-minute recovery discovered and prepared both within two seconds of its next tick, in one attempt each. The PR-head listResultsCommand showed the shared control and excluded both private rows. For execution provenance, the result writer, shared enqueue, and Results query ran from a clean worktree at the PR head; the already-running background scheduler/worker performed recovery. Its queue and processor source is unchanged between that runtime revision and the PR head, so this does not claim the entire service stack ran at the PR head. All temporary rows, the disposable automation, queue jobs, and the three associated usage records were removed.

Screenshots

Nightly Experiments shows the custom automation launch-criteria control in its off state

Customer-preview Experimental settings without the custom automation launch-criteria control

@roomote-community

roomote-community Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

No new code issues found. See task

  • Discord and Teams criteria-bearing automations can fail silently before their deferred destination root is created (packages/sdk/src/server/automations/custom-automations.ts:544).
  • Failed Telegram DM topic creation falls back to an unthreaded report (packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts:4508).
  • show_widget can send a destination reply before launch criteria are evaluated (packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts:2083).
  • Disabling the experiment after a queued Discord or Teams run can skip its deferred root and post unthreaded (packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts:2106).
  • Disabling the experiment prevents toggling an automation that already has saved criteria (apps/web/src/components/settings/automations/CustomAutomationsSection.tsx:913).

Reviewed 6678563

@roomote-roomote
roomote-roomote Bot marked this pull request as ready for review September 23, 2026 06:42
@roomote-roomote roomote-roomote Bot changed the title [Feat] Add declarative run conditions to custom automations [Feat] Add pre-work launch criteria to custom automations Sep 23, 2026
Comment thread packages/sdk/src/server/automations/custom-automations.ts
@roomote-roomote

roomote-roomote Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Fixed both outstanding findings in 7345263f: queued Discord/Teams runs now restore deferred roots when the experiment is disabled, and row-level automation toggles omit saved launch criteria while disabled so the update succeeds without clearing the saved rule.

The Roomote code review check reran on the pushed head and passed; the latest review summary reports no code issues, and both requested review threads are resolved. Focused web and Fast regression tests, affected typechecks, lint, and pre-push checks passed. The browser-proof capture for this follow-up timed out, so the PR body has no stale screenshots. See the task for the details.

Comment thread packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts
Comment thread packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts
@roomote-roomote roomote-roomote Bot changed the title [Feat] Add pre-work launch criteria to custom automations [Feat] Add opt-in launch criteria to custom automations Sep 24, 2026
Comment thread packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts Outdated
@daniel-lxs
daniel-lxs merged commit fabada9 into develop Sep 25, 2026
27 of 28 checks passed
@daniel-lxs
daniel-lxs deleted the feature/custom-automation-run-conditions-1ic82um4i96le branch September 25, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant