Skip to content

Conversation

shellmayr
Copy link
Member

@shellmayr shellmayr commented Oct 3, 2025

  • Add a constant that contains the allowed message roles according to OTEL and a mapping
  • Apply that mapping to all gen_ai integrations
  • We will track input roles that do not conform to expectations via a Sentry issue in agent monitoring to make sure we continually update the mappings

Closes TET-1077

Copy link

linear bot commented Oct 3, 2025

Copy link

codecov bot commented Oct 3, 2025

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
23705 4 23701 2317
View the top 3 failed test(s) by shortest run time
tests.integrations.openai_agents.test_openai_agents::test_tool_execution_span
Stack Traces | 0.079s run time
.../integrations/openai_agents/test_openai_agents.py:562: in test_tool_execution_span
    assert re.sub(
E   assert '[{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\\"message\\": \\"hello\\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool_call", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]' == '[{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\\"message\\": \\"hello\\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]'
E     
E     - [{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\"message\": \"hello\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]
E     ?                                                                                                                                                                                                                                                                                                                                                                                                                    ^^^^^^^^^^^^^
E     + [{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\"message\": \"hello\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool_call", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]
E     ?                                                                                                                                                                                                                                                                                                                                                                                                                    ^^^^^^^^^^^^^^^^^^
tests.integrations.openai_agents.test_openai_agents::test_tool_execution_span
Stack Traces | 0.095s run time
.../integrations/openai_agents/test_openai_agents.py:562: in test_tool_execution_span
    assert re.sub(
E   assert '[{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\\"message\\": \\"hello\\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool_call", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]' == '[{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\\"message\\": \\"hello\\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]'
E     
E     - [{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\"message\": \"hello\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]
E     ?                                                                                                                                                                                                                                                                                                                                                                                                                    ^^^^^^^^^^^^^
E     + [{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\"message\": \"hello\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool_call", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]
E     ?                                                                                                                                                                                                                                                                                                                                                                                                                    ^^^^^^^^^^^^^^^^^^
tests.integrations.openai_agents.test_openai_agents::test_tool_execution_span
Stack Traces | 0.17s run time
.../integrations/openai_agents/test_openai_agents.py:562: in test_tool_execution_span
    assert re.sub(
E   assert '[{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\\"message\\": \\"hello\\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool_call", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]' == '[{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\\"message\\": \\"hello\\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]'
E     
E     - [{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\"message\": \"hello\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]
E     ?                                                                                                                                                                                                                                                                                                                                                                                                                    ^^^^^^^^^^^^^
E     + [{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\"message\": \"hello\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool_call", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]
E     ?                                                                                                                                                                                                                                                                                                                                                                                                                    ^^^^^^^^^^^^^^^^^^
tests.integrations.openai_agents.test_openai_agents::test_tool_execution_span
Stack Traces | 0.195s run time
.../integrations/openai_agents/test_openai_agents.py:562: in test_tool_execution_span
    assert re.sub(
E   assert '[{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\\"message\\": \\"hello\\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool_call", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]' == '[{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\\"message\\": \\"hello\\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]'
E     
E     - [{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\"message\": \"hello\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]
E     ?                                                                                                                                                                                                                                                                                                                                                                                                                    ^^^^^^^^^^^^^
E     + [{"role": "system", "content": [{"type": "text", "text": "You are a helpful test assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Please use the simple test tool"}]}, {"role": "assistant", "content": [{"arguments": "{\"message\": \"hello\"}", "call_id": "call_123", "name": "simple_test_tool", "type": "function_call", "id": "call_123", "function": "NOT_CHECKED"}]}, {"role": "tool_call", "content": [{"call_id": "call_123", "output": "Tool executed with: hello", "type": "function_call_output"}]}]
E     ?                                                                                                                                                                                                                                                                                                                                                                                                                    ^^^^^^^^^^^^^^^^^^

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@shellmayr shellmayr marked this pull request as ready for review October 7, 2025 12:07
@shellmayr shellmayr requested a review from a team as a code owner October 7, 2025 12:07
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

LGTM, ty!

Left one nit.

Regarding the failing Check CI config check, merging master into this should fix it (took the liberty to sync this for you), if not, I'll take care of it. (We'll be removing the check altogether soon.)

assert SPANDATA.GEN_AI_REQUEST_MESSAGES in span["data"]

# Parse the stored messages
import json
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason not to have this at the top with the other imports?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, I'll move it up

cursor[bot]

This comment was marked as outdated.

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.

2 participants