Files
artex/agent/worker_intervention_test.go
dela 0335d572de
ci / go (push) Waiting to run
ci / go-db (agent) (push) Waiting to run
ci / go-db (config) (push) Waiting to run
ci / go-db (db) (push) Waiting to run
ci / go-db (evidence) (push) Waiting to run
ci / go-db (llmrec) (push) Waiting to run
ci / go-db (server) (push) Waiting to run
detections / detections (push) Waiting to run
web / web (push) Waiting to run
docs / links (push) Canceled after 0s
First Commit
2026-10-09 08:38:16 +08:00

29 lines
870 B
Go

package agent
import (
"testing"
"github.com/Autumn-27/norma/llm"
)
func TestWorkerSessionIDIsStablePerIntent(t *testing.T) {
if got := WorkerSessionID(12, 34); got != "exp12-worker-i34" {
t.Fatalf("session id = %q, want exp12-worker-i34", got)
}
}
func TestWorkerChatMarkerOnlyMatchesItsNormalUserTurn(t *testing.T) {
requestID := "worker-message-123"
messages := []llm.Message{
{Role: llm.RoleAssistant, Content: []llm.ContentBlock{llm.TextBlock(workerChatMarker(requestID))}},
llm.UserText(workerChatMarker("worker-message-other") + "\nother"),
llm.UserText(workerChatMarker(requestID) + "\nnew intent"),
}
if !hasWorkerChatMessage(messages, requestID) {
t.Fatal("expected the matching user turn to be detected")
}
if hasWorkerChatMessage(messages, "worker-message-missing") {
t.Fatal("unrelated request id matched a Worker user turn")
}
}