refactor: remove self-learning and the optimizer package (P1.4)
Self-learning is excluded from the community edition (ADR-0004); the project owner reworks it separately. Cost tracking stays. - agent: delete behaviour evolution (evolve-schema, iterative GEPA, compose-evolution, evolution gates, orchestrator and deploy), improvement and correction detection, AgentLearning, the eval-dataset builder, optimization-capture and the agent_insights tool. Secret detection moves from eval-dataset to secret-patterns. The LLM wiring keeps only the Haiku adapter and judge call used by skill audit and hygiene, so @ax-llm/ax is now declared by agent instead of server. - server: delete /api/evolution/*, the evolution and optimizer services, GEPA expansion of the first chat message, the prompt_optimization and monthly_assessment jobs, the idle-session reviewer and its session-reviewer persona, prompt injection of past corrections and thumbs-down recorded as correction signals. Existing job rows of the removed types are ignored, not deleted. - core: delete OptimizationLogStore; stop re-exporting the improvement signal and evolution run stores. - web: delete the Evolution screen and the two job types in the automation editor. - delete packages/optimizer. Also logs UF-027 (self-learning loops read data nothing collects) and UF-028 (the Settings prompt-shape choice is ignored by chat).
This commit is contained in:
@@ -14,10 +14,8 @@ import { afterEach, describe, it, expect } from 'vitest';
|
||||
import Fastify from 'fastify';
|
||||
import {
|
||||
deleteCustomPersona,
|
||||
deployPersonaOverride,
|
||||
isValidCustomPersonaId,
|
||||
listPersonas,
|
||||
rollbackPersonaOverride,
|
||||
saveCustomPersona,
|
||||
type AgentPersona,
|
||||
} from '@waggle/agent';
|
||||
@@ -118,14 +116,12 @@ describe('Personas Routes', () => {
|
||||
await server.close();
|
||||
});
|
||||
|
||||
it('contains all 23 personas', async () => {
|
||||
it('contains all 22 personas', async () => {
|
||||
const server = createTestServer();
|
||||
const res = await server.inject({ method: 'GET', url: '/api/personas' });
|
||||
const { personas } = res.json();
|
||||
|
||||
// 22 tiered personas + session-reviewer (internal self-evolution reviewer;
|
||||
// returned by the raw list but excluded from onboarding + PersonaSwitcher).
|
||||
expect(personas.length).toBe(23);
|
||||
expect(personas.length).toBe(22);
|
||||
const ids = personas.map((p: { id: string }) => p.id);
|
||||
expect(ids).toContain('researcher');
|
||||
expect(ids).toContain('writer');
|
||||
@@ -251,40 +247,5 @@ describe('Personas Routes', () => {
|
||||
.toThrow('Invalid custom persona ID');
|
||||
expect(fs.readFileSync(outsidePath, 'utf-8')).toBe('sentinel');
|
||||
});
|
||||
|
||||
it('deployPersonaOverride rejects traversal before writing an override', () => {
|
||||
const dataDir = makeTempDir();
|
||||
const outsidePath = path.join(dataDir, 'evolved.json');
|
||||
|
||||
expect(() => deployPersonaOverride(dataDir, {
|
||||
personaId: '../evolved',
|
||||
systemPrompt: 'Escaped override',
|
||||
})).toThrow('Invalid custom persona ID');
|
||||
expect(fs.existsSync(outsidePath)).toBe(false);
|
||||
});
|
||||
|
||||
it('deployPersonaOverride keeps its validated ID authoritative over overrides', () => {
|
||||
const dataDir = makeTempDir();
|
||||
const result = deployPersonaOverride(dataDir, {
|
||||
personaId: 'safe-persona',
|
||||
systemPrompt: 'Validated prompt',
|
||||
overrides: { id: '../evolved', systemPrompt: 'Spoofed prompt' } as never,
|
||||
});
|
||||
|
||||
const deployed = JSON.parse(fs.readFileSync(result.path, 'utf-8')) as AgentPersona;
|
||||
expect(deployed.id).toBe('safe-persona');
|
||||
expect(deployed.systemPrompt).toBe('Validated prompt');
|
||||
expect(fs.existsSync(path.join(dataDir, 'evolved.json'))).toBe(false);
|
||||
});
|
||||
|
||||
it('rollbackPersonaOverride rejects traversal before deleting an override', () => {
|
||||
const dataDir = makeTempDir();
|
||||
const outsidePath = path.join(dataDir, 'evolved.json');
|
||||
fs.writeFileSync(outsidePath, 'sentinel', 'utf-8');
|
||||
|
||||
expect(() => rollbackPersonaOverride(dataDir, '../evolved'))
|
||||
.toThrow('Invalid custom persona ID');
|
||||
expect(fs.readFileSync(outsidePath, 'utf-8')).toBe('sentinel');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user