Skip to content

fix(anthropic): Set exception info on streaming span when applicable#5683

Merged
alexander-alderman-webb merged 42 commits intomasterfrom
webb/anthropic/exc-on-exit
Mar 19, 2026
Merged

fix(anthropic): Set exception info on streaming span when applicable#5683
alexander-alderman-webb merged 42 commits intomasterfrom
webb/anthropic/exc-on-exit

Conversation

@alexander-alderman-webb
Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Mar 17, 2026

Description

Consolidate span finishing code in the __exit__ block of a new _StreamSpanContext context manager.
Forward exception info from _StreamSpanContext.__exit__() to Span.__exit__().

Issues

Reminders

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 7.37s

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 14347 uncovered lines.

Files with missing lines (1)
File Patch % Lines
anthropic.py 5.83% ⚠️ 404 Missing

Generated by Codecov Action

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (logging) Separate ignore lists for events/breadcrumbs and sentry logs by sl0thentr0py in #5698

Bug Fixes 🐛

Anthropic

  • Set exception info on streaming span when applicable by alexander-alderman-webb in #5683
  • Patch AsyncStream.close() and AsyncMessageStream.close() to finish spans by alexander-alderman-webb in #5675
  • Patch Stream.close() and MessageStream.close() to finish spans by alexander-alderman-webb in #5674

Documentation 📚

  • Add note on AI PRs to CONTRIBUTING.md by sentrivana in #5696

Internal Changes 🔧

  • Add client report tests for span streaming by sentrivana in #5677

Other

  • Update CHANGELOG.md by sentrivana in #5685

🤖 This preview updates automatically when you update the PR.

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 17, 2026 12:38
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner March 17, 2026 12:38
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 17, 2026 15:15
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Base automatically changed from webb/anthropic/async-iterators to master March 18, 2026 13:53
@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft March 18, 2026 14:15
@alexander-alderman-webb alexander-alderman-webb changed the title fix(anthropic): Set exception info on span when applicable fix(anthropic): Set exception info on streaming span when applicable Mar 18, 2026
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 18, 2026 15:01
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft March 18, 2026 15:13
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 18, 2026 15:59
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Maybe add a comment on what _guaranteed_streaming_state means exactly?

@alexander-alderman-webb alexander-alderman-webb merged commit 8d56b30 into master Mar 19, 2026
158 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/anthropic/exc-on-exit branch March 19, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants