Adds FE changes for Flow Schedules
What does this MR do and why?
MR 7 (of 7) that addressses: #594180. The goal of the series: users will be able to run AI flows on a cron schedule.
The earlier MRs in the stack lets us create an Ai::FlowSchedule row with a next_run_at and dispatches due schedules and a worker that actually runs them.
This MR adds FE changes for flow schedules.
Primarily swaps the pre-staged, gated-off schedule placeholder in constants.js for the real values (value: 'scheduled', valueInt: 9, graphQL: 'SCHEDULED'), with availability gated on the aiFlowSchedules frontend FF.
How to set up and validate locally
Prerequisites
- Duo Enterprise enabled
- GDK running with all services up
1. Checkout this branch: 594180/sq/flow-schedules-frontend
2. In rails console, enable the feature flags:
Feature.enable(:ai_flow_schedules)
Feature.enable(:autonomous_service_account_execution) # needed for :scheduled event type + RunService's composite-identity bypass3. Create a scheduled trigger in the GDK UI
- Navigate to Project > AI > Triggers > New Trigger. E.g. http://172.16.123.1:3000/test-status-bot-e63fd58e/test/-/automate/triggers/
- Pick a flow, then in the Conditions box, select Add condition and choose On a schedule event type. Expected: a Schedule section now appears with the the schedule fields.
- Choose a frequency (Every 15 minutes, Hourly, Daily, Weekdays, Weekly, Monthly, etc.).
- Recommended: use the time closest to you or every 15 minutes to verify the flow runs without a long wait.
- Set the time, then click
Add schedule, thenCreate trigger. Expected: the trigger saves without error.
4. Confirm the schedule persisted:
- Reopen the trigger, the schedule you set should still be there.
- In Rails console, confirm the backend record was created:
trigger = Ai::FlowTrigger.where(project: project).last
trigger.event_types # => [9] (EVENT_TYPES[:scheduled])
trigger.filter['scheduled'] # => the frequency/hour/minute you picked
schedule = trigger.flow_schedules.first
{ cron: schedule.cron, tz: schedule.cron_timezone, next_run_at: schedule.next_run_at, active: schedule.active }Expected: a schedule row whose cron matches the frequency you chose, with a future next_run_at. This confirms the frontend's valueInt: 9 lines up with the backend enum. A mismatch would save the trigger under the wrong event type.
5. Verify the scheduled flow runs at set time
- Wait until the scheduled time and confirm the flow runs. Visible in the UI under:
Automate>Agent Sessions. E.g.http://172.16.123.1:3000/test-status-bot-e63fd58e/test/-/automate/agent-sessions - Alternatively, to avoid waiting, you can force the schedule due and run the worker manually in rails console.
schedule.update_column(:next_run_at, 1.minute.ago)
Ai::RunFlowScheduleWorker.new.perform(schedule.id, { 'scheduling' => true })
schedule.reload.slice(:last_run_status, :last_run_error, :consecutive_failure_count)Expected: last_run_status is "success", and a new session appears in the UI: Automate > Agent Sessions.
6. Confirm the scheduled edit flow
- Edit the trigger, change the frequency, and save.
Expected: new frequency is persisted.
7. Confirm schedule removal flow
- Edit the trigger again and remove the Schedule event type.
Expected: the trigger saves and trigger.reload.flow_schedules will be empty in Rails console, since the sync service destroys the schedule when the event type is removed.
8. Confirm the feature is hidden when the feature flag is disabled.
Feature.disable(:ai_flow_schedules)- In the GDK UI, go to
Project>Automate>Triggersand add a trigger. - Open the trigger type dropdown.
Expected: no Schedule option appears. (Before this MR, it was hidden unconditionally.)
Screenshots or screen recordings
Related Stacked MRs (in order)
- Adds ai_flow_schedules table for scheduled AI f... (!250227 - merged)
- Add scheduled event type to AI flow triggers (!250805 - merged)
- Adds Flow Schedule Model (!250809 - merged)
- Add Flow Schedules API (!250821 - merged)
- Adds Flow Schedule Email Notifications (!250824 - merged)
- Adds flow schedule execution (!250838)
- Adds FE changes for Flow Schedules (!250843) (This MR)
References
| Before | After |
|---|---|
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.