Skip to content

Refactor enclave MCP service into focused executor modules - #11704

Merged
lpcox merged 3 commits into
mainfrom
copilot/refactor-enclave-mcp-service
Nov 17, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/refactor-enclave-mcp-service

Conversation

@lpcox

@lpcox lpcox commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

buildEnclaveMcpService mixed runtime validation, environment assembly, and security-sensitive service construction. This refactor separates those responsibilities, reducing the main module from 619 to 339 lines.

  • Topology: Extract executor validation and mixed-runtime restrictions.
  • Script service: Isolate image resolution, resource settings, and dependency wiring.
  • Agent service: Isolate image construction, dedicated proxy credential filtering, and agent environment assembly.
  • Compatibility: Retain server mount assembly, existing public exports, and enclaveMcpServiceTestHelpers; pass shared assembly state explicitly.

@lpcox lpcox changed the title [WIP] Refactor buildEnclaveMcpService into focused modules Refactor enclave MCP service into focused executor modules Nov 16, 2026
@lpcox
lpcox marked this pull request as ready for review November 16, 2026 21:50
Copilot AI adaptive review requested due to automatic review settings November 16, 2026 21:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Cloud Hypervisor workflow’s stale path filter skips changes limited to the extracted modules, and its deterministic test list omits the new topology and script tests.

1 open issue
What changed in this PR

Refactors enclave MCP service construction into focused modules, leaving the main service responsible for assembly while preserving existing exports and test helpers.

Changes:

  • Extract executor validation and runtime compatibility checks.
  • Separate script setup from agent image, proxy, and environment construction.
  • Add focused tests for extracted modules and shared assembly behavior.
File Description
src/​services/​enclave-mcp-service.ts Delegate executor construction while retaining server assembly and compatibility exports.
src/​services/​enclave-mcp-service.test.ts Verify helper exports and combined executor contributions.
src/​services/​enclave-mcp-script-service.ts Isolate script image setup, resource settings, and dependencies.
src/​services/​enclave-mcp-script-service.test.ts Cover script runtime branches and preservation of shared state.
src/​services/​enclave-mcp-executor-topology.ts Centralize executor validation and runtime restrictions.
src/​services/​enclave-mcp-executor-topology.test.ts Cover runtime combinations, disabled roles, and validation failures.
src/​services/​enclave-mcp-agent-service.ts Isolate agent image setup, proxy credential filtering, and environment assembly.

Review effort: Max (adaptive)

Comment on lines +43 to +44
if (cloudHypervisorExecutor && containerExecutor) {
throw new Error('Cloud Hypervisor enclaves cannot be mixed with container enclave runtimes');
@lpcox

lpcox commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Updated the workflow filter and deterministic test list in 20cbeb7.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@lpcox
lpcox merged commit 2e986e7 into main Nov 17, 2026
44 of 46 checks passed
@lpcox
lpcox deleted the copilot/refactor-enclave-mcp-service branch November 17, 2026 00:07
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.

[Refactoring] Split src/services/enclave-mcp-service.ts buildEnclaveMcpService into focused modules

3 participants