Fix recording audit event for status check response changes

What does this MR do and why?

In !189293 (merged) , we introduced recording audit event when an external status check response is updated through API.

In this MR, we are recording this audit event in 2 more places for full visibility:

  • When the status check response is updated through UI using retry option.

  • The status check responses have a timeout of 2.minutes and automatically failed after that if a response is not received, an audit event is recorded when the response is automatically failed.

References

#559043 (closed)

Query Plan

UPDATE "status_check_responses"
SET    "status" = 1
WHERE  "status_check_responses"."status" = 2
       AND ( retried_at IS NULL
             AND created_at < '2025-08-13 17:40:34.211473'
              OR retried_at < '2025-08-13 17:40:34.211624' )
       AND "status_check_responses"."id" >= 6 

Note: The timestamp for created_at and retried_at are dynamic in 2.minutes range.

Status checks fail if they stay in the pending state for more than two minutes. For more info: https://docs.gitlab.com/user/project/merge_requests/status_checks/

https://console.postgres.ai/gitlab/gitlab-production-main/sessions/42438/commands/129933

How to set up and validate locally

  1. Simulate a SaaS instance (export GITLAB_SIMULATE_SAAS=1)

  2. Under Project > Settings > Merge Requests > Status Checks

    Add some example status checks (see example screenshot below): image

  3. Setup audit event streaming in the group following:

  1. Create an MR (Edit the README.md of any project)
  2. Wait 2 minutes until the status check is automatically failed - verify an audit event is recorded with failed status
  3. Press Retry option in the UI - verify an audit event is record with pending status

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.

Related to #559043 (closed)

Edited by Imam Hossain

Merge request reports

Loading