Files
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

66 lines
2.0 KiB
Go

package agentstatus
import (
"context"
"path/filepath"
"runtime"
"testing"
"time"
)
func TestProbeCodexAppServerClassifiesMissingOptionalDependencyFromStderr(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("shell fixture is Unix-only")
}
platform, ok := codexNpmPlatformDir(runtime.GOOS, runtime.GOARCH)
if !ok {
t.Skip("unsupported Codex platform")
}
platformPackage := "@openai/" + platform
command := filepath.Join(t.TempDir(), "codex")
writeExecutable(t, command, "#!/bin/sh\n"+
"echo 'Error: Missing optional dependency "+platformPackage+". Reinstall @openai/codex with optional dependencies enabled.' >&2\n"+
"exit 1\n")
service := Service{
ProbeTimeout: 3 * time.Second,
ProbeReadyAfter: 100 * time.Millisecond,
}
evidence := service.probeCodexAppServer(
context.Background(),
[]string{command, "app-server"},
[]string{"PATH=" + filepath.Dir(command)},
)
if evidence.CommandStarted != true || evidence.ProtocolReady {
t.Fatalf("evidence = %#v, want a started command with failed protocol", evidence)
}
if evidence.Category != "platform_package_enoent" || evidence.PlatformPackageName != platformPackage {
t.Fatalf("evidence = %#v, want missing platform package %q classified from stderr", evidence, platformPackage)
}
}
func TestProbeCodexAppServerClassifiesUnsupportedSubcommandFromStderr(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("shell fixture is Unix-only")
}
command := filepath.Join(t.TempDir(), "codex")
writeExecutable(t, command, "#!/bin/sh\n"+
"echo \"error: unrecognized subcommand 'app-server'\" >&2\n"+
"exit 2\n")
service := Service{
ProbeTimeout: 3 * time.Second,
ProbeReadyAfter: 100 * time.Millisecond,
}
evidence := service.probeCodexAppServer(
context.Background(),
[]string{command, "app-server"},
[]string{"PATH=" + filepath.Dir(command)},
)
if evidence.Category != "app_server_unsupported" {
t.Fatalf("evidence = %#v, want app_server_unsupported classified from stderr", evidence)
}
}