[PR #6195] fix(langgraph): fix supersteps not populating task.result field #4897

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

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/6195

State: closed
Merged: Yes


Description

Fix bulk_update_state and abulk_update_state so history populates tasks[*].result when creating state via supersteps.

# apply pending writes, if not on specific checkpoint
if (
    CONFIG_KEY_CHECKPOINT_ID not in config[CONF]
    and saved is not None
    and saved.pending_writes
):
    next_tasks = prepare_next_tasks(...)

In the bulk-update flow every superstep carries a checkpoint_id, so this branch was not triggered. That skipped prepare_next_tasks(...) and prevented us from discovering the task IDs that we would need to attach the task result. This check was removed.

Now for each task discovered in prepare_next_tasks(...), I collect the task IDs and reuse them when applying updates to the node

Tests

  • test_supersteps_populate_task_results for PregelLoop and AsyncPregelLoop

These tests build a single node graph and compare history from two threads: one uses .invoke and the other is build from supersteps.

Issue

Solves https://github.com/langchain-ai/langgraph/issues/6206

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6195 **State:** closed **Merged:** Yes --- ### Description Fix `bulk_update_state` and `abulk_update_state` so history populates `tasks[*].result` when creating state via supersteps. ```python # apply pending writes, if not on specific checkpoint if ( CONFIG_KEY_CHECKPOINT_ID not in config[CONF] and saved is not None and saved.pending_writes ): next_tasks = prepare_next_tasks(...) ``` In the bulk-update flow every superstep carries a `checkpoint_id`, so this branch was not triggered. That skipped `prepare_next_tasks(...)` and prevented us from discovering the task IDs that we would need to attach the task result. This check was removed. Now for each task discovered in `prepare_next_tasks(...)`, I collect the task IDs and reuse them when applying updates to the node ### Tests - `test_supersteps_populate_task_results` for `PregelLoop` and `AsyncPregelLoop` These tests build a single node graph and compare history from two threads: one uses `.invoke` and the other is build from supersteps. ### Issue Solves https://github.com/langchain-ai/langgraph/issues/6206
yindo added the pull-request label 2026-02-20 17:50:55 -05:00
yindo closed this issue 2026-02-20 17:50:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4897