mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-28 12:44:28 +00:00
🧫 test: Lock Subagent File Context Propagation (#15126)
This commit is contained in:
parent
c411eb4cc6
commit
2018c70040
2 changed files with 108 additions and 0 deletions
|
|
@ -3838,6 +3838,50 @@ describe('AgentClient - titleConvo', () => {
|
|||
|
||||
expect(mockAgent.additional_instructions).toContain('Direct primary context');
|
||||
});
|
||||
|
||||
it('hydrates a pure lazy subagent with its own File Context when selected', async () => {
|
||||
const childContext = makeTextFile('child-context', 'child.txt', 'Pure child private context');
|
||||
const resolvedChild = {
|
||||
id: 'pure-child-agent',
|
||||
endpoint: EModelEndpoint.openAI,
|
||||
provider: EModelEndpoint.openAI,
|
||||
instructions: 'Pure child instructions',
|
||||
model_parameters: { model: 'gpt-4' },
|
||||
tools: [],
|
||||
agentContextAttachments: [childContext],
|
||||
};
|
||||
const descriptor = {
|
||||
id: resolvedChild.id,
|
||||
resolve: jest.fn().mockResolvedValue(resolvedChild),
|
||||
};
|
||||
mockAgent.lazySubagentConfigs = [descriptor];
|
||||
client.agentConfigs = new Map();
|
||||
|
||||
await client.buildMessages(
|
||||
[
|
||||
{
|
||||
messageId: 'msg-1',
|
||||
parentMessageId: null,
|
||||
sender: 'User',
|
||||
text: 'Answer from the child context.',
|
||||
isCreatedByUser: true,
|
||||
},
|
||||
],
|
||||
'msg-1',
|
||||
{},
|
||||
);
|
||||
const resolved = await descriptor.resolve({ signal: new AbortController().signal });
|
||||
|
||||
expect(resolved).toBe(resolvedChild);
|
||||
expect(resolvedChild.additional_instructions).toContain('Pure child private context');
|
||||
expect(mockAgent.additional_instructions ?? '').not.toContain('Pure child private context');
|
||||
expect(mockBuildAgentScopedContext).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({
|
||||
agentIds: ['pure-child-agent'],
|
||||
attachmentsByAgentId: new Map([['pure-child-agent', [childContext]]]),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('provider-native YouTube file preflight', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue