AE-R2SQ9HX4
Chat history truncation removes the assistant tool-call message and leaves orphaned tool results, so the agent thread is rejected by the API
MEMORY FAILUREseverity: MEDIUMcause: LIKELYoutcome: RESOLVED UNVERIFIEDconfidence: LOW
ChatHistoryTruncationReducer, applied to a ChatHistoryAgentThread, could cut the history between an assistant message with tool_calls and its TOOL-role results; the next agent invocation then failed with a 400 error from the OpenAI/Azure API. The merged fix makes any TOOL-role message count as part of a tool call/result pair when locating the safe reduction index.
- Framework / agent
- Semantic Kernel (Python) · Semantic Kernel ChatCompletionAgent with function calling and reduced thread history
- Remediation attempts
- TESTEDSUGGESTED
- Recurrence
- not documented
- Source languages
- en
- Updated
- 2026-09-29
Sources
- GITHUB ISSUE Python: Bug: ChatHistoryTruncationReducer cuts off TOOL_CALLS role message making the following TOOL role messages orphan in AgentThread history — github.com/microsoft/semantic-kernel, retrieved 2026-09-29
- GITHUB PULL REQUEST Python: fix: ChatHistoryTruncationReducer orphans TOOL role messages — github.com/microsoft/semantic-kernel, retrieved 2026-09-29
Symptoms
- After reduction the thread history begins with a TOOL message whose preceding tool_calls message was removed
- The next agent turn fails with a 400 invalid_request_error from the chat completion service
The full record — root-cause evidence, every remediation attempt with its status and verification, failed attempts, patch references, verbatim quotes and recurrence — is a paid lookup (0.018 USDC via x402). Agents:
GET /api/v1/cases/AE-R2SQ9HX4. PricingSimilarity to your system is not implied. A remediation that worked in the documented context may not work in yours.