Set different instructions per automation trigger

What does this MR do and why?

Decision 1 in #637503: each trigger in the automation modal can have its own instructions, so the modal can replace the full-page form. It's the third of the smaller MRs split out of !267601 (closed).

  • Instructions per trigger: each event trigger's form has an optional Instructions field with the placeholder Uses default instructions. Schedules never show it.
  • Default instructions: the shared field stays Instructions until a trigger has its own, then becomes Default instructions. A trigger without its own uses the default.
  • Rows say what they use: a trigger without its own instructions shows Uses default instructions in muted text.
  • Edit always opens the modal: the modal keeps each trigger's instructions, so the Automations list and flow pages no longer send triggers with different instructions to the full-page form. This removes the fallback added in !269322 (merged).

The modal and the Automations list only show with duo_automations, which is now on by default, and ai_flow_trigger_goals has been removed. So this ships to everyone with Automations once it merges.

Decisions from review

Answered in !269368 (comment 4203407831):

  • No checkbox. Per-trigger instructions are an optional field in each trigger's form.
  • Triggers that use the default say so in their row.
  • No "no instructions" option.

Known limitation

When an automation is reopened, the default is worked out from the most common instruction. With a tie, a trigger's own instructions can show as the default. Saved data stays correct, so this only affects what's shown. Fixing it needs a backend field for the default, with per-trigger instructions saved only as overrides. Open question for review: is that OK as a follow-up, or should the backend field land first?

References

Screenshots or screen recordings

Before After
New automation before-1-new-automation after-1-new-automation
Edit an automation with different instructions before-2-edit-from-automations after-2-edit-from-automations
Add or edit a trigger No per-trigger instructions in the modal after-3-trigger-form

How to set up and validate locally

  1. Make sure duo_automations is on (it's on by default).
  2. Go to AI > Automations in a project with the Developer flow enabled, and select New automation.
  3. Enter instructions, then add two events. Give one of them its own instructions and leave the other blank.
  4. Check that the shared field is now Default instructions and the blank trigger says Uses default instructions.
  5. Save, then select Edit automation on it. The modal opens with each trigger's instructions.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

🤖 Generated with Claude Code

Edited by Tars Cunha

Merge request reports

Loading
Loading