Files
Agent-System/internal/squad/workflow_outcome_test.go
T
weichen b820e0070d fix(taskrun): 刷新后恢复进行中任务并纠正进度问询
进行中的 run 提前写下消息锚点,并按会话列出活跃任务;进度疑问句改为查询真实状态,交付物已落盘且不是传输失败时不再被空结果否决。
2026-09-28 06:09:42 +00:00

32 lines
1.2 KiB
Go

package squad
import (
"errors"
"testing"
"chat-agent-system/internal/agent"
)
func TestStepOutputAccepted_DiskContentBeatsMissingDeliverable(t *testing.T) {
missing := &agent.Result{Success: false, ErrorReason: "missing target deliverable output.md"}
if !stepOutputAccepted(nil, nil, true, "# 调研报告\n正文", missing) {
t.Fatal("non-empty file must be accepted when the runner only reported a missing deliverable")
}
truncated := &agent.Result{Success: false, ErrorReason: "Connection error.", Retryable: true}
if stepOutputAccepted(nil, nil, true, "# partial", truncated) {
t.Fatal("retryable connection failure must stay fail-closed even if a file exists")
}
if stepOutputAccepted(nil, nil, true, " \n", missing) {
t.Fatal("blank content must not override a failed runner result")
}
if stepOutputAccepted(errors.New("backend"), nil, true, "# 调研报告", missing) {
t.Fatal("execute error must reject the step")
}
if stepOutputAccepted(nil, errors.New("materialize"), true, "# 调研报告", &agent.Result{Success: true}) {
t.Fatal("materialize error must reject the step")
}
if !stepOutputAccepted(nil, nil, false, "", &agent.Result{Success: true}) {
t.Fatal("runner success without a new file still counts")
}
}