fix(anthropic): Close span on GeneratorExit
#5643
Merged
@sentry/warden / warden
completed
Mar 13, 2026 in 1m 46s
1 issue
Medium
Missing test coverage for GeneratorExit handling - `sentry_sdk/integrations/anthropic.py:374-420`
The PR adds try/finally blocks to close spans when generators are suspended via GeneratorExit, but no tests verify this behavior. Without tests, there's no validation that spans are correctly closed with partial data when a consumer abandons the iterator early. Test coverage should verify the span is closed and contains expected partial data.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 1 | 50.5s | $0.17 |
| find-bugs | 0 | 1m 42s | $0.58 |
| skill-scanner | 0 | 7.8s | $0.03 |
| security-review | 0 | 25.3s | $0.10 |
Duration: 3m 6s · Tokens: 779.3k in / 6.1k out · Cost: $0.88 (+dedup: $0.00, +extraction: $0.00)
Loading