feat(pydantic-ai): Add tool description to execute_tool spans #1419
Triggered via pull request
March 6, 2026 14:23
ericapisani
synchronize
#5596
Status
Success
Total duration
24s
Artifacts
–
changelog-preview.yml
on: pull_request_target
changelog-preview
/
preview
20s
Annotations
3 warnings
|
Test asserts tool description is present when PR description says it should be omitted:
tests/integrations/pydantic_ai/test_pydantic_ai.py#L2869
The test `test_tool_without_description_omits_tool_description` asserts that `SPANDATA.GEN_AI_TOOL_DESCRIPTION in tool_span['data']` is True and its value is None. However, the PR description explicitly states: 'If no description is available (e.g. the tool has no docstring), the attribute is omitted from the span entirely.' The test docstring also says 'omits tool description' but the assertions verify the opposite - that it IS present with a None value.
|
|
Test asserts tool description is present but None, contradicting PR's stated omission behavior:
tests/integrations/pydantic_ai/test_pydantic_ai.py#L2871
The test `test_tool_without_description_omits_tool_description` (line 2871-2872) asserts that when a tool has no docstring, `SPANDATA.GEN_AI_TOOL_DESCRIPTION` should be present in the span data with value `None`. However, the PR description explicitly states: 'If no description is available (e.g. the tool has no docstring), the attribute is omitted from the span entirely.' The implementation in `execute_tool.py` line 41-42 only checks `if tool_definition:` before setting the description, so it will set `None` when the tool exists but has no docstring. The test should either assert the attribute is NOT present (matching PR intent), or the implementation needs to check `if tool_definition and tool_definition.description:`.
|
|
[2AX-BK8] Test asserts tool description is present but None, contradicting PR's stated omission behavior (additional location):
sentry_sdk/integrations/pydantic_ai/spans/execute_tool.py#L41
The test `test_tool_without_description_omits_tool_description` (line 2871-2872) asserts that when a tool has no docstring, `SPANDATA.GEN_AI_TOOL_DESCRIPTION` should be present in the span data with value `None`. However, the PR description explicitly states: 'If no description is available (e.g. the tool has no docstring), the attribute is omitted from the span entirely.' The implementation in `execute_tool.py` line 41-42 only checks `if tool_definition:` before setting the description, so it will set `None` when the tool exists but has no docstring. The test should either assert the attribute is NOT present (matching PR intent), or the implementation needs to check `if tool_definition and tool_definition.description:`.
|