Refactor MCP update tool to call Go function directly with context support#14360
Closed
Refactor MCP update tool to call Go function directly with context support#14360
Conversation
…pport - Add context.Context parameter to UpdateWorkflowsWithExtensionCheck and downstream functions - Create context-aware versions: UpdateWorkflowsWithExtensionCheckContext, UpdateActionsContext, UpdateWorkflowsContext, RunFixContext, checkExtensionUpdateContext, createUpdatePRContext - Keep deprecated wrappers for backward compatibility - Refactor MCP update tool handler to call UpdateWorkflowsWithExtensionCheckContext directly - Add captureStderr helper function to capture console output for MCP responses - Add cancellation checks throughout the update chain - Fix linter warnings with nolint directives for deprecated wrappers Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add comprehensive tests for context cancellation handling - Test UpdateWorkflowsWithExtensionCheckContext with cancellation and timeout - Test captureStderr helper function - Test all context-aware functions: UpdateActionsContext, UpdateWorkflowsContext, RunFixContext, checkExtensionUpdateContext - All tests pass successfully Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor MCP-server command implementation of update tool
Refactor MCP update tool to call Go function directly with context support
Feb 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 MCP update tool spawned a subprocess for each invocation, adding overhead and preventing proper cancellation handling. This refactors it to call the Go function directly with full context support.
Changes
Added context-aware function chain: Created
UpdateWorkflowsWithExtensionCheckContext()and context-aware versions of all downstream functions (UpdateActionsContext,UpdateWorkflowsContext,RunFixContext,checkExtensionUpdateContext,createUpdatePRContext)Refactored MCP handler: Replaced
execCmd()subprocess spawning with direct call toUpdateWorkflowsWithExtensionCheckContext(). AddedcaptureStderr()helper to intercept console output for MCP responses.Backward compatibility: Original functions remain as deprecated wrappers calling context versions with
context.Background()Cancellation support: Added context checks at key points throughout the update chain to respect MCP request cancellation
Example
Thread Safety
captureStderr()uses proper goroutine + channel synchronizationOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.