Files
tutti/packages/agent/daemon/runtime/codex_appserver_collab_test.go
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

73 lines
2.0 KiB
Go

package agentruntime
import "testing"
func TestAppServerCollabAgentFailedCarriesErrorOutput(t *testing.T) {
t.Parallel()
update, ok := appServerItemToolCallUpdate(map[string]any{
"type": "collabAgentToolCall",
"id": "call-subagent-1",
"tool": "spawnAgent",
"status": "failed",
"prompt": "Generate one random integer.",
"error": "collab spawn failed: agent thread limit reached",
}, true)
if !ok {
t.Fatalf("update was not produced")
}
if got := asString(update["status"]); got != messageStreamStateFailed {
t.Fatalf("status = %q, want failed", got)
}
rawOutput, ok := update["rawOutput"].(map[string]any)
if !ok {
t.Fatalf("rawOutput = %#v, want map", update["rawOutput"])
}
if got := asString(rawOutput["message"]); got != "collab spawn failed: agent thread limit reached" {
t.Fatalf("rawOutput.message = %q", got)
}
}
func TestAppServerCloseAgentIsControlTool(t *testing.T) {
t.Parallel()
update, ok := appServerItemToolCallUpdate(map[string]any{
"type": "collabAgentToolCall",
"id": "call-close-1",
"tool": "closeAgent",
"status": "completed",
}, true)
if !ok {
t.Fatalf("update was not produced")
}
if got := asString(update["title"]); got != "closeAgent" {
t.Fatalf("title = %q, want closeAgent", got)
}
if got := asString(update["kind"]); got != "other" {
t.Fatalf("kind = %q, want other", got)
}
}
func TestAppServerWaitIsControlTool(t *testing.T) {
t.Parallel()
update, ok := appServerItemToolCallUpdate(map[string]any{
"type": "collabAgentToolCall",
"id": "call-wait-1",
"tool": "wait",
"status": "completed",
}, true)
if !ok {
t.Fatalf("update was not produced")
}
if got := asString(update["title"]); got != "wait" {
t.Fatalf("title = %q, want wait", got)
}
if got := asString(update["kind"]); got != "other" {
t.Fatalf("kind = %q, want other", got)
}
if got := acpToolName("call-wait-1", asString(update["title"]), asString(update["kind"]), update["rawInput"]); got != "Wait" {
t.Fatalf("acpToolName = %q, want Wait", got)
}
}