Skip to content

fix(pydantic-ai): Stop capturing tool execution spans when validation fails - #7448

Merged
alexander-alderman-webb merged 2 commits into
masterfrom
webb/pydantic-ai/no-span-validation-failure
Sep 10, 2026
Merged

fix(pydantic-ai): Stop capturing tool execution spans when validation fails#7448
alexander-alderman-webb merged 2 commits into
masterfrom
webb/pydantic-ai/no-span-validation-failure

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Description

Do not capture a tool execution span when the tool doesn't execute because the arguments are invalid.

The tool is never executed when validation fails, as ToolHandler short circuits by raising an exception in this case. See https://github.com/pydantic/pydantic-ai/blob/0ec8a5dcc9c30e82e91d63af20e5d92f1456fac5/pydantic_ai_slim/pydantic_ai/tool_manager.py#L977

Issues

Reminders

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

131905 passed | ⏭️ 7131 skipped | Total: 139036 | Pass Rate: 94.87% | Execution Time: 482m 21s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2520 uncovered lines.
✅ Project coverage is 90.23%. Comparing base (7e95b86) to head (1fc035d).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/integrations/pydantic_ai/patches/tools.py 100.00% ⚠️ 1 partials
Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
+ Coverage    90.20%    90.23%    +0.03%
==========================================
  Files          193       193         —
  Lines        25788     25790        +2
  Branches      9530      9532        +2
==========================================
+ Hits         23261     23270        +9
- Misses        2527      2520        -7
- Partials      1432      1433        +1

Generated by Codecov Action

@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review September 9, 2026 14:09
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner September 9, 2026 14:09
@alexander-alderman-webb
alexander-alderman-webb merged commit 802326d into master Sep 10, 2026
164 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/pydantic-ai/no-span-validation-failure branch September 10, 2026 09:00
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