fix(litellm): Avoid double span exits when streaming #5933
+181
−20
Merged
@sentry/warden / warden
completed
Apr 13, 2026 in 2m 6s
1 issue
Medium
Failure callback lacks streaming-aware span handling - `sentry_sdk/integrations/litellm.py:237`
The _success_callback now correctly pops the span from metadata to prevent double exits during streaming, but _failure_callback still uses .get() instead of .pop() and doesn't check for streaming status. If failure_callback is also invoked multiple times during streaming (similar to success callbacks), or if both callbacks fire for the same request, this could still cause double span exits or resource leaks.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 1 | 1m 40s | $1.12 |
| find-bugs | 0 | 1m 28s | $1.72 |
| skill-scanner | 0 | 1m 31s | $0.32 |
| security-review | 0 | 2m 1s | $0.59 |
Duration: 6m 40s · Tokens: 1.8M in / 19.1k out · Cost: $3.75 (+dedup: $0.00, +extraction: $0.00)
Loading