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

Fixes #150
This commit is contained in:
ben
2026-02-27 10:05:58 +08:00
committed by GitHub
parent a39bf72bc2
commit b204ca94e2
3 changed files with 112 additions and 17 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())