Skip to content

Comments

Fix error messages not shown in gh aw compile output#14901

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-gh-aw-compile-errors
Feb 11, 2026
Merged

Fix error messages not shown in gh aw compile output#14901
pelikhan merged 3 commits intomainfrom
copilot/fix-gh-aw-compile-errors

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Error messages from gh aw compile were not displayed to users—only error counts and file paths were shown. Users had to set DEBUG=workflow or use --json to see what actually went wrong.

Changes

  • Add ErrorMessages []string field to WorkflowFailure struct
  • Pass error messages to trackWorkflowFailure from compile orchestration
  • Display error messages in printCompilationSummary

Before

✗ Compiled 1 workflow(s): 1 error(s), 0 warning(s)
✗ Failed workflows:
  - .github/workflows/bad-workflow.md (1 error)
✗ compilation failed

After

✗ Compiled 1 workflow(s): 1 error(s), 0 warning(s)
.github/workflows/bad-workflow.md:6:1: error: Unknown property: bad_field...
3 |   workflow_dispatch:
4 | 
5 | # Comment
6 | bad_field: value
    ^^^^^^^^^
7 | ---
✗ compilation failed

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 11, 2026 06:29
Previously, when running `gh aw compile`, users would only see the count
of errors and the workflow filenames, but not the actual error messages.
They had to use `--json` flag or set `DEBUG` environment variable to see
what went wrong.

This change:
- Adds ErrorMessages field to WorkflowFailure struct
- Updates trackWorkflowFailure to pass error messages
- Updates printCompilationSummary to display actual error messages

Fixes: Error messages are now shown in the compilation summary without
requiring DEBUG env var or --json flag.

Co-authored-by: eaftan <4733401+eaftan@users.noreply.github.com>
- Added comment clarifying that only first error is used for return value
- Added comment noting error messages include workflow path in file:line:col format

Co-authored-by: eaftan <4733401+eaftan@users.noreply.github.com>
@github-actions
Copy link
Contributor

🔍 PR Triage Results

Category: bug | Risk: low | Priority: 50/100

Scores Breakdown

  • Impact: 28/50 - Improves user experience by showing error messages, non-blocking bug fix
  • Urgency: 10/30 - Recent PR (0.2h old), CI pending, improves UX but not critical. Draft status reduces urgency
  • Quality: 12/20 - CI pending, detailed description with checklist (+5), includes tests (+3), WIP draft (-1)

📋 Recommended Action: defer

Rationale: Draft PR marked [WIP] - not ready for review until author marks ready for review.

Next Steps:

  • Wait for author to remove WIP/draft status
  • Ensure CI passes before review
  • Re-evaluate priority when marked ready

Triaged by PR Triage Agent on 2026-02-11

AI generated by PR Triage Agent

Copilot AI changed the title [WIP] Fix error messages display in gh aw compile command Fix error messages not shown in gh aw compile output Feb 11, 2026
Copilot AI requested a review from eaftan February 11, 2026 06:39
@pelikhan pelikhan marked this pull request as ready for review February 11, 2026 07:01
Copilot AI review requested due to automatic review settings February 11, 2026 07:01
@pelikhan pelikhan merged commit ab43451 into main Feb 11, 2026
165 checks passed
@pelikhan pelikhan deleted the copilot/fix-gh-aw-compile-errors branch February 11, 2026 07:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures gh aw compile surfaces the underlying validation/resolution error messages to users instead of only reporting counts and file paths.

Changes:

  • Add ErrorMessages []string to WorkflowFailure and plumb messages through compilation orchestration.
  • Update trackWorkflowFailure to store per-workflow error messages.
  • Update printCompilationSummary to print stored error messages in the error summary output.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
pkg/cli/compile_orchestration.go Collects validation error messages and passes them into failure tracking.
pkg/cli/compile_helpers.go Extends failure tracking and updates summary printing to show error messages.
pkg/cli/compile_config.go Adds ErrorMessages field to WorkflowFailure.
pkg/cli/compile_command_test.go Updates tests to validate storing/propagating error messages in tracked failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +376 to +377
for _, errMsg := range failure.ErrorMessages {
fmt.Fprintln(os.Stderr, errMsg)
Copy link

Copilot AI Feb 11, 2026

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.

Suggested change
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),
),
)
}

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The comment asserts error messages “already include workflow path…”, but at least one caller passes err.Error() directly (e.g., resolution errors), which may not include the workflow path/line/col. Either (a) adjust the comment to reflect that messages may be raw, or (b) ensure call sites consistently prefix messages with workflowPath (and location when available) before storing/printing.

Suggested change
// 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 uses AI. Check for mistakes.
Comment on lines +107 to +112
// 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)
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The “collect error messages from validation result” loop is duplicated (also in compileAllFilesInDirectory). Consider extracting a small helper (e.g., collectValidationMessages(errors []CompileValidationError) []string) to avoid repetition and keep message selection rules consistent in one place.

Copilot uses AI. Check for mistakes.
Comment on lines +271 to +276
// 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)
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

Same duplication as above—prefer reusing a shared helper for collecting verr.Message so future changes (filtering, formatting, truncation) don’t require editing multiple compilation paths.

Copilot uses AI. Check for mistakes.

// 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) {
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

Consider making errorMessages variadic (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.

Copilot uses AI. Check for mistakes.
github-actions bot added a commit that referenced this pull request Feb 11, 2026
- Document enhanced compile error messages (#14901)
- Document sandbox.agent: false option (#14888)
- Document breaking change: timeout_minutes removed (#14860)
- Update migration guide with breaking changes
- Update codemod documentation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants