Repository navigation
Python: Populate WorkflowAgent response for empty streams - #8389
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues were identified.
Pull request overview
This PR ensures after_run providers receive an empty AgentResponse for zero-output workflow runs.
Changes:
- Finalizes empty streamed update sequences before provider callbacks.
- Adds regression coverage for streaming and non-streaming zero-output runs.
File summaries
| File | Summary |
|---|---|
python/packages/core/tests/workflow/test_workflow_agent.py |
Adds zero-output lifecycle regression coverage. |
python/packages/core/agent_framework/_workflows/_agent.py |
Finalizes provider-visible responses for empty streams. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Thanks for the contribution. The approval-gated workflows ran, but the current head is not green: |
Eduard van Valkenburg (eavanvalkenburg)
left a comment
There was a problem hiding this comment.
Reviewed the complete diff and found no actionable issues. All reported checks for the current head are green.
Motivation & Context
A workflow can complete successfully without caller-facing output. Its fully consumed streaming run still finalizes to an empty
AgentResponse, butContextProvider.after_runcurrently seesSessionContext.response is None. The provider lifecycle contract says the response is populated when this hook runs.Description & Review Guide
AgentResponse.from_updatesfinalizer even when no updates were forwarded, and add a focused zero-output regression test with a non-streaming control.after_runproviders receive an empty finalized response instead ofNone. Non-empty streams, non-streaming runs, yielded updates, and public API signatures are unchanged. Existing history and memory providers add no output messages for the empty response.Related Issue
Fixes #8388
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.