fix(pydantic-ai): Use first-class hooks when available #5947
@sentry/warden / warden
completed
Apr 10, 2026 in 7m 27s
1 issue
Low
Span may leak if exception occurs after __enter__ in on_request hook - `sentry_sdk/integrations/pydantic_ai/__init__.py:52`
In the on_request hook, span.__enter__() is called on line 52, but if an exception occurs on the same line (e.g., dictionary assignment fails unexpectedly), the span won't be properly closed. While this is an edge case since the metadata check occurs earlier, wrapping the span entry in a try block would ensure proper cleanup.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 1 | 5m 14s | $1.53 |
| find-bugs | 0 | 7m 24s | $3.10 |
| skill-scanner | 0 | 4m 21s | $0.87 |
| security-review | 0 | 4m 25s | $0.82 |
Duration: 21m 24s · Tokens: 4.1M in / 50.8k out · Cost: $6.31 (+extraction: $0.00)
Loading