Repository navigation
Conversation
|
🌿 Preview your docs: https://nvidia-preview-pr-5797.docs.buildwithfern.com/openshell |
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. rust-sdk — No explicit risk acceptance found
2. cli — No explicit risk acceptance found
Review details
Advisory review; publication gates are unchanged. |
elezar
left a comment
There was a problem hiding this comment.
The design looks sound: per-sandbox persistence, init reading driver-owned overlay metadata, and the digest-bound registry WORKDIR.
One non-blocking suggestion: this changes guest init (passwd home rewrite, prepare_guest_directory, the image-mode skip), and the init test runs the helper with /sandbox hard-coded. A VM e2e with a custom managed workspace would be a good follow-up if you'd rather not add it here.
Details in the inline comments.
| } | ||
|
|
||
| /// Resolve a VM workspace that guest init will assign to the sandbox user. | ||
| pub fn resolve_vm_managed_workspace_root(root: &str) -> Result<String, String> { |
There was a problem hiding this comment.
The hard-coded /etc, /usr, /home, /var list is a general system-path denylist. container_paths.rs says CONTROL_ROOTS is deliberately not one (see #2578). Can you explain why VM managed mode needs this when Docker and Podman don't, or move it next to CONTROL_ROOTS with a comment?
There was a problem hiding this comment.
I added the rationale next to the VM managed validator.
Guest init changes the selected directory's owner and permissions and sets it as the sandbox account's home. The VM-specific restrictions protect system directories from those changes while still allowing workspaces below /home and /var.
| } | ||
|
|
||
| /// Resolve a VM workload's image-declared working directory. | ||
| pub fn resolve_vm_image_workspace_root(working_dir: &str) -> Result<String, String> { |
There was a problem hiding this comment.
Question: in image mode an image with WORKDIR=/etc or /usr/lib is accepted, while managed mode rejects those paths. This matches Docker and Podman, so I'm fine with it. Is that intended, and should the docs say image mode trusts the image's choice?
There was a problem hiding this comment.
Yes, image mode intentionally follows the image's OCI WORKDIR subject to validation.
/etc is rejected in both modes because it contains reserved OpenShell paths. /usr/lib can qualify in image mode if it exists without symlink components and is writable by the sandbox user.
I clarified in the runtime docs that guest init skips managed workspace setup for a custom image path and chooses the account’s /etc/passwd home independently.
| clap::ValueEnum, | ||
| )] | ||
| #[serde(rename_all = "snake_case")] | ||
| pub enum VmWorkspaceMode { |
There was a problem hiding this comment.
VmWorkspaceMode is defined in both the driver and the gateway (crates/openshell-gateway/src/vm.rs), and the gateway only forwards --workspace-mode image and a non-default --workspace-root. That works today but will break silently if a mode is added. Could the gateway reuse the driver's enum, or always pass both flags?
There was a problem hiding this comment.
Moved VmWorkspaceMode into openshell-core so the gateway and VM CLI share the same type. The gateway now uses an exhaustive match, so a new mode requires an explicit forwarding decision at compile time. Default managed /sandbox still uses the driver’s defaults.
| // Old local cache entries were exported by tag. Keep those entries | ||
| // separate from exports bound to the inspected image and its config. | ||
| let cache_identity = prepared_image_cache_identity( | ||
| &format!("local-image-id:{image_identity}"), |
There was a problem hiding this comment.
The cache key changes to local-image-id:..., so every locally built image is re-exported once after upgrade and the old tag-keyed entries are never cleaned up. Worth a release note, or a cleanup of the old entries.
There was a problem hiding this comment.
I documented the one-time rebuild in the VM driver README. The old cache key already used the inspected image ID, but the export resolved the tag again. The new namespace separates disks exported by immutable ID from older disks. Those older disks remain on disk and may still back existing sandboxes.
| drop(cache_guard); | ||
| self.publish_prepared_cache_hit(sandbox_id, image_ref, "registry", &cache_identity); | ||
| let working_dir = if inspect_workdir { | ||
| pull_registry_image_workdir(client, &reference, auth, image_ref).await? |
There was a problem hiding this comment.
Question: in image mode a cache hit now pulls the manifest and config blob again, so an unreachable registry fails creation even when the disk is cached. Could the WorkingDir be stored next to the cached disk so a hit needs no registry round trip? If the re-fetch is intentional, a comment saying why would help.
There was a problem hiding this comment.
Image mode now stores the digest-verified WorkingDir alongside the prepared disk. Older entries backfill from the pinned image on first use, including images with no WORKDIR. Warm hits skip the extra pinned manifest and config fetches while preserving registry authentication and mutable-tag resolution. The updated registry test passed for both backfill cases and verifies that warm hits skip those extra requests.
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. rust-sdk — No explicit risk acceptance found
2. configuration — No explicit risk acceptance foundDefault supervisor and sandbox runtime images move from
Review details
Advisory review; publication gates are unchanged. |
|
Thanks, I extended |
Signed-off-by: Shiju <shiju@nvidia.com>
Signed-off-by: Shiju <shiju@nvidia.com>
Share the workspace mode and reserved root across their callers. Reuse verified image working directories on prepared registry cache hits, document the local cache upgrade, and exercise a custom managed workspace across gateway restart. Signed-off-by: Shiju <shiju@nvidia.com>
323cd9a to
fdab97e
Compare
Summary
Make the MicroVM workspace configurable so images built around paths such as
/home/agentcan run without changing the VM driver. Keep/sandboxas the default, and support either an operator-managed directory or the image's OCIWORKDIR.Related Issue
Closes #5282
Changes
workspace_mode(managedorimage) andworkspace_rootto VM gateway configuration, with matching VM driver flags./sandbox.Release Notes
Configure
[openshell.drivers.vm]withworkspace_mode = "managed"andworkspace_root = "/home/agent"to choose a workspace, or useworkspace_mode = "image"to follow the image's OCIWORKDIR. Missing, empty,/, and/sandboxworkdirs, including rootfs tar archives without OCI metadata, fall back to managed/sandbox. The selected workspace is fixed when the sandbox is created.Testing
Checklist