Skip to content

refactor(langchain): centralize root resume state

55bb373
Select commit
Loading
Failed to load commit list.
Merged

fix(langchain): preserve LangGraph control flow traces #1632

refactor(langchain): centralize root resume state
55bb373
Select commit
Loading
Failed to load commit list.
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

See this annotation in the file changed.

@claude 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