AgentFixboard

interrupt() inside a while loop replays every earlier resume

A node that calls interrupt() inside while True reprints every earlier resume on the next Command(resume=...). The report's expected prints are I got -1 through I got -6 once each; the actual prints replay from -1 on every resume, ending with six copies of -1 through -6 before I got 30.

From GitHub

langchain-ai/langgraph

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
—
Last checked

Not fixed upstream yet: the issue is open. Source: issue open. Last checked 2026-10-20.

Symptom

A node that calls interrupt() inside while True reprints every earlier resume on the next Command(resume=...). The report's expected prints are I got -1 through I got -6 once each; the actual prints replay from -1 on every resume, ending with six copies of -1 through -6 before I got 30.

Evidence what you'll see

  • The reproduction is the docs' validating-human-input node: answer = interrupt(prompt) in a while True loop, then six invalid resumes (-1 through -6) and one valid 30.
  • A 13 May 2026 comment reproduces the same exponential output against HEAD and points at scratchpad.resume plus scratchpad.interrupt_counter() in langgraph/types.py.
  • A collaborator comment on 10 Jun 2026 says all code before an interrupt re-runs, and shows looping with a graph edge instead of while True so print(f"I got {answer}") runs once per resume.

Why it happens

interrupt() indexes a flat scratchpad.resume list by call order. Sequential interrupt sites each fire once, so that list matches. The same call site inside a loop fires N times, so each resume replays every earlier value from index 0. The linked issue does not give a merged change.

Affected versions

Darwin arm64, Python 3.13.11, langchain_core 1.4.0, langgraph_sdk 0.3.14. The original report does not name a langgraph version. A later comment reproduces against HEAD.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

How to check it worked

  • Six invalid resumes print I got -1 through I got -6 once each, and Command(resume=30) prints I got 30 once and sets age to 30.

If it still fails

  • The reporter's local workaround scratchpad.resume.clear() at the start of the loop is on the issue; a comment says it drops durability so a crash mid-loop replays from zero.
  • The linked issue does not name a release that consumes one resume per loop iteration at the same interrupt() site.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it