fix(openai): preserve native v1 stream contract #1627
+674
−46
Claude / Claude Code Review
completed
Apr 16, 2026 in 21m 21s
Code review found 3 potential issues
Found 5 candidates, confirmed 3. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 1 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟣 Pre-existing | langfuse/openai.py:1293-1308 |
Fallback async wrapper close/exit paths skip _finalize |
Annotations
Check notice on line 1308 in langfuse/openai.py
claude / Claude Code Review
Fallback async wrapper close/exit paths skip _finalize
The fallback async wrapper's `close()`, `aclose()`, and `__aexit__` methods never call `self._finalize()`, so if a user receives a `LangfuseResponseGeneratorAsync` wrapper (for non-OpenAI generator-style async streams) and closes or context-manages it without iterating, `generation.end()` is never called and the Langfuse span leaks. The same issue exists for `LangfuseResponseGeneratorSync.__exit__`. This is a pre-existing issue that predates this PR; the PR's `_is_finalized` guard improvements t
Loading