feat(agent): 墙钟超时改为就地收尾,移除外部硬 ctx 兜底
依赖 norma v0.3.6:MaxDuration 到点会打断在跑工具并就地进收尾(在活 ctx 上按收尾轮数续跑落库+总结,终态 timeout),不再依赖 worker/planner 各自 的 maxDur+90s 外部硬 ctx 把卡住的 run 直接杀成 aborted_tools。 - worker/planner: 删除 WithTimeoutCause 硬 ctx 与 settleHardGrace 常量, run 直接用 ctx(仅承载 pause/kill/shutdown)。 - chat 走同一 harness 自动获得同样行为;mainagent 无 MaxDuration 不受影响。 - terminalreason: 更新 ReasonTimeout 文案。
This commit is contained in:
1 parent
aa12706ed1
commit
64b08f518f
5 files changed
+12
-30
No files matched your search
+3
-8
@@ -431,14 +431,9 @@ func (p *Planner) Plan(ctx context.Context, taskID int64, as *db.AssetStore, ts
|
||||
}
|
||||
input := lead + situational + "\n\n据上面的态势,判定目标。目标已【真正达成】(已拿到目标成果/已确认目标漏洞)时用 prove_goal 逐个标记。**硬底线:只要目标尚未达成、且当前没有任何 open 或 running 意图(frontier_open=0 且 running_intents 为空),本轮就必须产出至少一个向目标推进的意图——此时没有在跑的 work 可等、也没有在排队的方向,产出 0 意图=任务停摆。仅当已有 open/running 意图在推进、或目标已达成时,本轮才可以不产出新意图。**" +
|
||||
renderPlannerTodos(opts.Todos.List())
|
||||
// 有 deadline 夹逼时加硬 ctx 兜底(软预算 + grace),防单轮卡死绕过轮边界软超时。
|
||||
runCtx := ctx
|
||||
if maxDur > 0 {
|
||||
var cancel context.CancelFunc
|
||||
runCtx, cancel = context.WithTimeoutCause(ctx, maxDur+settleHardGrace, AbortRunHardTimeout)
|
||||
defer cancel()
|
||||
}
|
||||
_, _, err = captureRun(runCtx, opts, input,
|
||||
// MaxDuration 现在会在墙钟到点打断在跑工具并就地进收尾(在活 ctx 上),单轮卡死不再
|
||||
// 绕过收尾,无需外部硬 ctx 兜底。ctx 只承载 pause / kill / shutdown。
|
||||
_, _, err = captureRun(ctx, opts, input,
|
||||
func(r db.Activity) {
|
||||
if emit != nil {
|
||||
r.Worker = "planner" // planner activity has no intent_id (it generates them)
|
||||
|
||||
Reference in new issue
Block a user