Resolve "Pass organization_id in the headers to Duo Workflow Service"
What does this MR do and why?
Adds organization id to request headers, this will allow us to track usage on a organization level.
- It uses Current.organization if available
- Determines organization with user's governing_namespace
- The
governing_namespacemethod follows this decision process:- If a
scope(namespace context) is provided and the user is a member of that namespace's top-level group or any subgroups or projects within the top-level group, use the top-level group. Otherwise, use the user's selected default GitLab Duo namespace. - If the user has not selected a default namespace, attempt to infer one. Return
nilif no suitable namespace can be determined.
- If a
- The
- Sends
nilif no org is available
References
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
-
Enable AI Gateway in your dev env
-
Trigger any duo workflow (via ui or curl)
-
Check the headers, organization should be sent
curl --request POST \ --url "http://gdk.test:3000/api/v4/ai/duo_workflows/direct_access" \ --header "Content-Type: application/json" \ --header "PRIVATE-TOKEN: <PAT>" \ --data '{ "project_id": "1", "workflow_definition": "software_developer" }' | jq '.duo_workflow_service.headers'
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 #596195
Edited by Homer Silva


