Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Runtime/class-wp-agent-conversation-loop.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,19 @@ private static function mediate_tool_calls(
'parameters' => $parameters,
) );

// Add tool-call message to transcript.
// Add tool-call message to transcript. The structured info
// (tool_name + parameters) lives in metadata; `content` is
// intentionally empty so adapters that flatten the transcript
// to provider text don't end up echoing the human-readable
// "Calling X" debug string back to the model. When the model
// sees "Calling foo" as a previous assistant text turn, it
// pattern-matches and starts emitting that literal string as
// text instead of issuing real function-calls — a sneaky
// failure mode on long multi-tool conversations (Gemini Flash
// in particular). Adapters that want a user-facing label can
// derive it from `metadata.tool_name`.
$messages[] = WP_Agent_Message::toolCall(
'Calling ' . $tool_name,
'',
$tool_name,
is_array( $parameters ) ? $parameters : array(),
$turn,
Expand Down
Loading