fix: generic interrupt() resumes with the raw user value, not {"decisions"} (gh #99) - #100
Merged
Merged
Conversation
…ions"} (gh #99) The CLI built the resume envelope unconditionally as {"decisions": [...]} — the deepagents tool-REVIEW protocol — and forwarded it verbatim as command.resume, which becomes the return value of interrupt(). So the canonical LangGraph "collect input from a human" pattern, name = interrupt("What is your name?"), received {"decisions": [{"type": "approve"}]} and produced the visibly wrong Hello, {'decisions': [{'type': 'approve'}]}!. Even "Provide custom decision (JSON)" wrapped the typed value inside the envelope, leaving no workaround. Branch the RESUME on the same signal #82/#95 use to RENDER: a deepagents tool-review interrupt (an action_request dict keyed `action`, or legacy `tool`) keeps the {"decisions": [...]} envelope unchanged; a generic/scalar interrupt(value) resumes with the raw value the user enters, UNWRAPPED (JSON is parsed when it parses; otherwise the text is used verbatim). Under --no-interactive a generic interrupt resumes with an empty value rather than injecting a fake approval, keeping the run-to-completion contract. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011HWCfJii6gXd3XL3Gq3W8B
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.
Problem
#82 and #95 fixed displaying a generic
interrupt(...)payload. This closes the matching resume gap.The CLI built the resume envelope unconditionally as
{"decisions": [...]}— the deepagents/langchain tool-review protocol — and forwarded it verbatim ascommand.resume, which becomes the return value ofinterrupt(). So the canonical LangGraph "collect input from a human" pattern:received
{"decisions": [{"type": "approve"}]}and produced the visibly wrongHello, {'decisions': [{'type': 'approve'}]}!. Even "Provide custom decision (JSON)" wrapped the typed value inside the envelope, so there was no workaround.Fix
Branch the resume on the same signal #82/#95 use to render (
_is_generic_interrupt, mirroringformat_interrupt_request):action_requestdict keyedaction, or legacytool) → keeps the{"decisions": [...]}envelope, unchanged.interrupt(value)(a bare string like"What is your name?", or a plain dict without an action key) → resumes with the raw value the user enters, unwrapped. JSON is parsed when it parses (so a number/list/dict survives); otherwise the text is used verbatim as a string.--no-interactiveon a generic interrupt → resumes with an empty value rather than injecting a fake approval it never asked for, keeping the run-to-completion contract.Tests
New
tests/test_generic_interrupt.pydrives real agents through the CLI resume path:interrupt("What is your name?")resumed withAlice→Hello, Alice!(and nodecisionsenvelope leaks).action_requestsinterrupt still resumes with{"decisions": [...]}(no HITL approval shows nothing for a generic LangGraphinterrupt(...)— bare string → empty banner, non-actiondict →1. unknown; the interrupt payload is dropped (post-#69 gap) #82/HITL: a plain-string interrupt("...") shows "(no action details provided)" — the human approves blind #95 regression).--no-interactivegeneric path avoids the envelope._is_generic_interruptclassifier boundary.test_no_interactive_approve.py's fixture now uses a genuine tool-review interrupt so it keeps testing auto-approve precisely; the generic auto path is covered in the new file.Full suite: 151 passed.
ruff checkandruff format --checkclean.🤖 Generated with Claude Code
https://claude.ai/code/session_011HWCfJii6gXd3XL3Gq3W8B