Correct LangGraph interrupt resumption and preserve user input - #260
Open
Vsevolod Kukol (sevoku) wants to merge 2 commits into
Open
Vsevolod Kukol (sevoku) wants to merge 2 commits into
Vsevolod Kukol (sevoku) wants to merge 2 commits into
Conversation
Vsevolod Kukol (sevoku)
requested review from
Theo van Kraay (TheovanKraay),
Jay Gordon (jaydestro) and
Sajeetharan (sajeetharan)
as code owners
September 22, 2026 12:46
Copilot started reviewing on behalf of
Vsevolod Kukol (sevoku)
September 22, 2026 12:47
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Resolve the asynchronous API usage and related guidance inconsistencies before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (3)
What changed in this PR
Updates LangGraph interrupt guidance to correctly resume with Command(resume=...) and preserve user input.
Changes:
- Reuses the thread ID when resuming.
- Records
interrupt()output in message history. - Documents node restart behavior and idempotent side effects.
- Links current LangGraph documentation.
| File | Summary |
|---|---|
skills/cosmosdb-best-practices/rules/pattern-langgraph-interrupt-human.md |
Corrects interrupt resumption and message-history guidance. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Vsevolod Kukol (sevoku)
marked this pull request as draft
September 22, 2026 12:51
Vsevolod Kukol (sevoku)
marked this pull request as ready for review
September 22, 2026 14:19
Copilot started reviewing on behalf of
Vsevolod Kukol (sevoku)
September 22, 2026 14:19
View session
This branch has not been deployed
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.


Summary
Correct the caller and node guidance in
pattern-langgraph-interrupt-human.mdso a pausedinterrupt()receives the user's response and adds it to the graph's message history through the appropriate async execution APIs.Problem
The rule tells callers to resume with
graph.stream(new_input, config). Ordinary graph input does not provide the resume value expected by a pendinginterrupt(); the supported API usesCommand(resume=...).The example's
human_nodealso discards the return value ofinterrupt()and returnsNone. Changing only the caller would therefore still lose the user's response instead of recording it in the conversation. The async agent node and checkpointer example also require an async execution path rather than synchronousgraph.stream()execution.Changes
graph.astream(Command(resume=user_message), config)and consume it withasync for, reusing the interrupted run'sthread_id. Documentawait graph.ainvoke(...)as the non-streaming alternative for the async graph and checkpointer.interrupt()and return it as a user message throughMessagesState.interrupt()must be idempotent.API Evidence
The official resuming-interrupts documentation states that callers resume with
Command(resume=...), must reuse the same thread ID, and that the supplied value becomes the return value ofinterrupt().The
interrupt()API reference demonstrates capturing that returned value and incorporating it into the node's state update. The side-effect guidance explains why code before the interrupt runs again.This guidance is specifically for resuming a pending dynamic interrupt, not a requirement to replace ordinary input dictionaries in normal multi-turn conversations.
Original Discussion And Scope
Addresses the original review discussion on microsoft/vscode-cosmosdb#3355, where the skill is vendored into the VS Code extension.
This PR changes only the interrupt rule. The async-execution review finding is addressed by 9f134a2, which adds explicit
async forconsumption and theainvoke()alternative.The conflicting checkpoint-guidance discussion is tracked by companion PR #261, which removes raw checkpoint reconstruction and internal trigger injection from the other rule. Both PRs should land before publishing the updated guidance. #261 remains unmerged and its changes are not duplicated here.