Skip to content

Conversation

@fpfp100
Copy link
Contributor

@fpfp100 fpfp100 commented Jan 7, 2026

Clean up inputs/outputs for InvokeAgent spans based on new OTel format

Copilot AI review requested due to automatic review settings January 7, 2026 19:28
@fpfp100 fpfp100 requested a review from a team as a code owner January 7, 2026 19:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the handling of input messages for InvokeAgent spans to align with a new OpenTelemetry format. Instead of storing the complete input structure and extracting attributes separately, the code now intelligently processes input arrays to extract user text content when available, falling back to the full array JSON when no user messages are present.

Key Changes:

  • Introduced a new buildInputMessages method that extracts text content from user role messages or returns the full array
  • Removed the previous logic that called Utils.getAttributesFromInput and set additional attributes from input
  • Added comprehensive test coverage for both extraction scenarios (user messages present and assistant-only messages)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/agents-a365-observability-extensions-openai/src/OpenAIAgentsTraceProcessor.ts Implements new buildInputMessages method to extract user text content from input arrays, replacing previous attribute extraction logic
tests/observability/extension/openai/OpenAIAgentsTraceProcessor.test.ts Adds two test cases validating the new input message processing behavior for both user and assistant-only scenarios

Copilot AI review requested due to automatic review settings January 7, 2026 20:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Copilot AI review requested due to automatic review settings January 7, 2026 23:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

spanData: {
type: 'response' as const,
name: 'ResponseArray',
_input: inputArray,
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace after the comma on this line. Remove the extra spaces to maintain consistent formatting.

Suggested change
_input: inputArray,
_input: inputArray,

Copilot uses AI. Check for mistakes.
startedAt: new Date().toISOString(),
spanData: {
type: 'response' as const,
name: 'ResponseArray',
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case uses the same span name 'ResponseArray' as the test on line 592. This creates ambiguity in the test suite as both tests access spansByName['ResponseArray']. Use a unique name like 'ResponseArrayNonStandard' to distinguish this test case.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@nikhilNava nikhilNava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you post the before and after for the input / output values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants