[PR #5595] fix: Suppress warning for END channel writes in Pregel apply_writes #4547

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

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

State: closed
Merged: No


Fixes #5572

Issue

When a subgraph returns a Command with goto=END and includes state updates, a warning is logged about writing to an "unknown" channel branch:to:__end__, even though the state update works correctly.

Solution

Modify the apply_writes function in libs/langgraph/langgraph/pregel/algo.py to treat END channels as a special case, skipping the warning for channels matching the branch:to:__end__ pattern.

Changes

  • Import END from langgraph.constants
  • Add a special case check to skip warning for END channels
  • Preserve existing functionality of state updates and graph termination

Motivation

  • Eliminates misleading warning
  • Maintains current behavior of state propagation
  • Improves user experience by reducing unnecessary log noise

Testing

  • Ran make format, make lint, and make test
  • All tests passed
  • No functional changes introduced

Resolves the warning when using Command(goto=END, update={...}) in subgraphs.

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/5595 **State:** closed **Merged:** No --- Fixes #5572 ## Issue When a subgraph returns a `Command` with `goto=END` and includes state updates, a warning is logged about writing to an "unknown" channel `branch:to:__end__`, even though the state update works correctly. ## Solution Modify the `apply_writes` function in `libs/langgraph/langgraph/pregel/algo.py` to treat END channels as a special case, skipping the warning for channels matching the `branch:to:__end__` pattern. ### Changes - Import `END` from `langgraph.constants` - Add a special case check to skip warning for END channels - Preserve existing functionality of state updates and graph termination ### Motivation - Eliminates misleading warning - Maintains current behavior of state propagation - Improves user experience by reducing unnecessary log noise ## Testing - Ran `make format`, `make lint`, and `make test` - All tests passed - No functional changes introduced Resolves the warning when using `Command(goto=END, update={...})` in subgraphs.
yindo added the pull-request label 2026-02-20 17:50:22 -05:00
yindo closed this issue 2026-02-20 17:50:22 -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#4547