Skip to content

test: stabilize crash-isolation timeout (pre-existing flake)#95

Merged
NathanFlurry merged 1 commit into
mainfrom
fix/crash-isolation-test
Jun 19, 2026
Merged

test: stabilize crash-isolation timeout (pre-existing flake)#95
NathanFlurry merged 1 commit into
mainfrom
fix/crash-isolation-test

Conversation

@NathanFlurry

@NathanFlurry NathanFlurry commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

The crash_isolation::guest_failure_in_one_vm_does_not_break_peer_vm_execution test (and the sibling process_isolation test) timed out after 10s waiting for events. This reproduces deterministically on main and is unrelated to any security review.

Root cause

It is not a crash-isolation defect — VM isolation works correctly. Both guest VMs ran fully independently and each emitted its own VM-scoped output/exit events. The test timed out because both VMs failed identically with Error: Cannot find module '/<entry>.cjs', so the "healthy" VM exited 1 instead of 0 and the loop's completion condition (healthy.exit_code == Some(0)) was never met.

The defect is in entrypoint materialization. When an Execute request supplies an absolute host path as the entrypoint (one that lives inside the VM's host cwd), prepare_javascript_shadow():

  1. treated that absolute host path as if it were the guest path, materializing the file at the wrong guest location in the shadow, and
  2. never synced the staged file into the kernel VFS.

The JavaScript runtime resolves modules against the kernel VFS (KernelModuleFsReader), so require("/<entry>.cjs") could not find the module and every such process exited 1.

Fix

In prepare_javascript_shadow():

  • Translate the absolute host entrypoint to its guest path (host_cwdguest_cwd) via resolve_host_entrypoint_within_vm_host_cwd before keying the shadow, so the file is staged at the path the runtime actually requires.
  • After staging, sync the entrypoint into the kernel VFS (sync_shadow_entrypoint_into_kernel) so the kernel-backed module resolver can read it.

The tests are unchanged — they verify the same behavior and now pass deterministically and fast (~1.1s instead of timing out at 10s). Confirmed green over repeated runs; cargo fmt --check and cargo clippy --workspace --all-targets -- -D warnings are clean; related sidecar suites (crash_isolation, process_isolation, vm_lifecycle, kill_cleanup, session_isolation, stdio_binary, fs_watch_and_streams, lib) pass.

The crash-isolation (and process-isolation) integration tests timed out
because both guest VMs failed identically with "Cannot find module",
not because a guest crash broke its peer. VM isolation itself works: each
VM ran independently and emitted its own VM-scoped events.

Root cause: when an Execute request supplies an absolute *host* path as
the entrypoint (within the VM host cwd), prepare_javascript_shadow()
treated that host path as the guest path. It (a) materialized the
entrypoint at the wrong guest path in the shadow, and (b) never synced
the staged file into the kernel VFS. The JS runtime resolves modules
against the kernel VFS, so require("/<file>") reported "Cannot find
module" and every such process exited 1 (the healthy VM never reached
exit 0, so the test waited out its deadline).

Fix: translate the host entrypoint to its guest path (host_cwd ->
guest_cwd) before materializing, and sync the staged entrypoint into the
kernel VFS so the kernel-backed module resolver can read it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@NathanFlurry
NathanFlurry merged commit 3314416 into main Jun 19, 2026
1 check failed
@NathanFlurry
NathanFlurry deleted the fix/crash-isolation-test branch June 19, 2026 11:26
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.

1 participant