gateway: a nameless tool call still passes through relayed replies and Gemini relays (#7565 sibling)
Left alone by the #7565 fix (k0ngk0ng). A tool call that names no function is now dropped from every translated reply and from every request history magpie builds or relays on Messages, Responses and Chat, with the results answering it. These routes still pass one through as it came:
- A relayed reply's call. Responses to a Responses client and Messages to a Messages client are relayed byte for byte. A vendor's
function_callortool_usewith"name":""reaches the agent. The request side then drops it from the next turn, so the session no longer dies, but the agent still sees a call it can't run. Only the Chat relay drops one in the reply (chatTidy, #1475). - Gemini relays. A Gemini client's body relayed to a Gemini upstream, and a Gemini reply relayed back, aren't checked for a
functionCallwith no name. - A relayed call with no
namemember at all.namelessBlocksOut,namelessItemsOutandnamelessChatCallsOutdecode only a body that holds"name":""or"name":null(emptyName), the cheap gate on every relayed request. Every client seen writes the member it was given, so no case of this is known.
The rule to carry over is in internal/gateway/nameless_calls.go. The second case may never happen. The first needs a stream filter on the relayed Responses and Messages events, which these relays don't decode today.
I have a proposed fix: https://github.com/yetone/magpie/compare/main...joei4cm:magpie:fix/7728-relayed-nameless-calls
It removes nameless calls from relayed Responses, Messages and Gemini replies, including stream fragments and final output, and removes nameless Gemini request parts. It also corrects empty first names in Chat relays. Retained stream items are renumbered over removed calls.
go test ./internal/gateway -run 'Nameless|ChatTidy' -count=1 and go vet ./internal/gateway passed. A previous whole-package run failed, but its retained log does not identify the failing test; the full suite and real vendor use were not run locally.
Tested local maintenance integration in L0NE-6/magpie-panel 182aae5: relayed Responses, Messages and Gemini replies now drop calls that name no function, including streamed fragments and final output, and renumber retained items; nameless Gemini request parts are removed too. Nameless/ChatTidy tests, 5 race iterations and vet pass. Real vendor streams were not available. This is a panel integration, not an upstream merge.