From fe5706885da3ebf7e6903b9d6d01a726a7351327 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 11 Nov 2025 21:09:50 +0100 Subject: [PATCH] Clean up bash output formatting - Remove "Command aborted by user" message (Aborted already shown separately) - Remove STDOUT/STDERR labels - just show output cleanly - Stderr is now separated by newline without labels - Timeout and error messages moved to end of output --- packages/coding-agent/src/tools/bash.ts | 26 +++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/packages/coding-agent/src/tools/bash.ts b/packages/coding-agent/src/tools/bash.ts index cbc3e184..a3e6630f 100644 --- a/packages/coding-agent/src/tools/bash.ts +++ b/packages/coding-agent/src/tools/bash.ts @@ -59,16 +59,30 @@ export const bashTool: AgentTool = { } if (signal?.aborted) { + let output = ""; + if (stdout) output += stdout; + if (stderr) { + if (output) output += "\n"; + output += stderr; + } resolve({ - output: `Command aborted by user\nSTDOUT: ${stdout}\nSTDERR: ${stderr}`, + output: output || "(no output)", details: undefined, }); return; } if (timedOut) { + let output = ""; + if (stdout) output += stdout; + if (stderr) { + if (output) output += "\n"; + output += stderr; + } + if (output) output += "\n\n"; + output += "Command timed out after 30 seconds"; resolve({ - output: `Command timed out after 30 seconds\nSTDOUT: ${stdout}\nSTDERR: ${stderr}`, + output, details: undefined, }); return; @@ -76,11 +90,15 @@ export const bashTool: AgentTool = { let output = ""; if (stdout) output += stdout; - if (stderr) output += stderr ? `\nSTDERR:\n${stderr}` : ""; + if (stderr) { + if (output) output += "\n"; + output += stderr; + } if (code !== 0 && code !== null) { + if (output) output += "\n\n"; resolve({ - output: `Command exited with code ${code}\n${output}`, + output: `${output}Command exited with code ${code}`, details: undefined, }); } else {