fix(coding-agent/modes): added checks to skip writing error messages to

- Added checks to skip writing error messages to stderr when stopReason is 'error' or 'aborted', as these cases already handle error output separately.
- This prevents duplicate error reporting in print mode when the assistant encounters terminal error conditions.
This commit is contained in:
can1357
2026-04-26 03:44:56 +02:00
parent 9f61a85d73
commit cfaee4c0dc
2 changed files with 6 additions and 1 deletions
@@ -161,7 +161,11 @@ export async function runPrintMode(session: AgentSession, options: PrintModeOpti
}
}
if (assistantMsg.errorMessage) {
if (
assistantMsg.errorMessage &&
assistantMsg.stopReason !== "error" &&
assistantMsg.stopReason !== "aborted"
) {
process.stderr.write(`${sanitizeText(assistantMsg.errorMessage)}\n`);
}