From 417df26781936d88cb2c551bc515211a256f775d Mon Sep 17 00:00:00 2001 From: "open-swe[bot]" Date: Tue, 29 Jul 2025 17:33:52 +0000 Subject: [PATCH] Apply patch --- libs/langgraph/langgraph/_internal/_runnable.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/langgraph/langgraph/_internal/_runnable.py b/libs/langgraph/langgraph/_internal/_runnable.py index 15e87e628..44e8db7aa 100644 --- a/libs/langgraph/langgraph/_internal/_runnable.py +++ b/libs/langgraph/langgraph/_internal/_runnable.py @@ -551,7 +551,9 @@ def coerce_to_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): + # Only wrap if the subgraph has a context_schema (needs runtime context) + if (PregelProtocol is not None and isinstance(thing, PregelProtocol) + and hasattr(thing, 'context_schema') and thing.context_schema is not None): return _PregelWrapper(thing, name=name) return thing elif is_async_generator(thing) or inspect.isgeneratorfunction(thing): @@ -956,3 +958,4 @@ async def _consume_aiter(it: AsyncIterator[Any]) -> Any: output = chunk return output +