Skip to content

fix: enforce one workload backend in enclave conformance - #10314

Merged
lpcox merged 4 commits into
mainfrom
lpcox-single-backend-conformance
Oct 20, 2026
Merged

lpcox merged 4 commits into
mainfrom
lpcox-single-backend-conformance

Conversation

@lpcox

@lpcox lpcox commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Diagnosis

Fixes a definite configuration blocker reproduced from the release sources used by run 39324827831 at v0.28.67 (24b5c159c7f6e8a410315942f3214a1c523610ad). The native live harness explicitly selected a Docker primary with Cloud Hypervisor enclaves; the environment-probe example omitted the primary runtime, also selecting Docker by default. Production normalization rejects these configurations with:

Enclave backend "cloud-hypervisor" differs from primary backend "docker"; one sandbox backend is required per run; no runtime fallback

This error was locally reproduced against the release normalizer, not observed in the removed private stderr of the failed jobs. The original jobs failed before broker readiness; no successful guest acceptance is claimed.

Changes and audit

  • All generated native profiles (primary, script-only, agent-only, combined) and the environment probe select Cloud Hypervisor for every workload. Generated runtime image tags match the artifact release; the primary-only profile omits the invalid empty enclave array.
  • Add a narrowly bounded admission path for the native conformance workflow. Both production admission gates require the exact manual, package-matched release-tag workflow identity, matching workflow/checkout SHA, a reviewed acceptance SHA, fixed public repository catalog, and existing script/agent resource, timeout, output, invocation and model limits. This does not generally enable primary-with-enclave execution.
  • Forward the required non-secret GitHub identity fields through sudo. Keep the exact-release checkout, acceptance-commit ancestry, manifest source/lineage, signature checks and no-fallback protections unchanged.
  • Use supported GITHUB_WORKSPACE wiring for the probe instead of an additional host mount. Enable the mandatory primary API-proxy infrastructure without adding a model credential, agent executor or model call.
  • Audit production validation, backend normalization, tests, native/agentic workflows, examples and backend documentation. Replace stale positive mixed-backend runtime-validation tests with rejection coverage; enforce consistency in the existing production validation helpers; align the gVisor service fixture's primary selection; correct the probe and sbx guidance. Existing deliberate mismatch-rejection tests remain. Docker Squid, proxies, gateway and broker infrastructure are not mixed workload backends and remain intact. Existing same-backend Cloud Hypervisor smoke sources need no changes or lock regeneration.
  • Add regressions using the actual generated configs through production schema validation, normalization and both admission gates; mutate primary/enclave backends, release identity, catalog and caps to verify rejection. Make the recovery unit test's Docker polling deterministic so the focused suite cannot inspect a real daemon.

Public-only data boundaries, credential isolation, private-log disclosure policy, cleanup/recovery and existing invocation/resource/model/time caps are preserved.

CI follow-up

The first PR CI failures were test-fixture regressions, not dependency/build failures: eight manager storage/isolation cases still selected Cloud Hypervisor enclaves with an implicit Docker primary; three enabled-only fabricated enclave objects lacked normalized executors; and the agent-acceptance runtime mutation asserted the later admission error instead of the stronger single-backend rejection. Commit 6142a1e9 fixes those five test files using complete normalized same-backend fixtures and the existing narrowly guarded native acceptance context. Commit 8c2ff114 removes the resulting unused WrapperConfig type import reported by ESLint. No production guards or lint rules were weakened.

All three requested checks pass on latest head 8c2ff114536355cf6b7c91c67d14b0b3baf4411a, through normal PR synchronize CI:

Check Result
ESLint PASS
Deterministic enclave contract (no KVM) PASS: 45 suites, 1,772 tests; build/typecheck passed
Root Unit Tests PASS: 489 suites, 9,117 tests; 5 suites/65 tests skipped; build passed

The retained reviewer verified both follow-up exact diffs and source hashes; all ten safety properties passed. Static whitespace and TypeScript syntax checks passed. The worktree is clean. No additional install attempts or manual dispatch/rerun/cancellation were performed for these CI fixes.

Validation and limitations

This PR is intentionally a draft. The user explicitly approved initial publication with local validation blocked.

  • PASS: all 17 original reviewed source hashes verified, git diff --check, and node --check for both changed JavaScript harnesses.
  • PASS: the retained read-only source reviewer examined the complete original final diff, transitive admission/workspace/identity behavior and exact 13-suite local test scope; all ten safety properties passed, with no confirmed production vulnerability. Source review is not runtime proof.
  • Local build could not start: npm run build failed with tsc: command not found.
  • Both isolated dependency restores failed on direct npm registry downloads with ENOTCONN, followed by npm's internal Exit handler never called! error (Node v22.23.3 / npm 10.9.9). The second was the single approved bounded recovery (--maxsockets=1 --fetch-retries=0 --fetch-timeout=30000). Both used --ignore-scripts --no-audit --no-fund, disposable HOME/TMPDIR, no inherited credentials, and the unchanged lockfile. No alternate registry or lifecycle-hook workaround was used.
  • Local typecheck/Jest/ESLint: NOT RUN. Successful hosted CI evidence is recorded separately above; no local pass is claimed.
  • Live KVM/guest acceptance: NOT RUN. Latest normal PR CI skipped live acceptance, privileged host boundaries and the environment probe. A separately authorized default-only manual run at a315239c did not authorize live acceptance or validate the later fixture commits. Remain draft pending the required release-attested acceptance; this patch does not bypass the published package-matched release/ancestry gate. No merge, release or Agent merge is requested.

Prepared in an isolated worktree from current main 2574130a7914d1ece152bfbfd6359110ca8868fb; the original checkout and its unrelated changes were untouched.

Authored Markdown security overview

Source Before / after Security impact
Probe README Docker-default standalone guidance becomes same-backend, release-gated native conformance guidance. Removes an unsupported invocation; documents mandatory proxy isolation without introducing model credentials or relaxing attestation.
Cloud Hypervisor foundation Clarifies the probe's same-backend workloads, supporting proxy, sudo identity and bounded native admission. General admission remains closed; exact release/source, public catalog and budget controls are unchanged.
sbx integration Independent backend selection becomes one backend with separate workload instances. Prevents misleading mixed-backend guidance; sbx enclaves remain fail-closed and isolated.

Align native conformance and the public environment probe with the single-backend contract while retaining narrowly bounded release-only admission.

Local build and tests remain unverified because dependency restoration failed; publish as a draft for review and normal PR CI.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 72a3b55a-ceaf-4f45-9779-26e9eb38904c
@github-actions

github-actions Bot commented Oct 19, 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-10314 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit bd9414d

lpcox and others added 2 commits October 19, 2026 15:43
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 72a3b55a-ceaf-4f45-9779-26e9eb38904c
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 72a3b55a-ceaf-4f45-9779-26e9eb38904c
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.39% 93.40% 📈 +0.01%
Statements 91.95% 91.96% ➡️ +0.01%
Functions 91.15% 91.16% ➡️ +0.01%
Branches 85.92% 85.99% 📈 +0.07%
📁 Per-file Coverage Changes (4 files)
File Lines (Before → After) Statements (Before → After)
src/cloud-hypervisor/runtime-validation.ts 98.6% → 96.2% (-2.46%) 97.3% → 95.0% (-2.26%)
src/enclave/host-executor-server.ts 91.0% → 91.0% (+0.00%) 90.0% → 89.7% (-0.29%)
src/enclave/preflight.ts 92.2% → 92.3% (+0.10%) 92.6% → 92.7% (+0.12%)
src/commands/validators/config-assembly.ts 78.6% → 82.1% (+3.57%) 78.6% → 82.1% (+3.57%)
✨ New Files (1 files)
  • src/enclave/cloud-hypervisor-conformance-acceptance.ts: 96.4% lines

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

@lpcox
lpcox marked this pull request as ready for review October 19, 2026 23:26
Copilot AI max review requested due to automatic review settings October 19, 2026 23:26

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

Probe admission and intermediate VM cleanup still prevent the targeted live conformance jobs from completing successfully.

2 open issues
What changed in this PR

Aligns AWF’s native enclave conformance harnesses with the single-workload-backend requirement while retaining release-scoped admission.

Changes:

  • Select Cloud Hypervisor for primary and enclave workloads.
  • Add bounded conformance admission and preserve workflow identity through sudo.
  • Update regression coverage, fixtures, examples and backend guidance.
File Description
src/​services/​enclave-agent-service.test.ts Aligns the gVisor primary fixture.
src/​enclave/​preflight.ts Enforces backend consistency and conformance admission.
src/​enclave/​preflight.test.ts Covers Docker-default backend rejection.
src/​enclave/​manager.test.ts Uses normalized, release-scoped fixtures.
src/​enclave/​cloud-hypervisor-conformance-acceptance.ts Adds bounded native conformance admission.
src/​enclave/​cloud-hypervisor-agent-acceptance.test.ts Updates runtime-mismatch expectations.
src/​commands/​validators/​infrastructure-validator.test.ts Replaces incomplete enclave fixtures.
src/​cloud-hypervisor/​runtime-validation.ts Integrates backend enforcement and admission.
src/​cloud-hypervisor/​runtime-validation.test.ts Replaces mixed-backend acceptance coverage.
src/​cloud-hypervisor-runtime-backend.env-mapping.test.ts Aligns normalized runtime fixtures.
scripts/​ci/​test-cloud-hypervisor-enclave-workflow.test.ts Checks sudo identity preservation.
scripts/​ci/​cloud-hypervisor-enclave-live-smoke.test.ts Makes recovery polling deterministic.
scripts/​ci/​cloud-hypervisor-enclave-live-smoke.js Selects VM primaries and release-matched images.
scripts/​ci/​cloud-hypervisor-enclave-environment-probe.test.ts Updates probe configuration assertions.
scripts/​ci/​cloud-hypervisor-enclave-environment-probe.js Adds release wiring and removes the extra mount.
scripts/​ci/​cloud-hypervisor-conformance-admission.test.ts Exercises generated profiles and admission mutations.
examples/​enclave-environment-probe/​README.md Documents release-gated probe execution.
examples/​enclave-environment-probe/​awf.yaml Selects Cloud Hypervisor and proxy infrastructure.
docs/​sbx-integration.md Clarifies shared backend requirements.
docs/​cloud-hypervisor-foundation.md Updates probe and admission guidance.
.github/​workflows/​test-cloud-hypervisor-enclaves.yml Preserves admission identity and adds regression coverage.

Review effort: Max

|| (profile === 'script-only' && entry.script)
|| (profile === 'agent-only' && entry.agent)),
container: { containerRuntime: 'docker' },
container: { containerRuntime: 'cloud-hypervisor', imageTag: artifacts.tag },
@lpcox

lpcox commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

Copilot AI commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Addressed in commit dd9fddb: intermediate cleanup checks now require the captured live primary VM to remain unchanged and detect additional VM residue; pre-security admission accepts an undefined CLI-derived API-proxy value while still rejecting explicit false. Added focused regressions. Local Jest/build remains blocked by missing dependencies and incompatible global TypeScript.

@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 af2c49e into main Oct 20, 2026
37 checks passed
@lpcox
lpcox deleted the lpcox-single-backend-conformance branch October 20, 2026 00:20
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.

3 participants