fix(codeagent-wrapper): keep logs + surface parsed error output

Fixes #150
This commit is contained in:
cexll
2026-02-27 01:42:03 +08:00
parent 4c25dd8d2f
commit 2943c894d9
3 changed files with 105 additions and 16 deletions

View File

@@ -1435,6 +1435,15 @@ waitLoop:
logErrorFn(fmt.Sprintf("%s exited with status %d", commandName, code))
result.ExitCode = code
result.Error = attachStderr(fmt.Sprintf("%s exited with status %d", commandName, code))
// Preserve parsed output when the backend exits non-zero (e.g. API error with stream-json output).
result.Message = parsed.message
result.SessionID = parsed.threadID
if stdoutLogger != nil {
stdoutLogger.Flush()
}
if stderrLogger != nil {
stderrLogger.Flush()
}
return result
}
logErrorFn(commandName + " error: " + waitErr.Error())