Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Plan: Agent-Friendly Compile Error Summary

  • Understand the current implementation
  • Identify the problem: Summary doesn't clearly list failed workflow IDs before showing detailed errors
  • Update printCompilationSummary to show failed workflow list immediately after summary line
  • Add tests to validate the new output format
  • Test manually with multiple failing workflows
  • Run make agent-finish to validate changes

Summary

Updated the compile command to provide an agent-friendly summary of failed workflows. When compilation errors occur, the output now shows:

  1. Overall summary line: ✗ Compiled X workflow(s): Y error(s), Z warning(s)
  2. Clear list of failed workflow IDs:
    ✗ Failed workflows:
      ✗ workflow1.md
      ✗ workflow2.md
    
  3. Detailed error messages for each workflow

This makes it much easier for agents (and humans) to quickly identify which workflows failed before diving into the detailed error messages.

Changes Made

  • Updated printCompilationSummary() in pkg/cli/compile_helpers.go to display failed workflow list immediately after the summary line
  • Added comprehensive unit tests in pkg/cli/compile_summary_output_test.go validating the new output format
  • Maintains backward compatibility with the existing FailedWorkflows field
  • All tests passing, code formatted and linted

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 11, 2026 16:45
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review February 11, 2026 16:50
Copilot AI review requested due to automatic review settings February 11, 2026 16:50
@pelikhan pelikhan merged commit ad5247d into main Feb 11, 2026
55 of 57 checks passed
@pelikhan pelikhan deleted the copilot/update-compile-command-summary branch February 11, 2026 16:52
Copilot AI requested a review from pelikhan February 11, 2026 16:52
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

Updates the compile command’s stderr summary so failed workflow IDs are listed immediately after the overall compilation summary line, before detailed per-workflow errors.

Changes:

  • Print a “Failed workflows” section (with workflow IDs) right after the error summary line when compilation fails.
  • Keep backward compatibility by still supporting FailedWorkflows when FailureDetails is absent.
  • Add unit tests to validate the updated output.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
pkg/cli/compile_helpers.go Prints a dedicated “Failed workflows” list (and spacing) before detailed error messages.
pkg/cli/compile_summary_output_test.go Adds tests capturing stderr to validate summary + failed workflow list output.

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

Comment on lines +115 to +126
r, w, _ := os.Pipe()
os.Stderr = w

// Call the function
printCompilationSummary(tt.stats)

// Restore stderr and capture output
w.Close()
os.Stderr = oldStderr

var buf bytes.Buffer
buf.ReadFrom(r)
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.

This test mutates the global os.Stderr, which can race with other tests (including tests in other packages) if they run in parallel. Prefer refactoring printCompilationSummary to write to an injected io.Writer (e.g., parameter or package-level writer) so tests can pass a bytes.Buffer without touching global process state; if keeping this approach, at minimum restore os.Stderr via t.Cleanup/defer, check the os.Pipe()/ReadFrom errors, and close r to avoid leaking FDs.

Suggested change
r, w, _ := os.Pipe()
os.Stderr = w
// Call the function
printCompilationSummary(tt.stats)
// Restore stderr and capture output
w.Close()
os.Stderr = oldStderr
var buf bytes.Buffer
buf.ReadFrom(r)
r, w, err := os.Pipe()
if err != nil {
t.Fatalf("failed to create pipe: %v", err)
}
os.Stderr = w
t.Cleanup(func() {
os.Stderr = oldStderr
})
// Call the function
printCompilationSummary(tt.stats)
// Restore stderr and capture output
os.Stderr = oldStderr
if err := w.Close(); err != nil {
t.Fatalf("failed to close write end of pipe: %v", err)
}
var buf bytes.Buffer
if _, err := buf.ReadFrom(r); err != nil {
t.Fatalf("failed to read from pipe: %v", err)
}
if err := r.Close(); err != nil {
t.Fatalf("failed to close read end of pipe: %v", err)
}

Copilot uses AI. Check for mistakes.
Comment on lines +129 to +134
// Check for expected content
for _, expected := range tt.expectedInOutput {
if !strings.Contains(output, expected) {
t.Errorf("Expected output to contain %q, but it didn't.\nFull output:\n%s", expected, output)
}
}
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 new behavior is specifically about ordering (failed workflow list appearing immediately after the summary line and before detailed errors), but these assertions only check presence. Add ordering assertions (e.g., using strings.Index to ensure Compiled ... occurs before Failed workflows: and that occurs before the first detailed error message) so the test will fail if the output sections are reordered.

Copilot uses AI. Check for mistakes.
fmt.Fprintln(os.Stderr, console.FormatErrorMessage("Failed workflows:"))
for _, workflow := range stats.FailedWorkflows {
fmt.Fprintf(os.Stderr, " - %s\n", workflow)
fmt.Fprintf(os.Stderr, " %s\n", workflow)
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.

In the FailedWorkflows fallback branch you print workflow as-is, but in the FailureDetails branch you print filepath.Base(failure.Path). For consistent output (and to better match the stated goal of listing workflow IDs), consider applying filepath.Base(workflow) here as well.

Suggested change
fmt.Fprintf(os.Stderr, " ✗ %s\n", workflow)
fmt.Fprintf(os.Stderr, " ✗ %s\n", filepath.Base(workflow))

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants