-
Notifications
You must be signed in to change notification settings - Fork 262
fix: add CONTROL_FLOW_EXCEPTION_TYPES check to on_tool_error, on_retriever_error, and on_llm_error #1514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vishnumishra
wants to merge
10
commits into
langfuse:main
Choose a base branch
from
vishnumishra:fix/control-flow-exception-check-in-error-handlers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix: add CONTROL_FLOW_EXCEPTION_TYPES check to on_tool_error, on_retriever_error, and on_llm_error #1514
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c445a75
fix: add CONTROL_FLOW_EXCEPTION_TYPES check to on_tool_error, on_retr…
vishnumishra 8a9016d
Merge branch 'main' into fix/control-flow-exception-check-in-error-ha…
vishnumishra f40fda7
fix: use DEFAULT level and preserve status_message for control-flow e…
vishnumishra c49a31f
Merge branch 'main' into fix/control-flow-exception-check-in-error-ha…
vishnumishra 526832d
Merge branch 'main' into fix/control-flow-exception-check-in-error-ha…
vishnumishra b888074
Merge branch 'main' into fix/control-flow-exception-check-in-error-ha…
vishnumishra 9a2617a
Merge branch 'main' into fix/control-flow-exception-check-in-error-ha…
vishnumishra 9e7aa4c
Merge branch 'main' into fix/control-flow-exception-check-in-error-ha…
vishnumishra 44b9fcc
Merge branch 'main' into fix/control-flow-exception-check-in-error-ha…
vishnumishra 3c9971e
Merge branch 'main' into fix/control-flow-exception-check-in-error-ha…
vishnumishra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Control-flow errors lose status
When
erroris a LangGraph control-flow exception, this setslevel=Noneand also clearsstatus_message(status_message=str(error) if level else None). That removes any indication in the observation that the run ended due to an interrupt/command, which makes these observations look “successfully ended” but empty. If the goal is only to avoidERROR, consider keeping a non-error status message (or setting a neutral level like"DEFAULT") so users can still see why the run stopped.Also appears in
on_tool_errorandon_llm_error(CallbackHandler.py:814-830,CallbackHandler.py:1016-1032).Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A user looking at traces can't distinguish between "tool completed normally" and
tool was interrupted for human-in-the-loopHowever, this is the exact same pattern on_chain_error already uses (line 583-596), which has been shipping and working. So the behavior is consistent across all four handlers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right that this is a real UX problem. When we set
level=Noneandstatus_message=None, control-flow interruptions become invisible in traces.Looking at the code, I can see that
on_chain_error(lines ~583-605) sets bothlevel=NoneAND clears the status message for control-flow exceptions:This PR applies the same pattern to
on_tool_error,on_retriever_error, andon_llm_error, which means control-flow interruptions will have no visible status indication in traces.The problem: Users can't distinguish between:
level=None,status_message=Nonelevel=None,status_message=None(same!)Suggested fix: Keep the status message but use a neutral level like
"DEFAULT"or"WARNING"instead ofNone, so the interruption reason is visible but not marked as an error:This preserves visibility of interrupts/handoffs while avoiding the red ERROR badge. The same pattern should be applied to
on_chain_errorfor consistency across all error handlers.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the PR, with the required changes.