mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
Claude requires tool_result in the IMMEDIATELY next message after tool_use. Existing fixToolPairs() checks global ID presence but not adjacency — keeping tool_use blocks whose tool_result exists later in the array but not in the next message, causing 400 errors. Add fixToolAdjacency() that runs after fixToolPairs() to remove tool_use blocks where the next message has no matching tool_result. Pipeline: fixToolPairs → fixToolAdjacency → stripTrailingAssistantOrphanToolUse Closes #2382 Co-Authored-By: OpenClaude (mimo-v2.5-pro) <openclaude@gitlawb.com>