[PR #1951] [MERGED] feat(stream): Add interrupts array to useStream for multi-interrupt support #1869

Closed
opened 2026-02-15 20:17:07 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/1951
Author: @maahir30
Created: 2/9/2026
Status: Merged
Merged: 2/10/2026
Merged by: @hntrl

Base: mainHead: stream-interrupt


📝 Commits (3)

📊 Changes

8 files changed (+145 additions, -23 deletions)

View changed files

.changeset/chilly-dodos-drive.md (+6 -0)
📝 libs/sdk/src/react/stream.custom.tsx (+13 -7)
📝 libs/sdk/src/react/stream.lgp.tsx (+23 -15)
📝 libs/sdk/src/react/types.tsx (+1 -0)
📝 libs/sdk/src/ui/manager.test.ts (+83 -0)
📝 libs/sdk/src/ui/stream/base.ts (+9 -1)
📝 libs/sdk/src/ui/subagents.ts (+2 -0)
📝 libs/sdk/src/ui/types.ts (+8 -0)

📄 Description

Changes

  • Adds a new interrupts (plural) array property to the useStream hook, exposing all pending interrupts from the current graph suspension
  • Fixes a bug where only the last task's interrupts were checked when reading from thread history — now all tasks are checked via flatMap, which is critical for Send() fan-out patterns where each parallel task produces its own interrupt
  • The existing singular interrupt property is preserved as a backward-compatible alias derived from interrupts[0]
  • Adds unit tests verifying that multiple concurrent interrupts in __interrupt__ arrays are correctly preserved through the stream manager

Fixes:

When using Send() to fan out tool calls into parallel nodes that each call interrupt(), the backend produces N separate interrupt objects (one per task). The previous implementation only surfaced one of them because the thread state fallback path used tasks.at(-1)?.interrupts (last task only) and returned interrupts.at(-1) (last interrupt of that task). This made it impossible for the frontend to sequentially resume all pending interrupts in a human-in-the-loop workflow.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraphjs/pull/1951 **Author:** [@maahir30](https://github.com/maahir30) **Created:** 2/9/2026 **Status:** ✅ Merged **Merged:** 2/10/2026 **Merged by:** [@hntrl](https://github.com/hntrl) **Base:** `main` ← **Head:** `stream-interrupt` --- ### 📝 Commits (3) - [`fbfe392`](https://github.com/langchain-ai/langgraphjs/commit/fbfe392574e2b15aec7fac1ed235e64d4749bef0) add interrupts property to stream - [`5aff289`](https://github.com/langchain-ai/langgraphjs/commit/5aff2893789161b0c2deb9bc80cee39fb4a30206) Create chilly-dodos-drive.md - [`f758f6d`](https://github.com/langchain-ai/langgraphjs/commit/f758f6d6c939a55f01a62a47d39b19307d404fa4) cr ### 📊 Changes **8 files changed** (+145 additions, -23 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/chilly-dodos-drive.md` (+6 -0) 📝 `libs/sdk/src/react/stream.custom.tsx` (+13 -7) 📝 `libs/sdk/src/react/stream.lgp.tsx` (+23 -15) 📝 `libs/sdk/src/react/types.tsx` (+1 -0) 📝 `libs/sdk/src/ui/manager.test.ts` (+83 -0) 📝 `libs/sdk/src/ui/stream/base.ts` (+9 -1) 📝 `libs/sdk/src/ui/subagents.ts` (+2 -0) 📝 `libs/sdk/src/ui/types.ts` (+8 -0) </details> ### 📄 Description ### Changes - Adds a new `interrupts` (plural) array property to the `useStream` hook, exposing all pending interrupts from the current graph suspension - Fixes a bug where only the last task's interrupts were checked when reading from thread history — now all tasks are checked via `flatMap`, which is critical for `Send()` fan-out patterns where each parallel task produces its own interrupt - The existing singular `interrupt` property is preserved as a backward-compatible alias derived from `interrupts[0]` - Adds unit tests verifying that multiple concurrent interrupts in `__interrupt__` arrays are correctly preserved through the stream manager ### Fixes: When using `Send()` to fan out tool calls into parallel nodes that each call `interrupt()`, the backend produces N separate interrupt objects (one per task). The previous implementation only surfaced one of them because the thread state fallback path used `tasks.at(-1)?.interrupts` (last task only) and returned `interrupts.at(-1)` (last interrupt of that task). This made it impossible for the frontend to sequentially resume all pending interrupts in a human-in-the-loop workflow. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 20:17:07 -05:00
yindo closed this issue 2026-02-15 20:17:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#1869