Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 20, 2025

Overview

This PR simplifies error pattern detection across all three agentic engines (Claude, Codex, and Copilot), reducing the total number of patterns from 68 to 25 (a 63% reduction) while maintaining full error detection capabilities.

Problem

The error pattern system had grown overly complex with many redundant and non-engine-specific patterns:

  • Claude Engine: 12 patterns including 9 permission-related patterns that weren't engine-specific
  • Codex Engine: 16 patterns with 11 generic permission/authentication patterns
  • Copilot Engine: 40 patterns including many generic errors (npm, rate limit, quota, timeout, network, token, memory, etc.) that could be detected by simpler patterns

This complexity made the codebase harder to maintain and created unnecessary duplication across engines.

Solution

New Pattern Philosophy

Error patterns should focus on:

  1. Engine-specific log formats - unique timestamp formats, brackets, structured output
  2. Common error indicators - patterns shared across all engines
  3. Essential environment-specific errors - CLI indicators, shell errors specific to the execution environment

Error patterns should NOT duplicate detection of:

  • Generic permission/authentication errors
  • Network/quota/timeout errors
  • Application-specific errors

These are now caught by generic ERROR: and Error: patterns in the common pattern set.

Changes Made

Common Patterns (shared by all engines):

  • Added generic (ERROR|Error):\s+(.+) pattern
  • Added generic (WARNING|Warning):\s+(.+) pattern
  • Retained GitHub Actions workflow commands (::(error|warning|notice)::)

Claude Engine: 12 → 5 patterns (58% reduction)

  • Removed all 9 permission/authentication patterns
  • Now uses only common patterns
  • Rationale: Claude outputs structured JSON, doesn't need text log parsing

Codex Engine: 16 → 7 patterns (56% reduction)

  • Removed 11 permission/authentication patterns
  • Kept 2 Rust timestamp patterns for Codex-specific log format:
    • YYYY-MM-DDTHH:MM:SS.sssZ ERROR message
    • YYYY-MM-DDTHH:MM:SS.sssZ WARN message

Copilot Engine: 40 → 13 patterns (67% reduction)

  • Removed 31 generic patterns
  • Kept 4 timestamp patterns for Copilot CLI log format
  • Kept 4 essential CLI-specific patterns:
    • failed command indicator
    • Shell command not found errors
    • Node.js module not found errors
    • Permission denied warnings

Testing

All tests updated to reflect the new pattern philosophy and continue to pass:

  • ✅ Unit tests validate correct pattern detection
  • ✅ Integration tests verify real-world error detection
  • ✅ Pattern safety tests ensure no infinite loops
  • ✅ Linter and build succeed

Impact

  • Improved maintainability: 63% fewer patterns to maintain
  • Better organization: Clear separation between common and engine-specific patterns
  • Preserved functionality: All important errors still detected through generic patterns
  • Reduced duplication: Permission, network, and quota errors detected once in common patterns instead of per-engine
Original prompt

clear error patterns for claude, codex, copilot


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Clear error patterns for Claude, Codex, and Copilot Clear error patterns: Reduce from 68 to 25 patterns (63% reduction) Oct 20, 2025
Copilot AI requested a review from pelikhan October 20, 2025 23:30
@pelikhan pelikhan marked this pull request as ready for review October 20, 2025 23:31
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan pelikhan merged commit 8e6e899 into main Oct 20, 2025
3 checks passed
@pelikhan pelikhan deleted the copilot/clear-error-patterns-claude-codex-copilot branch October 20, 2025 23:35
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