Sync AI governance sessions when ClickHouse is enabled

What does this MR do and why?

The worker that writes ai_governance_sessions was only queued when ClickHouse analytics is off. So on GitLab.com, no Duo sessions reached the table (or ClickHouse through Siphon).

Now the worker is queued when ClickHouse is off, or when sync_ai_governance_sessions is enabled for the top-level group. SessionArtifact still syncs only when ClickHouse is off, because ClickHouse instances read the session list from siphon_duo_workflows_workflows.

This matters because the ClickHouse sessions finder (!258121 (merged)) and the rollout (https://gitlab.com/gitlab-org/gitlab/-/work_items/630766) depend on these sessions existing on GitLab.com.

References

Screenshots or screen recordings

Not applicable, backend only.

How to set up and validate locally

  1. Run the specs:
    bundle exec rspec ee/spec/workers/ai/duo_workflows/sync_session_artifact_worker_spec.rb
  2. Optionally, with Feature.enable(:sync_ai_governance_sessions, group), create or update a Duo workflow in a project under group on a ClickHouse-enabled instance. A row appears in ai_governance_sessions and no row is added to duo_workflow_session_artifacts.

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.

Merge request reports

Loading
Loading