Merge pull request #3112 from chengzhichao-xydt/codex/toolloop-marshal-error-check

fix(tools): handle json.Marshal error in toolloop tool call arguments
This commit is contained in:
Mauro
2026-06-12 13:16:33 +02:00
committed by GitHub
+5 -1
View File
@@ -132,7 +132,11 @@ func RunToolLoop(
Content: response.Content,
}
for _, tc := range normalizedToolCalls {
argumentsJSON, _ := json.Marshal(tc.Arguments)
argumentsJSON, err := json.Marshal(tc.Arguments)
if err != nil {
logger.Warnf("toolloop: failed to marshal tool call arguments for %s: %v", tc.Name, err)
argumentsJSON = []byte("{}")
}
assistantMsg.ToolCalls = append(assistantMsg.ToolCalls, providers.ToolCall{
ID: tc.ID,
Type: "function",