fix(core): resolve scheduler hang and improve policy violation visibility

This PR addresses three core issues with the Policy Engine and Scheduler:
1. Scheduler Hang: Removed a redundant MessageBus listener in Scheduler.ts that caused race conditions in TTY environments.
2. Policy Visibility: Updated ToolGroupMessage.tsx to always display policy violation errors, regardless of verbosity settings.
3. User Feedback: Added emitFeedback to MessageBus.ts to ensure blocked tool calls are reported to the UI.
This commit is contained in:
mkorwel
2026-03-14 12:14:50 -07:00
parent 9f7691fd88
commit e162f622e4
5 changed files with 15 additions and 33 deletions
@@ -21,6 +21,7 @@ import { isShellTool } from './ToolShared.js';
import {
shouldHideToolCall,
CoreToolCallStatus,
ToolErrorType,
} from '@google/gemini-cli-core';
import { useUIState } from '../../contexts/UIStateContext.js';
import { getToolGroupBorderAppearance } from '../../utils/borderStyles.js';
@@ -59,7 +60,8 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
if (
isLowErrorVerbosity &&
t.status === CoreToolCallStatus.Error &&
!t.isClientInitiated
!t.isClientInitiated &&
t.errorType !== ToolErrorType.POLICY_VIOLATION
) {
return false;
}
+4
View File
@@ -10,6 +10,7 @@ import {
type ToolResultDisplay,
debugLogger,
CoreToolCallStatus,
type ToolErrorType,
} from '@google/gemini-cli-core';
import {
type HistoryItemToolGroup,
@@ -63,6 +64,7 @@ export function mapToDisplay(
let progressMessage: string | undefined = undefined;
let progress: number | undefined = undefined;
let progressTotal: number | undefined = undefined;
let errorType: ToolErrorType | undefined = undefined;
switch (call.status) {
case CoreToolCallStatus.Success:
@@ -72,6 +74,7 @@ export function mapToDisplay(
case CoreToolCallStatus.Error:
case CoreToolCallStatus.Cancelled:
resultDisplay = call.response.resultDisplay;
errorType = call.response.errorType;
break;
case CoreToolCallStatus.AwaitingApproval:
correlationId = call.correlationId;
@@ -114,6 +117,7 @@ export function mapToDisplay(
progressTotal,
approvalMode: call.approvalMode,
originalRequestName: call.request.originalRequestName,
errorType,
};
});
+2
View File
@@ -16,6 +16,7 @@ import {
type AgentDefinition,
type ApprovalMode,
type Kind,
type ToolErrorType,
CoreToolCallStatus,
checkExhaustive,
} from '@google/gemini-cli-core';
@@ -117,6 +118,7 @@ export interface IndividualToolCallDisplay {
originalRequestName?: string;
progress?: number;
progressTotal?: number;
errorType?: ToolErrorType;
}
export interface CompressionProps {