mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-16 22:36:48 -07:00
fix: explicitly fail pending tool calls when approval is required
This commit ensures that when a tool call enters the 'awaiting_approval' state (which is not yet supported in the new protocol), we not only emit a fatal error but also emit a 'tool_response' event with 'isError: true'. This allows the UI to correctly transition the tool call from a pending (scheduled/executing) state to an error state, providing clear visual feedback to the user and preventing the UI from appearing to hang.
This commit is contained in:
@@ -170,6 +170,15 @@ class LegacyAgentProtocol implements AgentProtocol {
|
||||
for (const tc of event.toolCalls) {
|
||||
if (tc.status === 'awaiting_approval') {
|
||||
this._emit([
|
||||
this._makeToolResponseEvent({
|
||||
requestId: tc.request.callId,
|
||||
name: tc.request.name,
|
||||
content: [
|
||||
{ type: 'text', text: 'Tool approvals not yet implemented.' },
|
||||
],
|
||||
isError: true,
|
||||
displayContent: [{ type: 'text', text: 'Approval required' }],
|
||||
}),
|
||||
this._makeErrorEvent({
|
||||
status: 'UNIMPLEMENTED',
|
||||
message:
|
||||
|
||||
Reference in New Issue
Block a user