From a43a9deaea5f74703258147484e187aae76708cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AC=E6=98=8E?= <83812544+Ed1s0nZ@users.noreply.github.com> Date: Sat, 23 May 2026 19:33:23 +0800 Subject: [PATCH] Add files via upload --- internal/multiagent/runner.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/multiagent/runner.go b/internal/multiagent/runner.go index 2f5cc10a..9c98f966 100644 --- a/internal/multiagent/runner.go +++ b/internal/multiagent/runner.go @@ -597,6 +597,13 @@ func chatToolCallsToSchema(tcs []agent.ToolCall) []schema.ToolCall { argsStr = string(b) } } + // Some OpenAI-compatible gateways require `function.arguments` to exist + // on every assistant tool_call message. When args are empty, omitempty may + // drop the field during serialization and cause "missing field arguments" + // on the next turn history replay. + if strings.TrimSpace(argsStr) == "" { + argsStr = "{}" + } typ := tc.Type if typ == "" { typ = "function"