mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 13:22:35 -07:00
fix(cli/acp): prevent infinite thought loop in ACP mode by disablig nextSpeakerCheck (#26874)
This commit is contained in:
@@ -1043,6 +1043,28 @@ describe('loadCliConfig', () => {
|
||||
|
||||
expect(config.isInteractive()).toBe(false);
|
||||
});
|
||||
|
||||
describe('isAcpMode', () => {
|
||||
it('should force skipNextSpeakerCheck to true when in ACP mode', async () => {
|
||||
process.argv = ['node', 'script.js', '--acp'];
|
||||
const argv = await parseArguments(createTestMergedSettings());
|
||||
const settings = createTestMergedSettings({
|
||||
model: { skipNextSpeakerCheck: false },
|
||||
});
|
||||
const config = await loadCliConfig(settings, 'test-session', argv);
|
||||
expect(config.getSkipNextSpeakerCheck()).toBe(true);
|
||||
});
|
||||
|
||||
it('should respect settings.model.skipNextSpeakerCheck when not in ACP mode', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const argv = await parseArguments(createTestMergedSettings());
|
||||
const settings = createTestMergedSettings({
|
||||
model: { skipNextSpeakerCheck: false },
|
||||
});
|
||||
const config = await loadCliConfig(settings, 'test-session', argv);
|
||||
expect(config.getSkipNextSpeakerCheck()).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Hierarchical Memory Loading (config.ts) - Placeholder Suite', () => {
|
||||
|
||||
@@ -1105,7 +1105,11 @@ export async function loadCliConfig(
|
||||
shellToolInactivityTimeout: settings.tools?.shell?.inactivityTimeout,
|
||||
enableShellOutputEfficiency:
|
||||
settings.tools?.shell?.enableShellOutputEfficiency ?? true,
|
||||
skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck,
|
||||
// In ACP mode, always skip the next-speaker check. This check triggers
|
||||
// recursive continuation turns inside GeminiClient.processTurn() that
|
||||
// conflict with ACP's explicit turn management via session/prompt,
|
||||
// causing infinite agent_thought_chunk loops.
|
||||
skipNextSpeakerCheck: isAcpMode || settings.model?.skipNextSpeakerCheck,
|
||||
truncateToolOutputThreshold: settings.tools?.truncateToolOutputThreshold,
|
||||
eventEmitter: coreEvents,
|
||||
useWriteTodos: argv.useWriteTodos ?? settings.useWriteTodos,
|
||||
|
||||
Reference in New Issue
Block a user