fix(builder): separate build output from error to preserve timeout messages

When a build timed out, the timeout error was silently replaced by
truncated stderr output. Split into separate Error and Output fields
on BuildHostResult so the cause (e.g. "build timed out after 30m0s")
is always visible in logs and CLI output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 13:24:04 +01:00
parent c13914bf5a
commit 1a23847d31
3 changed files with 15 additions and 4 deletions

View File

@@ -269,10 +269,12 @@ func (b *Builder) handleBuildRequest(subject string, data []byte) {
DurationSeconds: hostDuration,
}
if !result.Success {
hostResult.Error = truncateOutput(result.Stderr, 50)
if hostResult.Error == "" && result.Error != nil {
if result.Error != nil {
hostResult.Error = result.Error.Error()
}
if result.Stderr != "" {
hostResult.Output = truncateOutput(result.Stderr, 50)
}
}
results = append(results, hostResult)
@@ -284,7 +286,7 @@ func (b *Builder) handleBuildRequest(subject string, data []byte) {
}
} else {
failed++
b.logger.Error("host build failed", "host", host, "error", hostResult.Error)
b.logger.Error("host build failed", "host", host, "error", hostResult.Error, "output", hostResult.Output)
if b.metrics != nil {
b.metrics.RecordHostBuildFailure(req.Repo, host, hostDuration)
}

View File

@@ -82,6 +82,7 @@ type BuildHostResult struct {
Host string `json:"host"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Output string `json:"output,omitempty"`
DurationSeconds float64 `json:"duration_seconds"`
}