Repository navigation
fix(fspy): don't fail spawns from vp run nested in a cached task - #1045
Open
ericclemmons wants to merge 5 commits into
Open
ericclemmons wants to merge 5 commits into
ericclemmons wants to merge 5 commits into
Conversation
ericclemmons
marked this pull request as ready for review
December 1, 2026 18:20
This branch has not been deployed
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.
AI Summary
Motivation
A cached task that runs two
vp runcalls with;fails on macOS when the inner tasks aren't cached yet:Reproduced with Vite+ 1.8.0.
vp run lint && vp run testworks, becausevp runsplits&&and runs each task itself. It doesn't split;,||, or|, so a shell runs the nestedvp runcalls instead, and each of these fails the same way:vp run lint && vp run testvp run lint; vp run testvp run lint || truevp run lint | catThe same happens when a script calls
vp run, such as a release script that runsexecSync("vp run build").The outer run injects fspy into the shell. The nested
vp runis then traced by the outer preload, and starts its own fspy session for its task, settingFSPY_PAYLOADfor that child. When the nested run spawns the task, the outer preload intercepts the spawn and callsensure_envwith its own payload. The value already differs, soensure_envreturnsEINVALand the spawn fails.Changes
fspy_shared_unix: addEncodedPayload::is_overridden_in, which reports whether an exec's environment carries another session's payload.fspy_client_unix: inClient::handle_exec, leave such an exec unchanged so the nested session traces it. Then callreport_loss, so the outer run treats its trace as incomplete and doesn't cache the outer task from a partial trace.vt_bine2e: add thenested_run_in_sequencefixture, a cachedchecktask that runsvt run lint; vt run compile. It fails onmainwith the error above.Once the nested tasks hit the cache, they spawn nothing, so the outer trace is complete and the outer task can be cached. Its inputs then include the files the nested runs read to validate their caches. Changing
compile's input invalidates bothcheckandcompile, whilelintstill hits, as the last step of the snapshot shows.Testing
On macOS (aarch64):
cargo test -p vt_bin --test e2e_snapshots: 215 passed, 72 ignored. The new test fails without the fix, and passed 5 runs in a row with it.cargo test -p fspy -p fspy_shared_unix -p fspy_client_unix: passed.cargo clippy -p fspy_shared_unix -p fspy_client_unix -- -D warnings: clean.Not tested locally on Linux. The Linux preload path calls the same
Client::handle_exec, so it likely hit the same error, and the new test has nocfgrestriction.