Commit cc024b3
fix(tutorials): stop at130-langgraph workflow deadlock on graph compile
The 130_langgraph tutorial's workflow called `lg_graph(GRAPH_NAME).compile()`
each turn. With the tools node as LangGraph's `ToolNode` (a Runnable) running
`execute_in="workflow"`, the temporalio LangGraph plugin wraps it in
`wrap_workflow`, whose closure captures the ToolNode. LangGraph's compile-time
subgraph detection (`find_subgraph_pregel` -> `get_function_nonlocals` ->
`inspect.getsource`) then recurses through that wrapper with no cycle
detection and never terminates, tripping Temporal's 2s deadlock detector. The
agent never emitted a tool_request and the integration test timed out on every
retry.
Replace the `ToolNode` tools node with a plain `async def tools_node` that
dispatches the requested tool calls. A plain function isn't a Runnable, so the
plugin-wired graph compiles in ~2ms instead of hanging, while keeping the
intended activity(LLM)/workflow(tools) split. Verified: wired compile drops
from non-terminating to 2ms and the hermetic ReAct-loop test still passes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent bbfb22e commit cc024b3
1 file changed
Lines changed: 30 additions & 3 deletions
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
13 | 22 | | |
14 | 23 | | |
15 | 24 | | |
| |||
26 | 35 | | |
27 | 36 | | |
28 | 37 | | |
29 | | - | |
30 | | - | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
| |||
58 | 69 | | |
59 | 70 | | |
60 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
61 | 88 | | |
62 | 89 | | |
63 | 90 | | |
| |||
72 | 99 | | |
73 | 100 | | |
74 | 101 | | |
75 | | - | |
| 102 | + | |
76 | 103 | | |
77 | 104 | | |
78 | 105 | | |
| |||
0 commit comments