fix(llm): strip inline <think> reasoning from Dahl/MiniMax streams; dedupe identical parallel tool calls; hermetic config tests

This commit is contained in:
OpenClaw Dev 2026-10-25 06:51:20 +01:00
parent 46d98502dd
commit 546a9315d5
6 changed files with 264 additions and 5 deletions

View file

@ -178,11 +178,20 @@ func (a *Agent) Run(parent context.Context, sessionID, userText string, emit fun
if len(resp.ToolCalls) == 0 {
return resp.Content, nil
}
// Some models (seen with GLM/DeepSeek on Dahl) emit the same call several times in
// parallel; identical name+arguments run once and share the result.
seen := map[string]string{}
for _, tc := range resp.ToolCalls {
emit(Event{Type: "tool_call", Tool: tc.Name, Args: tc.Arguments, CallID: tc.ID})
out := "error: cancelled by user"
if !cancelled() {
key := tc.Name + "\x00" + tc.Arguments
out, dup := seen[key]
switch {
case dup:
case cancelled():
out = "error: cancelled by user"
default:
out = a.Tools.Call(ctx, tc.Name, tc.Arguments)
seen[key] = out
}
emit(Event{Type: "tool_result", Tool: tc.Name, Text: clip(out, 2000), CallID: tc.ID})
// Every tool call gets a result so the history stays valid for the provider.