Show one Instructions field in the automation modal

What does this MR do and why?

When you add or edit an event in the automation modal, the event form shows its own Instructions box, next to the shared Instructions field. People read that as two competing inputs (Slack thread, note on #643346).

This MR makes the modal show one Instructions field:

  • New automations, and automations whose events share instructions: one Instructions field. Event forms no longer show their own Instructions box.
  • Automations that already have different instructions per event: they open with a selected Use different instructions for some events checkbox, so every event's instructions stay visible and editable. Nothing the agent receives is hidden.
  • Clearing that checkbox: shows "Turning this off uses the instructions above for every event." On save, the shared instructions apply to every event, and the checkbox no longer appears for that automation.

To use different instructions for an event, create a separate automation for it. The API and GraphQL still accept per-event instructions.

No backend, API or catalog enable modal changes.

This reverses the review decision on !269368 (merged) to offer per-trigger instructions in each trigger's form (note). The feedback in #643346 and Slack shows the always-available field reads as two competing inputs.

How we got here
  • !260639 (merged) added an optional Instructions field to the event condition form, which shows on the trigger page and in the catalog enable modal.
  • !269368 (merged) brought that field into the automation modal's event form, per review, so automations with different instructions no longer needed the full-page form (#637503). Every time you add or edit an event, it shows a second Instructions box next to the shared one.
  • Removing the per-event boxes for automations that already have different instructions would hide instructions the agent still receives, or overwrite them on save. Reverting !269368 (merged) would send those automations back to the full-page form. Showing the boxes only where they're stored avoids both.
  • Trigger instructions are added in front of the flow's own goal, so they never replace it. For events other than mentions, the resource URL is included.

Not changed

  • The catalog enable modal in groups still shows instructions per condition (from !260639 (merged)). Automations written there open with the checkbox selected.
  • #632627 proposes instructions per action, which goes the other way. It's open and unscheduled.

References

Screenshots or screen recordings

Before After
Adding an event to a new automation Before: a second Instructions box in the event form After: one Instructions field
Editing an automation with different instructions per event Same as today After: checkbox selected, each event's instructions shown

How to set up and validate locally

  1. Go to a project's Automate > Automations page, for example http://gdk.test:3000/gitlab-duo/test/-/automate/triggers.
  2. Select New automation, then Add condition > On an event. Pick Mention. The event form has no Instructions box. Select Add event: there's one Instructions field and no checkbox.
  3. Open an existing automation whose events have different instructions (in the GDK seed, Bug triage under Event). The checkbox is selected and each event shows its instructions.
  4. Clear the checkbox. The help text disappears, each event shows no instructions, and the checkbox stays until you save or cancel.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

🤖 Generated with Claude Code

Edited by Tars Cunha

Merge request reports

Loading
Loading