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
Python: [Bug]: HandoffBuilder drops agent-level compaction_strategy when cloning participants #8320
Summary:
HandoffAgentExecutor._clone_chat_agent() rebuilds each
participant agent to inject handoff tools and middleware, but
does not forward the agent’s compaction_strategy. Because these are stored outside default_options,
the cloned executor agent gets None for both and silently
falls back to client defaults/no compaction.
Expected:
A participant’s supported agent-level compaction
configuration remains effective when that participant is used
through HandoffBuilder.
Actual:
The original Agent.compaction_strategy are discarded during cloning.
Root cause / proposed fix:
Forward both fields in the Agent(...) call within
_clone_chat_agent, and add a clone-retention regression test.
changed the title [-]Python: [Bug]: HandoffBuilder drops agent-level compaction_strategy and tokenizer when cloning participants[/-][+]Python: [Bug]: HandoffBuilder drops agent-level compaction_strategy when cloning participants[/+]on Sep 11, 2026
🤖 Automated triage reproduction notes(agent-authored — trust but verify)
Agent analysis
The bug occurs in python/packages/orchestrations/agent_framework_orchestrations/_handoff.py::HandoffAgentExecutor._clone_chat_agent at lines 294-304, where participant reconstruction omits compaction_strategy and tokenizer. It is triggered whenever a HandoffBuilder participant has either agent-level setting configured. Minimal repro: construct such an Agent, build a handoff workflow, retrieve its executor agent, and observe both cloned attributes are None.
One thing worth confirming, Melissa Zulle (@melzeta): the report says the clone "gets None for both" and asks to
"forward both fields", but only names compaction_strategy. The second one is tokenizer —
it also lives outside default_options and is dropped the same way:
The PR forwards both, by reference rather than deep-copied — matching context_providers and middleware on the neighbouring lines, since both hold immutable configuration the clone never
mutates and a tokenizer can carry a vocabulary that is costly to copy.
It also adds a guard test, because this is at least the fourth field to go missing here: the three test_handoff_clone_preserves_* tests already in the suite were each written after a drop was found.
The guard reads the keyword names off the Agent(...) call and fails if any Agent.__init__
parameter is neither forwarded nor explicitly excused, so the next one fails in CI rather than in
someone's workflow.
Happy to drop the guard if maintainers would rather not carry it — the two-line fix stands on its own.
Activity
[-]Python: [Bug]: HandoffBuilder drops agent-level compaction_strategy and tokenizer when cloning participants[/-][+]Python: [Bug]: HandoffBuilder drops agent-level compaction_strategy when cloning participants[/+]github-actions commentedon Sep 11, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
The bug occurs in
python/packages/orchestrations/agent_framework_orchestrations/_handoff.py::HandoffAgentExecutor._clone_chat_agentat lines 294-304, where participant reconstruction omitscompaction_strategyandtokenizer. It is triggered whenever aHandoffBuilderparticipant has either agent-level setting configured. Minimal repro: construct such anAgent, build a handoff workflow, retrieve its executor agent, and observe both cloned attributes areNone.python/packages/orchestrations/tests/test_handoff.py::test_handoff_clone_preserves_compaction_strategy_and_tokenizeragent-framework-orchestrations 1.1.1 (agent-framework-core 1.18.0)agent-framework-orchestrations 1.1.1manjunathshiva commentedon Sep 12, 2026
Opened #8329 for this.
One thing worth confirming, Melissa Zulle (@melzeta): the report says the clone "gets
Nonefor both" and asks to"forward both fields", but only names
compaction_strategy. The second one istokenizer—it also lives outside
default_optionsand is dropped the same way:The PR forwards both, by reference rather than deep-copied — matching
context_providersandmiddlewareon the neighbouring lines, since both hold immutable configuration the clone nevermutates and a tokenizer can carry a vocabulary that is costly to copy.
It also adds a guard test, because this is at least the fourth field to go missing here: the three
test_handoff_clone_preserves_*tests already in the suite were each written after a drop was found.The guard reads the keyword names off the
Agent(...)call and fails if anyAgent.__init__parameter is neither forwarded nor explicitly excused, so the next one fails in CI rather than in
someone's workflow.
Happy to drop the guard if maintainers would rather not carry it — the two-line fix stands on its own.