Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ func (e *CommandCustodianExecutor) Execute(ctx context.Context, req CustodianExe
if err != nil {
result.Err = fmt.Errorf("custodian execution failed: %w", err)
result.Errors = append(result.Errors, result.Err.Error())
if result.Stderr != "" {
result.Errors = append(result.Errors, result.Stderr)
}
Comment on lines 261 to +266

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces new behavior (stderr is added to result.Errors when cmd.Run() fails), but there is no test exercising the failure path with non-empty stderr to ensure it’s included (and to lock in expectations around formatting/truncation). Please add a unit test in the existing TestCommandCustodianExecutor suite for a script that exits non-zero and writes to stderr.

Copilot uses AI. Check for mistakes.
Comment on lines +264 to +266

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appending raw result.Stderr into result.Errors will duplicate stderr in the final payload (Execution.Stderr is already populated) and will also cause the warning log at the end of Execute to emit the full stderr content under the errors field. This can significantly bloat logs/payloads and may include newlines or sensitive data. Consider keeping Errors for discrete error messages and instead logging stderr separately (ideally trimmed and length-capped), or only adding a summarized/truncated stderr entry to Errors.

Copilot uses AI. Check for mistakes.
}
if runErr := runCtx.Err(); runErr != nil {
// Avoid duplicating context timeout/cancel errors when cmd.Run already
Expand Down
Loading