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

@ -206,3 +206,29 @@ func TestSummarizeNowManual(t *testing.T) {
t.Fatalf("%v %v", sm, err)
}
}
func TestDuplicateToolCallsRunOnce(t *testing.T) {
st := newStore(t)
ss, _ := st.CreateSession(context.Background(), "")
n := 0
now := func() time.Time { n++; return time.Date(2026, 10, 25, 6, 0, 0, 0, time.UTC) }
dup := []llm.ToolCall{{ID: "a", Name: "time_now", Arguments: `{"timezone":"UTC"}`}, {ID: "b", Name: "time_now", Arguments: `{"timezone":"UTC"}`}, {ID: "c", Name: "time_now", Arguments: `{}`}}
p := &scripted{resps: []llm.Response{{ToolCalls: dup}, {Content: "ok"}}}
a := &Agent{LLM: p, Store: st, Tools: tools.NewRegistry(tools.TimeNow{Now: now}), MaxIterations: 3}
if _, err := a.Run(context.Background(), ss.ID, "zeit?", nil); err != nil {
t.Fatal(err)
}
if n != 2 {
t.Fatalf("tool executed %d times, want 2", n)
}
msgs, _ := st.Messages(context.Background(), ss.ID, 0)
tools := 0
for _, m := range msgs {
if m.Role == llm.RoleTool {
tools++
}
}
if tools != 3 {
t.Fatalf("every call id needs a result, got %d", tools)
}
}