From 6dce6317e8c1ca0633e9719ebfa3b68ca11bc58e Mon Sep 17 00:00:00 2001 From: Autumn-27 <53844290+Autumn-27@users.noreply.github.com> Date: Sat, 8 Aug 2026 12:59:58 -0400 Subject: [PATCH] =?UTF-8?q?feat(worker):=20=E6=B4=BE=E5=8F=91=E6=84=8F?= =?UTF-8?q?=E5=9B=BE=E6=97=B6=E6=8C=89=20asset=5Fids=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=BA=B3=E5=85=A5=E4=BB=BB=E5=8A=A1=E6=B5=8B=E8=AF=95=E8=8C=83?= =?UTF-8?q?=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Execute 里复用已查出的目标资产,逐个 AddAutoScope(与 insertAssets 同一套 保守粒度、source=auto) - 去重由 upsertTaskScope 的 ON CONFLICT DO NOTHING + uq_task_scope 唯一索引 保证,重跑/重试幂等 no-op Co-Authored-By: Claude Opus 4.8 --- agent/worker.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/agent/worker.go b/agent/worker.go index 8e37699..9495908 100644 --- a/agent/worker.go +++ b/agent/worker.go @@ -307,6 +307,12 @@ func (w *Worker) Execute(ctx context.Context, name string, taskID int64, as *db. if b, err := json.Marshal(assets); err == nil { input += "\n\n本意图 asset_ids 对应的目标资产:\n" + string(b) } + // 意图明确针对的这些资产 → 自动纳入任务测试范围(与 insertAssets 同一套 + // 保守粒度)。upsertTaskScope 的 ON CONFLICT DO NOTHING + uq_task_scope + // 唯一索引保证不会重复添加;重跑/重试同样是幂等 no-op。 + for _, a := range assets { + _ = as.AddAutoScope(taskID, a.Type, a.Domain, a.URL, a.IP) + } } } }