-
Notifications
You must be signed in to change notification settings - Fork 28
[WIP] Refactor CopilotEngine to use unified MCPConfigRenderer #4062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Update unified renderer to use MCP passthrough syntax for Copilot
- Copilot now uses "Bearer \${GITHUB_PERSONAL_ACCESS_TOKEN}" instead of shell variable
- Fixes TestGitHubRemoteModeConfiguration test failures
- All tests now passing
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the CopilotEngine to use the unified MCPConfigRenderer, eliminating duplicate MCP rendering code. The key change involves replacing four engine-specific rendering functions with calls to a unified renderer configured with Copilot-specific options, and implementing engine-aware authentication header syntax for remote GitHub MCP configurations.
Key Changes:
- Replaced duplicated Copilot MCP rendering functions with unified renderer calls
- Added engine-aware authentication header logic in unified renderer
- Updated tests to use unified renderer directly instead of removed engine methods
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/copilot_engine.go | Refactored to use unified renderer with lambda functions, removed ~60 lines of duplicate code |
| pkg/workflow/mcp_renderer.go | Added conditional authentication header syntax based on IncludeCopilotFields option |
| pkg/workflow/copilot_engine_test.go | Updated tests to create and use unified renderer directly |
| pkg/workflow/copilot_github_mcp_test.go | Updated tests to create and use unified renderer directly |
| pkg/workflow/github_toolset_test.go | Updated tests to create and use unified renderer directly |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot merge main and lint |
…lot-engine-rendering
- Merged latest changes from main branch - Ran formatter to fix code formatting - All tests passing ✅ - Linter passing ✅ - Build successful ✅ Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot recompile and make sure generate lock file did not change |
✅ Recompiled all workflows - no lock files changed.
|
Refactor CopilotEngine to use unified MCPConfigRenderer
Objective: Replace duplicated MCP rendering functions in
copilot_engine.gowith unified renderer calls.Plan Checklist
RenderMCPConfigmethod incopilot_engine.goto create renderer with Copilot optionsrenderGitHubCopilotMCPConfigwith unified renderer callrenderPlaywrightCopilotMCPConfigwith unified renderer callrenderSafeOutputsCopilotMCPConfigwith unified renderer callrenderAgenticWorkflowsCopilotMCPConfigwith unified renderer callImplementation Summary
Following the Claude engine pattern (from
claude_mcp.go):createRendererclosure inRenderMCPConfigwith Copilot-specific options (IncludeCopilotFields: true)MCPToolRendererswith lambda functions that call the unified rendererChanges Made
Files Modified:
pkg/workflow/copilot_engine.go- Refactored to use unified renderer, removed ~60 lines of duplicate codepkg/workflow/mcp_renderer.go- Added logic to use correct auth syntax based on engine (Copilot vs others)pkg/workflow/copilot_engine_test.go- Updated tests to use unified rendererpkg/workflow/copilot_github_mcp_test.go- Updated tests to use unified rendererpkg/workflow/github_toolset_test.go- Updated tests to use unified rendererKey Differences:
"Bearer \${GITHUB_PERSONAL_ACCESS_TOKEN}""Bearer $GITHUB_MCP_SERVER_TOKEN"IncludeCopilotFieldsoptionAll tests passing ✅
Build successful ✅
Linter passing ✅
Merged with main ✅
Original prompt
💡 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.