Skip to content

Commit ab1b377

Browse files
ericdalloeca-agent
andcommitted
Fix duplicate on-prepare-tool-call with Copilot encrypted IDs
The when-not guard in response.completed checked by item-id key, but Copilot returns different encrypted item IDs in streaming vs output. Check by call_id value instead, which is consistent across both, preventing duplicate prepare calls and stale atom entries. 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <git@eca.dev>
1 parent 99993f4 commit ab1b377

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/eca/llm_providers/openai.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
(let [response (:response data)
251251
tool-calls (or (seq (keep (fn [{:keys [id call_id name arguments] :as output}]
252252
(when (= "function_call" (:type output))
253-
(when-not (get @tool-call-by-item-id* id)
253+
(when-not (some #(= call_id (:id %)) (vals @tool-call-by-item-id*))
254254
(swap! tool-call-by-item-id* assoc id {:full-name name :id call_id})
255255
(on-prepare-tool-call {:id call_id
256256
:full-name name

0 commit comments

Comments
 (0)