Skip to content

Python: [Bug]: Orphaned mcp_call items cause HTTP 400 in multi-turn reasoning model flows #6883

Closed

Description

@csajmishra

Description

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.

Activity

  1. added theissue type on Jul 2, 2026
  2. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Jul 2, 2026
  3. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Jul 2, 2026
  4. github-actions commented on Jul 2, 2026

    @github-actions
    Contributor

    🤖 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.

    • Failing test: python/packages/core/tests/core/test_orphaned_mcp_call_issue_6883.py
    • Files examined: python/packages/core/agent_framework/_compaction.py, python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py, python/packages/core/agent_framework/_types.py, python/packages/foundry_hosting/tests/test_responses.py, python/packages/core/tests/core/test_compaction.py
    • Tests run: python/packages/core/tests/core/test_orphaned_mcp_call_issue_6883.py
    • Reported version: 1.8.0
    • Current version: 1.10.0
  5. deleted a comment from on Jul 7, 2026
  6. added
    mcpUsage: [Issues, PRs], Target: MCP
    and removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

mcpUsage: [Issues, PRs], Target: MCPpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions