mirror of
https://gh-proxy.org/https://github.com/klinsmaya/CLIProxyAPI.git
synced 2026-11-09 01:46:48 +08:00
The input item ID dedupe added in #3620 keeps only the last occurrence of each item id. When an upstream reuses the same item id across a re-sent or repaired tool call (so two function_call items share an id but carry different call_ids), the last-wins rule can drop the function_call whose call_id still has a matching function_call_output. The upstream then rejects the request with HTTP 400 "No tool call found for function call output with call_id ...", breaking every subsequent turn over the Codex WebSocket path. Make the dedupe orphan-aware: when several input items share an id, never replace an item whose call_id is still referenced by a tool-call output with one that is not. This keeps a single item per id (preserving the original intent) while ensuring retained tool calls stay paired with their outputs. Adds a regression test covering two function_call items that share an id where only the earlier call_id has a surviving output.