fix(server): 删掉 seed() 的 t.Notify()——种子任务误触发首轮 planner 的真凶

上一修复(HasActiveIntent)只堵了 Run 里的首轮 Notify,但 s.seed() 在建任务时(早于
Run)也调 t.Notify(),它 buffered 进 notify 通道存着,plannerLoop 一启动就消费掉→跑首轮,
完全绕过 Run 的门控。所以种子任务部署后仍会「目标拆解后立马 edge 触发」。

改法:删掉 seed() 全部三处 t.Notify()(正常路径 + 两个早退)。首轮是否触发统一收敛到
engine.Run 的 HasActiveIntent 一个决策点:种子意图(open/running)存在则跳过首轮。
已确认 createGoals/seedFirstIntent 均不 Notify、不建带 notify 的 ToolSet,路径无其它 buffered 源。
This commit is contained in:
Autumn-27 committed 2026-08-12 11:41:43 -04:00
1 parent 4835cb57bd
commit 8e31a75263
1 file changed
+3 -3
+3 -3
View File
@@ -1148,13 +1148,11 @@ func (s *Server) seed(t *Task, text string) {
scheme, host, port, ok := parseTarget(text)
if !ok {
log.Printf("[seed] task %s: 未能从 %q 解析出目标 host/IP,不创建站点(请手动配置 scope)", t.ID, text)
t.Notify()
return
}
// P0-1 guard: never treat the configured LLM gateway as a target.
if gw := s.llmHost(); gw != "" && host == gw {
log.Printf("[seed] task %s: 目标 %q 是 LLM 网关,拒绝作为渗透目标", t.ID, host)
t.Notify()
return
}
@@ -1180,7 +1178,9 @@ func (s *Server) seed(t *Task, text string) {
}
}
log.Printf("[seed] task %s: 目标站点 %s", t.ID, u)
t.Notify()
// 不在这里 Notify:首轮是否触发统一由 engine.Run 的 HasActiveIntent 决定(种子意图任务
// 跳过首轮)。seed 早于 Run 执行,若在此 Notify 会 buffered 到通道、被 plannerLoop 启动时
// 消费掉而绕过 Run 的门控 → 种子任务仍误触发首轮。
}
// seedFirstIntent writes ONE open intent (summary = 描述+目标) into the task's