Missing project ID in billing events for certain DAP workflows

Summary

Billing events for certain DAP workflows are missing the project_id field, which prevents proper linking from the Credits Dashboard to DAP session details pages. See discussion here - #579139 (comment 3101412224).

Background

This issue was discovered during implementation of #579139 (closed), which adds links from the Credits Dashboard user drill-down to DAP session details pages.

The session details URL format requires a project path: https://<project-path>/-/automate/agent-sessions/<session-id>

However, billing events for certain workflows are being sent without a project_id, making it impossible to construct the proper session details URL.

Problem

For certain workflows, the billing events have a blank/missing project_id field. See events data below since 2026-01-15 where project id is null.

Event Sub-type Count
code_completions code_suggestions 38,700,515
code_generations code_suggestions 4,784,542
ai_gateway_proxy_use ai_gateway_proxy_use 4,156,608
ai_gateway_proxy_use 915,225
duo_agent_platform_workflow_completion chat 544,573
duo_agent_platform_workflow_completion code_review/v1 38,242
duo_agent_platform_workflow_completion software_development 22,796
duo_agent_platform_workflow_completion sast_fp_detection/v1 5,558
duo_agent_platform_workflow_completion fix_pipeline/v1 2,499
duo_agent_platform_workflow_completion duo_planner/experimental 3,119
duo_agent_platform_workflow_completion security_analyst_agent/experimental 996
duo_agent_platform_workflow_completion analytics_agent/v1 951
duo_agent_platform_workflow_completion security_analyst_agent/v1 893
duo_agent_platform_workflow_completion duo_planner/v1 1,680
duo_agent_platform_workflow_completion developer/v1 1,670
duo_agent_platform_workflow_completion ai_catalog_agent 1,504
duo_agent_platform_workflow_completion resolve_sast_vulnerability/v1 76
duo_agent_platform_workflow_completion issue_to_merge_request 54
duo_agent_platform_workflow_completion convert_to_gl_ci/v1 32
duo_agent_platform_workflow_completion developer/experimental 13
duo_agent_platform_workflow_completion convert_to_gitlab_ci 3

This prevents:

  1. Linking from Credits Dashboard to session details
  2. Proper attribution of usage to specific projects
  3. Complete audit trails for billing

Expected Behavior

All DAP billing events should include a project_id when the session is associated with a specific project.

Acceptance Criteria

  • Identify which DAP workflows are sending billing events without project_id
  • Determine the root cause (AI Gateway, billing event emission, etc.)
  • Ensure project_id is included in billing events for all project-scoped DAP sessions
  • Verify that existing billing events can be backfilled or that the fix applies going forward
Edited by 🤖 GitLab Bot 🤖