Skip to content

Add error/warning summary to logs command with pattern IDs#2212

Merged
pelikhan merged 5 commits intomainfrom
copilot/update-logs-command-summary
Oct 23, 2025
Merged

Add error/warning summary to logs command with pattern IDs#2212
pelikhan merged 5 commits intomainfrom
copilot/update-logs-command-summary

Conversation

Copy link
Contributor

Copilot AI commented Oct 23, 2025

Overview

Adds error and warning summary tables to the gh aw logs command, sorted by frequency of occurrence. Each summary entry includes the error message, occurrence count, pattern ID, engine name, and a link to a sample run where the error occurred.

Changes

Error Pattern ID System

Added a unique ID field to the ErrorPattern struct to identify each error pattern:

type ErrorPattern struct {
    ID           string `json:"id"`           // Unique identifier
    Pattern      string `json:"pattern"`
    LevelGroup   int    `json:"level_group"`
    MessageGroup int    `json:"message_group"`
    Description  string `json:"description"`
    // ...
}

All error patterns now have unique IDs:

  • Common patterns: common-gh-actions-error, common-generic-warning, etc.
  • Codex-specific: codex-rust-error, codex-rust-warning

Enhanced Error Tracking

The LogError struct now includes a PatternID field to track which pattern matched each error, enabling aggregation and analysis by pattern type.

Summary Tables

Added two new summary tables to the logs output:

⚠️ Errors Summary

Error/Warning Occurrences Pattern ID Engine Sample Run
Authentication failed 15 common-generic-error copilot 12345

⚠️ Warnings Summary

Error/Warning Occurrences Pattern ID Engine Sample Run
Rate limit approaching 8 common-generic-warning copilot 12347

Summaries are sorted by frequency (descending) to highlight the most common issues.

JSON Output

The summaries are also available in JSON format via the --json flag:

{
  "errors_summary": [
    {
      "message": "Authentication failed",
      "count": 15,
      "pattern_id": "common-generic-error",
      "engine": "copilot",
      "run_id": 12345,
      "run_url": "https://github.com/test/repo/actions/runs/12345"
    }
  ]
}

Schema Update

Updated the error_patterns JSON schema to support the optional id field for custom error patterns defined in workflow frontmatter.

Benefits

  • Quick Issue Identification: Most frequent errors appear at the top of the summary
  • Pattern Tracking: Pattern IDs help categorize and track error types
  • Engine Comparison: See which engines produce which errors
  • Easy Investigation: Sample run links enable quick navigation to logs
  • Programmatic Access: JSON output supports automation and analysis

Testing

Added comprehensive test coverage:

  • Pattern ID uniqueness validation
  • Summary aggregation logic
  • JSON serialization
  • Struct field validation
  • Demo tests showing expected output format

All tests passing ✅

Fixes issue requesting error/warning summaries sorted by frequency with pattern IDs and run links.

Original prompt

Update the "logs" command to provide a summary of the error/warning sorted by frequency of occurrences with a link to 1 run. The table should also show the agentic engine name and error pattern id (if available).

  • update error pattern definition and assign an id to each of them
  • update error pattern schema to apport an optimal id

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

Copilot AI and others added 4 commits October 23, 2025 13:59
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update logs command to summarize errors and warnings Add error/warning summary to logs command with pattern IDs Oct 23, 2025
Copilot AI requested a review from pelikhan October 23, 2025 14:21
@pelikhan pelikhan marked this pull request as ready for review October 23, 2025 14:22
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan pelikhan merged commit 65d0f19 into main Oct 23, 2025
7 checks passed
@pelikhan pelikhan deleted the copilot/update-logs-command-summary branch October 23, 2025 14:24
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