feat(task): 创建任务可选下发种子意图,worker 免等首轮规划直接开跑

新增 seed_first_intent(默认开启):创建即把"描述+目标"作为一条意图
写入 frontier,worker 轮询领取立即执行,省掉开跑前的首轮 planner LLM;
跑完由 NotifyDone 正常唤醒 planner 判定/补充。CTF 场景常一 work 解决。

- Engine.Run 首轮 kick 改为"frontier 为空才触发",一处覆盖普通/种子/恢复三种情况
- HTTP createTask 与 spawn_task 工具同步支持;bump 工具 schema 刷新 flag 使旧库生效

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Autumn-27andClaude Opus 4.8 committed 2026-08-09 02:19:40 -04:00
1 parent 4cf622593a
commit f86885ec3d
5 files changed
+73 -19

No files matched your search

+8 -3
View File
@@ -9,11 +9,11 @@ import (
"sync"
"time"
"github.com/Autumn-27/norma/harness"
"github.com/Autumn-27/norma/llm"
"github.com/Autumn-27/artex/agent"
"github.com/Autumn-27/artex/db"
"github.com/Autumn-27/artex/intercept"
"github.com/Autumn-27/norma/harness"
"github.com/Autumn-27/norma/llm"
)
// model_error(provider/API 故障:LLM 层瞬时重试耗尽,或流已开始后中途断流)
@@ -367,7 +367,12 @@ func (e *Engine) Run(ctx context.Context, t *Task) {
go e.workerLoop(ctx, t, fmt.Sprintf("work#%d", i+1))
}
e.startDeadlineCoordinator(ctx, t) // 任务级超时定时器(仅 timeout>0;去重)
t.Notify() // kick the first planning round (acted on once LLM is ready)
// 仅在 frontier 为空时才 kick 首轮规划:普通任务(空 frontier)照常触发;带种子意图的
// 任务 frontier 已非空 → 跳过首轮 planner,worker 直接领种子意图开跑,跑完由 NotifyDone
// 唤醒 planner。重启自动恢复时 frontier 通常也非空 → 顺带避免白烧一轮。
if fr, _ := t.Store.Frontier(1); len(fr) == 0 {
t.Notify() // kick the first planning round (acted on once LLM is ready)
}
}
func (e *Engine) plannerLoop(ctx context.Context, t *Task) {