From 901ad10b151d69ae2e50ab9b0c4054e90e7fc206 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Mon, 11 May 2026 12:47:17 +0800 Subject: [PATCH] Refine OpenClaw artifact delivery detection --- internal/acp/orchestrator.go | 24 ++++++++++++++++++++++++ internal/acp/routing_test.go | 13 +++++++++++++ 2 files changed, 37 insertions(+) diff --git a/internal/acp/orchestrator.go b/internal/acp/orchestrator.go index 69b77d9..e6e1784 100644 --- a/internal/acp/orchestrator.go +++ b/internal/acp/orchestrator.go @@ -450,6 +450,9 @@ func openClawArtifactDeliveryRequired(params map[string]any) bool { if strings.TrimSpace(text) == "" { return false } + if openClawArtifactDeliverySuppressed(text) { + return false + } fileSignals := []string{ "ppt", "pptx", "powerpoint", "slide", "slides", "pdf", "docx", "word", "xlsx", "excel", @@ -482,6 +485,27 @@ func openClawArtifactDeliveryRequired(params map[string]any) bool { return false } +func openClawArtifactDeliverySuppressed(text string) bool { + suppressedSignals := []string{ + "do not create file", "do not create files", + "don't create file", "don't create files", + "do not generate file", "do not generate files", + "don't generate file", "don't generate files", + "do not write file", "do not write files", + "don't write file", "don't write files", + "no file", "no files", "no artifact", "no artifacts", + "without file", "without files", "without artifact", "without artifacts", + "不要创建文件", "不要生成文件", "不要写入文件", "不创建文件", "不生成文件", + "无需创建文件", "无需生成文件", "不需要文件", "不要产物", "无需产物", + } + for _, signal := range suppressedSignals { + if strings.Contains(text, signal) { + return true + } + } + return false +} + func openClawArtifactDeliveryClaimedByOutput(output string) bool { if strings.TrimSpace(output) == openClawNoDisplayableText { return false diff --git a/internal/acp/routing_test.go b/internal/acp/routing_test.go index f37ba9a..196940d 100644 --- a/internal/acp/routing_test.go +++ b/internal/acp/routing_test.go @@ -1455,6 +1455,19 @@ func TestOpenClawNoDisplayableOutputDoesNotClaimArtifacts(t *testing.T) { } } +func TestOpenClawArtifactDeliverySuppressionKeepsTextOnlyPrompt(t *testing.T) { + if openClawArtifactDeliveryRequired(map[string]any{ + "taskPrompt": "Reply exactly pong. Do not create files.", + }) { + t.Fatalf("negative file directive must not trigger artifact delivery") + } + if openClawArtifactDeliveryRequired(map[string]any{ + "taskPrompt": "只回答 pong,不要生成文件。", + }) { + t.Fatalf("Chinese negative file directive must not trigger artifact delivery") + } +} + func TestExecuteSessionTaskGatewayRejectsMissingOpenClawFilesForDeliveryRequest(t *testing.T) { gateway := newAcpFakeOpenClawGateway(t) defer gateway.Close()