You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Runner.run_async ignores yield_user_message=True for composite-agent roots #8407
Composite roots persist the incoming user event but omit it from the public stream even when yield_user_message=True. Direct LlmAgent and node roots already honor the flag.
Run this offline reproduction; it uses no credentials or external services:
Expected vs actual: With yield_user_message=True, both roots should yield and store authors ['user', 'child']. Before the fix, SequentialAgent yields only ['child'], though it stores both events. After the fix, both roots yield and store both events.
@sumedh-aerram Reproduced on main (2.15.1), and it's not just SequentialAgent: ParallelAgent and LoopAgent roots also yield only ['child'] while storing ['user', 'child']. They all go through _run_with_trace, which never looks at yield_user_message.
A workaround that held up for me: count session.events before the new/resumed invocation setup, then yield the newly stored user event(s) right before _exec_with_plugin starts, reusing the stored event so the id matches. LlmAgent and node roots stay as they are, and the default False is unchanged.
Could you check whether that matches what you're seeing? Also, did you run into this in a real app, or spot it while reading the code? One gap on my side: a resume of an already-finished invocation returns early, so nothing gets yielded there.
Since #8408 is already open, please give it a thorough test first (resume, state-delta-only resume, before_run short-circuit) before marking it ready.
@surajksharma07 Thanks for reproducing this. You're right that ParallelAgent and LoopAgent roots are affected too; all three go through _run_with_trace, and #8408 now covers them. It uses the approach you described: count session.events before the new or resumed invocation setup, then yield the stored user event(s) right before _exec_with_plugin, so the ids match. LlmAgent and node roots and the default False are unchanged.
Tested for all three composite roots (LlmAgent and node roots as controls):
new turns, on_user_message_callback rewrites, and a before_run short-circuit (user event first, as on the node path);
resume with a function response, with no new input, and state-delta only, including a real pause through a long-running tool, where the yielded event id matches the stored one;
resume of a finished invocation: no model call, and only a stored delta event (if any) is yielded.
Without the fix 21 of the 126 new cases fail; the full unit suite shows no new failures.
One thing I noticed while testing, which happens on main too: once a composite child is waiting on a tool result, a state-delta-only resume applies the delta and then raises ValueError: No agent to transfer to for resuming agent from function response child. It's separate from this PR, so I left it alone; happy to open an issue if useful.
To your question: I found this while reviewing the runner code paths, not in a production app.
Thanks @sumedh-aerram, 263a489 covers it, including the finished-invocation gap I mentioned. The yield now comes before the end_of_agents return, so a stored delta event still goes out and no model call happens. The change is small and in the right place: count before setup, yield the stored user events before _exec_with_plugin, same objects so the ids match. #8408 merges cleanly with main (30737fa), and main/2.15.1 still drop the user event for composite roots.
On the ValueError: yes, please open an issue. I reproduced it on main with a SequentialAgent child paused on a LongRunningFunctionTool and then resumed with only state_delta={"k": "v"}. The delta is applied, then it raises "No agent to transfer to for resuming agent from function response child".
It looks like the content-less user event from the delta-only resume becomes the last event on the branch. LlmAgent's resume lookup (llm_agent.py ~1022-1038) treats any user-authored last event as a function response, finds no matching call, and raises. Skipping user events that carry no function response there would probably fix it.
I'll flag #8408 for review so the 2 pending workflows get approved. Nothing else needed from you on this one.
Activity
surajksharma07 commentedon Dec 1, 2026
@sumedh-aerram Reproduced on main (2.15.1), and it's not just SequentialAgent: ParallelAgent and LoopAgent roots also yield only ['child'] while storing ['user', 'child']. They all go through _run_with_trace, which never looks at yield_user_message.
A workaround that held up for me: count session.events before the new/resumed invocation setup, then yield the newly stored user event(s) right before _exec_with_plugin starts, reusing the stored event so the id matches. LlmAgent and node roots stay as they are, and the default False is unchanged.
Could you check whether that matches what you're seeing? Also, did you run into this in a real app, or spot it while reading the code? One gap on my side: a resume of an already-finished invocation returns early, so nothing gets yielded there.
Since #8408 is already open, please give it a thorough test first (resume, state-delta-only resume, before_run short-circuit) before marking it ready.
sumedh-aerram commentedon Dec 1, 2026
@surajksharma07 Thanks for reproducing this. You're right that ParallelAgent and LoopAgent roots are affected too; all three go through
_run_with_trace, and #8408 now covers them. It uses the approach you described: countsession.eventsbefore the new or resumed invocation setup, then yield the stored user event(s) right before_exec_with_plugin, so the ids match. LlmAgent and node roots and the defaultFalseare unchanged.Tested for all three composite roots (LlmAgent and node roots as controls):
on_user_message_callbackrewrites, and abefore_runshort-circuit (user event first, as on the node path);Without the fix 21 of the 126 new cases fail; the full unit suite shows no new failures.
One thing I noticed while testing, which happens on
maintoo: once a composite child is waiting on a tool result, a state-delta-only resume applies the delta and then raisesValueError: No agent to transfer to for resuming agent from function response child. It's separate from this PR, so I left it alone; happy to open an issue if useful.To your question: I found this while reviewing the runner code paths, not in a production app.
surajksharma07 commentedon Dec 1, 2026
Thanks @sumedh-aerram, 263a489 covers it, including the finished-invocation gap I mentioned. The yield now comes before the end_of_agents return, so a stored delta event still goes out and no model call happens. The change is small and in the right place: count before setup, yield the stored user events before _exec_with_plugin, same objects so the ids match. #8408 merges cleanly with main (30737fa), and main/2.15.1 still drop the user event for composite roots.
On the ValueError: yes, please open an issue. I reproduced it on main with a SequentialAgent child paused on a LongRunningFunctionTool and then resumed with only state_delta={"k": "v"}. The delta is applied, then it raises "No agent to transfer to for resuming agent from function response child".
It looks like the content-less user event from the delta-only resume becomes the last event on the branch. LlmAgent's resume lookup (llm_agent.py ~1022-1038) treats any user-authored last event as a function response, finds no matching call, and raises. Skipping user events that carry no function response there would probably fix it.
I'll flag #8408 for review so the 2 pending workflows get approved. Nothing else needed from you on this one.