fix: properly use systemMessage for hooks in UI (#16250)

This commit is contained in:
Jack Wotherspoon
2026-01-09 15:47:14 -05:00
committed by GitHub
parent 9d187e041c
commit c7d17dda49
6 changed files with 88 additions and 19 deletions
+2 -2
View File
@@ -349,7 +349,7 @@ export async function runNonInteractive({
} else if (event.type === GeminiEventType.Error) {
throw event.value.error;
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
const stopMessage = `Agent execution stopped: ${event.value.reason}`;
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
if (config.getOutputFormat() === OutputFormat.TEXT) {
process.stderr.write(`${stopMessage}\n`);
}
@@ -369,7 +369,7 @@ export async function runNonInteractive({
}
return;
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
const blockMessage = `Agent execution blocked: ${event.value.reason}`;
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
if (config.getOutputFormat() === OutputFormat.TEXT) {
process.stderr.write(`[WARNING] ${blockMessage}\n`);
}