← Back to Pull requests

Add gen_ai.user.id for the user interacting with a GenAI session #552

Open
steverao opened this pull request with 1087 lines diff across 29 files
View on GitHub
steverao steverao commented on Sep 30, 2026 11:06 UTC
Author

Description

Add gen_ai.user.id to identify the user interacting with a GenAI session, as identified by the instrumented framework or component. It is recommended when applicable on inference, agent invocation (including workflows), and tool execution spans. Inference operation details events share the inference span's attribute group.

The field describes the session's interacting user. Browser login state, visitor cookies, and the identity used to authenticate or authorize an operation do not establish that user by themselves. Instrumentation reads the component's defined user field and omits the attribute when the component does not expose this concept. The registry includes a sensitive-information warning.

Related to #83.

Motivation

Correlate GenAI operations for incident triage and per-user quality analysis using the framework or provider's session-user concept. Keep the user identifier distinct from the conversation identifier.

Reference coverage

  • Google ADK: Session.user_id, runner user_id, and ToolContext.session.user_id, with explicit assertions for runner, internal agent, SequentialAgent workflow, and tool spans.

  • Anthropic Messages: SDK-defined metadata.user_id on ordinary and compaction requests, plus a separate ordinary request without a user ID.

  • Amazon Bedrock AgentCore: InvokeAgentRuntime(runtimeUserId=...) on client invoke_agent spans, including a request without that parameter. The scenario checks the SDK's serialized user header and keeps runtimeSessionId separate. It mocks the HTTP response while exercising real SDK validation, serialization, and response parsing. The Runtime API has no standardized model token usage or finish reasons; the conformance configuration documents those exceptions.
  • Validation

  • Strict reference scenarios: Google ADK, Anthropic (reference, without_user, caller_close), and AgentCore (reference, without_user).

  • make check-policies, make generate-all, and make test-json-schemas (33 tests).

  • Ruff lint and formatting checks for the changed Python scenarios; git diff --check.
  • Checklist

  • Motivation section filled in above

  • Reference scenarios updated for affected libraries

  • Towncrier fragment added under changelog.d/ for the consumer-visible convention change
  • Diff: 1087 lines (+825 / -262) across 29 files Reviewer: steverao Review duration: 96189m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.93) × (1 − Review Confidence (0.83)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.93 · 1087 lines diff across 29 files
    0.93
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.93 · 5 substantive comment(s)
    0.93
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    82%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Self Review self_review
    0.140
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    26 items
    opentelemetry-pr-dashboard[bot] opentelemetry-pr-dashboard[bot] commented on Sep 30, 2026 11:08 UTC
    Bot

    <!-- pull-request-dashboard-status -->
    <!-- pull-request-dashboard-status-revision:25 -->

    Pull request dashboard status

    Waiting on reviewers · refreshed 2026-12-04 04:36 UTC

    Review the latest changes.

    Also blocked by: Merge conflicts.

    <details>
    <summary>Status above doesn't look right?</summary>

    <br>

  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.

  • Should this be with the author? Comment /dashboard route:author to route it back.

  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.
  • </details>

    Copilot Copilot commented on code on Sep 30, 2026 11:08 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -145,6 +145,9 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: user.id
    +        brief: Unique identifier of the user on whose behalf the agent is invoked.
    +        requirement_level: opt_in

    This shared attribute group feeds both the client and internal invoke_agent spans, but the PR only demonstrates the internal case. The regenerated client report confirms the gap with user.id | (none) at reference/reports/invoke-agent-client-span.md:63. Please add a client-library scenario where the value comes from the client API, or keep user.id off the client span until that capturability can be shown.

    Copilot Copilot commented on code on Sep 30, 2026 11:08 UTC
    Code Review
    reference/scenarios/google-adk/scenario.py:1
    @@ -210,6 +210,7 @@ async def _run():
                 ) as workflow_span:
                     workflow_span.set_attribute("gen_ai.workflow.name", runner.app_name)
                     workflow_span.set_attribute("gen_ai.conversation.id", session.id)
    +                workflow_span.set_attribute("user.id", session.user_id)

    This does not establish invoke_workflow coverage. The runner is configured with a standalone Agent at lines 180-198, while this model explicitly says not to report a workflow span for standalone agent invocations and lists ADK Runner.run(...) only with a multi-agent or graph workflow. Use an actual ADK workflow such as SequentialAgent for this emission, or remove the workflow coverage claim until such a scenario exists.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Sep 30, 2026 11:08 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    Copilot review overview

    🟡 Changes recommended

    Client coverage is missing, and the workflow coverage uses a standalone agent rather than an ADK workflow.

    Review effort: Balanced
    Findings: 2 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture>

    <details open>
    <summary><strong>Open (2)</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [Demonstrate user.id capture on client spans](#discussion_r4143892288) · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [Use a workflow to establish invoke_workflow coverage](#discussion_r4143892361) · New

  • </details>

    <details>
    <summary><strong>What changed in this PR</strong></summary>

    Adds opt-in user.id support to agent and workflow spans for per-user correlation.

    Changes:

  • Adds user.id to agent and workflow span models and generated documentation.

  • Emits the attribute from Google ADK session state.

  • Updates reference reports and the changelog.
  • | File | Description |
    | ---- | ----------- |
    | model/​gen-ai/​spans.yaml | Adds the span attributes. |
    | docs/​gen-ai/​gen-ai-agent-spans.md | Regenerates span tables. |
    | reference/​scenarios/​google-adk/​scenario.py | Emits user.id. |
    | reference/​scenarios/​google-adk/​README.md | Documents the source value. |
    | reference/​scenarios/​google-adk/​data.json | Records emitted coverage. |
    | reference/​reports/​invoke-agent-client-span.md | Reports missing client coverage. |
    | reference/​reports/​invoke-agent-internal-span.md | Reports ADK internal coverage. |
    | reference/​reports/​invoke-workflow-span.md | Reports ADK workflow coverage. |
    | changelog.d/​+.enhancement.1.md | Adds the release note. |
    </details>

    ---

    💡 Configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>

    steverao steverao commented on code on Sep 30, 2026 14:41 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -145,6 +145,9 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: user.id
    +        brief: Unique identifier of the user on whose behalf the agent is invoked.
    +        requirement_level: opt_in

    Thanks. I initially moved user.id off the shared group, but after re-evaluating the proposal I chose to align it with gen_ai.conversation.id across the applicable GenAI operation spans in 3c092ab1. The client report intentionally remains (none): none of the current client reference APIs expose a real application-user identifier, and I do not want to synthesize one solely to claim coverage. The updated PR description calls out this gap explicitly so the community can review the symmetric model and narrow client usage later if needed.

    steverao steverao commented on code on Sep 30, 2026 14:42 UTC
    Code Review
    reference/scenarios/google-adk/scenario.py:1
    @@ -210,6 +210,7 @@ async def _run():
                 ) as workflow_span:
                     workflow_span.set_attribute("gen_ai.workflow.name", runner.app_name)
                     workflow_span.set_attribute("gen_ai.conversation.id", session.id)
    +                workflow_span.set_attribute("user.id", session.user_id)

    Addressed in 3d19a11c. The ADK runner now uses a real SequentialAgent(name="test_workflow", sub_agents=[agent]) as its root agent, and the invoke_workflow span wraps that workflow execution. The reference coverage therefore no longer comes from a standalone Agent.

    lmolkova lmolkova commented on code on Oct 06, 2026 14:41 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -145,6 +145,10 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: user.id

    Is it applicable besides ADK? Are there other frameworks that have the notion of user id in the API directly?

    steverao steverao commented on code on Oct 07, 2026 15:29 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -145,6 +145,10 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: user.id

    ADK is the clearest case. Microsoft Agent Framework also has framework-defined user principals (tenant_id + user_id) in its security context, although that API is currently experimental rather than part of the general agent invocation API. I only added ADK coverage for now. Do you think the Agent Framework case should also map to user.id?

    lmolkova lmolkova commented on code on Oct 12, 2026 17:51 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -145,6 +145,10 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: user.id

    the main concern is that user.id is known to be problematic because it's too broad and could mean anything from end user making request in the browser and to OS user which executes the running process or IAM human identity used to make specific model call - https://github.com/open-telemetry/semantic-conventions/issues/1172.

    So we need to define some other attribute that would not collide with the generic one (what if app stamps user.id on all telemetry already via context and it's different than one used on Google ADK?). Or maybe ADK thing is expected to be that opaque id?

    So need to understand how user id is used in ADK and other places and from there we can define if it's a framework-specific attribute or a more general one.

    opentelemetry-pr-dashboard[bot] opentelemetry-pr-dashboard[bot] commented on Oct 19, 2026 18:51 UTC
    Bot

    <!-- pull-request-dashboard-author-nudge:692b9c222b814cfaa68f0ebd06db8cfe -->
    Hi @steverao — just a friendly reminder that this pull request is waiting on you. The dashboard status comment has the open items and is kept current.

  • Replying is enough to hand it off — answer, explain why no change is needed, or ask a follow-up. The dashboard routes it onward once nothing on the list is waiting on you.

  • To hand it back for any other reason, including the dashboard getting this wrong, comment /dashboard route:reviewers.
  • <!-- pull-request-dashboard-author-nudge-completed:692b9c222b814cfaa68f0ebd06db8cfe -->

    _Outdated as of 2026-10-19 18:51 UTC: this reminder no longer reflects the current dashboard state. Check the dashboard status comment to see whether action is needed._

    steverao steverao commented on code on Oct 20, 2026 14:07 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -145,6 +145,10 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: user.id

    In ADK, this is an application-provided identifier for the user that owns the session and its state. AgentScope and Agno expose a similar concept for partitioning session/state or user memory, so it does not seem ADK-specific.
    It is not intended to represent an OS user or the IAM identity used to call the model. I agree that mapping it to the generic user.id may collide with an identity already recorded by the application.
    Would a GenAI-specific gen_ai.user.id, with this narrower meaning, make more sense here?

    naushkorai naushkorai commented on code on Oct 30, 2026 14:03 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -145,6 +145,10 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: user.id

    I'm also unclear on when and how to use the existing OpenTelemetry attributes on gen_ai. spans, specifically when it comes to standardizing how GenAI spans are ingested and displayed in UIs. It feels counterintuitive to add something like gen_ai.user.id when OpenTelemetry already has user.id.

    what if app stamps user.id on all telemetry already via context and it's different than one used on Google ADK

    I would expect user.id to flow through the app as a constant ID and mean the same thing in every context, which is the end user. I understand the general definition is broad, but the GenAI semantic conventions can narrow it on their own spans, and this PR's wording ("the user on whose behalf the model is invoked") already does that. If the app has already set user.id, the instrumentation shouldn't overwrite it. If a framework needs a user identifier that means something different, I would expect a separate gen_ai. attribute for that case.

    Thank you both for tackling this problem!

    steverao steverao commented on code on Nov 02, 2026 16:15 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -145,6 +145,10 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: user.id

    Hi @lmolkova, based on our previous discussion about the ambiguity of user.id, I looked more closely at how user identifiers are used across GenAI frameworks and model-provider APIs.

    I agree that directly mapping a framework-provided user identifier to the generic user.id could collide with an identity already propagated by the application. This is especially relevant given the broader ambiguity discussed in open-telemetry/semantic-conventions#1172.

    There does appear to be a recurring GenAI-specific concept that is separate from the conversation itself:

  • Google ADK says that Session.userId links a conversation to a particular user, while the session ID identifies the individual conversation thread.

  • Agno explicitly distinguishes user_id, which identifies the person/auth subject across sessions, from session_id, which identifies one conversation thread.

  • AgentScope Runtime also exposes user_id separately from session_id, using it to differentiate users and support per-account accounting.
  • However, similar-looking identifiers do not always have the same meaning:

  • LangChain4j’s @MemoryId can distinguish either users or conversations, so it is a memory-partition key rather than an unambiguous user identity.

  • Microsoft Agent Framework’s FIDES identity model uses tenant_id and user_id as an authorization principal. That may represent a different identity domain and should not be mapped automatically.

  • Anthropic’s metadata.user_id and OpenAI’s safety_identifier identify an external application user for provider-specific safety and abuse-detection purposes. OpenAI also allows a session identifier for anonymous users, which demonstrates why the field name alone is not sufficient evidence for mapping.
  • Based on these distinctions, I think a separate gen_ai.user.id would be safer than reusing the generic user.id.

    I propose defining it as:

    gen_ai.user.id: The unique identifier of the application-level user on whose behalf the GenAI operation is performed, as explicitly provided to or exposed by the GenAI framework or provider.

    The intended boundaries would be:

  • Instrumentations SHOULD populate it only when the library or API explicitly defines the value as an application-level user identity.

  • Instrumentations MUST NOT populate it solely because a parameter is named user_id.

  • Instrumentations MUST NOT derive it from session_id, gen_ai.conversation.id, memory_id, or another value that is only a state-partition key.

  • It MUST NOT represent an OS user, service account, model-call IAM principal, or agent identity.

  • It may coexist with the generic user.id; the two values are not assumed to be equal.

  • Instrumentations MUST NOT overwrite or reinterpret an application-provided user.id.
  • I would not place this under gen_ai.conversation.*, because the same user may span multiple conversations and is not intrinsically a property of one conversation.

    Would this narrower definition of gen_ai.user.id address the collision and ambiguity concerns?

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Nov 24, 2026 01:47 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🔵 Needs a closer look

    The shared attribute introduces a remote client-agent requirement without demonstrated API coverage, leaving a convention-boundary decision that the author explicitly reserves for community review.

    No open issues 🎉

    <details>
    <summary><strong>2 resolved since last review</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> Use a workflow to establish invoke_workflow coverage

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> Demonstrate user.id capture on client spans

  • </details>

    <sub>Review effort: Balanced</sub>

    lmolkova lmolkova commented on code on Dec 01, 2026 00:39 UTC
    Code Review
    model/gen-ai/registry.yaml:1
    @@ -446,6 +446,25 @@ attributes:
           `audio` and 200 as `unknown`.
         examples: ['text', 'image', 'audio']
         stability: development
    +  - key: gen_ai.user.id
    +    type: string
    +    stability: development
    +    brief: The identifier of the application user on whose behalf the GenAI operation is performed.
    +    note: |
    +      Instrumentations MUST use only an identifier that the framework or provider explicitly
    +      defines for this purpose, such as Google ADK's `Session.user_id`. The same user may
    +      participate in multiple conversations.
    +
    +      Browser login state, a visitor cookie, or a generic `user.id` alone is insufficient
    +      to identify the user of a GenAI operation. For example, if the application supplies
    +      its signed-in user's ID as `metadata.user_id` in an Anthropic Messages request,
    +      the instrumentation records the identifier from that request.
    +
    +      Instrumentations MUST NOT infer the user from a conversation ID, a memory partition key,
    +      an agent identity, a service account, or the OS or IAM principal used to execute the operation.
    +      This identifier can differ from the application's `user.id`.
    +      Instrumentations MUST NOT overwrite an application-provided `user.id` with this value.
    +    examples: ["usr_7f32a"]
    lmolkova lmolkova commented on code on Dec 01, 2026 00:39 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -55,6 +55,9 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: gen_ai.user.id
    +        requirement_level:
    +          conditionally_required: When the framework or provider explicitly identifies the application user for this operation.

    should this be recommended (here and on the other two spans)? It's a user identifier, and conditionally required makes instrumentations emit it by default with no clear way to turn it off.

    also I don't think we need to repeat the attribute brief in the requirement level.

          - ref: gen_ai.user.id
            requirement_level:
              recommended: When applicable.
    

    lmolkova lmolkova commented on code on Dec 01, 2026 00:45 UTC
    Code Review
    model/gen-ai/registry.yaml:1
    @@ -446,6 +446,25 @@ attributes:
           `audio` and 200 as `unknown`.
         examples: ['text', 'image', 'audio']
         stability: development
    +  - key: gen_ai.user.id
    +    type: string
    +    stability: development
    +    brief: The identifier of the application user on whose behalf the GenAI operation is performed.

    we don't really know if it's an application user - it's whatever is set in the corresponding field in the SDK

        brief: The identifier of the user as known to the GenAI agent framework or another component.
    

    lmolkova lmolkova commented on code on Dec 01, 2026 00:49 UTC
    Code Review
    model/gen-ai/registry.yaml:1
    @@ -446,6 +446,25 @@ attributes:
           `audio` and 200 as `unknown`.
         examples: ['text', 'image', 'audio']
         stability: development
    +  - key: gen_ai.user.id
    +    type: string
    +    stability: development
    +    brief: The identifier of the application user on whose behalf the GenAI operation is performed.
    +    note: |
    +      Instrumentations MUST use only an identifier that the framework or provider explicitly
    +      defines for this purpose, such as Google ADK's `Session.user_id`. The same user may
    +      participate in multiple conversations.
    +
    +      Browser login state, a visitor cookie, or a generic `user.id` alone is insufficient
    +      to identify the user of a GenAI operation. For example, if the application supplies
    +      its signed-in user's ID as `metadata.user_id` in an Anthropic Messages request,
    +      the instrumentation records the identifier from that request.
    +
    +      Instrumentations MUST NOT infer the user from a conversation ID, a memory partition key,
    +      an agent identity, a service account, or the OS or IAM principal used to execute the operation.
    +      This identifier can differ from the application's `user.id`.
    +      Instrumentations MUST NOT overwrite an application-provided `user.id` with this value.

    Can we be tighten it up, remove mentions of user.id which has no conflict now and provide more examples? I.e. talk about what it is rather than what it's not?

          The value SHOULD map to a user concept defined by the library or component,
          for example:
          - Google ADK [`Session.user_id`](https://adk.dev/sessions/session/)
          - Agno [`Agent.run(user_id=...)`](https://docs.agno.com/reference/agents/agent)
          - Amazon Bedrock AgentCore [`runtimeUserId`](https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_InvokeAgentRuntime.html)
          
          Instrumentations SHOULD NOT set this attribute if corresponding component does
          not have a notion of user.
    

    lmolkova lmolkova commented on code on Dec 01, 2026 00:55 UTC
    Code Review
    reference/scenarios/anthropic/conformance.yaml:1
    @@ -17,6 +17,23 @@ scenarios:
               attributes:
                 gen_ai.operation.name: chat
               type: gen_ai.client.inference
    +      # The basic chat sends metadata.user_id. The compaction request omits it.

    The compaction request omits it.

    why? is this how it intends to work?

    lmolkova lmolkova commented on code on Dec 01, 2026 00:55 UTC
    Code Review
    reference/scenarios/anthropic/README.md:1
    @@ -8,6 +8,9 @@ This reference configures the util-genai upload completion hook so real Messages
     API inference spans carry external references for captured system instructions,
     input messages, output messages, and tool definitions.
     
    +The basic chat request supplies the application's opaque user ID in the Messages
    +API's `metadata.user_id`. The inference span records that value as `gen_ai.user.id`.
    +

    I don't think we document low level scenario details in this file.

    lmolkova lmolkova commented on code on Dec 01, 2026 00:56 UTC
    Code Review
    reference/scenarios/google-adk/README.md:1
    @@ -4,6 +4,10 @@ The Google Agent Development Kit (ADK) is an agent framework. It calls models
     through its model layer (e.g. `google-genai`), so it **delegates inference**. It
     owns the agent, workflow, tool, and memory operations it runs directly.
     
    +Runner, agent, and workflow invocations record the application user's ID from
    +the ADK session or the runner's `user_id` argument. Tools read the same
    +`gen_ai.user.id` from `ToolContext.session.user_id`.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Dec 01, 2026 00:57 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟢 Approval recommended

    No active review issues block the addition of gen_ai.user.id to the GenAI conventions.

    No open issues 🎉

    <sub>Review effort: Balanced</sub>

    lmolkova lmolkova commented on code on Dec 01, 2026 00:59 UTC
    Code Review
    model/gen-ai/spans.yaml:1
    @@ -55,6 +55,9 @@ attribute_groups:
           - ref: gen_ai.conversation.id
             requirement_level:
               conditionally_required: If and only if the instrumented library has one readily available, or the user application provides one through OpenTelemetry context or library-specific mechanisms.
    +      - ref: gen_ai.user.id
    +        requirement_level:
    +          conditionally_required: When the framework or provider explicitly identifies the application user for this operation.

    question: this group also feeds the client invoke_agent span, but no scenario emits it there. Is there an agent SDK that exposes the user on a remote agent call? Bedrock AgentCore InvokeAgentRuntime(runtimeUserId=...) might be one.

    lmolkova lmolkova commented on code on Dec 01, 2026 01:03 UTC
    Code Review
    reference/scenarios/anthropic/scenario.py:1
    @@ -137,6 +138,7 @@ def run_chat(handler):
             server_port=port,
         ) as inv:
             inv.max_tokens = request_max_tokens  # -> gen_ai.request.max_tokens
    +        inv.attributes["gen_ai.user.id"] = metadata["user_id"]

    nit, can you please add a comment pointing to user_id being top-level property and recognized by anthropic SDK, otherwise it might look like random app-defined constant

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Dec 01, 2026 02:03 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟢 Approval recommended

    No active review issues block the addition of gen_ai.user.id for per-user telemetry correlation.

    No open issues 🎉

    <sub>Review effort: Balanced</sub>

    Reviewers
    Assignees
    steverao steverao
    Labels
    risk: low confidence: 82.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 92.5% (HIGH) · Higher = larger blast radius
    92.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 82.5% · Lower = rushed or shallow review
    82.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.2% · Safe to merge
    16.2%