Draft: [skip ci] Prototype the automation modal replacing the full-page form

What does this MR do and why?

A UX prototype for #637503, so we can try out a replacement for the full-page trigger form before duo_automations cleanup. It isn't meant to merge as is.

It covers decisions 1 and 2 from the issue:

  • Different instructions per trigger (option A): the automation modal gets a Use different instructions for some triggers checkbox. When it's on, the shared field becomes Default instructions, and each trigger's form gets its own Instructions field. A trigger without its own instructions uses the default. Opening an automation whose triggers have different instructions turns the checkbox on, and the most common instruction becomes the default.
  • Edit always opens the modal: the Automations list no longer falls back to /triggers/:id/edit for those automations.
  • Add a trigger from a flow's page: opens the modal with the flow preselected, instead of linking to /triggers/new.

This also fixes a bug on master: on a flow's page, Edit opened the modal even when the triggers had different instructions, and saving deleted them.

Not part of this prototype:

  • Decision 3 (group editing): settled with Michael. Group-level trigger editing will use this modal, with no group Triggers page, because triggers run per project. Michael is working with frontend on it.
  • Decision 4 (Enable modal): not covered yet.

Automations stay separate from the AI Catalog.

Open questions for review

  • The backend doesn't allow a schedule together with other triggers. So in practice, different instructions only apply to automations with several events. Is a checkbox worth it for that, or should per-trigger instructions always show when there are 2 or more events?
  • A trigger that uses the default shows no text in its row. Should it say something like "Uses default instructions"?
  • An automation that has instructions on some triggers and none on others: saving fills in the default for the empty ones. Is that OK, or do we need a "no instructions" choice per trigger?

References

Screenshots or screen recordings

Before After
before-1-new-automation after-1-new-automation
before-2-edit-mixed after-2-edit-mixed
before-3-flow-page
before-4-add-a-trigger
after-4-add-a-trigger

How to set up and validate locally

  1. In the Rails console, enable the flags:
    Feature.enable(:duo_automations)
    Feature.enable(:ai_flow_trigger_goals)
  2. Go to AI > Automations in a project with the Developer flow enabled, and select New automation.
  3. Turn on Use different instructions for some triggers, then add two events, giving one its own instructions.
  4. Save, then select Edit automation on it. The modal opens with each trigger's instructions.
  5. Go to AI > Flows, open a flow that has no triggers, and select Add a trigger. The modal opens with that flow selected.

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