fix(langchain): preserve LangGraph control flow traces #1632
+983
−58
Claude / Claude Code Review
completed
Apr 20, 2026 in 35m 16s
Code review found 1 potential issue
Found 3 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | langfuse/langchain/CallbackHandler.py:460-478 |
persist_resume_trace_context called after observation.end() in non-chain error handlers |
Annotations
Check warning on line 478 in langfuse/langchain/CallbackHandler.py
claude / Claude Code Review
persist_resume_trace_context called after observation.end() in non-chain error handlers
In on_chain_error, _persist_resume_trace_context is correctly called before observation.end() (line 868), so the resume key is saved even if end() throws. In the three non-chain handlers (on_retriever_error, on_tool_error, on_llm_error), observation.update().end() is chained and _persist_resume_trace_context is called afterward; if end() throws, the except block is entered without saving the resume key, and the subsequent finally: _reset(run_id) destroys the entire _RootRunState including its re
Loading