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
fix(groupchat): detect participant loops via executor_completed events
In agent-framework 1.3.0 the GroupChat orchestrator agent (Coordinator)
is invoked directly inside the framework's internal _invoke_agent_helper
(agent_framework_orchestrations/_group_chat.py:484) rather than through
an AgentExecutor. The Coordinator therefore never surfaces as a workflow
event, which makes our existing Coordinator-JSON-based loop detector in
_complete_agent_response permanently dead in 1.3.0.
Symptom in production: workflow loops with the Coordinator latched onto
the same participant (e.g., Chief Architect repeatedly asked to produce
an Evidence Pack that never satisfies the next reviewer). The loop runs
until the framework's max_rounds ceiling fires (~17 min at default 100)
instead of being caught early.
Fix:
* Track participant turn completions from WorkflowEvent.executor_completed,
the one observable signal that does NOT depend on Coordinator visibility
(participants ARE wrapped in AgentExecutor and so do emit these events).
* Force-terminate (hard_loop) after 3 consecutive completions of the same
participant.
* Force-terminate (hard_timeout) when total participant completions reach
max_rounds; independent of len(agent_responses) which only grows on
agent switch and so can never reach max_rounds during a same-participant
loop.
* Flush per-participant streaming buffer on each executor_completed so
back-to-back same-agent turns produce one AgentResponse per turn instead
of accumulating across turns.
* Move forced-termination break check to top of the streaming loop so any
branch (timeout, participant loop, Coordinator finish=true) takes effect
on the very next event rather than waiting for the next output event.
Adds 3 regression tests covering the streak trigger, the alternation
reset, and the round-budget enforcement. 836 tests pass (833 -> 836).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments