chore(plan): planner 心跳默认/下限 300s(5min) → 600s(10min)
This commit is contained in:
1 parent
06e714598d
commit
c85b2397e8
4 files changed
+13
-41
No files matched your search
+4
-28
@@ -1017,7 +1017,7 @@ type createTaskReq struct {
|
||||
Goal string `json:"goal"`
|
||||
LLMProfileID *int64 `json:"llm_profile_id,omitempty"` // 指定运行本任务的 LLM 配置;省略/null=用激活配置
|
||||
TimeoutSeconds int `json:"timeout_seconds"` // 任务级超时(秒);0/省略=不限时
|
||||
PlanHeartbeatSeconds int `json:"plan_heartbeat_seconds"` // planner 心跳触发间隔(秒);0/省略=默认300(5min);下限=默认=300,低于自动抬到300
|
||||
PlanHeartbeatSeconds int `json:"plan_heartbeat_seconds"` // planner 心跳触发间隔(秒);0/省略=默认600(10min);下限=默认=600,低于自动抬到600
|
||||
SeedFirstIntent *bool `json:"seed_first_intent,omitempty"` // 创建时直接下发一条种子意图(内容=描述+目标),让 worker 免等首轮 planner 直接开跑;省略/null=默认开启。CTF 常一 work 解决,省掉开跑前的 planner 轮。
|
||||
}
|
||||
|
||||
@@ -1047,34 +1047,10 @@ func (s *Server) createTask(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
log.Printf("[task] 新建任务 #%s «%s» 目标: %s", t.ID, req.Description, req.Goal)
|
||||
// seed initial asset(s) from goal/description so the event-driven loop has a root.
|
||||
s.seed(t, req.Description+" "+req.Goal)
|
||||
// 种子意图(默认开启):直接把"描述+目标"作为一条待办意图写入 frontier,worker 轮询即可
|
||||
// 领取开跑,省掉开跑前的首轮 planner LLM;跑完由 NotifyDone 正常唤醒 planner 判定/补充。
|
||||
// CTF 场景常一个 work 就解决。仅显式传 false 才关闭。
|
||||
if req.SeedFirstIntent == nil || *req.SeedFirstIntent {
|
||||
s.seedFirstIntent(t)
|
||||
}
|
||||
// Return immediately — goal decomposition is async so the UI isn't blocked.
|
||||
// 共享的建后流程(seed + 种子意图 + 后台目标分解 + engine.Run),与 spawn_task 复用同一段。
|
||||
// launchTask 内部异步,不阻塞 UI —— 目标分解在后台可见地进行。
|
||||
s.launchTask(t, req.Description+" "+req.Goal, req.SeedFirstIntent == nil || *req.SeedFirstIntent)
|
||||
writeJSON(w, 201, t)
|
||||
// Background: emit round-0 marker, decompose goals via LLM, then start engine.
|
||||
// Engine starts only after goals are seeded to avoid a race where the planner
|
||||
// fires before any goal nodes exist.
|
||||
go func() {
|
||||
s.engine.emitActivity(t, db.Activity{Worker: "planner", Kind: "round",
|
||||
Summary: "第 0 轮目标拆解"})
|
||||
goals := s.createGoals(s.ctx, t, func(r db.Activity) {
|
||||
s.engine.emitActivity(t, r)
|
||||
})
|
||||
for _, g := range goals {
|
||||
summary := g.Text
|
||||
if g.VulnClass != "" {
|
||||
summary = fmt.Sprintf("[%s] %s", g.VulnClass, g.Text)
|
||||
}
|
||||
s.engine.emitActivity(t, db.Activity{Worker: "planner", Kind: "text", Summary: summary})
|
||||
}
|
||||
s.engine.Run(s.ctx, t)
|
||||
}()
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
Reference in new issue
Block a user