Commit 3537416
fix(graph): prevent reset_executor_state from corrupting MultiAgentBase state
GraphNode.reset_executor_state() checked hasattr(self.executor, 'state')
but did not verify the state type before overwriting it with AgentState.
When the executor is a MultiAgentBase (e.g. a nested Graph), its state
is a GraphState, and overwriting it with AgentState corrupts the
executor.
The __post_init__ method already had the correct guard:
hasattr(self.executor.state, 'get')
but reset_executor_state() was missing it.
This affected two call sites:
- _execute_node (when reset_on_revisit is enabled with nested graphs)
- deserialize_state (unconditionally resets all nodes on completed runs)
Fixes #17751 parent fca208b commit 3537416
File tree
2 files changed
+35
-1
lines changed- src/strands/multiagent
- tests/strands/multiagent
2 files changed
+35
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2405 | 2405 | | |
2406 | 2406 | | |
2407 | 2407 | | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
0 commit comments