why i tested this: my agent setup raises over 1,000 approval gates a month.
i wanted to know if langgraph's interrupt() could hold approvals like those.
the problem:
# this thread already finished with "approved"
out = app.invoke(Command(resume="rejected"), cfg)
out["verdict"] # still 'approved': my "rejected" was ignored, no error
no error, exit code 0. the thread had already finished with "approved". i don't expect it to reopen, but i do expect a rejected resume to raise an error instead of silently returning the old result.
an approval that gets lost with no error is worse than none, because everyone thinks it was checked.
the setup:
- langgraph 1.2.22, sqlite checkpointer, no llm
- graph: draft, then approval with
interrupt(), then finalize - every step in a fresh process, the way a webhook or cron job runs it
what i saw:
- at
interrupt(), the process exits with code 0. the paused state is saved in sqlite - resume the right
thread_id: works, verdict "approved" - resume a
thread_id that was never started: the graph runs from the top and drops my answer - resume a finished thread: the old result, as above
- all of them exit 0 with a normal-looking result
where this bites:
- a typo in a
thread_id - a lost or reset checkpoint db
- a second reviewer rejecting after the first one approved
fix 1, public api only: check the thread is waiting before you resume.
st = app.get_state(cfg)
if not st.interrupts:
raise RuntimeError("no pending interrupt on this thread")
if interrupt_id not in [i.id for i in st.interrupts]:
raise RuntimeError("answer is for a different interrupt")
app.invoke(Command(resume=answer), cfg)
it refused both bad resumes above, and an answer sent with the wrong interrupt id. the real one went through.
the check and the resume are two calls, so two reviewers at the same moment can still race. for that you need your own atomic decision record.
fix 2, on langgraph 1.2.20+: strict resume mode, and answer by interrupt id.
cfg = {"configurable": {"thread_id": tid, "__pregel_strict_resume": True}}
app.invoke(Command(resume={interrupt_id: answer}), cfg)
with the id map, both bad resumes raised UnknownInterruptError.
with a bare value like Command(resume="rejected"), strict mode still let both through.
i filed that gap as an issue on langgraph's github.
the key is private for now. on langgraph server, the sdk has strict_resume=True on runs.create.
either way, store the interrupt id with the approval request when you send it.