Skip to content

Load enclave Copilot native addons from a sealed image runtime - #10940

Merged
lpcox merged 5 commits into
mainfrom
copilot/fix-docker-agent-enclave-native-addon
Nov 1, 2026
Merged

lpcox merged 5 commits into
mainfrom
copilot/fix-docker-agent-enclave-native-addon

Conversation

Copilot AI commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Copilot 1.0.77 extracts native addons into invocation HOME, conflicting with Docker’s deliberately noexec writable storage and likely causing the reported mapping failure.

  • Immutable runtime: Extract the pinned distribution during image build, seal ownership and permissions, and select it through the verified loader-supported COPILOT_CLI_DIST_DIR.
  • Backend consistency: Configure the runtime path in both images and Cloud Hypervisor’s explicit guest environment.
  • Isolation preserved: Keep writable /agent and /tmp noexec; leave runtime security controls unchanged.
  • Regression coverage: Add real pinned Copilot startup under production mounts and security settings, plus checks that trusted addon mappings succeed while identical writable copies receive EPERM.

Copilot AI changed the title [WIP] Fix Docker agent enclave native addon mapping issue Load enclave Copilot native addons from a sealed image runtime Nov 1, 2026
Copilot AI requested a review from lpcox November 1, 2026 00:49
@lpcox
lpcox marked this pull request as ready for review November 1, 2026 00:53
Copilot AI adaptive review requested due to automatic review settings November 1, 2026 00:53

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

Cleanup can mask container startup errors and leave privileged test resources behind, while post-copy permission sealing duplicates image contents, increasing image size and uncached pull time.

2 open issues
What changed in this PR

Moves enclave Copilot native addons into a sealed image runtime to address #10939 without relaxing Docker’s writable-storage noexec restrictions.

Changes:

  • Extract and seal the pinned Copilot distribution during image builds.
  • Configure the runtime path for Docker and Cloud Hypervisor, including the explicit guest environment.
  • Add native-loading regression checks and document the runtime layout.
File Description
tests/​integration/​enclave-copilot-native-load.test.ts Adds opt-in Copilot startup and executable-mapping checks under production restrictions.
src/​enclave/​image-layout.test.ts Checks runtime extraction, selection, and sealing commands.
src/​cloud-hypervisor/​host-enclave-executor.test.ts Checks the runtime path in the guest environment.
src/​cloud-hypervisor/​enclave-invocation-staging.ts Passes the sealed runtime path to the guest.
docs/​enclaves-architecture.md Documents the immutable runtime and writable-storage constraints.
containers/​enclave/​Dockerfile Extracts and seals Copilot’s runtime and configures its loader path.
containers/​enclave/​agent-executor/​enclave-runner-spec.js Updates the /agent storage description in a comment.
containers/​cloud-hypervisor/​Dockerfile Configures and seals the copied Copilot runtime.

Review effort: Max (auto)

Comment thread containers/enclave/Dockerfile Outdated
Comment on lines +70 to +71
&& chown -R 0:0 /usr/local/lib/node_modules/@github/copilot \
&& chmod -R a+rX,a-w /usr/local/lib/node_modules/@github/copilot \
Ensure container removal only if it exists.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

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

@lpcox

lpcox commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-10940 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 3319a44

Copilot AI commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed in f27f2ed: the Copilot runtime is sealed in the build stage before copying, and cleanup now verifies container absence before releasing storage while still attempting remaining safe cleanup after startup errors.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.58% 93.58% ➡️ +0.00%
Statements 92.10% 92.10% ➡️ +0.00%
Functions 91.32% 91.32% ➡️ +0.00%
Branches 86.17% 86.17% ➡️ +0.00%

Coverage comparison generated by scripts/ci/compare-coverage.ts

@lpcox

lpcox commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Copilot AI commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix this failing ci check. make sure 'npm test' has no failures
https://github.com/github/gh-aw-firewall/actions/runs/41260756590/job/124714675396?pr=10940

Fixed in 140075e: the image-layout assertions now match the current build stages, and the vulnerable adm-zip copy is replaced after Copilot extracts its runtime. npm test passes (11,377 passed, 67 skipped); the updated commit will rerun the CI checks.

@lpcox
lpcox merged commit bcfbba5 into main Nov 1, 2026
45 of 46 checks passed
@lpcox
lpcox deleted the copilot/fix-docker-agent-enclave-native-addon branch November 1, 2026 06:26
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.

Docker agent enclave: Copilot native addon fails to map from noexec /agent cache (v0.29.4)

3 participants