Add flow_metadata_json to workflows

What does this MR do and why?

Add flow_metadata_json to workflows. Adds a new field that can contain flow information for the flow that was actually run. This is required because flow_version resolution happens on the AI Gateway.

Also added a model-level validation to the existing model_metadata_json field, which matches the DB constraints.

References

#604884 (closed)

How to set up and validate locally

Update Database

bundle exec rails db:migrate:up:main VERSION=20260713115338                                                                                                                                                    

Testing flow data being saved:

  1. Check out this branch on your AIGW: gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!6210 (merged)
  2. gdk restart duo-workflow-service
  3. Run database migration above
  4. Run a developer flow
  5. Confirm the resolved version was set:
pry(main)> Ai::DuoWorkflows::Workflow.last.flow_metadata_json
...
=> "{\"flow_version\": \"2.0.0\", \"schema_version\": \"v1\", \"flow_id\": \"developer\"}"

Cleanup

  1. Undo database migration
bundle exec rails db:migrate:down:main VERSION=20260713115338

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.

Edited by Roman Eisner

Merge request reports

Loading
Loading