From c15049446fe3fbaf798b6920abaf2dc1069d27bd Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Thu, 22 Jan 2026 01:00:58 +0000 Subject: [PATCH] Improve logging for failed bash --- entry | 7 ++++++- mcp/bash.ts | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/entry b/entry index 76093f4..76988f0 100755 --- a/entry +++ b/entry @@ -119302,9 +119302,14 @@ ${stderr}` : stderr : stdout; if (timedOut) output = output ? `${output} [timed out after ${timeout}ms]` : `[timed out after ${timeout}ms]`; + const finalExitCode = exitCode ?? (timedOut ? 124 : -1); + if (finalExitCode !== 0) { + log.error(`bash command failed with exit code ${finalExitCode}: ${params.command}`); + if (output) log.error(`output: ${output.trim()}`); + } return { output: output.trim(), - exit_code: exitCode ?? (timedOut ? 124 : -1), + exit_code: finalExitCode, timed_out: timedOut }; }) diff --git a/mcp/bash.ts b/mcp/bash.ts index 3bdc077..740949b 100644 --- a/mcp/bash.ts +++ b/mcp/bash.ts @@ -3,6 +3,7 @@ import { randomUUID } from "node:crypto"; import { closeSync, openSync, writeFileSync } from "node:fs"; import { join } from "node:path"; import { type } from "arktype"; +import { log } from "../utils/log.ts"; import type { ToolContext } from "./server.ts"; import { execute, tool } from "./shared.ts"; @@ -174,9 +175,15 @@ Use this tool to: ? `${output}\n[timed out after ${timeout}ms]` : `[timed out after ${timeout}ms]`; + const finalExitCode = exitCode ?? (timedOut ? 124 : -1); + if (finalExitCode !== 0) { + log.error(`bash command failed with exit code ${finalExitCode}: ${params.command}`); + if (output) log.error(`output: ${output.trim()}`); + } + return { output: output.trim(), - exit_code: exitCode ?? (timedOut ? 124 : -1), + exit_code: finalExitCode, timed_out: timedOut, }; }),