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
web / web (push) Waiting to run
docs / links (push) Canceled after 0s
detections / detections (push) Canceled after 0s
29 lines
870 B
Go
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")
|
|
}
|
|
}
|