feat: reserve microVM network resources atomically - #7893
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 93.86% | 93.14% | 📉 -0.72% |
| Statements | 92.67% | 91.92% | 📉 -0.75% |
| Functions | 93.24% | 92.27% | 📉 -0.97% |
| Branches | 86.14% | 85.59% | 📉 -0.55% |
📁 Per-file Coverage Changes (4 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/microvm/network-plan.ts |
95.2% → 93.1% (-2.08%) | 94.5% → 92.5% (-2.00%) |
src/microvm/network-manager.ts |
98.4% → 98.5% (+0.14%) | 96.9% → 97.2% (+0.26%) |
src/microvm/network-commands.ts |
97.8% → 98.0% (+0.23%) | 97.9% → 98.2% (+0.27%) |
src/log-directory-setup.ts |
96.2% → 100.0% (+3.78%) | 96.3% → 100.0% (+3.71%) |
✨ New Files (1 files)
src/microvm/network-reservation.ts: 52.0% lines
Coverage comparison generated by scripts/ci/compare-coverage.ts
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Concurrent iptables locking and incomplete live-resource detection can still cause failures or unsafe reservation recovery.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (3)
| Severity | Finding |
|---|---|
src/microvm/network-reservation.ts — This ignores live host routes that ip route emits as a bare IPv4 (a /32) and typed routes such… |
|
src/microvm/network-reservation.ts — The PR's stale-recovery contract includes waiting for the reserved address to disappear, but this… |
|
src/microvm/network-commands.ts — The reservation lock is released before network setup/cleanup, so independent managers can execute… |
What changed in this PR
Adds atomic, cross-process microVM network reservations and lease-owned cleanup to support concurrent Cloud Hypervisor runs safely.
Changes:
- Adds a root-owned reservation registry for subnets, addresses, and resource tokens.
- Integrates reservations and owned firewall rules into the network lifecycle.
- Expands unit, live-smoke, and documentation coverage.
| File | Description |
|---|---|
src/microvm/network.ts |
Exports reservation APIs and types. |
src/microvm/network.test.ts |
Tests owned-rule and cleanup behavior. |
src/microvm/network-types.ts |
Defines allocation and reservation types. |
src/microvm/network-reservation.ts |
Implements locking, allocation, and recovery. |
src/microvm/network-reservation.test.ts |
Tests concurrent reservations and recovery. |
src/microvm/network-plan.ts |
Supports reserved network allocations. |
src/microvm/network-manager.ts |
Releases reservations during cleanup. |
src/microvm/network-commands.ts |
Adds token-owned firewall rules. |
src/cloud-hypervisor/vm-config-builder.test.ts |
Updates plan fixture. |
src/cloud-hypervisor/preflight.ts |
Requires trusted flock. |
src/cloud-hypervisor/preflight.test.ts |
Updates preflight expectations. |
src/cloud-hypervisor/manager.ts |
Wires reservation dependencies. |
src/cloud-hypervisor/manager.test.ts |
Tests reservation propagation. |
src/cloud-hypervisor/manager-types.ts |
Extends manager dependency contracts. |
src/cloud-hypervisor/manager-start.ts |
Reserves networking before setup. |
src/cloud-hypervisor-runtime-backend.test.ts |
Updates host-tool fixture. |
scripts/ci/cloud-hypervisor-live-smoke.sh |
Adds cross-process reservation smoke coverage. |
docs/cloud-hypervisor-foundation.md |
Documents reservation and cleanup behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for (const line of routeOutput.stdout.split('\n')) { | ||
| const destination = line.trim().split(/\s+/)[0]; | ||
| if (/^\d+\.\d+\.\d+\.\d+\/\d+$/.test(destination)) routes.push(destination); | ||
| } |
| || live.firewallTokens.has(record.resourceToken) | ||
| || live.routes.some((route) => cidrsOverlap(route, record.guestSubnet)); |
| const checkResult = await this.execute( | ||
| 'iptables', | ||
| ['-t', 'filter', '-C', 'DOCKER-USER', '-i', bridgeName, '-o', bridgeName, '-j', 'ACCEPT'], | ||
| [ | ||
| '-t', 'filter', '-C', 'DOCKER-USER', | ||
| '-i', bridgeName, '-o', bridgeName, | ||
| ...ownership, '-j', 'ACCEPT', | ||
| ], |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤
|
|
🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅ Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "example.com"See Network Configuration for more information.
|
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓
|
|
📰 VERDICT: Smoke Docker Sbx has concluded. All systems operational. This is a developing story. 🎤
|
|
✅ Smoke Claude passed Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "api.anthropic.com"See Network Configuration for more information.
|
|
❌ Smoke Gemini reports failed. Facets need polishing...
|
|
✅ Contribution Check completed successfully! PR #7893 follows the contribution guidelines in CONTRIBUTING.md based on the provided context: it includes tests for the new functionality, updates documentation for the feature, places new code under the appropriate src/ and scripts/ci/ locations, and the PR description is clear and references the related concurrency gap.
|
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.
|
|
🔌 Smoke Services — All services reachable! ✅
|
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅
|
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓
|
|
🚀 Security Guard has started processing this pull request |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓
|
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 Warning Firewall blocked 2 domainsThe following domains were blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "msfeed25.pkgs.visualstudio.com"
- "registry.npmjs.org"See Network Configuration for more information.
|
|
✅ Build Test Suite completed successfully!
|
|
EGRESS_RESULT allow=pass deny=pass ✅ Allowed domain (github.com) reachable: Overall: PASS — network isolation egress enforcement working as expected. cc @lpcox Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "example.com"See Network Configuration for more information.
|
Smoke Test: Claude Engine Validation
Overall result: PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "api.anthropic.com"See Network Configuration for more information.
|
|
Smoke Test: Copilot BYOK (Direct) Mode ✅
Status: PASS Running in direct BYOK mode (
|
Smoke Test Results: FAIL ❌
Overall: FAIL —
|
Smoke Test: API Proxy OpenTelemetry Tracing
Overall: ✅ Pass — all core OTEL integration points (module, tests, env forwarding, token-tracker hook) verified working. Diagnostics scenario shows expected "no spans" state given no api-proxy-routed LLM traffic in this run, not a bug.
|
Chroot Version Comparison
Overall: FAILED — Node.js version mismatch between host and chroot environments (
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — PASS Notes:
|
|
Smoke Test: Copilot Engine — @lpcox
Overall: PASS
|
|
Smoke Test: Docker Sbx — @lpcox
PRs checked: #7892 fix: filter workflow commands from microVM output; #7889 feat: verify Cloud Hypervisor runtime confinement Overall: PASS
|
|
@lpcox ❌ GitHub MCP Testing (expected #7892, #7889, got #7903, #7896) Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) Overall: FAIL
|
|
Smoke test:
Warning Firewall blocked 2 domainsThe following domains were blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "msfeed25.pkgs.visualstudio.com"
- "registry.npmjs.org"See Network Configuration for more information.
|
|
fix: filter workflow commands from microVM output MCP: ✅ 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
|


Summary
flock-serialized reservation registry for per-run guest subnets, infrastructure addresses, and resource tokensDOCKER-USERrules per reservation so concurrent runs cannot remove each other's resourcesValidation
npm test -- --runInBand— 330 suites, 5,282 tests passednpm run buildnpm run lint -- --quietnpx markdownlint-cli2 docs/cloud-hypervisor-foundation.mdbash -n scripts/ci/cloud-hypervisor-live-smoke.shThe KVM live smoke itself requires a GitHub-hosted Ubuntu x86_64 KVM runner; this change adds the real cross-process reservation exercise to that existing CI suite.