From 402553be413faeabe9901ce960d3be4c38d41ab6 Mon Sep 17 00:00:00 2001 From: Spencer Date: Fri, 20 Mar 2026 06:09:14 +0000 Subject: [PATCH] fix(a2a-server): replace ApprovalMode.YOLO with wildcard policy check --- packages/a2a-server/src/agent/task.ts | 6 ++---- packages/a2a-server/src/http/app.test.ts | 1 + packages/cli/src/ui/components/InputPrompt.test.tsx | 1 - packages/cli/src/ui/hooks/useGeminiStream.test.tsx | 10 ++++------ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/a2a-server/src/agent/task.ts b/packages/a2a-server/src/agent/task.ts index a76054263f..0adc665754 100644 --- a/packages/a2a-server/src/agent/task.ts +++ b/packages/a2a-server/src/agent/task.ts @@ -10,7 +10,6 @@ import { type GeminiClient, GeminiEventType, ToolConfirmationOutcome, - ApprovalMode, getAllMCPServerStatuses, MCPServerStatus, isNodeError, @@ -89,7 +88,8 @@ export class Task { autoExecute: boolean; private get isYoloMatch(): boolean { return ( - this.autoExecute || this.config.getApprovalMode() === ApprovalMode.YOLO + this.autoExecute || + (this.config.getAllowedTools()?.includes('*') ?? false) ); } @@ -880,9 +880,7 @@ export class Task { if ( part.kind !== 'data' || !part.data || - // eslint-disable-next-line no-restricted-syntax typeof part.data['callId'] !== 'string' || - // eslint-disable-next-line no-restricted-syntax typeof part.data['outcome'] !== 'string' ) { return false; diff --git a/packages/a2a-server/src/http/app.test.ts b/packages/a2a-server/src/http/app.test.ts index c874032074..63bf019d63 100644 --- a/packages/a2a-server/src/http/app.test.ts +++ b/packages/a2a-server/src/http/app.test.ts @@ -121,6 +121,7 @@ describe('E2E Tests', () => { beforeEach(() => { getApprovalModeSpy.mockReturnValue(ApprovalMode.DEFAULT); getAllowedToolsSpy.mockReturnValue([]); + getAllowedToolsSpy.mockReturnValue([]); }); afterAll( diff --git a/packages/cli/src/ui/components/InputPrompt.test.tsx b/packages/cli/src/ui/components/InputPrompt.test.tsx index 5745d04a07..0ada0892c3 100644 --- a/packages/cli/src/ui/components/InputPrompt.test.tsx +++ b/packages/cli/src/ui/components/InputPrompt.test.tsx @@ -4033,7 +4033,6 @@ describe('InputPrompt', () => { unmount(); }); - it('should not show inverted cursor when shell is focused', async () => { props.isEmbeddedShellFocused = true; props.focus = false; diff --git a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx index 497f3e0725..07524ca80c 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx +++ b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx @@ -106,12 +106,10 @@ const MockedGeminiClientClass = vi.hoisted(() => ); const MockedUserPromptEvent = vi.hoisted(() => - vi - .fn() - .mockImplementation(() => ({ - toLogBody: vi.fn(), - toOpenTelemetryAttributes: vi.fn(), - })), + vi.fn().mockImplementation(() => ({ + toLogBody: vi.fn(), + toOpenTelemetryAttributes: vi.fn(), + })), ); const mockParseAndFormatApiError = vi.hoisted(() => vi.fn()); const mockIsBackgroundExecutionData = vi.hoisted(