fix(backthink): 主动推送降频(15min心跳+60min≤1次+推后30min冷却+刚聊过10min冷避) + 情绪约束(分类限频/活跃感知) + 剥离'我决定:push'内部标记
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

This commit is contained in:
Aska committed 2026-09-08 13:08:57 +08:00
1 parent 03d7050e1e
commit 12031bd13c
14 files changed
+662 -149

No files matched your search

@@ -33,6 +33,35 @@ func TestNew_Validation(t *testing.T) {
}
}
// TestConfig_Defaults verifies the tightened proactive-push defaults: a 15-minute
// heartbeat, at most 1 push per 60 minutes, a 30-minute post-push cooldown, a
// 10-minute recent-conversation cooldown, and a 2-hour per-flavor window.
func TestConfig_Defaults(t *testing.T) {
t.Parallel()
cfg := normalize(Config{})
if cfg.IntervalSec != 900 {
t.Fatalf("IntervalSec = %d, want 900", cfg.IntervalSec)
}
if cfg.Interval != 900*time.Second {
t.Fatalf("Interval = %v, want 900s", cfg.Interval)
}
if cfg.PushLimit != 1 {
t.Fatalf("PushLimit = %d, want 1", cfg.PushLimit)
}
if cfg.PushWindow != 60*time.Minute {
t.Fatalf("PushWindow = %v, want 60m", cfg.PushWindow)
}
if cfg.PushCooldown != 30*time.Minute {
t.Fatalf("PushCooldown = %v, want 30m", cfg.PushCooldown)
}
if cfg.RecentChatCooldown != 10*time.Minute {
t.Fatalf("RecentChatCooldown = %v, want 10m", cfg.RecentChatCooldown)
}
if cfg.KindWindow != 2*time.Hour {
t.Fatalf("KindWindow = %v, want 2h", cfg.KindWindow)
}
}
func TestBackthink_Heartbeat_TriggersThink(t *testing.T) {
t.Parallel()
thinker := &mockThinker{text: "nothing to report"}