Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Migrates generate_git_patch.cjs from synchronous execSync to asynchronous execution for better performance and error handling.

Changes Made

  • generate_git_patch.cjs: Converted from execSync to async execution using a dual-context approach that detects the runtime environment
  • safe_outputs_handlers.cjs: Updated createPullRequestHandler and pushToPullRequestBranchHandler to be async functions
  • generate_git_patch.test.cjs: Updated all test cases to await async function calls

Technical Details

The implementation uses a runtime detection pattern to support both execution contexts:

  • In github-script context: Uses the global exec.getExecOutput API provided by actions/github-script
  • In MCP server context: Falls back to promisified child_process.exec

This dual-context approach ensures the code works seamlessly in both GitHub Actions workflows (via github-script) and MCP server environments without requiring package imports that aren't available at runtime.

Testing

  • ✅ All 8 unit tests passing
  • ✅ JavaScript formatting validated
  • ✅ Linting passed
  • make agent-finish completed successfully
  • ✅ No breaking changes to existing functionality

The code now uses modern async/await patterns instead of blocking synchronous calls, improving performance and allowing for better error handling while maintaining compatibility across different runtime environments.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot keep working

@pelikhan
Copy link
Contributor

@copilot keep working

…ests

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot exec is a builtin object to actions/github-script. Do not import

…me compatibility

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 10, 2026

@copilot keep working

Completed migration from execSync to promisified exec for async execution. All tests and linting passing. Commit: 2f3a7fe

Copilot AI changed the title [WIP] Update process execution method in generate_git_patch.cjs Replace execSync with async exec in generate_git_patch.cjs Feb 10, 2026
…process

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 10, 2026

@copilot exec is a builtin object to actions/github-script. Do not import

Updated to use exec from github-script global when available, with fallback to child_process.exec for MCP server context. Commit: 8bbeccd

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