Skip to content

fix(anthropic): Close span on GeneratorExit

9eff33e
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

fix(anthropic): Close span on GeneratorExit #5643

fix(anthropic): Close span on GeneratorExit
9eff33e
Select commit
Loading
Failed to load commit list.
GitHub Actions / warden: code-review completed Mar 12, 2026 in 1m 13s

1 issue

code-review: Found 1 issue (1 medium)

Medium

Missing test coverage for GeneratorExit scenario - `sentry_sdk/integrations/anthropic.py:367-413`

The PR adds try/finally handling to close spans when GeneratorExit is raised (e.g., when consumers break early from a streaming iterator), but no test verifies this behavior. Without a test that simulates early iterator termination, there's no regression protection for this fix.


Duration: 1m 13s · Tokens: 468.1k in / 5.1k out · Cost: $0.60

Annotations

Check warning on line 413 in sentry_sdk/integrations/anthropic.py

See this annotation in the file changed.

@github-actions github-actions / warden: code-review

Missing test coverage for GeneratorExit scenario

The PR adds try/finally handling to close spans when GeneratorExit is raised (e.g., when consumers break early from a streaming iterator), but no test verifies this behavior. Without a test that simulates early iterator termination, there's no regression protection for this fix.