Version 2.48.0 Release: Smart History Sanitization for Context Optimization
This commit is contained in:
@@ -204,4 +204,35 @@ describe('local project path preflight', () => {
|
||||
expect(followup).toContain('src/agent.ts');
|
||||
expect(followup).toContain('recently generated project knowledge record');
|
||||
});
|
||||
|
||||
it('removes old Second Brain trace details from assistant history before model requests', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
const history = [
|
||||
{ role: 'user', content: 'ConnectAI 지식 만들어줘' },
|
||||
{
|
||||
role: 'assistant',
|
||||
content: [
|
||||
'## 간단 요약',
|
||||
'ConnectAI 프로젝트 지식을 만들었습니다.',
|
||||
'<details>',
|
||||
'<summary>2nd Brain Trace: 사용함</summary>',
|
||||
'Project_Logs/2026-04-25-Datacollector_Fix.md',
|
||||
'## Second Brain Debug JSON',
|
||||
'{"path":"Datacollector"}',
|
||||
'</details>'
|
||||
].join('\n')
|
||||
}
|
||||
];
|
||||
|
||||
const requestHistory = agent.buildRequestHistory(history);
|
||||
|
||||
expect(requestHistory[1].content).toContain('ConnectAI 프로젝트 지식을 만들었습니다');
|
||||
expect(requestHistory[1].content).not.toContain('Datacollector');
|
||||
expect(requestHistory[1].content).not.toContain('2nd Brain Trace');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user