fix(nix): add lsof to the flake test sandbox for --reap discovery#3406
Closed
worktrunk-bot wants to merge 1 commit into
Closed
fix(nix): add lsof to the flake test sandbox for --reap discovery#3406worktrunk-bot wants to merge 1 commit into
worktrunk-bot wants to merge 1 commit into
Conversation
The nix-flake nightly job failed on integration_tests::remove:: test_remove_reap_kills_process with "child never discovered". The test (added with the experimental `--reap` in #3396) spawns a detached child under a worktree and polls reap::processes_under() until it appears, failing at a 5s deadline otherwise. processes_under() shells out to `lsof -d cwd`; on a spawn failure it returns an empty list by design, so with lsof absent from the sandbox PATH the child is never discovered. The worktrunk-tests derivation already enumerates the host tools tests shell out to (git, python3, procps for `ps`); lsof was the missing one. Add pkgs.lsof alongside them. The test passed on all three real OS runners (full-tests linux/macos/ windows) and failed only in the Nix sandbox, matching a packaging- environment gap rather than a code regression — the class of bug the nix-flake job exists to catch. nix-flake runs only in nightly, not on PR CI, which is why #3396 merged without it gating. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Jul 10, 2026
Owner
|
@worktrunk-bot resolve conflicts |
Collaborator
Author
|
Resolved by closing: this PR is superseded by #3410 (merged 2026-07-10), which landed the identical The merge conflict here is purely the |
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.
Problem
The
nix-flakejob in the nightly workflow (failed run) failed on:The test was added with the experimental
--reapfeature in #3396. It spawns a detachedsleepchild whose cwd is a worktree, then pollsreap::processes_under()until the child appears, asserting against a 5s deadline.processes_under()shells out tolsof -d cwdand, by design, returns an empty list on a spawn failure (best-effort — seesrc/git/reap.rs). Withlsofabsent from the Nix sandbox PATH, discovery always returns empty, so the child is never found and the poll times out.This is a packaging-environment gap, not a code regression:
full-testslinux/macos/windows) and failed only in the Nix sandbox — the class of bug thenix-flakejob exists to catch.worktrunk-testsderivation inflake.nixalready enumerates the host tools tests shell out to (git,python3,procpsforps).lsofwas the one it missed.nix-flakeruns only in the nightly workflow, not on PR CI, which is why feat(remove): add experimental --reap to kill worktree processes #3396 merged without this check gating it.Solution
Add
pkgs.lsofto theworktrunk-testsderivation'snativeBuildInputs, alongside the existinggit/python3/procps, and extend the comment to explain what needs it. This is the right level — it fixes the sandbox to provide the tool the test requires, matching the established pattern, rather than skipping the test (which would remove the reap safety-net coverage the nightly nix job is meant to provide).Testing
Not verifiable in the tend CI sandbox: Nix isn't installed and the runner has no root/passwordless-sudo to install it, so
nix flake checkcouldn't be run here. The change is a one-line dependency addition of a standard nixpkgs package (pkgs.lsof) mirroring the adjacentgit/python3/procpsentries;/procis known-available in the sandbox (the existingps-based pgid test relies on it), solsof -d cwdwill resolve the sandbox's own child cwds.PR CI does not cover this fix —
nix-flakelives only in.github/workflows/nightly.yaml. To confirm before/after merge, trigger the nightly manually (workflow_dispatch) or wait for the next cron run.Automated fix for failed run