Commit 42902ab
fix(groupchat): route WorkflowEvent payloads + enforce framework max_rounds for af 1.3.0
In agent-framework 1.3.0, `workflow.run(stream=True)` only yields
`WorkflowEvent` instances. `AgentResponseUpdate` is wrapped inside
`event.data` for `type=="output"` events. The two types are unrelated
(verified by MRO), so the previous `isinstance(event, AgentResponseUpdate)`
gate from the b260107 era was permanently dead in 1.3.0. As a result every
orchestrator-side safety guard inside that branch silently no-opped:
* per-agent loop detection
* Coordinator finish=true detection
* max_rounds enforcement
* streaming callback dispatch
* manager-instruction extraction
That is why production runs hit the framework's own 100-iteration runner
cap as `RuntimeError("Runner did not converge after 100 iterations")`
even after the recent identity-resolution patch (which only touched code
that never executed).
Three coordinated fixes:
1. Replace the dead `isinstance(event, AgentResponseUpdate)` gate with
`isinstance(event, WorkflowEvent) and event.type == "output"` and
inspect `event.data` / `event.executor_id` to distinguish per-
participant streaming chunks (executor_id matches one of self.agents
and data is AgentResponseUpdate) from the framework orchestrator's
final output (list[Message] or custom result object).
2. Add `executor_id` parameter to `_handle_agent_update` so identity
resolves from the WorkflowEvent wrapper's executor_id (always populated
from `AgentExecutor.id` = the agent's name) first, then falls back
to `event.author_name`, then legacy `event.agent_id`. Matches the
approach already used by Content Processing Solution.
3. Pass `max_rounds=self.max_rounds` and `intermediate_outputs=True`
to `GroupChatBuilder`:
- `max_rounds` gives the framework itself a clean termination
ceiling so even if our orchestrator-side guards miss, the workflow
halts cleanly instead of crashing at the runner's 100-iteration cap.
- `intermediate_outputs=True` is required for each participant's
`yield_output(AgentResponseUpdate)` call to surface as a workflow
`output` event. Without this, only the orchestrator's final yield
reaches our streaming loop and the per-agent guards above never run.
Tests:
* Existing termination/loop-detection tests still pass (handler now has
3-tier identity resolution with backward-compat for `author_name`).
* Added `test_handle_agent_update_prefers_executor_id_over_author_name`
to lock in the new precedence.
* Added `test_handle_agent_update_strips_executor_id_prefix` to cover
the `groupchat_agent:Coordinator` framework prefix.
* Full suite: 833 passed (was 831; +2 new tests).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent f74629b commit 42902ab
2 files changed
Lines changed: 135 additions & 34 deletions
File tree
- src/processor/src
- libs/agent_framework
- tests/unit/libs/agent_framework
Lines changed: 70 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
547 | 569 | | |
548 | | - | |
| 570 | + | |
| 571 | + | |
549 | 572 | | |
550 | 573 | | |
551 | 574 | | |
| |||
565 | 588 | | |
566 | 589 | | |
567 | 590 | | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | 591 | | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
584 | 608 | | |
585 | 609 | | |
586 | 610 | | |
| |||
715 | 739 | | |
716 | 740 | | |
717 | 741 | | |
| 742 | + | |
718 | 743 | | |
719 | 744 | | |
720 | 745 | | |
| |||
726 | 751 | | |
727 | 752 | | |
728 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
729 | 761 | | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
742 | 769 | | |
743 | 770 | | |
744 | 771 | | |
| |||
1237 | 1264 | | |
1238 | 1265 | | |
1239 | 1266 | | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
1240 | 1279 | | |
1241 | 1280 | | |
1242 | 1281 | | |
1243 | 1282 | | |
| 1283 | + | |
| 1284 | + | |
1244 | 1285 | | |
1245 | 1286 | | |
1246 | 1287 | | |
| |||
Lines changed: 65 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
235 | 295 | | |
0 commit comments