-
Notifications
You must be signed in to change notification settings - Fork 306
Fix error messages not shown in gh aw compile output #14901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -344,14 +344,15 @@ func handleFileDeleted(mdFile string, verbose bool) { | |||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| // trackWorkflowFailure adds a workflow failure to the compilation statistics | ||||||||||||||||||||||||||||||||||||||||||||||||
| func trackWorkflowFailure(stats *CompilationStats, workflowPath string, errorCount int) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| func trackWorkflowFailure(stats *CompilationStats, workflowPath string, errorCount int, errorMessages []string) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| // Add to FailedWorkflows for backward compatibility | ||||||||||||||||||||||||||||||||||||||||||||||||
| stats.FailedWorkflows = append(stats.FailedWorkflows, filepath.Base(workflowPath)) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| // Add detailed failure information | ||||||||||||||||||||||||||||||||||||||||||||||||
| stats.FailureDetails = append(stats.FailureDetails, WorkflowFailure{ | ||||||||||||||||||||||||||||||||||||||||||||||||
| Path: workflowPath, | ||||||||||||||||||||||||||||||||||||||||||||||||
| ErrorCount: errorCount, | ||||||||||||||||||||||||||||||||||||||||||||||||
| Path: workflowPath, | ||||||||||||||||||||||||||||||||||||||||||||||||
| ErrorCount: errorCount, | ||||||||||||||||||||||||||||||||||||||||||||||||
| ErrorMessages: errorMessages, | ||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -367,15 +368,14 @@ func printCompilationSummary(stats *CompilationStats) { | |||||||||||||||||||||||||||||||||||||||||||||||
| // Use different formatting based on whether there were errors | ||||||||||||||||||||||||||||||||||||||||||||||||
| if stats.Errors > 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||
| fmt.Fprintln(os.Stderr, console.FormatErrorMessage(summary)) | ||||||||||||||||||||||||||||||||||||||||||||||||
| // List the failed workflows with their error counts | ||||||||||||||||||||||||||||||||||||||||||||||||
| // Display actual error messages from each failed workflow | ||||||||||||||||||||||||||||||||||||||||||||||||
| // Error messages already include workflow path in format: file:line:col: error: message | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
| // Error messages already include workflow path in format: file:line:col: error: message | |
| // Error messages may already include workflow path/position (e.g., "file:line:col: error: message"). | |
| // Callers are responsible for adding path/position context when available. |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printCompilationSummary will print nothing for failures that have FailureDetails entries but an empty ErrorMessages slice (e.g., if validation produced zero messages or a caller passes nil/empty). Since the else if len(stats.FailedWorkflows) > 0 fallback won’t run when FailureDetails is non-empty, users can lose all indication of which workflows failed. Add an in-loop fallback when len(failure.ErrorMessages)==0 (e.g., print failure.Path and failure.ErrorCount, or a generic “failed workflow” line) so failures are still visible even without messages.
| for _, errMsg := range failure.ErrorMessages { | |
| fmt.Fprintln(os.Stderr, errMsg) | |
| if len(failure.ErrorMessages) > 0 { | |
| for _, errMsg := range failure.ErrorMessages { | |
| fmt.Fprintln(os.Stderr, errMsg) | |
| } | |
| } else { | |
| // Fallback when there are no individual error messages for this failure | |
| if failure.Path != "" { | |
| fmt.Fprintln( | |
| os.Stderr, | |
| console.FormatErrorMessage( | |
| fmt.Sprintf("Failed workflow %s (%d error(s))", failure.Path, failure.ErrorCount), | |
| ), | |
| ) | |
| } else { | |
| fmt.Fprintln( | |
| os.Stderr, | |
| console.FormatErrorMessage( | |
| fmt.Sprintf("Failed workflow (%d error(s))", failure.ErrorCount), | |
| ), | |
| ) | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,7 +80,7 @@ func compileSpecificFiles( | |
| errorMessages = append(errorMessages, err.Error()) | ||
| errorCount++ | ||
| stats.Errors++ | ||
| trackWorkflowFailure(stats, markdownFile, 1) | ||
| trackWorkflowFailure(stats, markdownFile, 1, []string{err.Error()}) | ||
| result.Valid = false | ||
| result.Errors = append(result.Errors, CompileValidationError{ | ||
| Type: "resolution_error", | ||
|
|
@@ -104,8 +104,17 @@ func compileSpecificFiles( | |
| if !fileResult.success { | ||
| errorCount++ | ||
| stats.Errors++ | ||
| trackWorkflowFailure(stats, resolvedFile, 1) | ||
| errorMessages = append(errorMessages, fileResult.validationResult.Errors[0].Message) | ||
| // Collect error messages from validation result for display in summary | ||
| var errMsgs []string | ||
| for _, verr := range fileResult.validationResult.Errors { | ||
| errMsgs = append(errMsgs, verr.Message) | ||
| } | ||
| trackWorkflowFailure(stats, resolvedFile, 1, errMsgs) | ||
|
Comment on lines
+107
to
+112
|
||
| // Only append first error to errorMessages for the return error value | ||
| // (all errors are already displayed in the summary via printCompilationSummary) | ||
| if len(fileResult.validationResult.Errors) > 0 { | ||
| errorMessages = append(errorMessages, fileResult.validationResult.Errors[0].Message) | ||
| } | ||
| } else { | ||
| compiledCount++ | ||
| workflowDataList = append(workflowDataList, fileResult.workflowData) | ||
|
|
@@ -259,7 +268,12 @@ func compileAllFilesInDirectory( | |
| if !fileResult.success { | ||
| errorCount++ | ||
| stats.Errors++ | ||
| trackWorkflowFailure(stats, file, 1) | ||
| // Collect error messages from validation result | ||
| var errMsgs []string | ||
| for _, verr := range fileResult.validationResult.Errors { | ||
| errMsgs = append(errMsgs, verr.Message) | ||
| } | ||
| trackWorkflowFailure(stats, file, 1, errMsgs) | ||
|
Comment on lines
+271
to
+276
|
||
| } else { | ||
| successCount++ | ||
| workflowDataList = append(workflowDataList, fileResult.workflowData) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making
errorMessagesvariadic (errorMessages ...string) instead of[]string. This makes call sites clearer for the common single-message case and avoids forcing callers to allocate slices like[]string{err.Error()}just to pass one message.