mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-13 07:30:52 -07:00
Fix: Avoid tool confirmation timeout when no UI listeners are present (#17955)
This commit is contained in:
@@ -79,8 +79,21 @@ export class MessageBus extends EventEmitter {
|
||||
});
|
||||
break;
|
||||
case PolicyDecision.ASK_USER:
|
||||
// Pass through to UI for user confirmation
|
||||
this.emitMessage(message);
|
||||
// Pass through to UI for user confirmation if any listeners exist.
|
||||
// If no listeners are registered (e.g., headless/ACP flows),
|
||||
// immediately request user confirmation to avoid long timeouts.
|
||||
if (
|
||||
this.listenerCount(MessageBusType.TOOL_CONFIRMATION_REQUEST) > 0
|
||||
) {
|
||||
this.emitMessage(message);
|
||||
} else {
|
||||
this.emitMessage({
|
||||
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
||||
correlationId: message.correlationId,
|
||||
confirmed: false,
|
||||
requiresUserConfirmation: true,
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown policy decision: ${decision}`);
|
||||
|
||||
Reference in New Issue
Block a user