Refactor CodingAgentEngine using Interface Segregation Principle #11607
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
CodingAgentEngineinterface contained 18 methods mixing unrelated concerns (identity, capabilities, workflow execution, MCP configuration, logging, security), forcing all implementations to inherit the entire surface area.Changes
Interface Segregation
Engine: Core identity (4 methods)CapabilityProvider: Feature detection (6 methods)WorkflowExecutor: Workflow compilation (3 methods)MCPConfigProvider: MCP configuration (1 method)LogParser: Log analysis (3 methods)SecurityProvider: Security features (2 methods)CodingAgentEngineremains as composite interface (backward compatible)Usage Pattern
Implementation
BaseEnginewhich provides default implementationsBug Fix
CustomEngine.GetRequiredSecretNames()now returns empty slice instead of nilTesting
Original prompt
This section details on the original issue you should resolve
<issue_title>[Code Quality] Refactor CodingAgentEngine interface using Interface Segregation Principle</issue_title>
<issue_description>## Description
The
CodingAgentEngineinterface contains 18 methods that mix multiple unrelated concerns (metadata, capabilities, workflow, rendering, parsing, security), violating the Interface Segregation Principle and Single Responsibility Principle. This forces all implementations to implement or inherit all methods, making testing difficult and adding new engine types harder.Background
Identified during Sergo analysis on 2026-01-23 (discussion #11477). The interface has grown from 16 methods to 18 methods (+12.5%) in just 5 days, indicating continued bloat.
Current state: Single monolithic interface with 18 methods
Trend: Growing worse (16 methods on 2026-01-18 → 18 methods on 2026-01-23)
Impact: Tight coupling, difficult testing, hard to add new engines
Files Affected
pkg/workflow/agentic_engine.go:19-81- Interface definitionpkg/workflow/claude_engine.go:14-16- ClaudeEngine implementationpkg/workflow/copilot_engine.go:25-27- CopilotEngine implementationpkg/workflow/custom_engine.go- CustomEngine implementationpkg/workflow/codex_engine.go- CodexEngine implementationSuggested Changes
Split into focused interfaces using composition:
Implementation Steps
Success Criteria
make agent-finishpassesPriority
High - Architectural improvement that prevents further bloat
Estimated effort: Large (4-6 hours, affects 90+ files)
Source
Extracted from Sergo Interface Segregation analysis discussion githubnext/gh-aw#11477
Analysis quote:
💡 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.