From 7642dcec24c594ca03e8d1666e1b721250a2fd4b Mon Sep 17 00:00:00 2001 From: weichen Date: Thu, 8 Oct 2026 03:31:03 +0000 Subject: [PATCH] Complete the delegation task brief with output format and tool sections (Q3 WP3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: Q3 acceptance requires the delegation template to state goal, output format, tools and boundaries; SubagentFactory's brief had four of six sections and the kernel Request gained the two carriers (agent-native #40). Evidence: adapter_test task-brief assertions extended (输出格式/工具面 sections present with declared values); full backend suite green (SELF); CI authoritative (GATE). Impact: nested deps/agent-native 1ac21c6 -> 37c5e6f (Request.OutputFormat/ Tools + delegate_task schema); SubagentFactory renders the two sections when declared, omits them when empty (no behavior change for existing callers). Refs: Q3 plan WP3; task card .task/feature-agent-stack-q3.md --- deps/agent-native | 2 +- internal/squadadapter/adapter.go | 8 ++++++++ internal/squadadapter/adapter_test.go | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/deps/agent-native b/deps/agent-native index 1ac21c6..37c5e6f 160000 --- a/deps/agent-native +++ b/deps/agent-native @@ -1 +1 @@ -Subproject commit 1ac21c68d4e2c2728d92d6db67a30ff06e0066d3 +Subproject commit 37c5e6fbd65c69cc794ce476f3bed020aafd9eef diff --git a/internal/squadadapter/adapter.go b/internal/squadadapter/adapter.go index 51d1490..cff3128 100644 --- a/internal/squadadapter/adapter.go +++ b/internal/squadadapter/adapter.go @@ -248,6 +248,14 @@ func SubagentFactory(rc Ctx) subagent.Factory { if len(req.Deliverables) > 0 { b.WriteString("\n交付物:" + strings.Join(req.Deliverables, ", ")) } + // Q3 WP3:任务书四要素补全——目标、输出格式、工具和边界。空声明 + // 不落节(沿用子代理画像默认)。 + if strings.TrimSpace(req.OutputFormat) != "" { + b.WriteString("\n输出格式:" + req.OutputFormat) + } + if len(req.Tools) > 0 { + b.WriteString("\n工具面(可用工具,不得越界):" + strings.Join(req.Tools, ", ")) + } // Background(N2 WP5):声明驱动后台派生,语义同产品 delegate 的 // background 参数;完成结果经通知队列回投,本次调用立即返回 run ID。 // rc 无后台能力(测试桩/旧宿主)时回落同步派生,不 fail-closed。 diff --git a/internal/squadadapter/adapter_test.go b/internal/squadadapter/adapter_test.go index 64cf621..e61c06d 100644 --- a/internal/squadadapter/adapter_test.go +++ b/internal/squadadapter/adapter_test.go @@ -85,6 +85,8 @@ func TestSubagentFactoryBridgesSpawnSubagent(t *testing.T) { Goal: "查证数据", Inputs: "docs/v2", WriteScope: "research/", NonGoals: "不做实现", DoneCriteria: "三来源对照", Deliverables: []string{"notes.md"}, + OutputFormat: "Markdown:结论先行,附对照表", + Tools: []string{"web_search", "read_file"}, }) if err != nil { t.Fatal(err) @@ -92,7 +94,8 @@ func TestSubagentFactoryBridgesSpawnSubagent(t *testing.T) { if !res.Success || res.Text != "子代理结论" { t.Fatalf("bridge result wrong: %+v", res) } - for _, want := range []string{"查证数据", "docs/v2", "research/", "不做实现", "三来源对照", "notes.md"} { + for _, want := range []string{"查证数据", "docs/v2", "research/", "不做实现", "三来源对照", "notes.md", + "输出格式:Markdown:结论先行,附对照表", "工具面(可用工具,不得越界):web_search, read_file"} { if !strings.Contains(rc.gotTask, want) { t.Fatalf("task brief missing %q:\n%s", want, rc.gotTask) } -- 2.54.0