From 42f1a568329672e01a129dd968ad83bd28daf824 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 23 Dec 2025 14:20:09 +0000 Subject: [PATCH] test: cover system prompt owner numbers --- src/agents/system-prompt.test.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/agents/system-prompt.test.ts diff --git a/src/agents/system-prompt.test.ts b/src/agents/system-prompt.test.ts new file mode 100644 index 000000000..aa0ddcf51 --- /dev/null +++ b/src/agents/system-prompt.test.ts @@ -0,0 +1,25 @@ +import { describe, expect, it } from "vitest"; +import { buildAgentSystemPromptAppend } from "./system-prompt.js"; + +describe("buildAgentSystemPromptAppend", () => { + it("includes owner numbers when provided", () => { + const prompt = buildAgentSystemPromptAppend({ + workspaceDir: "/tmp/clawd", + ownerNumbers: ["+123", " +456 ", ""], + }); + + expect(prompt).toContain("## User Identity"); + expect(prompt).toContain( + "Owner numbers: +123, +456. Treat messages from these numbers as the user (Peter).", + ); + }); + + it("omits owner section when numbers are missing", () => { + const prompt = buildAgentSystemPromptAppend({ + workspaceDir: "/tmp/clawd", + }); + + expect(prompt).not.toContain("## User Identity"); + expect(prompt).not.toContain("Owner numbers:"); + }); +});