A Chat tool message's input_audio part was dropped: toolOutput read a
tool result's text and images only, so after 22f8db6c9 carried a user's
audio, a tool's audio still never reached a Gemini model (Parlevent_ on
X, who found the cause). toolOutput now reads input_audio, from any
inbound API's tool result (Chat's tool message; a Responses
function_call_output that holds one), into the ToolResult's new Audio
parts, with audioType's MIME type.
- Gemini (Gemini API, Vertex AI, Code Assist, Antigravity's Gemini
models): each recording follows the functionResponse as inlineData, as
the tool's images do, and moves to the user turn after it on Vertex AI
as they do.
- Every other upstream (Chat, Responses, Messages, the Claude bridge,
Antigravity's Claude models): the result's text ends with
"[attachment audio/wav]", as a user's audio is told of; the bytes are
never sent as an image, which those APIs would turn away with a 400.
- Anthropic's tool_result has no audio block, so nothing changes for it.
- tool_loop's resultSum counts the recordings, so two results that
differ only in their audio aren't taken as a repeat.
Not changed: a file a tool returns (an Anthropic document block, a
Responses input_file) is still dropped from its result: #6703.
Run (mica, mica-run; mote's load was over its cores):
- TestChatToolAudioReachesGemini, TestToolAudioToldElsewhere: green.
Broken by hand: with toolOutput's input_audio case off, both red;
with the Gemini emitter's audio loop off, TestChatToolAudioReachesGemini
red (no inlineData after the functionResponse).
- go test ./internal/gateway -count=1 -timeout 45m: ok (862s), at base 9afec644c
- rebased on ec97a4d7b (4 commits, none in internal/gateway): go vet
./internal/gateway and its Audio|ToolResult|Gemini tests: ok
- go vet ./internal/gateway on darwin, GOOS=linux and GOOS=windows: ok
- gofmt -l: clean
Not tried: a real Gemini or Vertex AI request with a tool's audio.