Fix: Resume graph on generic/custom interrupts instead of starting a new run#263
Open
Geoffrey Pruvost (geoffreyp) wants to merge 1 commit intolangchain-ai:mainfrom
Open
Fix: Resume graph on generic/custom interrupts instead of starting a new run#263Geoffrey Pruvost (geoffreyp) wants to merge 1 commit intolangchain-ai:mainfrom
Geoffrey Pruvost (geoffreyp) wants to merge 1 commit intolangchain-ai:mainfrom
Conversation
…raph restart When a non-HITL interrupt is pending, resume the graph using Command(resume=...) instead of submitting new messages. This prevents the graph from looping back to START for custom/generic interrupts.
|
Geoffrey Pruvost (@geoffreyp) is attempting to deploy a commit to the LangChain Team on Vercel. A member of the Team first needs to authorize it. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix issue
#262
Problem
When a LangGraph backend uses interrupt() with a custom/generic payload (i.e. not the standard HumanInterrupt schema with action_request / config), the chat input always sends the user's response as a new run. This causes the graph to restart from START, re-triggering the interrupt() node in an infinite loop instead of resuming execution.
Only interrupts matching the isAgentInboxInterruptSchema format (with action_requests and review_configs) were properly handled via Command(resume=...) through the ThreadView / agent-inbox components. Any other interrupt format — like a simple {"type": "human_input_request", "message": "..."} — was displayed read-only via GenericInterruptView with no way to resume the graph from the chat input.
Solution
Modified handleSubmit in src/components/thread/index.tsx to detect when there is a pending interrupt that is not a standard HITL interrupt. In that case, the user's message is sent as Command(resume=input) instead of new input, allowing the graph to resume correctly.
action_requests/review_configs)ThreadViewCommand(resume=...)