Skip to content

feat: add enclave lifecycle diagnostics and branch iteration - #10057

Merged
lpcox merged 1 commit into
mainfrom
lpcox-enclave-smoke-v0921
Oct 16, 2026
Merged

lpcox merged 1 commit into
mainfrom
lpcox-enclave-smoke-v0921

Conversation

@lpcox

@lpcox lpcox commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to merged #10052 and the failed main run 38835024407. That run reached Copilot and the enclave MCP server, but the single enclave call returned Host executor lifecycle is unresolved; shutdown repeated that error and no public-fixture VM logs were produced. These changes add evidence, not an asserted root-cause fix.

  • Add protected enclave-host-executor.jsonl broker diagnostics for availability, local validation, socket/exchange failures, parsed lifecycle responses, cancellation, terminal digest/schema verification, settlement, and reconciliation. Fixed classifications only; bounded to 4,096 records plus a limit marker per runner.
  • Add a durable host-executor-control snapshot before invocation-plan/backend creation, recording request/policy rejection, registration, backend entry/completion/failure, cleanup and shutdown. Retain 128 events and the first failure independently; export through the existing protected snapshot preservation path even when shutdown rejects.
  • Add script guest JSON stderr milestones for seed materialization, output link, cwd, execution and failure categories without changing result stdout or exit behavior.
  • Allow manually selected same-repository branches for this exact smoke workflow, retaining workflow/ref/SHA consistency, verified release artifacts, the single static public script/invocation limit and isolation controls. Forks, PR events/merge refs and automated events remain rejected.
  • Non-main branch dispatches build the checked-out host CLI and infrastructure containers (including the MCP broker) using --build-local, so they exercise unmerged host/broker diagnostics. Main/tag runs retain the published binary/image path.

Artifact and execution boundaries

No request/script/result bytes, credentials, capabilities, environment dumps, raw host errors or stacks are added to protected control diagnostics or tool responses. Caller-visible canonical error behavior is unchanged. Existing opt-in unredacted public-fixture VM capture and its host-only bounded one-day upload remain unchanged.

Guest-entrypoint changes are not present in the pinned v0.28.59 rootfs. They require a rebuilt, release-attested rootfs; branch runs intentionally retain verified published VM artifacts rather than bypassing attestation. Host/broker diagnostics can be exercised without a new guest release.

No workflow dispatch, rerun, VM/inference execution, merge or release performed. This PR is draft; live behavior has not been verified.

Validation

  • Official checksum-verified session-local gh-aw v0.92.1: compile smoke-enclave-cloud-hypervisor --gh-aw-ref v0.92.1 --no-check-update; passed with the expected experimental notice.
  • Mandatory npx ts-node scripts/ci/postprocess-smoke-workflows.ts; passed, only target lock changed.
  • Focused Jest run covering broker/protocol, bounds, invocation evidence, script guest, lifecycle export, acceptance guards, concrete backend, startup diagnostics, smoke generation/postprocessing and collector: 12 suites passed, 375 tests passed, 1 opt-in Linux mount test skipped. After final refinements, affected subset rerun: 7 suites passed, 191 tests passed, 1 skipped.
  • Build, npm run type-check, repository npm run lint, JavaScript syntax checks and git diff --check passed. Repository lint emits existing warnings. Explicit off-path script lint still exposes existing CommonJS/config mismatches and four pre-existing postprocessor errors; no suppressions added.
  • Workflow scanner gate is not clean: native actionlint reports unsupported copilot-requests and concurrency.queue syntax, as before. Native normal zizmor reports four ref-version-mismatch medium findings; its existing/default configuration also reports four suppressed findings. No scanner suppression or policy broadening added. No claim that previous compiler diagnostic/activation-secret findings are resolved.

Regressions verify exact failure phase/reason, unchanged finite errors, no private bytes in diagnostics, missing socket errno, pre-launch policy rejection without VM launch, event bounds, owner-only files, export despite shutdown failure, and branch/event restrictions.

Preserve protected broker and host control evidence for pre-launch failures, add script guest lifecycle diagnostics, and allow manual same-repository branch smoke runs using the source runtime.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3f2fbf21-2958-4850-a191-bc7c631b0809
@github-actions

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-10057 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 6c331de

@lpcox
lpcox marked this pull request as ready for review October 16, 2026 02:10
Copilot AI max review requested due to automatic review settings October 16, 2026 02:10
@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.18% 93.20% 📈 +0.02%
Statements 91.76% 91.77% ➡️ +0.01%
Functions 90.67% 90.68% 📈 +0.01%
Branches 85.62% 85.64% 📈 +0.02%
📁 Per-file Coverage Changes (4 files)
File Lines (Before → After) Statements (Before → After)
src/enclave/host-executor-journal.ts 90.4% → 90.4% (+0.00%) 87.6% → 87.4% (-0.17%)
src/enclave/host-executor-server.ts 90.3% → 90.8% (+0.43%) 88.8% → 89.2% (+0.43%)
src/nvx/one-shot-adapter.ts 82.9% → 83.4% (+0.56%) 80.2% → 80.7% (+0.52%)
src/log-directory-setup.ts 96.8% → 100.0% (+3.18%) 96.9% → 100.0% (+3.13%)

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

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

Branch startup, checkout provenance, diagnostic preservation, and guest exit behavior have unresolved defects.

6 open findings
What changed in this PR

Adds lifecycle evidence for unresolved Cloud Hypervisor enclave failures and enables manual branch iteration in the existing smoke workflow.

Changes:

  • Adds bounded host/broker diagnostics and regression coverage.
  • Adds guest stderr milestones, requiring a rebuilt release-attested rootfs.
  • Adds branch-local CLI/container builds while retaining verified published VM artifacts.
File Description
src/​enclave/​script-entrypoint-diagnostics.test.ts Tests guest milestones and disclosure boundaries.
src/​enclave/​host-executor-server.ts Records host lifecycle phases and rejections.
src/​enclave/​host-executor-journal.ts Adds bounded control snapshots.
src/​enclave/​host-executor-invocation-diagnostics.test.ts Tests snapshot bounds and permissions.
src/​enclave/​host-executor-diagnostic-bounds.test.ts Tests broker record limits.
src/​enclave/​host-executor-broker.test.ts Tests failure-phase evidence and cancellation.
src/​enclave/​cloud-hypervisor-script-acceptance.ts Allows manual same-repository branches.
src/​enclave/​cloud-hypervisor-script-acceptance.test.ts Tests branch and event restrictions.
src/​enclave/​cloud-hypervisor-lifecycle.test.ts Tests control evidence export after shutdown failure.
src/​cloud-hypervisor/​host-enclave-executor.test.ts Selects invocation-specific diagnostic snapshots.
scripts/​ci/​workflow-step-builders.ts Generates branch-only local installation steps.
scripts/​ci/​smoke-enclave-workflow.test.ts Checks branch installation and documentation.
scripts/​ci/​apply-general-workflow-patches.ts Injects branch build steps during postprocessing.
docs/​enclaves-architecture.md Explains branch and published-runtime modes.
docs/​cloud-hypervisor-foundation.md Documents lifecycle evidence and guest milestones.
docs/​adr/​0004-unified-workload-sandbox-backends.md Documents branch acceptance boundaries.
containers/​enclave/​script-entrypoint.py Emits guest lifecycle diagnostics on stderr.
containers/​enclave/​mcp-server/​server.js Connects runners to a dedicated audit stream.
containers/​enclave/​mcp-server/​host-executor-runner.js Records bounded broker lifecycle evidence.
containers/​enclave/​mcp-server/​host-executor-client.js Records socket and exchange diagnostics.
.github/​workflows/​smoke-enclave-cloud-hypervisor.md Documents manual branch iteration and prerequisites.
.github/​workflows/​smoke-enclave-cloud-hypervisor.lock.yml Adds generated branch-local build steps.

🧠 Review effort: Max


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

run: npm ci
- name: Build awf
if: github.event_name == 'workflow_dispatch' && github.repository == 'github/gh-aw-firewall' && github.ref_type == 'branch' && github.ref != 'refs/heads/main'
run: npm run build
Comment on lines +25 to +31
print(json.dumps({
"component": "enclave-script",
"phase": phase,
"status": status,
"elapsedMs": max(0, round((time.monotonic() - started) * 1000)),
**fields,
}, separators=(",", ":")), file=sys.stderr, flush=True)
}

export function buildBranchEnclaveInstallSteps(indent: string): string {
const condition = "github.event_name == 'workflow_dispatch' && github.repository == 'github/gh-aw-firewall' && github.ref_type == 'branch' && github.ref != 'refs/heads/main'";
.flatMap(line => line.startsWith(`${indent}- name:`)
? [line, `${indent} if: ${condition}`] : [line])
.join('\n')
.replace('/dist/cli.js" "\\$@"', '/dist/cli.js" --build-local "\\$@"');
Comment on lines +258 to +263
elapsedMs: Math.max(0, Math.round(performance.now() - started)) });
throw error;
}
const response = parseHostExecutorResponse(bytes, requestId);
diagnose({ phase: 'response', status: response ? 'parsed' : 'failed',
elapsedMs: Math.max(0, Math.round(performance.now() - started)),
}),
);
const handlers = {};
const hostExecutorAudit = createProtectedAuditLog(serverConfig.auditDir, 'enclave-host-executor.jsonl');
@lpcox

lpcox commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

@github-actions

Copy link
Copy Markdown
Contributor

⏳ Copilot review left inline comments.

@lpcox To proceed:

  1. Ask @copilot to address the review feedback (reply to this comment or the review thread)
  2. Once the fix is pushed, add the ready-for-aw label to trigger agentic CI smoke tests

@lpcox
lpcox merged commit 6232594 into main Oct 16, 2026
39 of 40 checks passed
@lpcox
lpcox deleted the lpcox-enclave-smoke-v0921 branch October 16, 2026 02:44
Copilot stopped work on behalf of lpcox due to an error October 16, 2026 02:46
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