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 <noreply@anthropic.com>
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user