From 675ed30ba003a67daede401cdb3679f14c6707c5 Mon Sep 17 00:00:00 2001 From: Gavriel Cohen Date: Sat, 7 Feb 2026 00:17:46 +0200 Subject: [PATCH] fix: improve container error logging to include full stdout/stderr Always log detailed input/output/stderr on error (not just in verbose mode), and stop truncating stderr/stdout in structured log fields. Co-Authored-By: Claude Opus 4.6 --- src/container-runner.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/container-runner.ts b/src/container-runner.ts index 2bad7ed..eaf3fce 100644 --- a/src/container-runner.ts +++ b/src/container-runner.ts @@ -339,7 +339,9 @@ export async function runContainerAgent( ``, ]; - if (isVerbose) { + const isError = code !== 0; + + if (isVerbose || isError) { logLines.push( `=== Input ===`, JSON.stringify(input, null, 2), @@ -373,14 +375,6 @@ export async function runContainerAgent( .join('\n'), ``, ); - - if (code !== 0) { - logLines.push( - `=== Stderr (last 500 chars) ===`, - stderr.slice(-500), - ``, - ); - } } fs.writeFileSync(logFile, logLines.join('\n')); @@ -392,7 +386,8 @@ export async function runContainerAgent( group: group.name, code, duration, - stderr: stderr.slice(-500), + stderr, + stdout, logFile, }, 'Container exited with error', @@ -439,7 +434,8 @@ export async function runContainerAgent( logger.error( { group: group.name, - stdout: stdout.slice(-500), + stdout, + stderr, error: err, }, 'Failed to parse container output',