mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
963f753f53
after_model strips intercepted frontend tool_calls from the AIMessage but leaves the equivalent responses/v1 function_call content blocks in message.content. When a run is cancelled mid-turn the partial turn persists without a ToolMessage, and on replay langchain-openai serializes the orphaned block into the Responses API input with no matching function_call_output, so OpenAI rejects every subsequent turn with 400 "No tool output found for function call call_...". Extend the checkpoint message sanitizer to treat function_call blocks like the existing Anthropic tool_use handling: strip blocks whose call_id is missing from msg.tool_calls, strip all of them when tool_calls is empty, and strip the ones belonging to unanswered tool_calls. Fixes #6676