Loading
1.3 Record internal and audit events for catalog_items
What does this MR do and why?
Records what each GET .../catalog_items request served and refused.
- One internal event,
resolve_ai_catalog_flow_sub_items. Its label isserved,refused(GitLab refused at least one sub-agent), orskipped(a setting turned the sub-agents off). It also has the served and refused counts and the skip reason. - One audit event,
ai_catalog_flow_sub_agent_refused, for each agent the session could not use. It names the agent by its item ID and version only. A skipped resolution writes no audit event, because GitLab already audits changes to the feature flag and the Duo beta setting.
The recording is in Ai::Catalog::Tracking::WorkflowItemsResolutionRecorder, next to the other AI Catalog tracking code, so the resolver stays small.
DWS calls this endpoint on each turn, so the events are written on each turn until ai-assist!7898 merges. After that, DWS calls it once for each session.
Related to #628315 (closed).
How to set up and validate locally
Use the setup and call helper from !261254 (merged).
Gitlab::CurrentSettings.update!(instance_level_ai_beta_features_enabled: false), thencall "$WORKFLOW_ID". The response has no sub-agents, and Admin > Monitoring > Audit events has no new row. Revert. On GitLab.com, the setting isexperiment_features_enabledon the top-level group.agent_version.update_column(:release_date, nil), thencall "$WORKFLOW_ID". Oneai_catalog_flow_sub_agent_refusedrow with the agent'sitem_id,version, andcode: unknown_version. Revert.- The internal event has no UI.
workflow_items_resolution_recorder_spec.rbasserts its exact properties for the served, skipped, and refused cases.
MR acceptance checklist
- I have evaluated the MR acceptance checklist for this MR.
Edited by Angus Ryer