Skip to content

feat(anthropic): Emit AI Client Spans for synchronous messages.stream() #6732

feat(anthropic): Emit AI Client Spans for synchronous messages.stream()

feat(anthropic): Emit AI Client Spans for synchronous messages.stream() #6732

Triggered via pull request March 2, 2026 08:32
Status Cancelled
Total duration 6m 23s
Artifacts 2

test-integrations-cloud.yml

on: pull_request
Matrix: Cloud
All Cloud tests passed
2s
All Cloud tests passed
Fit to window
Zoom out
Zoom in

Annotations

4 errors and 29 warnings
Cloud (3.13, ubuntu-22.04)
Canceling since a higher priority waiting request for Test Cloud-webb/anthropic/new-patch exists
Cloud (3.13, ubuntu-22.04)
The operation was canceled.
All Cloud tests passed
Process completed with exit code 1.
Test Cloud
Canceling since a higher priority waiting request for Test Cloud-webb/anthropic/new-patch exists
Cloud (3.10, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Cloud (3.6, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Cloud (3.6, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.6, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.14, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Cloud (3.14, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.14, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.14t, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Cloud (3.14t, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.14t, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.12, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Cloud (3.12, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.12, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.11, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Cloud (3.11, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.11, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.8, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Cloud (3.8, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.8, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.7, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Cloud (3.7, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.7, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.9, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Cloud (3.9, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Cloud (3.9, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Span may leak if exception occurs after entry but before iterator patching: sentry_sdk/integrations/anthropic.py#L759
In `_sentry_patched_stream_common`, the span is entered via `span.__enter__()` (line 759) but there's no exception handling to ensure `span.__exit__()` is called if subsequent operations (`_set_stream_input_data` or `_patch_streaming_response_iterator`) raise an exception. This differs from the existing pattern in `_sentry_patched_create_sync` which uses a `finally` block to handle span cleanup on errors. A leaked span could result in incorrect tracing data or resource leaks.
Cloud (3.13, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Span never closed if stream iteration raises exception or is interrupted: sentry_sdk/integrations/anthropic.py#L96
In `_sentry_patched_stream_common` (called via the new `MessageStreamManager.__enter__` patch at line 96-98), a span is entered via `span.__enter__()` but the span is only closed when stream iteration completes successfully via `_set_output_data(..., finish_span=True)`. If the stream consumer raises an exception, breaks out of iteration early, or the Anthropic API returns an error mid-stream, the span will never be closed, causing span leaks in traces.
[SGT-DUP] Span never closed if stream iteration raises exception or is interrupted (additional location): sentry_sdk/integrations/anthropic.py#L759
In `_sentry_patched_stream_common` (called via the new `MessageStreamManager.__enter__` patch at line 96-98), a span is entered via `span.__enter__()` but the span is only closed when stream iteration completes successfully via `_set_output_data(..., finish_span=True)`. If the stream consumer raises an exception, breaks out of iteration early, or the Anthropic API returns an error mid-stream, the span will never be closed, causing span leaks in traces.

Artifacts

Produced during runtime
Name Size Digest
codecov-coverage-results-webb-anthropic-new-patch-test-cloud
106 KB
sha256:256d56f57bbfaa79146219c7aa0638b930b4b138cc6ba6cebdbeee9a52c847bd
codecov-test-results-webb-anthropic-new-patch-test-cloud
230 Bytes
sha256:dcd703740f9a3774993d1a32594eecc8f72d9a6b22e2823cd7cdd80ee52a5a8c