mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-25 14:53:34 +00:00
fix: propagate real tool_call_id instead of hardcoded placeholder (#73)
The worker (both agent/worker.rs and worker/runtime.rs) was passing the literal string "tool_call_id" to ChatMessage::tool_result instead of the actual tool call ID from the LLM response. This breaks OpenAI-compatible providers that match tool results to their corresponding calls by ID. - Add tool_call_id field to ToolSelection struct - Propagate ToolCall.id through select_tools() into ToolSelection - Replace all hardcoded "tool_call_id" usages with selection.tool_call_id - Generate unique IDs for plan-based synthetic selections - Add test verifying tool_call_id is preserved Co-authored-by: Yi LIU <[email protected]> Co-authored-by: Illia Polosukhin <[email protected]>
This commit is contained in:
co-authored by
Yi LIU
Illia Polosukhin
parent
225af29db2
commit
eaef335db6
@@ -313,6 +313,7 @@ Work independently to complete this job. Report when done."#,
|
||||
parameters: tc.arguments.clone(),
|
||||
reasoning: String::new(),
|
||||
alternatives: vec![],
|
||||
tool_call_id: tc.id.clone(),
|
||||
};
|
||||
self.process_result(reason_ctx, &selection, result);
|
||||
}
|
||||
@@ -422,7 +423,7 @@ Work independently to complete this job. Report when done."#,
|
||||
);
|
||||
|
||||
reason_ctx.messages.push(ChatMessage::tool_result(
|
||||
"tool_call_id",
|
||||
&selection.tool_call_id,
|
||||
&selection.tool_name,
|
||||
wrapped,
|
||||
));
|
||||
@@ -436,7 +437,7 @@ Work independently to complete this job. Report when done."#,
|
||||
Err(e) => {
|
||||
tracing::warn!("Tool {} failed: {}", selection.tool_name, e);
|
||||
reason_ctx.messages.push(ChatMessage::tool_result(
|
||||
"tool_call_id",
|
||||
&selection.tool_call_id,
|
||||
&selection.tool_name,
|
||||
format!("Error: {}", e),
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user