Skip to content

.

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

ref(anthropic): Factor out streamed result handling #5563

.
db5dbb9
Select commit
Loading
Failed to load commit list.
GitHub Actions / warden: code-review completed Feb 27, 2026 in 2m 6s

1 issue

code-review: Found 1 issue (1 medium)

Medium

Streaming response handling no longer protected by capture_internal_exceptions - `sentry_sdk/integrations/anthropic.py:513-516`

The streaming path now checks kwargs.get("stream", False) and calls _patch_streaming_response_iterator before entering the capture_internal_exceptions() block. Previously, the streaming detection (hasattr(result, "_iterator")) was inside the exception handling block. If stream=True is passed but the result unexpectedly lacks _iterator (e.g., API behavior change, error responses), an AttributeError will propagate instead of being gracefully handled, potentially breaking the instrumented code path.


Duration: 2m 6s · Tokens: 548.0k in / 5.3k out · Cost: $0.59 (+extraction: $0.00)

Annotations

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

See this annotation in the file changed.

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

Streaming response handling no longer protected by capture_internal_exceptions

The streaming path now checks `kwargs.get("stream", False)` and calls `_patch_streaming_response_iterator` before entering the `capture_internal_exceptions()` block. Previously, the streaming detection (`hasattr(result, "_iterator")`) was inside the exception handling block. If `stream=True` is passed but the result unexpectedly lacks `_iterator` (e.g., API behavior change, error responses), an `AttributeError` will propagate instead of being gracefully handled, potentially breaking the instrumented code path.