Repository navigation
feat: add enclave lifecycle diagnostics and branch iteration - #10057
Merged
Merged
Conversation
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
Contributor
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit 6c331de |
Contributor
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (4 files)
Coverage comparison generated by |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Branch startup, checkout provenance, diagnostic preservation, and guest exit behavior have unresolved defects.
6 open findings
Define compatible version policy for branch builds and pinned artifacts · New Make diagnostic writes resilient to closed or missing stderr · New Prevent PR-context checkout from bypassing ref and SHA restrictions · New Filter --skip-pull when using --build-local on non-main branches · New Separate exchange duration from lifecycle elapsedMs · New Preserve enclave-host-executor.jsonl during cleanup · New
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'); |
Collaborator
Author
|
@copilot address review feedback |
Contributor
|
⏳ Copilot review left inline comments. @lpcox To proceed:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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.enclave-host-executor.jsonlbroker 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.host-executor-controlsnapshot 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.--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
compile smoke-enclave-cloud-hypervisor --gh-aw-ref v0.92.1 --no-check-update; passed with the expected experimental notice.npx ts-node scripts/ci/postprocess-smoke-workflows.ts; passed, only target lock changed.npm run type-check, repositorynpm run lint, JavaScript syntax checks andgit diff --checkpassed. 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.copilot-requestsandconcurrency.queuesyntax, as before. Native normal zizmor reports fourref-version-mismatchmedium 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.