mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-28 20:45:05 +02:00
Fixes #6956 Fixes #8579 When parallel tasks interrupt, resuming one leaves its old `__interrupt__` write in the open superstep. `get_state()` treated that write as pending even after the task finished, so the answered question reappeared. Use `read_task_statuses()` for execution, state reads, and resume checks. An output write marks a task finished; `RESUME` alone does not, because the task may have interrupted again. Record `NO_WRITES` when a resumed task completes without output, so it isn't run again. Latest-state reads now omit interrupts from finished tasks. History and explicit checkpoint reads still show the last recorded interrupt per task. A task paused at its second interrupt appears in `next` with `result=None`. `Command(resume=value)` without an id now raises when more than one interrupt is pending, including in a subgraph. Older checkpoints where a resumed task finished without output may still appear unfinished. On SQLite and Postgres, insert-ignore can leave an old `RESUME` value for a finished task; that task does not run again. Tests: `tests/test_interrupt_state.py` (sync and async). `make format`, `make lint`; memory/SQLite: 2075 passed, 4 skipped; Postgres 16: 3659 passed, 6 skipped.