fix(task): use shared memory for fspy ipc#234
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
8a79947 to
e524579
Compare
ac63d0a to
9301e45
Compare
5a72a00 to
fb36a7f
Compare
8b46431 to
4049e8b
Compare
fb36a7f to
9ee81fa
Compare
- Enable cli e2e test on Linux in ci and skip failed tests - Add a test for caching vitest browser mode, stably reproducing the issue of https://github.com/voidzero-dev/vibe-dashboard/actions/runs/18532354385/job/52818262992. The added vitest browser mode test will be fixed and enabled in #234
9ee81fa to
4f3b622
Compare
e1d4405 to
138807a
Compare
4f3b622 to
5b562c0
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR transitions the fspy IPC mechanism from file descriptor-based communication to a shared memory-based channel implementation. The change improves reliability and cross-platform compatibility by using shared memory for inter-process communication instead of passing file descriptors.
Key changes:
- Implements a new lock-free shared memory writer/reader system
- Replaces FD-passing IPC with shared memory channels
- Removes Linux-specific memfd implementation in favor of unified filesystem-based approach
Reviewed Changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/snap-tests/vitest-browser-mode/steps.json | Removes Linux from ignored platforms for browser mode tests |
| fspy/node_spawn.mjs | Removes temporary test file |
| fspy/.gitignore | Removes gitignore file |
| crates/vite_task/src/execute.rs | Changes task execution to await path accesses after child completion instead of concurrently |
| crates/fspy_test_utils/src/lib.rs | Adds new test utility crate for creating subprocess commands with encoded arguments |
| crates/fspy_test_utils/README.md | Adds documentation for fspy_test_utils |
| crates/fspy_test_utils/Cargo.toml | Adds dependencies for the test utilities crate |
| crates/fspy_shared_unix/src/spawn/macos.rs | Updates to use as_os_str() method for path conversions |
| crates/fspy_shared_unix/src/spawn/linux/mod.rs | Updates to use as_os_str() method for path conversions |
| crates/fspy_shared_unix/src/payload.rs | Replaces ipc_fd with ipc_channel_conf in payload structure |
| crates/fspy_shared/src/ipc/shm/mod.rs | Removes placeholder TODO file |
| crates/fspy_shared/src/ipc/native_str.rs | Enhances NativeString to support both Unix and Windows platforms with improved API |
| crates/fspy_shared/src/ipc/mod.rs | Updates module structure to include channel and export NativeString unconditionally |
| crates/fspy_shared/src/ipc/channel/shm_io.rs | Implements lock-free concurrent shared memory writer and reader |
| crates/fspy_shared/src/ipc/channel/mod.rs | Implements mpsc IPC channel based on shared memory |
| crates/fspy_shared/Cargo.toml | Adds dependencies for shared memory and IPC channel functionality |
| crates/fspy_preload_windows/src/windows/detours/create_process.rs | Updates to use from_ansi method for Windows ANSI strings |
| crates/fspy_preload_unix/src/interceptions/spawn/posix_spawn.rs | Removes unused posix_spawn file actions handling and variables |
| crates/fspy_preload_unix/src/interceptions/spawn/exec/with_argv.rs | Fixes type inconsistency in pointer type annotation |
| crates/fspy_preload_unix/src/client/mod.rs | Replaces shared memory FD-passing IPC with channel-based implementation |
| crates/fspy_e2e/src/main.rs | Changes to await accesses_future after child completion |
| crates/fspy/tests/test_utils.rs | Changes to await accesses_future after child completion |
| crates/fspy/tests/node_fs.rs | Changes to await accesses_future after child completion |
| crates/fspy/src/unix/mod.rs | Replaces FD-passing IPC with shared memory channel implementation |
| crates/fspy/src/lib.rs | Simplifies Spy initialization by using filesystem-based approach for all platforms |
| crates/fspy/src/fixture.rs | Adds conditional compilation for unused fixture method |
| crates/fspy/examples/cli.rs | Changes to await child completion before accessing results |
| crates/fspy/Cargo.toml | Adds dependencies for fixture creation on all platforms |
| bench/Cargo.toml | Reorders dependencies alphabetically |
| Cargo.toml | Adds fspy_test_utils workspace member and updates reqwest features |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 30 out of 31 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 30 out of 31 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
1a28bf1 to
cf17463
Compare
# Conflicts: # Cargo.lock # Cargo.toml # crates/fspy_preload_unix/src/interceptions/spawn/exec/with_argv.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: branchseer <3612422+branchseer@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: branchseer <3612422+branchseer@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: branchseer <3612422+branchseer@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: branchseer <3612422+branchseer@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: branchseer <3612422+branchseer@users.noreply.github.com>
21bdcf0 to
05cbeb6
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 30 out of 31 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
# Fix seccomp filter IPC and add static executable support This PR improves the seccomp filter IPC mechanism by using path-based Unix domain sockets instead of directly passing file descriptors. This approach is consistent with #234 and eliminates the need for pre-exec handling. Key changes: - Replace direct fd passing with Unix domain socket communication - Fix handling of path overflow in CStrPtr by returning a boolean success indicator - Add support for tracking static executables with tests - Add a test binary crate that can be included as a static binary for testing - Implement proper handling of the `open` syscall on x86_64 architecture - Enable typeaware linting test on Linux The PR also includes various code improvements and cleanup, such as better error handling and more robust syscall tracking.
Includes: - ux: hint Escape key when no tasks match in interactive selector (#235) - docs: overhaul README.md, CLAUDE.md and add CONTRIBUTING.md (#234) https://claude.ai/code/session_0139LsSbe67hcD8NKKaK6Y8U
## Summary - Bump vite-task from `28f371a1` to `398a147f` - Includes: hint Escape key when no tasks match in interactive selector (#235), overhaul README/CLAUDE.md and add CONTRIBUTING.md (#234) ## Test plan - [x] `cargo check` passes - [ ] CI passes https://claude.ai/code/session_0139LsSbe67hcD8NKKaK6Y8U Co-authored-by: Claude <noreply@anthropic.com>

Implemented a shared memory IPC channel for fspy to improve performance and reliability when tracking file system accesses.
The channel implementation is cross-platform. In this PR it's only adopted in macOS/Linux version of
fspy. Windows version offspy will switch to it in a separate PR.Why make this change?
The previous IPC implementation uses file descriptor inheritance to pass down the IPC channel. It has the risk of descriptors being closed in the child processes. Some defensive logic was implemented to handle it, including:
vite-plus/crates/fspy/src/unix/mod.rs
Line 156 in 540f597
posix_spawn to avoid being closed byPOSIX_SPAWN_CLOEXEC_DEFAULT:vite-plus/crates/fspy_preload_unix/src/client/mod.rs
Line 208 in 540f597
It apparently missed some cases, and the IPC fd still got closed, leading to
bad descriptor error in https://github.com/voidzero-dev/vibe-dashboard/actions/runs/18532354385/job/52818262992.What changed?
accesses_futureafter the root target process has exited. If descendants are spawned after the root target process has exited, their fs accesses will be missed.Note
Replaces Unix fspy IPC with a lock-backed shared-memory channel and updates payloads, readers, and callers; adds test utils and adjusts env/TLS dependencies.
fspy_shared::ipc::channel) withSender/Receiverand lock-guardedShmReader/ShmWriterfor zero-syscall writes.ChannelConfinstead of an FD.SpyInner::init_in, fixture handling, and path injection; reads frames via shared memory; lazy-locks receiver after child exit.PathAccessvia shared memory; removes POSIX spawn FD-inheritance handling; minor argv handling fix.NativeStrconstruction and a temporary task to avoid blocking.accesses_futuremust be awaited after child exit; updates examples, tests, e2e, andvite_taskexecution flow accordingly.fspy_test_utilscrate for cross-process test helpers.NativeStr/NativeStringfor zero-copy (ANSI/wide) and cross-platform encoding; updates spawn payload/env usage.shared_memory,memmap2,uuid,tracing; tweaksnixfeatures; switchesreqwesttonative-tls-vendored(addsopenssl-src).Written by Cursor Bugbot for commit 8f35015. This will update automatically on new commits. Configure here.