mirror of
https://github.com/block/buzz.git
synced 2026-11-08 02:11:36 +00:00
fix(agent): backfill tool name on Responses API event ordering race
output_item.added may arrive after function_call_arguments.delta when the Responses API reorders events. The delta handler creates the HashMap entry with an empty name, and the previous or_insert_with no-oped on existing entries. Use and_modify to backfill the name regardless of insertion order. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
parent
d22ba793a6
commit
52e1013b17
@@ -732,6 +732,11 @@ impl Llm {
|
||||
if !call_id.is_empty() {
|
||||
tool_calls_map
|
||||
.entry(call_id)
|
||||
.and_modify(|e| {
|
||||
if e.0.is_empty() {
|
||||
e.0 = name.clone();
|
||||
}
|
||||
})
|
||||
.or_insert_with(|| (name, String::new()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user