Files
Agent-System-Backend/internal/runtime/planless_nudge_test.go
T
weichen f1302ed5b3 Enable canonical versioned Go module consumption
Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements.

Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate.

Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable.

Refs: Versioned dependencies U1/U3; feature/dependency-workspace
2026-10-13 15:47:16 +00:00

43 lines
1.2 KiB
Go

package runtime
import (
"context"
"strings"
"testing"
core "git-ssh.u1680832.nyat.app/weichen/Agent-System-Core.git"
)
// P4:计划提醒常开——没有任何计划/待办而任务变长时,给一次可忽略的轻提醒;
// 已有计划但停滞的旧提醒行为不变。
func TestPlanlessNudgeFiresOnce(t *testing.T) {
rc := &fakeRunCtx{
ctx: context.Background(),
prof: core.AgentProfile{Model: core.ModelRoute{Chat: "test-model"}},
}
quiet := textDeltaTurn("", toolCall("make_report", "{}"))
turns := [][]interface{}{}
_ = turns
st := &directRun{l: &LLMRunner{}, rc: rc, eff: core.EffectiveSettings{}}
var seen []string
emitReminder := func(turn int) []string {
// 模拟连续工具轮推进。
st.closedToolTurn = true
st.toolTurnsSince++
return st.reminders(turn)
}
for i := 0; i < 3; i++ {
seen = append(seen, emitReminder(i)...)
}
if len(seen) != 1 || !strings.Contains(seen[0], "update_plan") {
t.Fatalf("planless nudge should fire exactly once, got %v", seen)
}
for i := 0; i < 6; i++ {
seen = append(seen, emitReminder(i)...)
}
if len(seen) != 1 {
t.Fatalf("planless nudge must not repeat, got %v", seen)
}
_ = quiet
}