[PR #617] [MERGED] Fix for update_state mistakenly resetting barrier channels #1575

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

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraph/pull/617
Author: @nfcampos
Created: 6/6/2024
Status: Merged
Merged: 6/7/2024
Merged by: @nfcampos

Base: mainHead: nc/6jun/potential-fix-for-update-state-on-triggered-barrier


📝 Commits (1)

  • ec0aa27 Fix for update_state mistakenly resetting barrier channels

📊 Changes

5 files changed (+109 additions, -10 deletions)

View changed files

📝 langgraph/channels/base.py (+9 -1)
📝 langgraph/channels/dynamic_barrier_value.py (+5 -5)
📝 langgraph/channels/named_barrier_value.py (+4 -2)
📝 langgraph/pregel/__init__.py (+10 -2)
📝 tests/test_pregel.py (+81 -0)

📄 Description

  • This introduces a new optional method BaseChannel.consume, which gets called when a channel triggers a node
  • This is an alternative place to clean up channel state, in addition to the existing pattern of clearing state in the update() call for the next step
  • Channels should implement consume() when they want to clean up state exactly if and only if the channel triggered a node
  • Channels should clean up state in update() when they instead need to guarantee their value is available for a single step, irrespective of whether it was actually read

🔄 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/langgraph/pull/617 **Author:** [@nfcampos](https://github.com/nfcampos) **Created:** 6/6/2024 **Status:** ✅ Merged **Merged:** 6/7/2024 **Merged by:** [@nfcampos](https://github.com/nfcampos) **Base:** `main` ← **Head:** `nc/6jun/potential-fix-for-update-state-on-triggered-barrier` --- ### 📝 Commits (1) - [`ec0aa27`](https://github.com/langchain-ai/langgraph/commit/ec0aa273fda496187a3fde1adf23874d6331429a) Fix for update_state mistakenly resetting barrier channels ### 📊 Changes **5 files changed** (+109 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `langgraph/channels/base.py` (+9 -1) 📝 `langgraph/channels/dynamic_barrier_value.py` (+5 -5) 📝 `langgraph/channels/named_barrier_value.py` (+4 -2) 📝 `langgraph/pregel/__init__.py` (+10 -2) 📝 `tests/test_pregel.py` (+81 -0) </details> ### 📄 Description - This introduces a new optional method BaseChannel.consume, which gets called when a channel triggers a node - This is an alternative place to clean up channel state, in addition to the existing pattern of clearing state in the update() call for the next step - Channels should implement consume() when they want to clean up state exactly if and only if the channel triggered a node - Channels should clean up state in update() when they instead need to guarantee their value is available for a single step, irrespective of whether it was actually read --- <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-20 17:45:03 -05:00
yindo closed this issue 2026-02-20 17:45:04 -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#1575