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

@@ -198,10 +198,9 @@ func runWithLoggerAndCleanup(fn func() int) (exitCode int) {
for _, entry := range entries {
fmt.Fprintln(os.Stderr, entry)
}
fmt.Fprintf(os.Stderr, "Log file: %s (deleted)\n", logger.Path())
fmt.Fprintf(os.Stderr, "Log file: %s\n", logger.Path())
}
}
_ = logger.RemoveLogFile()
}()
defer runCleanupHook()
@@ -689,6 +688,13 @@ func runSingleMode(cfg *Config, name string) int {
result := runTaskFn(taskSpec, false, cfg.Timeout)
if result.ExitCode != 0 {
// Surface any parsed backend output even on non-zero exit to avoid "(no output)" in tool runners.
if strings.TrimSpace(result.Message) != "" {
fmt.Println(result.Message)
if result.SessionID != "" {
fmt.Printf("\n---\nSESSION_ID: %s\n", result.SessionID)
}
}
return result.ExitCode
}