Extract duplicate custom engine step handling into shared helper functions #1804
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.
Problem
Multiple workflow engine implementations contained duplicate code for handling custom steps and custom MCP tool configurations. The duplication existed across 4 engine files (
copilot_engine.go,codex_engine.go,claude_engine.go,custom_engine.go) and created maintenance overhead:These duplicate blocks had to be kept in sync manually, increasing the risk of inconsistent fixes and making future changes more error-prone.
Solution
Created two shared helper functions in
pkg/workflow/engine_shared_helpers.go:1.
InjectCustomEngineSteps()Extracts the common pattern for processing custom steps from engine configuration:
2.
HandleCustomMCPToolInSwitch()Extracts the common pattern for handling custom MCP tools in switch statement default cases:
Impact
Testing
make agent-finish- all 64 workflows compile correctlyFixes #123
Original prompt
Fixes #1800
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.