fix(anthropic): Patch Stream.close() and MessageStream.close() to finish spans#5674
Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Internal Changes 🔧
Other
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ 13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 7.01s All tests are passing successfully. ❌ Patch coverage is 0.00%. Project has 14331 uncovered lines. Files with missing lines (1)
Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Stream.close() and MessageStream.close() to finish spans
sentrivana
left a comment
There was a problem hiding this comment.
lgtm, see one suggestion

Description
Close AI Client Spans when the Anthropic SDK's HTTP connection is closed and not merely when the streamed response iterator is consumed or the GC collects the private
_iteratorinstance variable. Patch theclose()method that also closes the connection.Issues
Reminders
tox -e linters.feat:,fix:,ref:,meta:)