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]: Orphaned mcp_call items cause HTTP 400 in multi-turn reasoning model flows #6883
Problem highlighted in below issue has not been resolved for customer. #6074
Code Sample
Attached the code sample used by client.
[run_maf_workflow.txt](https://github.com/user-attachments/files/29597439/run_maf_workflow.txt)[run_workflow.txt](https://github.com/user-attachments/files/29597438/run_workflow.txt)
Error Messages / Stack Traces
HTTP 400 — Item 'mcp_<id>' of type 'mcp_call' was provided without its
required 'reasoning' item: 'rs_<id>'.
Package Versions
agent-framework==1.8.0
Python Version
3.13
Additional Context
Issue is INTERMITTENT — does not fire on every run. We need to try 5-6 times to reproduce.
🤖 Automated triage reproduction notes(agent-authored — trust but verify)
Agent analysis
Repro: SlidingWindowStrategy in packages/core/agent_framework/_compaction.py orphans mcp_call from reasoning because (1) _output_item_to_message in packages/foundry_hosting/.../_responses.py:1381-1386 converts reasoning OutputItems via Content.from_text() instead of Content.from_text_reasoning(), and (2) _is_tool_call_assistant at _compaction.py:78 only checks for "function_call" not "mcp_server_tool_call". Minimal repro: annotate_message_groups on [system, assistant(text="Reasoning"), assistant(mcp_server_tool_call), tool(result), assistant(text), user] then apply SlidingWindowStrategy(keep_last_groups=4) — reasoning is removed while mcp_call remains.
Activity
github-actions commentedon Jul 2, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro: SlidingWindowStrategy in packages/core/agent_framework/_compaction.py orphans mcp_call from reasoning because (1) _output_item_to_message in packages/foundry_hosting/.../_responses.py:1381-1386 converts reasoning OutputItems via Content.from_text() instead of Content.from_text_reasoning(), and (2) _is_tool_call_assistant at _compaction.py:78 only checks for "function_call" not "mcp_server_tool_call". Minimal repro: annotate_message_groups on [system, assistant(text="Reasoning"), assistant(mcp_server_tool_call), tool(result), assistant(text), user] then apply SlidingWindowStrategy(keep_last_groups=4) — reasoning is removed while mcp_call remains.
python/packages/core/tests/core/test_orphaned_mcp_call_issue_6883.py1.8.01.10.0