Repository navigation
refactor(host,sandboxes): share guest client and primitives in host-core, use parking_lot, tighten VZ Sendable - #1855
Merged
Conversation
…ore, use parking_lot, tighten VZ Sendable
The shared guest client move dropped the module-level HashMap import. The only remaining non-test user is the cfg(target_os = "linux") pss_samples field, so macOS clippy did not see the error and every Linux lane failed to compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lock special case - vm.rs no longer re-exports Sendable; vsock_bridge imports it from queue_bound, its owner. The agentd port import moves into the import block, so the vsock port doc comment attaches to its constant again. - agentd_request sends every request through guest_client::request. The StepClock arm rebuilt the same frame through step_guest_clock. - The Sync SAFETY text states that Clone only retains, and the socket device lookup states why its wrapper is sound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…trings Resolve the coordinator's state name to a SessionState once, then match on variants. The names come from SessionState::as_str, so the mapping is unchanged: active evicts, parked resumes, pending/created/evacuating/ evicting wait, unreachable is reported, and other states are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t-core Also restore the pidfd module's statement of the two kernel properties callers rely on: identity survives pid reuse, and the fd is readable at process exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sorting the list conflicts with a parallel change that adds a dependency in the same block. The order has no effect on the build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Deduplicates guest-agent wire client and OS primitives across sandbox backends, and hardens host-agent/VZ reliability:
engram-host-core: Extracts the duplicatedengram-agentdwire client (guest_client.rs),ENGRAM_AGENTD_PORT,pidfd.rs,epoch_stream.rs, andPOST_COPY_SEALED_FILEout ofengram-sandbox-firecrackerandengram-sandbox-vzintoengram-host-core, removingengram-host-agent's direct imports of Firecracker internals.std::sync::Mutexinengram-host-agent/src/blk_source.rsandcapture_job.rstoparking_lot::Mutex(and fixes a capture-job task-handle race).Sendable<T>soundness: Removes unconstrainedDerefinengram-sandbox-vzand gates access behind explicit queue-bound accessors (queue_bound.rs).engram-upgrade-drainwith canonicalSessionState.Behavior notes
startpreviously reserved the slot with a placeholder task, dropped the lock, spawned the real task, and then wrote its handle into whatever entry held the job id. A concurrentstartfor a newer epoch in that window aborted only the placeholder, and the older attempt's handle then overwrote the newer entry, so the older capture kept running.startnow spawns and inserts under one lock; Tokio never polls a spawned task inline, and the task cannot touch the registry until the lock drops.parking_lot: no caller recovered from poisoning (every site called.unwrap()). The guarded state is either one map or queue operation, or the ublk prefetch window, whose entries always map a chunk to that chunk's own bytes. A panic mid-section cannot make a later reader serve wrong data. Withstdpoisoning, one panic made every later heartbeat or ublk read panic too.fileDescriptorthere. VZ exec errors from the probe, send, and cancel steps are nowUnavailable(as on Firecracker) instead ofVm.SessionState::as_str, so the mapping is byte-identical to the previous literals.Validation
cargo fmt --all --check;cargo clippy --all-targets -D warningsfor host-core, host-agent, sandbox-firecracker, sandbox-vz, upgrade-drain, dst-cosim, rootfs-materializer on macOS.--target aarch64-unknown-linux-musl,-D warnings) for host-core, host-agent, sandbox-firecracker, upgrade-drain, dst-cosim. This found the missingHashMapimport that failed every Linux lane.cargo nextest runon the six crates above (macOS): 653 passed.just vz-e2e(live VZ VMs): 11 passed.🤖 Generated with Claude Code