|
4 | 4 | * a model (the OpenAI provider class stubbed at its module boundary) that calls them, and the tool results the next |
5 | 5 | * model call receives. With the learning flag on, a placeholder user's turn has no learner and the tools refuse |
6 | 6 | * (`no_learner`); in mode `off` they refuse (`off`). With the flag off adapt_personality changes an editable trait as |
7 | | - * before, and the trait it changes reaches no prompt; honesty and emotionality it refuses on every host |
| 7 | + * before, and the trait it changes reaches no prompt, which carries the persona's own trait paragraph as defined; |
| 8 | + * honesty and emotionality it refuses on every host |
8 | 9 | * (`operator_only`), since only the persona definition sets them. |
9 | 10 | */ |
10 | 11 | import { afterEach, describe, expect, it, vi } from 'vitest'; |
@@ -39,6 +40,7 @@ vi.mock('../../core/llm/providers/implementations/OpenAIProvider', () => { |
39 | 40 |
|
40 | 41 | import { AgentOS } from '../AgentOS'; |
41 | 42 | import type { IPersonaDefinition } from '../../cognition/substrate/personas/IPersonaDefinition'; |
| 43 | +import { renderPersonalitySection } from '../../cognition/substrate/personas/personalityPrompt'; |
42 | 44 |
|
43 | 45 | const HEADING = '## Personality & Communication Style'; |
44 | 46 | const tutor = { |
@@ -105,7 +107,9 @@ describe('the self-modification tools on the full runtime', () => { |
105 | 107 | await send(booted, { userId: 'ana', sessionId: 's-1', textInput: 'Again.' }); |
106 | 108 | const [first, afterTool, nextTurn] = provider.seenMessages; |
107 | 109 | expect(toolMessages(afterTool)[0]).toContain('"newValue"'); |
108 | | - expect(systemTextOf(first)).not.toContain(HEADING); |
| 110 | + // With no learning layer the GMI renders the persona's own trait paragraph once, from the definition. |
| 111 | + expect(systemTextOf(first)).toContain(renderPersonalitySection(tutor.personalityTraits)!); |
| 112 | + expect(systemTextOf(first).split(HEADING)).toHaveLength(2); |
109 | 113 | expect(systemTextOf(afterTool)).toBe(systemTextOf(first)); |
110 | 114 | expect(systemTextOf(nextTurn)).toBe(systemTextOf(first)); |
111 | 115 | }); |
|
0 commit comments