feat(insert_assets): 资产可标记是否与当前任务相关(related)

insert_assets 每条资产新增 related 入参(默认 true):仅在任务开启资产
覆盖度功能时生效——true 才自动纳入覆盖度(测试范围分母),false 则只入
共享资产库、不计入本任务覆盖度(如顺带发现的旁站/无关资产)。

- Call 内部按 related + coverageDisabled 双重 gate 决定是否 AddAutoScope
- 覆盖度关闭时 related 无意义,经 StripCoverageParams 从最终工具 schema
  剔除(必须在 ToolResolve 的 DB schema 覆盖之后做,故在装配链末端处理)
- 旧库经 refreshBuiltinToolSchemas(flag v6) 刷新 insert_assets schema,
  否则首插入only 的 seed 收不到新参数
- 补 StripCoverageParams 回归测试(开启保留/关闭隐藏/不改原始 schema)

Claude-Session: https://claude.ai/code/session_01Jm87Gr5fq5aso6SfLyguhx
This commit is contained in:
Autumn-27 committed 2026-08-22 10:26:11 -04:00
1 parent eb3f278711
commit 22ae280584
6 files changed
+126 -6

No files matched your search

+1
View File
@@ -89,6 +89,7 @@ func (m *MainAgent) Chat(ctx context.Context, taskID int64, as *db.AssetStore, t
base := append(tsx.DropCoverageTools(tsx.MainAgentTools()), actool.DefaultTools()...)
ctx = WithRunInfo(ctx, RunInfo{TaskID: taskID, ExplorationID: explorationID(ts)})
tools, def, cleanup := AugmentTools(ctx, "mainagent", base)
tools = tsx.StripCoverageParams(tools) // 覆盖度关闭时隐藏 insert_assets 的 related 入参
defer cleanup()
// 本任务的工作目录 <workDir>/tasks/<taskID>,先建好。
mainDir := ensureRunDir(m.workDir, taskID, 0)