Adds Service Account ID column to duo_workflows_workflows table
What does this MR do and why?
This MR is part 1 of the solution that addresses #584271 (closed).
We're adding a service_account_id column to the duo_workflows_workflows table to store the service account ID for individual workflows. This service account will be used to author system notes that display agent activity.
Problem
Currently, service account details are not associated with workflows. The workaround requires fetching the service account via the workflow definition, for example:
::Ai::Catalog::Item.with_foundational_flow_reference(workflow.workflow_definition).first
This approach has several drawbacks:
- Performance: Incurs extra queries per status update (finding the item, then the consumer, then the service account)
-
Coupling: Creates dependencies on the
Ai::Catalogdomain - Consistency: Resolves the service account at runtime rather than storing it, which could cause inconsistencies if the service account changes between session start and end
Solution
By storing the service account ID directly on the workflow record, we ensure consistency throughout the workflow lifecycle and eliminate unnecessary runtime lookups.
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
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.