Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

ci(tend): assert `nix` reaches the sandbox alongside the rest of the toolchain (#3909)

Maximilian Roos6b0c0d0f4cd8
diff --git a/.claude/skills/running-tend/SKILL.md b/.claude/skills/running-tend/SKILL.md
index c62a89f6d..604273e37 100644
--- a/.claude/skills/running-tend/SKILL.md
+++ b/.claude/skills/running-tend/SKILL.md
@@ -285,12 +285,13 @@ nix flake update rust-overlay
nix eval .#devShells.x86_64-linux.default.name
```
-If `nix` isn't on the PATH, `tend-setup` regressed. Say so in the PR and leave
-`flake.lock` alone rather than hand-computing an entry.
+Commit `flake.lock` alongside the other toolchain changes once both commands
+succeed. A failure is reported in the PR, never worked around: leave the file
+alone if the update fails, `git checkout flake.lock` if the eval does, and
+hand-compute an entry in neither case.
-Commit `flake.lock` alongside the other toolchain changes. After bumping, run
-the full test suite (`cargo run -- hook pre-merge --yes`) and verify
-`cargo msrv verify` passes.
+After bumping, run the full test suite (`cargo run -- hook pre-merge --yes`)
+and verify `cargo msrv verify` passes.
## Weekly Maintenance: CI Pin Bumps
diff --git a/.config/tend.yaml b/.config/tend.yaml
index 871087437..b9f94a683 100644
--- a/.config/tend.yaml
+++ b/.config/tend.yaml
@@ -6,15 +6,16 @@ setup:
# the sandbox user once its PATH is built, with ~/.local/bin already first on it:
# pre-commit installs into the sandbox's own home so uv's shim shebang resolves
# there, and the cargo binaries are copied from where `tend-setup` already built
-# them, at the versions pinned there. The probe is the assertion — sandbox-setup
-# runs the block under `bash -eo pipefail`, so a tool that goes missing again
-# fails the job and files a tend-outage issue naming it.
+# them, at the versions pinned there. `nu` and `nix` take the system-location
+# route instead and need no line. The probe asserts all five: sandbox-setup
+# runs the block under `bash -eo pipefail`, so a tool that goes missing fails
+# the job and files a tend-outage issue naming it.
sandbox_setup:
- mkdir -p ~/.local/bin
- install -m755 /home/runner/.cargo-install/cargo-insta/bin/cargo-insta ~/.local/bin/
- install -m755 /home/runner/.cargo-install/cargo-nextest/bin/cargo-nextest ~/.local/bin/
- uv tool install --quiet pre-commit
-- 'for t in cargo-insta cargo-nextest pre-commit nu; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; wt hook pre-merge cannot run"; exit 1; }; done'
+- 'for t in cargo-insta cargo-nextest pre-commit nu nix; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; see Sandbox toolchain in .github/CLAUDE.md"; exit 1; }; done'
secrets:
allowed:
- CODECOV_TOKEN
diff --git a/.github/CLAUDE.md b/.github/CLAUDE.md
index 4326558ac..9871afcee 100644
--- a/.github/CLAUDE.md
+++ b/.github/CLAUDE.md
@@ -83,14 +83,15 @@ running in that same `release` environment.
The agent runs as `tend-sandbox`, whose PATH tend derives from the runner's by
rewriting a leading `/home/runner` to `/home/tend-sandbox` and keeping an entry
-only where that directory exists. `useradd -m` seeds the sandbox home from
-`/etc/skel`, so an image-baked toolchain has a sibling there and survives;
-anything `tend-setup` installs at runtime into the runner's home has none and is
-dropped, unlogged. So a tool the agent needs has to land in a system location
-(`/opt/hostedtoolcache/...`, `/usr/local/bin`), which carries across verbatim —
-the route `nu` takes — or be copied in by `.config/tend.yaml`'s
-`sandbox_setup:`, which is what the pre-merge gate's `cargo-insta`,
-`cargo-nextest` and `pre-commit` take. Its closing probe asserts all four.
+only where the rewritten directory exists and the sandbox UID can traverse it.
+`useradd -m` seeds the sandbox home from `/etc/skel`, so an image-baked
+toolchain has a sibling there and survives; anything `tend-setup` installs at
+runtime into the runner's home has none and is dropped, unlogged. So a tool the
+agent needs has to land in a system location (`/opt/hostedtoolcache/...`,
+`/nix/var/nix/profiles/default/bin`), which carries across verbatim — the route
+`nu` and `nix` take — or be copied in by `.config/tend.yaml`'s `sandbox_setup:`,
+which is what the pre-merge gate's `cargo-insta`, `cargo-nextest` and
+`pre-commit` take. Its closing probe asserts every tool on both routes.
## Build environment
diff --git a/.github/actions/tend-setup/action.yaml b/.github/actions/tend-setup/action.yaml
index 456ec02a1..e5aeab648 100644
--- a/.github/actions/tend-setup/action.yaml
+++ b/.github/actions/tend-setup/action.yaml
@@ -96,10 +96,25 @@ runs:
# Nix, for the weekly toolchain bump's `flake.lock` refresh. The sandboxed
# agent can't install it: that user has no sudo, so it can't create /nix.
- # Installed here as `runner`, /nix/var/nix/profiles/default/bin lands on
- # $GITHUB_PATH — a system path, so the agent inherits `nix` on the same
- # rule as `nu` above. ~4 s, so it isn't worth gating to the one workflow
- # that needs it.
+ # `install-nix-action` runs as `runner` and puts
+ # /nix/var/nix/profiles/default/bin on $GITHUB_PATH — a system path, so the
+ # agent inherits `nix` on the same rule as `nu` above.
+ #
+ # Every tend workflow installs it, though only the weekly one runs `nix`.
+ # `.config/tend.yaml`'s probe asserts `nix` from inside the sandbox and
+ # runs everywhere, so gating this step to the weekly workflow would fail
+ # the rest. It costs 4 s of the action's ~50 s.
+ #
+ # The multi-user daemon install is what carries it across, so the ~1 s
+ # `nixbuild/nix-quick-install-action` is no substitute: it hands /nix to
+ # the runner and puts only $HOME/.nix-profile/bin on $GITHUB_PATH, which
+ # the /home/runner rewrite drops. Here root owns /nix and the sandbox user
+ # reaches the store through the daemon.
+ #
+ # Caching doesn't apply. Of the 4 s, the binary tarball is about half; the
+ # rest creates the nixbld users, /etc/nix and the daemon unit, which no
+ # restored /nix reproduces. Caching the store instead would serve only the
+ # weekly job's flake fetches, at the cost of a restore in every workflow.
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
diff --git a/.github/workflows/tend-ci-fix.yaml b/.github/workflows/tend-ci-fix.yaml
index 7eca1291e..9bab699a2 100644
--- a/.github/workflows/tend-ci-fix.yaml
+++ b/.github/workflows/tend-ci-fix.yaml
@@ -46,7 +46,7 @@ jobs:
install -m755 /home/runner/.cargo-install/cargo-insta/bin/cargo-insta ~/.local/bin/
install -m755 /home/runner/.cargo-install/cargo-nextest/bin/cargo-nextest ~/.local/bin/
uv tool install --quiet pre-commit
- for t in cargo-insta cargo-nextest pre-commit nu; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; wt hook pre-merge cannot run"; exit 1; }; done
+ for t in cargo-insta cargo-nextest pre-commit nu nix; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; see Sandbox toolchain in .github/CLAUDE.md"; exit 1; }; done
prompt: |
/tend-ci-runner:ci-fix ${{ github.event.workflow_run.id }}
- Run URL: ${{ github.event.workflow_run.html_url }}
diff --git a/.github/workflows/tend-mention.yaml b/.github/workflows/tend-mention.yaml
index b4fc1798f..34dabd889 100644
--- a/.github/workflows/tend-mention.yaml
+++ b/.github/workflows/tend-mention.yaml
@@ -432,7 +432,7 @@ jobs:
install -m755 /home/runner/.cargo-install/cargo-insta/bin/cargo-insta ~/.local/bin/
install -m755 /home/runner/.cargo-install/cargo-nextest/bin/cargo-nextest ~/.local/bin/
uv tool install --quiet pre-commit
- for t in cargo-insta cargo-nextest pre-commit nu; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; wt hook pre-merge cannot run"; exit 1; }; done
+ for t in cargo-insta cargo-nextest pre-commit nu nix; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; see Sandbox toolchain in .github/CLAUDE.md"; exit 1; }; done
prompt: >-
${{ steps.delay.outputs.seconds
&& format('This job started {0}s after the triggering event (over ~40s means it was queued). ',
diff --git a/.github/workflows/tend-nightly.yaml b/.github/workflows/tend-nightly.yaml
index 3277c5f29..0ac567659 100644
--- a/.github/workflows/tend-nightly.yaml
+++ b/.github/workflows/tend-nightly.yaml
@@ -46,6 +46,6 @@ jobs:
install -m755 /home/runner/.cargo-install/cargo-insta/bin/cargo-insta ~/.local/bin/
install -m755 /home/runner/.cargo-install/cargo-nextest/bin/cargo-nextest ~/.local/bin/
uv tool install --quiet pre-commit
- for t in cargo-insta cargo-nextest pre-commit nu; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; wt hook pre-merge cannot run"; exit 1; }; done
+ for t in cargo-insta cargo-nextest pre-commit nu nix; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; see Sandbox toolchain in .github/CLAUDE.md"; exit 1; }; done
prompt: |
/tend-ci-runner:nightly
diff --git a/.github/workflows/tend-notifications.yaml b/.github/workflows/tend-notifications.yaml
index 8ee1eefe0..3b32943f4 100644
--- a/.github/workflows/tend-notifications.yaml
+++ b/.github/workflows/tend-notifications.yaml
@@ -161,6 +161,6 @@ jobs:
install -m755 /home/runner/.cargo-install/cargo-insta/bin/cargo-insta ~/.local/bin/
install -m755 /home/runner/.cargo-install/cargo-nextest/bin/cargo-nextest ~/.local/bin/
uv tool install --quiet pre-commit
- for t in cargo-insta cargo-nextest pre-commit nu; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; wt hook pre-merge cannot run"; exit 1; }; done
+ for t in cargo-insta cargo-nextest pre-commit nu nix; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; see Sandbox toolchain in .github/CLAUDE.md"; exit 1; }; done
prompt: |
/tend-ci-runner:notifications
diff --git a/.github/workflows/tend-review-runs.yaml b/.github/workflows/tend-review-runs.yaml
index 5a1665b60..ac452c915 100644
--- a/.github/workflows/tend-review-runs.yaml
+++ b/.github/workflows/tend-review-runs.yaml
@@ -46,6 +46,6 @@ jobs:
install -m755 /home/runner/.cargo-install/cargo-insta/bin/cargo-insta ~/.local/bin/
install -m755 /home/runner/.cargo-install/cargo-nextest/bin/cargo-nextest ~/.local/bin/
uv tool install --quiet pre-commit
- for t in cargo-insta cargo-nextest pre-commit nu; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; wt hook pre-merge cannot run"; exit 1; }; done
+ for t in cargo-insta cargo-nextest pre-commit nu nix; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; see Sandbox toolchain in .github/CLAUDE.md"; exit 1; }; done
prompt: |
/tend-ci-runner:review-runs
diff --git a/.github/workflows/tend-review.yaml b/.github/workflows/tend-review.yaml
index 30b70ecc5..537508726 100644
--- a/.github/workflows/tend-review.yaml
+++ b/.github/workflows/tend-review.yaml
@@ -161,7 +161,7 @@ jobs:
install -m755 /home/runner/.cargo-install/cargo-insta/bin/cargo-insta ~/.local/bin/
install -m755 /home/runner/.cargo-install/cargo-nextest/bin/cargo-nextest ~/.local/bin/
uv tool install --quiet pre-commit
- for t in cargo-insta cargo-nextest pre-commit nu; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; wt hook pre-merge cannot run"; exit 1; }; done
+ for t in cargo-insta cargo-nextest pre-commit nu nix; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; see Sandbox toolchain in .github/CLAUDE.md"; exit 1; }; done
prompt: >-
${{ format('/tend-ci-runner:review {0}', github.event.pull_request.number) }}
diff --git a/.github/workflows/tend-triage.yaml b/.github/workflows/tend-triage.yaml
index 4abd79211..34b6af5e2 100644
--- a/.github/workflows/tend-triage.yaml
+++ b/.github/workflows/tend-triage.yaml
@@ -58,7 +58,7 @@ jobs:
install -m755 /home/runner/.cargo-install/cargo-insta/bin/cargo-insta ~/.local/bin/
install -m755 /home/runner/.cargo-install/cargo-nextest/bin/cargo-nextest ~/.local/bin/
uv tool install --quiet pre-commit
- for t in cargo-insta cargo-nextest pre-commit nu; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; wt hook pre-merge cannot run"; exit 1; }; done
+ for t in cargo-insta cargo-nextest pre-commit nu nix; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; see Sandbox toolchain in .github/CLAUDE.md"; exit 1; }; done
prompt: |
/tend-ci-runner:triage ${{ github.event.issue.number }}
diff --git a/.github/workflows/tend-weekly.yaml b/.github/workflows/tend-weekly.yaml
index 914d907f2..db9f163b6 100644
--- a/.github/workflows/tend-weekly.yaml
+++ b/.github/workflows/tend-weekly.yaml
@@ -46,6 +46,6 @@ jobs:
install -m755 /home/runner/.cargo-install/cargo-insta/bin/cargo-insta ~/.local/bin/
install -m755 /home/runner/.cargo-install/cargo-nextest/bin/cargo-nextest ~/.local/bin/
uv tool install --quiet pre-commit
- for t in cargo-insta cargo-nextest pre-commit nu; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; wt hook pre-merge cannot run"; exit 1; }; done
+ for t in cargo-insta cargo-nextest pre-commit nu nix; do command -v "$t" >/dev/null || { echo "::error::tend sandbox is missing $t; see Sandbox toolchain in .github/CLAUDE.md"; exit 1; }; done
prompt: |
/tend-ci-runner:weekly