Python: Fix HandoffBuilder silently dropping context_provider during agent cloning#3721
Python: Fix HandoffBuilder silently dropping context_provider during agent cloning#3721
Conversation
Co-authored-by: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com>
Co-authored-by: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com>
Co-authored-by: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com>
|
@copilot Fix this error F841 Local variable |
…ng_handoff Co-authored-by: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com>
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
|
@copilot Run the python pre-commit hook on the changed files to fix formatting errors |
Co-authored-by: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com>
Fixed in commit (hash will be shown after push). Removed trailing whitespace from lines 325 and 342 in test_handoff.py. |
There was a problem hiding this comment.
Pull request overview
Fixes a bug in the orchestrations handoff flow where HandoffBuilder-created agent clones silently lost their configured context_provider due to a parameter name mismatch, and adds a regression test to ensure context providers are preserved during cloning.
Changes:
- Fix
_clone_chat_agentto passcontext_provider=(singular) toChatAgentinstead of the incorrectcontext_providers=argument. - Add a new orchestration test validating that a context provider is invoked when running a handoff workflow, confirming it survived cloning.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/orchestrations/agent_framework_orchestrations/_handoff.py | Corrects the constructor kwarg so cloned ChatAgents retain context_provider. |
| python/packages/orchestrations/tests/test_handoff.py | Adds regression coverage verifying context provider invocation during handoff workflow execution. |
context_providers=should becontext_provider=context_providerstocontext_providerin _clone_chat_agent methodeventsvariable from testSummary
Successfully fixed the bug where HandoffBuilder was silently ignoring the context_provider due to using
context_providers=(plural) instead ofcontext_provider=(singular) when cloning agents. Added comprehensive test to prevent regression. Fixed linter error and formatting issues.Security Summary
No security vulnerabilities were introduced or discovered during this change. The codeql_checker found 0 alerts.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.