Fix OpenClaw terminal artifact states
This commit is contained in:
parent
ee1207ebfc
commit
68df669576
@ -805,6 +805,8 @@ func guardOpenClawArtifactResult(result map[string]any, artifactDeliveryRequired
|
||||
message := "未检测到 OpenClaw 本轮导出的实际文件。已阻止口头下载声明进入 artifacts 面板;请重新执行并要求 OpenClaw 在 workspace 中真实生成文件。"
|
||||
result["success"] = false
|
||||
result["status"] = "artifact_missing"
|
||||
result["code"] = "OPENCLAW_ARTIFACT_MISSING"
|
||||
result["error"] = "OpenClaw artifact export returned no files for this run."
|
||||
result["output"] = message
|
||||
result["message"] = message
|
||||
result["summary"] = message
|
||||
@ -824,6 +826,7 @@ func guardOpenClawNoDisplayableResult(result map[string]any, noDisplayableOutput
|
||||
}
|
||||
result["success"] = false
|
||||
result["status"] = "failed"
|
||||
result["code"] = "OPENCLAW_NO_DISPLAYABLE_OUTPUT"
|
||||
result["error"] = "openclaw returned no displayable output"
|
||||
result["message"] = openClawNoDisplayableText
|
||||
result["output"] = openClawNoDisplayableText
|
||||
|
||||
@ -557,6 +557,9 @@ func TestExecuteSessionTaskGatewayNoDisplayableOutputFails(t *testing.T) {
|
||||
if got := response["status"]; got != "failed" {
|
||||
t.Fatalf("expected failed status for no-output gateway response, got %#v", response)
|
||||
}
|
||||
if got := response["code"]; got != "OPENCLAW_NO_DISPLAYABLE_OUTPUT" {
|
||||
t.Fatalf("expected structured no-displayable code, got %#v", response)
|
||||
}
|
||||
if got := response["output"]; got != openClawNoDisplayableText {
|
||||
t.Fatalf("expected no-displayable output message, got %#v", response)
|
||||
}
|
||||
@ -883,6 +886,12 @@ func TestExecuteSessionTaskGatewayDoesNotExportStaleWorkspaceArtifactsWhenScoped
|
||||
if got := response["status"]; got != "artifact_missing" {
|
||||
t.Fatalf("expected artifact_missing status, got %#v", response)
|
||||
}
|
||||
if got := response["code"]; got != "OPENCLAW_ARTIFACT_MISSING" {
|
||||
t.Fatalf("expected structured artifact missing code, got %#v", response)
|
||||
}
|
||||
if _, ok := response["artifacts"]; ok {
|
||||
t.Fatalf("expected no stale artifacts when scoped directory is empty, got %#v", response["artifacts"])
|
||||
}
|
||||
exportParams := gateway.LastArtifactExportParams()
|
||||
if got := strings.TrimSpace(shared.StringArg(exportParams, "artifactScope", "")); !strings.HasPrefix(got, "tasks/thread-openclaw-latest-artifact/") {
|
||||
t.Fatalf("expected scoped artifact export params, got %#v", exportParams)
|
||||
@ -934,6 +943,9 @@ func TestExecuteSessionMessageGatewayRejectsClaimedArtifactsWithoutScopedFiles(t
|
||||
if got := response["status"]; got != "artifact_missing" {
|
||||
t.Fatalf("expected artifact_missing status, got %#v", response)
|
||||
}
|
||||
if got := response["code"]; got != "OPENCLAW_ARTIFACT_MISSING" {
|
||||
t.Fatalf("expected structured artifact missing code, got %#v", response)
|
||||
}
|
||||
if gateway.ArtifactExportCount() != 0 {
|
||||
t.Fatalf("expected no artifact export for unprepared claimed output, got %d", gateway.ArtifactExportCount())
|
||||
}
|
||||
@ -1599,6 +1611,12 @@ func TestExecuteSessionTaskGatewayRejectsMissingOpenClawFilesForDeliveryRequest(
|
||||
if success, _ := response["success"].(bool); success {
|
||||
t.Fatalf("expected missing artifact delivery to be marked unsuccessful, got %#v", response)
|
||||
}
|
||||
if got := response["status"]; got != "artifact_missing" {
|
||||
t.Fatalf("expected artifact_missing status, got %#v", response)
|
||||
}
|
||||
if got := response["code"]; got != "OPENCLAW_ARTIFACT_MISSING" {
|
||||
t.Fatalf("expected structured artifact missing code, got %#v", response)
|
||||
}
|
||||
output := strings.TrimSpace(shared.StringArg(response, "output", ""))
|
||||
if strings.Contains(output, "点击直接下载") || strings.Contains(output, "文件已就绪") {
|
||||
t.Fatalf("expected hallucinated download text to be replaced, got %q", output)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user