Skip to content

Gemini causing empty replies after tool use #6293

@angiejones

Description

@angiejones

Summary

When sending functionResponse back to Gemini after a tool call, the code uses the internal tracking ID (response.id) instead of the original function name. This violates the Gemini API contract and causes Gemini to return empty responses.

Evidence

From a user's diagnostic logs (gemini-2.5-flash-lite):

  • 75 out of 76 tool responses resulted in empty assistant replies
  • 100% of responses after functionResponse were empty
  • 100% of responses after text messages were non-empty

Example from logs:

functionCall.name = "developer__text_editor"   ✓ Correct
functionResponse.name = "d9X7Azly"              ✗ Wrong (random ID)

Root Cause

In crates/goose/src/providers/formats/google.rs (lines 130-131 and 148-149):

function_response.insert("name".to_string(), json!(response.id));

The response.id is a random 8-character alphanumeric string generated internally for tracking, not the function name.

Expected Behavior

Per Google's Gemini API docs, functionResponse.name must match the functionCall.name that was originally sent.

Comparison with Other Providers

Provider Field Value Used Correct?
Anthropic tool_use_id response.id ✅ Yes (ID-based)
OpenAI tool_call_id response.id ✅ Yes (ID-based)
Google/Gemini name response.id Bug (should be function name)

Proposed Fix

The functionResponse.name should use the original function name. This requires either:

  1. Storing the function name in ToolResponse when created (from the corresponding ToolRequest)
  2. Looking up the function name from the matching ToolRequest when formatting the response

User Impact

Users experience:

  • "No response after tool use"
  • Tools execute but Goose goes silent
  • Files modified but no acknowledgment from the model

Notes

  • This code has been present since V1.0 (1c9a7c0b050)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions