From 650194fc4006deab3ced42f0a366638b644944cf Mon Sep 17 00:00:00 2001 From: "open-swe[bot]" Date: Tue, 29 Jul 2025 17:27:20 +0000 Subject: [PATCH] Apply patch --- libs/langgraph/langgraph/_internal/_runnable.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/langgraph/langgraph/_internal/_runnable.py b/libs/langgraph/langgraph/_internal/_runnable.py index 2622d92b2..a541a92d8 100644 --- a/libs/langgraph/langgraph/_internal/_runnable.py +++ b/libs/langgraph/langgraph/_internal/_runnable.py @@ -545,6 +545,10 @@ def coerce_to_runnable( A Runnable. """ if isinstance(thing, Runnable): + # Check if this is a PregelProtocol instance (compiled subgraph) + # and wrap it to handle runtime context propagation + if PregelProtocol is not None and isinstance(thing, PregelProtocol): + return _PregelWrapper(thing, name=name) return thing elif is_async_generator(thing) or inspect.isgeneratorfunction(thing): return RunnableLambda(thing, name=name) @@ -949,3 +953,4 @@ async def _consume_aiter(it: AsyncIterator[Any]) -> Any: return output +