mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-10-14 04:05:27 +02:00
The thread stream's lifecycle watcher ended the run on any `completed` or `failed` lifecycle event, including the one a subgraph sends when it finishes. So `thread.output` could read the thread state before the parent stored the step that ran the subgraph, and a run that failed after a subgraph completed was reported as completed. The async and sync watchers now end the run only on a root event, with the `_is_root_terminal_lifecycle` check the fanout already uses. The JS SDK checks the root namespace here too. This is the `sdk-py integration` flake where the final `items` comes back as `['streamed', 'tool', 'asked']` without `'sub'`: the example graph's last node runs a subgraph. ## Tests New async and sync tests send a subgraph `completed` and then a root `failed`. Without the fix the run ends as completed. `make lint` and `make test` in `libs/sdk-py` pass.