fix(langchain): preserve LangGraph control flow traces #1632
+983
−58
Claude / Claude Code Review
completed
Apr 20, 2026 in 11m 31s
Code review found 2 potential issues
Found 5 candidates, confirmed 2. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | langfuse/langchain/CallbackHandler.py:949-955 |
Missing _reset() in root-level control-flow error paths for tool/retriever/LLM handlers |
Annotations
Check warning on line 955 in langfuse/langchain/CallbackHandler.py
claude / Claude Code Review
Missing _reset() in root-level control-flow error paths for tool/retriever/LLM handlers
The three newly-modified error handlers — `on_tool_error` (line 949), `on_retriever_error` (line 309), and `on_llm_error` (line 1161) — call `_persist_resume_trace_context` for root-level control-flow exceptions but never call `_reset()` afterward, unlike `on_chain_error` which correctly includes `_reset()` in its `finally` block. This is a pre-existing gap that the PR makes slightly worse by adding a new side effect (`_persist_resume_trace_context`) without matching cleanup, meaning stale `_chi
Loading