Cleanup post delegate_to_agent removal (#17875)

This commit is contained in:
Christian Gunderman
2026-01-29 18:24:35 +00:00
committed by GitHub
parent 0e30055ae4
commit bc258eba4c
5 changed files with 36 additions and 10 deletions

View File

@@ -45,6 +45,7 @@ describe('handleAtCommand', () => {
}
beforeEach(async () => {
vi.restoreAllMocks();
vi.resetAllMocks();
testRootDir = await fsPromises.mkdtemp(
@@ -1403,4 +1404,32 @@ describe('handleAtCommand', () => {
134,
);
});
it('should include agent nudge when agents are found', async () => {
const agentName = 'my-agent';
const otherAgent = 'other-agent';
// Mock getAgentRegistry on the config
mockConfig.getAgentRegistry = vi.fn().mockReturnValue({
getDefinition: (name: string) =>
name === agentName || name === otherAgent ? { name } : undefined,
});
const query = `@${agentName} @${otherAgent}`;
const result = await handleAtCommand({
query,
config: mockConfig,
addItem: mockAddItem,
onDebugMessage: mockOnDebugMessage,
messageId: 600,
signal: abortController.signal,
});
const expectedNudge = `\n<system_note>\nThe user has explicitly selected the following agent(s): ${agentName}, ${otherAgent}. Please use the following tool(s) to delegate the task: '${agentName}', '${otherAgent}'.\n</system_note>\n`;
expect(result.processedQuery).toContainEqual(
expect.objectContaining({ text: expectedNudge }),
);
});
});