Commit a86efa6
fix(runners): fall back to root agent when a resumed call author is not in the tree
`Runner._find_agent_to_run` is annotated `-> BaseAgent` and documents that it
"falls back to root agent if no suitable agents are found". But on a resumable
resume from a function response it returned
`root_agent.find_agent(event.author)` unconditionally, and `find_agent` returns
None when `event.author` is not a node in the agent tree (host integrations
commonly hydrate resumed or external events with author='user'). That None
then flowed into `build_node(agent_to_run)` in `run_async`, raising
"ValueError: Invalid node type: <class 'NoneType'>".
Fix: in the resumable branch, only short-circuit when `find_agent` resolves the
author; otherwise fall through to the existing event scan and root-agent
fallback. This matches the non-resumable branch and the method's documented
contract, so the change only turns a guaranteed crash into the documented
fallback.
Also de-nests the TestRunnerFindAgentToRun tests, which were accidentally
defined inside a module-level test function and never collected, and adds two
regression tests.
Change-Id: I7d64187be5e6443a185a20b0ad08bea3ae017fb11 parent a5fa3da commit a86efa6
2 files changed
Lines changed: 493 additions & 396 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1728 | 1728 | | |
1729 | 1729 | | |
1730 | 1730 | | |
1731 | | - | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
1732 | 1740 | | |
1733 | 1741 | | |
1734 | 1742 | | |
| |||
0 commit comments