Usage Billing - NamespaceId and RootNamespaceId are missing when Default GitLab Duo namespace is not set
Problem to solve
In https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/issues/1728#note_2959449109 we noticed that the NamespaceId and RootNamespaceId is sometimes missing for chat events.
This was reproducible on .com with my user by emitting chat events (using Agentic Chat) in the https://gitlab.com/gl-demo-ultimate-sscharmann namespace:
However, my user didn't have a Duo Default Namespace configured in user preferences. After I selected a default namespace (e.g., gitlab-org) and triggered another chat event in https://gitlab.com/gl-demo-ultimate-sscharmann, the billing event then included the previously missing RootNamespaceId and namespaceId data:
Our documentation states:
If you are assigned a GitLab Duo seat in multiple namespaces, you must select a default namespace.
Proposal
We need to double check why the default namespace can be empty in some cases and consider enforcing setting a default namespace or implementing some fallback logic when there is no default namespace selected

