mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-08 20:30:53 -07:00
Fix issue where subagent thoughts are appended. (#22975)
This commit is contained in:
committed by
GitHub
parent
0ed9f1e7f5
commit
0082e1ec97
@@ -230,7 +230,7 @@ describe('LocalSubagentInvocation', () => {
|
|||||||
expect(display.terminateReason).toBe(AgentTerminateMode.TIMEOUT);
|
expect(display.terminateReason).toBe(AgentTerminateMode.TIMEOUT);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should stream THOUGHT_CHUNK activities from the executor', async () => {
|
it('should stream THOUGHT_CHUNK activities from the executor, replacing the last running thought', async () => {
|
||||||
mockExecutorInstance.run.mockImplementation(async () => {
|
mockExecutorInstance.run.mockImplementation(async () => {
|
||||||
const onActivity = MockLocalAgentExecutor.create.mock.calls[0][2];
|
const onActivity = MockLocalAgentExecutor.create.mock.calls[0][2];
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ describe('LocalSubagentInvocation', () => {
|
|||||||
isSubagentActivityEvent: true,
|
isSubagentActivityEvent: true,
|
||||||
agentName: 'MockAgent',
|
agentName: 'MockAgent',
|
||||||
type: 'THOUGHT_CHUNK',
|
type: 'THOUGHT_CHUNK',
|
||||||
data: { text: ' Still thinking.' },
|
data: { text: 'Thinking about next steps.' },
|
||||||
} as SubagentActivityEvent);
|
} as SubagentActivityEvent);
|
||||||
}
|
}
|
||||||
return { result: 'Done', terminate_reason: AgentTerminateMode.GOAL };
|
return { result: 'Done', terminate_reason: AgentTerminateMode.GOAL };
|
||||||
@@ -258,7 +258,13 @@ describe('LocalSubagentInvocation', () => {
|
|||||||
expect(lastCall.recentActivity).toContainEqual(
|
expect(lastCall.recentActivity).toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: 'thought',
|
type: 'thought',
|
||||||
content: 'Analyzing... Still thinking.',
|
content: 'Thinking about next steps.',
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
expect(lastCall.recentActivity).not.toContainEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
type: 'thought',
|
||||||
|
content: 'Analyzing...',
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ export class LocalSubagentInvocation extends BaseToolInvocation<
|
|||||||
lastItem.type === 'thought' &&
|
lastItem.type === 'thought' &&
|
||||||
lastItem.status === 'running'
|
lastItem.status === 'running'
|
||||||
) {
|
) {
|
||||||
lastItem.content += text;
|
lastItem.content = text;
|
||||||
} else {
|
} else {
|
||||||
recentActivity.push({
|
recentActivity.push({
|
||||||
id: randomUUID(),
|
id: randomUUID(),
|
||||||
|
|||||||
Reference in New Issue
Block a user