Files
Agent-System-Backend/internal/runmgr/entry_test.go
T
weichenandCursor ebeb6c599c Route a matched intent to its workflow after commands
Why: A hit intent should start the bound workflow, and a command that shares the same id still has to win.
Evidence: go test ./internal/intentgate/ ./internal/runmgr/ ./internal/server/ passed. Recognize keeps slots and the missing-slot question. StartWorkflowRun copies the definition and selects the workflow runner even when mock is on.
Impact: Ordinary turns are unchanged. The workflow runner body is still a stub until the executor lands.
Refs: feature/agent-harness-p4
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 16:04:49 +00:00

33 lines
1.2 KiB
Go

package runmgr
import (
"testing"
"agent-system-backend/internal/runtime"
"agent-system-backend/internal/workflow"
core "agent-system-core"
)
type nameRunner struct{ name string }
func (n nameRunner) Name() string { return n.name }
func (n nameRunner) Execute(rc runtime.RunCtx) error { return nil }
func TestSelectConversationRunner(t *testing.T) {
m := &Manager{runner: nameRunner{name: "direct"}, mock: nameRunner{name: "mock"}, squad: nameRunner{name: "squad"}, wfRunner: nameRunner{name: "workflow"}}
if got := selectConversationRunner(m, core.EffectiveSettings{}, nil); got.Name() != "direct" {
t.Fatalf("default = %s", got.Name())
}
squadEff := core.EffectiveSettings{"runtime": map[string]any{"entry": "squad"}}
if got := selectConversationRunner(m, squadEff, nil); got.Name() != "squad" {
t.Fatalf("squad entry = %s", got.Name())
}
mockEff := core.EffectiveSettings{"runtime": map[string]any{"entry": "squad", "mock": true}}
if got := selectConversationRunner(m, mockEff, nil); got.Name() != "mock" {
t.Fatalf("mock wins = %s", got.Name())
}
if got := selectConversationRunner(m, mockEff, &workflow.Launch{}); got.Name() != "workflow" {
t.Fatalf("workflow wins = %s", got.Name())
}
}