Write status for agentic scan pipelines and find them from merged-results pipelines

What does this MR do and why?

With agentic_analyzer_security_ingestion on, two things go wrong today:

  • Status is missing for scan pipelines that produced reports. The analyzer status and scan profile status workers skip them, because a scan runs on a synthetic ref.
  • Merged-results pipelines miss the scan. The lookup uses the temporary merge commit, not the source commit the scan ran on.

Terms: a scan pipeline is a duo_workflow workload pipeline at the default-branch HEAD. The business logic security scan is the only producer today.

Part of the split of !246889 (closed). Tracker: https://gitlab.com/gitlab-org/gitlab/-/work_items/630266

Depends on / merge order

Before / after

Case Tier Before After
Analyzer status for a scan pipeline Ultimate Not written when the scan produced reports Written
Scan profile status for a scan pipeline Ultimate Never written Written
CI analyzers missing from a scan pipeline Ultimate n/a Not counted as absent, so they don't drift to stale
Merged-results pipeline, scan ran on its source commit Ultimate Approval policies and the MR widget miss the scan Both find it

Flag off / on

  • Flag off: unchanged. default_branch_scan? and the scan lookup are both no-ops.
  • Flag on: both status workers run for scan pipelines.
  • Flag on: the analyzer absence count skips scan pipelines. It checks the pipeline itself, not the live default-branch HEAD.
  • Flag on: scan lookups use the source commit for merged-results pipelines.

Rollback: turn the flag off. No data migration or Redis state is involved.

How to review

Two commits, one per fix:

  1. Write analyzer and scan profile status for agentic scan pipelines. ingestion_subscriber_worker.rb, scan_profile_status/update_worker.rb, analyzers_status/update_service.rb.
  2. Find agentic scan pipelines from merged-results pipelines. New AgenticAnalyzer.scanned_sha and scan_pipeline_ids_for_pipeline. Used in enabled_scans_resolver.rb and related_pipelines.rb.

Trade-offs

  • default_branch_scan? accepts any duo_workflow workload pipeline at the default-branch HEAD. It can't tell the business logic scan from another Duo flow.
  • scanned_sha uses only the source commit, not every commit Security::RelatedPipelinesFinder considers.

Reviewers

Security status and approval-policy code. It needs a Sec reviewer.

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.

🤖 Generated with Claude Code

Edited by Meir Benayoun

Merge request reports

Loading
Loading