Skip to content

feat: add enclave agent executor - #6990

Merged
lpcox merged 10 commits into
mainfrom
lpcox-enclave-agent-executor
Aug 7, 2026
Merged

feat: add enclave agent executor#6990
lpcox merged 10 commits into
mainfrom
lpcox-enclave-agent-executor

Conversation

@lpcox

@lpcox lpcox commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stack layer 3 of the greenfield MCP-based enclave migration.

  • adds static enclave_run_agent({ privateRepo, schema, prompt }) to the same private authenticated enclave MCP server as enclave_run_script
  • shares one live per-repository information-budget ledger and serialization lane across script and agent executors
  • reuses the hardened bounded-agent runner, workspace, native entrypoint, result contract, runtime proofs, labels, cleanup, and dedicated API-proxy topology
  • adds lifecycle, preflight, Compose/network, image, action digest, and release wiring
  • preserves legacy boundedQueries and boundedAgents behavior and their fail-closed conflict with unified enclaves
  • deliberately does not attach the private server to gh-aw-mcpg or expose it to the primary agent; layer 4 owns that integration

Stack

Security properties

Caller-controlled agent arguments are exactly privateRepo, schema, and prompt; additional properties are rejected. Runtime, engine, model, provider/profile, endpoints, mounts, network, tools, credentials, resource limits, system prompts, and messages remain trusted configuration.

Each invocation gets a fresh single-use enclave with an immutable read-only seed, read-only root, bounded tmpfs, fixed non-root identity, dropped capabilities, no-new-privileges, seccomp, and memory/CPU/PID/file-size/timeout bounds. The enclave joins only a dedicated internal network whose sole peer is the private dedicated API proxy. The MCP server remains networkless.

Repository-derived content reaches the configured model provider through the dedicated API proxy. Credentials remain only in that proxy and never enter MCP-server, enclave, or primary-agent state.

Validation

  • targeted Jest: 190 passed; 3 manager cases were blocked only by the local sandbox denying /var/tmp creation
  • TypeScript --noEmit: clean
  • ESLint on changed TypeScript: 0 errors
  • Node syntax checks: 9/9

npm ci could not use the configured package feed because it lacks locked typescript-eslint@8.66.0; validation used isolated temporary tooling without modifying dependency manifests.

lpcox and others added 3 commits August 6, 2026 07:33
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 5da2e8c6-bddd-4f94-84c2-862ab467e4bf
Implement stack layer 2 with an AWF-owned authenticated MCP server, unified script ledger, hardened enclave runner, lifecycle wiring, release images, and tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add the prompt-driven enclave_run_agent tool to the unified private MCP server, sharing the script executor ledger and hardened lifecycle while preserving legacy bounded executors.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7e34b0de-383c-4832-9cb7-14432b920ace
Copilot AI balanced review requested due to automatic review settings August 6, 2026 18:30

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

@github-actions

github-actions Bot commented Aug 6, 2026

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.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit d84b156

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 98.64% 98.62% 📉 -0.02%
Statements 98.50% 98.46% 📉 -0.04%
Functions 98.52% 98.36% 📉 -0.16%
Branches 94.52% 94.46% 📉 -0.06%
📁 Per-file Coverage Changes (7 files)
File Lines (Before → After) Statements (Before → After)
src/enclave/manager.ts 82.4% → 80.2% (-2.24%) 81.3% → 79.2% (-2.05%)
src/enclave/preflight.ts 100.0% → 98.8% (-1.18%) 100.0% → 98.9% (-1.06%)
src/artifact-preservation.ts 92.4% → 91.5% (-0.91%) 92.5% → 91.5% (-0.91%)
src/services/optional-services.ts 100.0% → 100.0% (+0.00%) 98.5% → 97.8% (-0.63%)
src/compose-generator.ts 98.5% → 98.6% (+0.09%) 98.5% → 98.6% (+0.09%)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)
src/services/enclave-mcp-service.ts 85.3% → 97.6% (+12.32%) 85.3% → 95.5% (+10.21%)
✨ New Files (1 files)
  • src/enclave/network.ts: 100.0% lines

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

lpcox and others added 3 commits August 6, 2026 18:42
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 5da2e8c6-bddd-4f94-84c2-862ab467e4bf
Implement stack layer 2 with an AWF-owned authenticated MCP server, unified script ledger, hardened enclave runner, lifecycle wiring, release images, and tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add the prompt-driven enclave_run_agent tool to the unified private MCP server, sharing the script executor ledger and hardened lifecycle while preserving legacy bounded executors.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7e34b0de-383c-4832-9cb7-14432b920ace
@lpcox
lpcox force-pushed the lpcox-enclave-agent-executor branch from a60f5bd to 24cd7de Compare August 7, 2026 01:42
@lpcox
lpcox requested a balanced review from Copilot August 7, 2026 14:44

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.

Review details

Suppressed comments (2)

src/enclave/preflight.ts:37

  • A provider base URL alone is not a usable Copilot route. The dedicated proxy removes OIDC state, and its Copilot adapter requires COPILOT_GITHUB_TOKEN or COPILOT_PROVIDER_API_KEY; with only copilotProviderBaseUrl, preflight succeeds but every enclave call fails. Require a nonblank credential here instead.
    containers/bounded-query/enclave-mcp/Dockerfile:24
  • Use the repository's security-patched Node base. The other current Node services pin node:22.23.2-alpine3.24 (for example containers/bounded-query/Dockerfile:39 and containers/api-proxy/Dockerfile:3), and containers/gh-aw-node/Dockerfile:9-24 documents the libcrypto/libssl and bundled-undici fixes supplied by 22.23.2. Pinning this Docker-socket-owning server to 22.23.1 regresses that baseline.
FROM node:22.23.1-alpine3.24 AS enclave-mcp-server
  • Files reviewed: 38/38 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread src/enclave/preflight.ts Outdated
Base automatically changed from lpcox-enclave-mcp-script to main August 7, 2026 15:52
@lpcox lpcox changed the title Add enclave agent executor feat: add enclave agent executor Aug 7, 2026
lpcox added 3 commits August 7, 2026 08:55
Reject Docker socket exposure for every enclave executor, require a Copilot credential, use the patched Node image, and fix the enclave repository type lint error.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7e34b0de-383c-4832-9cb7-14432b920ace
Resolve overlapping enclave stack changes against current main while preserving the shared ledger, hardened agent executor, and upstream timing fixes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7e34b0de-383c-4832-9cb7-14432b920ace
Upgrade js-yaml to the available patched release.

Keep the fallback logging unit test hermetic by injecting its model refresh dependency.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7e34b0de-383c-4832-9cb7-14432b920ace
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 98.64% 98.61% 📉 -0.03%
Statements 98.50% 98.45% 📉 -0.05%
Functions 98.52% 98.36% 📉 -0.16%
Branches 94.52% 94.45% 📉 -0.07%
📁 Per-file Coverage Changes (8 files)
File Lines (Before → After) Statements (Before → After)
src/enclave/manager.ts 82.4% → 80.2% (-2.24%) 81.3% → 79.2% (-2.05%)
src/rules.ts 98.1% → 96.2% (-1.89%) 98.2% → 96.4% (-1.82%)
src/enclave/preflight.ts 100.0% → 98.8% (-1.18%) 100.0% → 98.9% (-1.06%)
src/artifact-preservation.ts 92.4% → 91.5% (-0.91%) 92.5% → 91.5% (-0.91%)
src/services/optional-services.ts 100.0% → 100.0% (+0.00%) 98.5% → 97.8% (-0.63%)
src/compose-generator.ts 98.5% → 98.6% (+0.09%) 98.5% → 98.6% (+0.09%)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)
src/services/enclave-mcp-service.ts 85.3% → 97.6% (+12.32%) 85.3% → 95.5% (+10.21%)
✨ New Files (1 files)
  • src/enclave/network.ts: 100.0% lines

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

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Security Guard failed. Please review the logs for details.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Contribution Check failed. Please review the logs for details.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) reports failed to deliver outputs. AOAI BYOK (api-key) mode investigation needed...

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude failed to deliver outputs

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Build Test Failed Build Test Suite - See logs for details

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🛡️ Smoke Copilot Network Isolation reports failed to deliver outputs while checking network isolation. Investigate the egress model.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📰 DEVELOPING STORY: Smoke Docker Sbx reports failed to deliver outputs. Our correspondents are investigating the incident...

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Result
API status ✅ PASS
gh check ✅ PASS
File status ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #6990 · haiku45 · 55.8 AIC · ⊞ 3.6K ·
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Engine@lpcox

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: GHA Services Connectivity — FAIL

  • Redis PING: ❌ (Temporary failure in name resolution)
  • pg_isready: ❌ (no response)
  • PostgreSQL SELECT 1: ❌ (could not translate host name)

Overall: FAILhost.docker.internal did not resolve inside the AWF sandbox.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (github.com) reachable: allowed=200
✅ Non-allowed domain (example.com) blocked: 403 proxy denial

Overall status: PASS

@lpcox

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"

See Network Configuration for more information.

🛡️ Egress verdict from Smoke Copilot Network Isolation
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK ✅ PASS

Direct BYOK mode (COPILOT_PROVIDER_API_KEY via api-proxy sidecar)

  • ✅ GitHub MCP connectivity (verified)
  • ✅ HTTP 200 to github.com
  • ✅ File write/read working
  • ✅ BYOK inference path active (agent → api-proxy → api.githubcopilot.com)

All checks passed. Running in direct BYOK mode.

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📡 OTel Tracing Smoke Test Results

Scenario Result
1. Module Loading ✅ otel.js loads, isEnabled() true, exports 15 functions incl. startRequestSpan, setTokenAttributes, endSpan
2. Test Suite ✅ 68/68 tests passed (3 suites: otel, otel-fanout, otel-workload-identity)
3. Env Var Forwarding ✅ GITHUB_AW_OTEL_TRACE_ID/GITHUB_AW_OTEL_PARENT_SPAN_ID forwarded in env-passthrough.ts (agent); GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, trace/span IDs forwarded in api-proxy-env-config.ts
4. Token Tracker Integration ✅ onUsage callback present in token-tracker-http.js
5. OTEL Diagnostics ⚪ No spans exported (expected — validation ran outside a live awf sandbox invocation, no proxied API calls made)

Overall: ✅ All scenarios passed or expected-pending. No regressions detected in OTel tracing integration.

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results

  • GitHub MCP Testing: ❌ (Filtered by secrecy/integrity policy)
  • GitHub.com Connectivity: ❌ (Network unreachable)
  • File Writing Testing: ✅
  • Bash Tool Testing: ✅

Overall status: FAIL

💎 Faceted by Smoke Gemini
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK Direct (Azure OpenAI Foundry)

  • Merged PRs: ${{ steps.smoke-data.outputs.SMOKE_PR_DATA }} ✅
  • GitHub.com connectivity: ✅
  • File write/read: ✅
  • BYOK inference: ✅

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
Overall: PASS

@lpcox

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results

Recent PRs:

GitHub MCP:
GitHub.com Connectivity:
File Write/Read:
BYOK Inference:

Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra

Overall: PASS

Thanks @lpcox

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test

  • chore: upgrade gh-aw to v0.86.0 pre-release and recompile workflows
  • fix(api-proxy): stop alias fallback picking arbitrary models
  • Merged PR review: ✅
  • safeinputs-gh / PR query: ❌ (gh fallback used; requested safe-input CLI missing)
  • Playwright title check: ✅
  • File write/readback: ✅
  • Discussion query/comment: ❌ (commenting disabled for discussions in this workflow)
  • Build npm ci && npm run build: ✅
  • Overall: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Chroot Version Comparison

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.13 YES
Node.js v24.18.0 v22.23.2 NO
Go go1.22.12 go1.22.12 YES

Overall: FAILED - Node.js version mismatch between host (v24.18.0) and chroot (v22.23.2) environments. smoke-chroot label not added since not all tests passed.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color ok ✅ PASS
Go env ok ✅ PASS
Go uuid ok ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx All passed ✅ PASS
Node.js execa All passed ✅ PASS
Node.js p-limit All passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — PASS

All 18 projects across 8 ecosystems built/installed and tested successfully through the AWF firewall (proxy-aware toolchains correctly routed through Squid).

Note: Java required setting a writable <localRepository> in ~/.m2/settings.xml (the default ~/.m2/repository path was not writable in this runner) — an environment permission detail unrelated to the firewall itself, worked around locally.

Generated by Build Test Suite for #6990 · auto · 39.3 AIC · ⊞ 11.6K ·
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Docker Sbx@lpcox

Overall: PASS

📰 BREAKING: Report filed by Smoke Docker Sbx
Add label ready-for-aw to run again

@lpcox
lpcox merged commit 015f294 into main Aug 7, 2026
134 of 144 checks passed
@lpcox
lpcox deleted the lpcox-enclave-agent-executor branch August 7, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants