@@ -23,6 +23,41 @@ const transformProviderSystemPrompt: Parameters<
|
23 | 23 | >[0]["transformProviderSystemPrompt"] = ({ context }) => context.systemPrompt; |
24 | 24 | |
25 | 25 | describe("buildAttemptSystemPrompt", () => { |
| 26 | +it("injects workspace identity context without a system prompt override", () => { |
| 27 | +const result = buildAttemptSystemPrompt({ |
| 28 | +isRawModelRun: false, |
| 29 | + transformProviderSystemPrompt, |
| 30 | +embeddedSystemPrompt: { |
| 31 | +workspaceDir: "/tmp/openclaw", |
| 32 | +reasoningTagHint: false, |
| 33 | +runtimeInfo: { |
| 34 | +host: "test-host", |
| 35 | +os: "Darwin", |
| 36 | +arch: "arm64", |
| 37 | +node: "v22.0.0", |
| 38 | +model: "openai/gpt-5.5", |
| 39 | +}, |
| 40 | +tools: [], |
| 41 | +modelAliasLines: [], |
| 42 | +userTimezone: "UTC", |
| 43 | +contextFiles: [ |
| 44 | +{ path: "/tmp/openclaw/SOUL.md", content: "SOUL_CONTEXT_MARKER" }, |
| 45 | +{ path: "/tmp/openclaw/IDENTITY.md", content: "IDENTITY_CONTEXT_MARKER" }, |
| 46 | +{ path: "/tmp/openclaw/USER.md", content: "USER_CONTEXT_MARKER" }, |
| 47 | +], |
| 48 | +}, |
| 49 | +providerTransform: baseProviderTransform, |
| 50 | +}); |
| 51 | + |
| 52 | +expect(result.systemPrompt).toContain("# Project Context"); |
| 53 | +expect(result.systemPrompt).toContain("## /tmp/openclaw/SOUL.md"); |
| 54 | +expect(result.systemPrompt).toContain("SOUL_CONTEXT_MARKER"); |
| 55 | +expect(result.systemPrompt).toContain("## /tmp/openclaw/IDENTITY.md"); |
| 56 | +expect(result.systemPrompt).toContain("IDENTITY_CONTEXT_MARKER"); |
| 57 | +expect(result.systemPrompt).toContain("## /tmp/openclaw/USER.md"); |
| 58 | +expect(result.systemPrompt).toContain("USER_CONTEXT_MARKER"); |
| 59 | +}); |
| 60 | + |
26 | 61 | it("preserves bootstrap Project Context when a system prompt override is configured", () => { |
27 | 62 | const result = buildAttemptSystemPrompt({ |
28 | 63 | isRawModelRun: false, |
|