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(
|
logLines.push(
|
||||||
`=== Input ===`,
|
`=== Input ===`,
|
||||||
JSON.stringify(input, null, 2),
|
JSON.stringify(input, null, 2),
|
||||||
@@ -373,14 +375,6 @@ export async function runContainerAgent(
|
|||||||
.join('\n'),
|
.join('\n'),
|
||||||
``,
|
``,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (code !== 0) {
|
|
||||||
logLines.push(
|
|
||||||
`=== Stderr (last 500 chars) ===`,
|
|
||||||
stderr.slice(-500),
|
|
||||||
``,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFileSync(logFile, logLines.join('\n'));
|
fs.writeFileSync(logFile, logLines.join('\n'));
|
||||||
@@ -392,7 +386,8 @@ export async function runContainerAgent(
|
|||||||
group: group.name,
|
group: group.name,
|
||||||
code,
|
code,
|
||||||
duration,
|
duration,
|
||||||
stderr: stderr.slice(-500),
|
stderr,
|
||||||
|
stdout,
|
||||||
logFile,
|
logFile,
|
||||||
},
|
},
|
||||||
'Container exited with error',
|
'Container exited with error',
|
||||||
@@ -439,7 +434,8 @@ export async function runContainerAgent(
|
|||||||
logger.error(
|
logger.error(
|
||||||
{
|
{
|
||||||
group: group.name,
|
group: group.name,
|
||||||
stdout: stdout.slice(-500),
|
stdout,
|
||||||
|
stderr,
|
||||||
error: err,
|
error: err,
|
||||||
},
|
},
|
||||||
'Failed to parse container output',
|
'Failed to parse container output',
|
||||||
|
|||||||
Reference in New Issue
Block a user