agent_signal

Guide

LangGraph parallel tool approval: an approved call is asked again and runs twice

By Agent Signal · Published 2026-11-28 · Updated 2026-11-28

Short answer

With create_agent, HumanInTheLoopMiddleware(interrupt_mode="per_call") and durability="exit", approving several parallel tool calls one per resume can lose a write when two tool tasks finish at the same moment. Open issue #9676 (Nov 12, 2026) traces it to PregelLoop.put_writes. The approved call then shows up for approval again and runs a second time, or a pending approval disappears and the run stalls. We reproduced it on langgraph 1.2.24 and langchain 1.5.2. Run with durability="sync" (or "async"), and make each tool refuse a second run of the same thread_id plus tool_call_id.

Your agent makes several tool calls in one turn, and each one needs a person's approval. You use HumanInTheLoopMiddleware with interrupt_mode="per_call" and approve them one at a time. Then a call you already approved comes back for approval. The reviewer has no reason to say no, approves it again, and the email goes out twice or the card is charged twice. Sometimes a pending approval disappears instead, and the run stops with nothing left to approve. This guide shows why, reproduces it, and gives a tested fix. Everything below ran on langgraph 1.2.24, langchain 1.5.2, langchain-core 1.8.5, Python 3.13.5, Nov 28, 2026.

Who this hits

This is not the usual "node re-runs on resume" problem from LangGraph interrupt resumes twice. It needs all of these:

  1. An agent built with create_agent and HumanInTheLoopMiddleware(..., interrupt_mode="per_call"). The LangChain docs say per-call mode "raises one interrupt per gated call, answered by interrupt ID", and that "when multiple tool calls are paused at the same time, each action requires a separate decision" (LangChain human-in-the-loop).
  2. Two or more gated tool calls in the same model turn, approved one per resume.
  3. The graph run with durability="exit". The default is "async" (the invoke docstring in langgraph 1.2.24 says so), and in that version's source the older checkpoint_during=False also maps to "exit". The LangGraph docs say that in this mode it "persists changes only when graph execution exits", including at a human-in-the-loop interrupt (LangGraph checkpointers: durability modes).

Why it happens

The report is issue #9676, opened on Nov 12, 2026 and still open on Nov 28, 2026. The parallel tool calls run as separate tasks. When a task finishes, PregelLoop.put_writes() filters the loop's list of pending writes, assigns the filtered copy back and adds its own writes, with no lock. If two tasks do this at the same moment, the later one can write back a list that is missing the other task's write. With durability="exit", that list is what the checkpoint keeps.

Which write is lost decides what you see:

  • The approved call's result is lost. Its old interrupt comes back, so get_state().interrupts lists it as pending again. Approve it and the tool runs a second time.
  • A waiting call's interrupt is lost. get_state() shows fewer approvals than waiting calls, and the run stalls.

A fix for the dropped writes, #9668, was closed without being merged. The issue says an earlier lock fix, #8114, was also closed. With durability="sync" or "async", every write also goes to the checkpointer as it happens, so the report found neither symptom.

Reproduce it

We ran the script from the issue as is: three parallel tool calls (send_email, charge_card, book_room), each approved one per resume, 30 runs per row. The race window is only milliseconds wide, so the script has a hook that waits up to 10 ms at the end of each pass over the pending-writes list. It doesn't add, drop or reorder any write. Our output:

langgraph 1.2.24 langchain 1.5.2
as is, durability='exit'                     asked again  0/30  tool ran twice  0/30  approval lost, run stalled  0/30
window widened, durability='exit'            asked again 20/30  tool ran twice 20/30  approval lost, run stalled 11/30
window widened, durability='sync'            asked again  0/30  tool ran twice  0/30  approval lost, run stalled  0/30
window widened, put_writes() locked, 'exit'  asked again  0/30  tool ran twice  0/30  approval lost, run stalled  0/30

Without the hook, all 30 runs were clean, so this won't show up in a quick local test. The reporter says they hit it once without the hook, in a long-running approval workflow under CPU load. With the hook, an approved call was asked again and ran twice in 20 of 30 runs, and an approval was lost in 11 of 30. With durability="sync", all 30 runs were clean.

The fix

Do two things. Neither depends on the upstream fix.

1. Don't run human-in-the-loop agents with durability="exit". Use "sync", or leave it unset. Pass it on every invoke or stream, including every resume:

agent.invoke(Command(resume={interrupt_id: {"type": "approve"}}), config, durability="sync")

2. Make each tool refuse a second run of the same call. The repeat is the same tool call with the same id, so key the side effect on thread_id plus the tool call id. Record the key before the side effect runs, and return the saved result when the key already exists. LangChain injects the id into a tool with InjectedToolCallId:

db = sqlite3.connect(":memory:", check_same_thread=False)
db.execute("CREATE TABLE done (key TEXT PRIMARY KEY, result TEXT)")

def once(tool_call_id, effect):
    """Run effect once per thread_id:tool_call_id; a repeat returns the saved result."""
    key = f'{get_config()["configurable"]["thread_id"]}:{tool_call_id}'
    try:
        db.execute("INSERT INTO done (key, result) VALUES (?, NULL)", (key,)); db.commit()
    except sqlite3.IntegrityError:
        return db.execute("SELECT result FROM done WHERE key=?", (key,)).fetchone()[0] or "already ran"
    result = effect()
    db.execute("UPDATE done SET result=? WHERE key=?", (result, key)); db.commit()
    return result

@tool
def charge_card(amount: int, tool_call_id: Annotated[str, InjectedToolCallId]) -> str:
    """Charge a card."""
    return once(tool_call_id, lambda: (executed.append(("charge_card", amount)), "charged")[1])

Here executed stands in for the real email, charge or booking, and the table is in-memory SQLite to keep the example small. Use your own database in production, or the provider's idempotency key. We ran the same three-tool agent with these guarded tools and the hook still on:

langgraph 1.2.24 langchain 1.5.2
guarded tools, window widened, 'exit'        asked again 15/30  tool ran twice  0/30  approval lost, run stalled 11/30
guarded tools, window widened, 'sync'        asked again  0/30  tool ran twice  0/30  approval lost, run stalled  0/30

With the guard alone, approved calls were still asked again, 15 of 30 times, but no tool ran twice. The lost approvals stayed (11 of 30), because the guard can't bring back an interrupt that was never saved. Only durability="sync" cleared both. So you need both: "sync" stops the lost writes, and the key makes any repeat harmless, whatever caused it.

One caution: an approval that comes back looks real to the reviewer. If a call is pending and its key is already in your table, show it as already done instead of asking again.

Will the crash test catch this?

No, and a PASS doesn't rule it out. Our free crash test stops your graph mid-approval, starts it again, counts the charges and prints PASS or FAIL. We ran it on a two-tool create_agent agent with HumanInTheLoopMiddleware(interrupt_mode="per_call"), and it passed 5 of 5. It restarts and replays your graph; it doesn't force two tool tasks to finish at the same moment. It's still the right check for the restart and replay cases: run it on your agent, then add the guard above, which makes this race harmless too.

Related guides

Run the free crash test on your agent

Free starter pack

The approval-flow starter pack

Tested human-in-the-loop approval starters for LangGraph, OpenAI Agents SDK, Vercel AI SDK and Google ADK, plus the Agent Signal newsletter. Free.

Get the Agent Signal newsletter