Skip to content

Add intelligent diagnostic agent for model selection errors#1

Draft
tdevere with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-model-selection-error
Draft

Add intelligent diagnostic agent for model selection errors#1
tdevere with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-model-selection-error

Conversation

Copilot AI commented Feb 13, 2026

Copy link
Copy Markdown

Implements automatic detection and repair of model selection errors caused by outdated CLI versions. When a user specifies an invalid model (e.g., newer model not yet recognized), the agent detects the error, checks for CLI updates, and optionally applies them.

Implementation

DiagnosticAgent Class

  • Monitors stderr/stdout with regex patterns for model selection errors
  • Checks npm for available CLI updates via npm view @github/copilot version
  • Validates config with defaults: enabled: true, autoUpdate: false, autoRepair: true
  • Limits repair attempts to 3 to prevent loops

Integration

  • Added handleDiagnosticCheck() method to CopilotAutoWrapper for shared error detection
  • Invoked on both stdout and stderr data events
  • Displays diagnostic summary on process exit

Configuration

// CLI flags
copilot-auto --auto-update "task"
copilot-auto --disable-diagnostics "task"

// Environment
export COPILOT_AUTO_UPDATE=1

// Config file
{
  "diagnostics": {
    "enabled": true,
    "autoUpdate": false,  // Requires explicit opt-in
    "autoRepair": true
  }
}

Safety Considerations

  • Auto-update disabled by default, requires explicit --auto-update flag
  • Package name validated before executing update command
  • Enhanced error messages for common npm failures (not found, network issues)
  • All configuration values validated with type checks

Error Detection Patterns

/option\s+'--model[^']*'\s+is\s+invalid/i
/unknown\s+model[:\s]+['"]?([^'".\s]+)['"]?/i
/model\s+['"]?([^'".\s]+)['"]?\s+not\s+found/i

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits February 13, 2026 21:35
… errors

Co-authored-by: tdevere <24923679+tdevere@users.noreply.github.com>
Co-authored-by: tdevere <24923679+tdevere@users.noreply.github.com>
Co-authored-by: tdevere <24923679+tdevere@users.noreply.github.com>
… reduce duplication

Co-authored-by: tdevere <24923679+tdevere@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix model selection error in CLI tool Add intelligent diagnostic agent for model selection errors Feb 13, 2026
Copilot AI requested a review from tdevere February 13, 2026 21:43
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