fix(anthropic): Patch Stream.close() and MessageStream.close() to finish spans#5674
fix(anthropic): Patch Stream.close() and MessageStream.close() to finish spans#5674alexander-alderman-webb wants to merge 15 commits intomasterfrom
Stream.close() and MessageStream.close() to finish spans#5674Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Other
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ 6 passed | Total: 6 | Pass Rate: 100% | Execution Time: 1.20s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ❌ Patch coverage is 0.00%. Project has 15976 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 21.80% 21.76% -0.04%
==========================================
Files 189 189 —
Lines 20385 20419 +34
Branches 7008 7018 +10
==========================================
+ Hits 4443 4443 —
- Misses 15942 15976 +34
- Partials 379 379 —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

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:)