Repository navigation
ci(tend): reach the pre-merge gate's tools from inside the sandbox - #3897
Conversation
The agent runs as `tend-sandbox`, and tend derives that user's PATH from the runner's by rewriting a leading /home/runner to /home/tend-sandbox and keeping an entry only where the rewritten directory exists. `useradd -m` seeds the sandbox home from /etc/skel, so an image-baked toolchain has a sibling there; anything `tend-setup` installs at runtime into the runner's home has none and is dropped, silently. `baptiste0928/cargo-install` forces `--root $HOME/.cargo-install/<crate>` and `uv tool install` writes to the runner's ~/.local/bin, so all three tools `wt hook pre-merge` runs went missing: the gate died on `pre-commit: exit status: 127`, `cargo insta` answered `no such command`, and the bot verified its work with `cargo test` plus `INSTA_UPDATE=always` — which writes snapshots rather than checking them. Since 2026-06-18, 16 of 197 bot PRs pushed a first commit with the `lint` job red, against 4 of 350 for human PRs. `sandbox_setup:` runs as 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; the cargo binaries are copied from where the runner-side step already built them, at the versions pinned in `tend-setup`. The closing probe is the assertion: sandbox-setup.sh runs the block under `bash -eo pipefail`, so a recurrence fails the job and files a tend-outage issue naming the tool instead of degrading quietly. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
I ran the sandbox_setup: block verbatim in this review session's own sandbox (as tend-sandbox, under bash -eo pipefail) and it works end to end: the two install copies succeed (/home/runner is drwxr-x--x, so it's traversable and the binaries are world-readable), uv resolves from /opt/hostedtoolcache, uv tool install pre-commit drops its shim in ~/.local/bin, and the probe passes. The .github/CLAUDE.md description of the PATH derivation matches tend 0.1.18's proxy/setup-sandbox.sh — ~/.local/bin is prepended unconditionally there, so the mkdir -p correctly doesn't need to precede PATH construction.
One gap, though: nu is still missing, so wt hook pre-merge --yes still can't complete.
The gate's insta step in .config/wt.toml runs --all-features, which turns on shell-integration-tests — "needs bash, zsh, fish, nu, pwsh, and jq on PATH", per its comment in Cargo.toml. tests/integration_tests/nushell_default_config_dir.rs is gated on that feature and spawns Command::new("nu") with .expect("nu must be on PATH (installed by .github/actions/test-setup)"). tend-setup apt-installs only zsh and fish; nothing in it installs Nushell, and command -v nu is empty in this sandbox (nu is also absent from /opt/hostedtoolcache and /usr/local/bin, so it isn't on the runner either). Net effect after this PR: the probe passes, the agent pays for a full --all-features build, and the gate dies on a missing tool the probe just cleared it for.
dev/codex.sh is the sibling "make the gate runnable in a sandbox" script, and it provisions exactly pre-commit, cargo-insta, cargo-nextest, nu, and pwsh. This block covers three of those, pwsh ships on the runner image, and nu is the one left over.
It doesn't need a sandbox_setup line — hustcer/setup-nu@v3 installs into /opt/hostedtoolcache/nu/<version>/<arch>, a system path the derivation carries across verbatim, which is the mechanism the new .github/CLAUDE.md section describes and the one #3891 leans on for nix. In .github/actions/tend-setup/action.yaml, level with test-setup's pin (it's outside this diff, so no inline suggestion):
- name: Install nushell
uses: hustcer/setup-nu@v3
with:
version: '0.115.0'nu would then belong in the probe list alongside the other three. Happy to push that commit if you want it.
Separately, #3891 also edits .github/actions/tend-setup/action.yaml — it appends the Nix steps at the end, so no textual conflict — and its inline comment re-derives the same "system PATH entries carry into the sandbox verbatim" rule this PR centralizes in .github/CLAUDE.md. Whichever lands second could point at that section instead of restating it.
Other things checked, no action needed
sandbox_setup:as a list of strings is the schema tend 0.1.18 expects (generator/src/tend/config.py:sandbox_setup: list[str], and it's inKNOWN_KEYS), andshared/steps/sandbox-setup.shdoes run it undersudo -u "$SANDBOX" … bash -eo pipefail -c, so the probe really is load-bearing as the comment claims.- All eight tend workflows call
./.github/actions/tend-setupwith default inputs, soinstall-cargo-toolsistrueeverywhere and neitherinstallline can hit a missing source today. The new comment in the action covers the case where that stops being true. - The rendered block in each of the eight workflows matches the five
.config/tend.yamlentries in order. - Cargo is usable from the sandbox, with two costs worth knowing before relying on the gate in a tend session:
CARGO_HOMEis the sandbox's own~/.cargo, sorust-cache's restored registry (under the runner's home) isn't reachable and crates re-download —index.crates.iodoes answer through the proxy — and the firstcargocall pulls therust-toolchain.toml-pinned 1.96.0 toolchain, since/etc/skelseeds onlystable. I rancargo --versionhere and it resolved fine. The 4.5 GBtarget/is reachable, since it lives in the workspace.git ls-remote https://github.com/pre-commit/pre-commit-hooksalso succeeds, sopre-commit run --all-filescan install its hook environments.
The gate's `insta` step runs `--all-features`, turning on `shell-integration-tests` — which needs `nu` as much as zsh and fish, and which two tests `.expect()` outright. `tend-setup` apt-installed only zsh and fish, so the probe added in the previous commit would have cleared the agent to run a gate that then died on a missing shell. `hustcer/setup-nu` installs under /opt/hostedtoolcache, a system path the sandbox PATH derivation carries across verbatim, so this needs no `sandbox_setup:` line the way the runner-home installs do. Pinned level with `test-setup` and `dev/codex.sh`, both already on 0.115.0; `running-tend`'s weekly pin-bump recipe enumerates the `setup-nu` call sites, so it gains the fifth. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
The nu gap from my last review is closed, and I traced the mechanism end to end rather than taking the comment's word for it: hustcer/setup-nu@v3 ends at tc.cacheDir(cacheSource, 'nushell', version), so the binary lands in /opt/hostedtoolcache/nushell/0.115.0/x64 — outside /home/runner, so tend 0.1.18's rewrite loop keeps it verbatim and the sudo -u tend-sandbox test -x filter passes on the 0755 dir. The probe sees the same PATH the agent does (sandbox-setup.sh runs the commands under env "${AGENT_ENV[@]}" from $AGENT_ENV_FILE), so adding nu to it can't be a false negative. With this, all six tools the --all-features gate needs are reachable — bash, zsh, fish, pwsh, jq are all in /usr/bin on the runner, which the same rule carries across.
One correction to my last review, which said #3891 would not conflict textually: it does now. #3891 appends its Nix steps at the same end-of-file anchor this commit's nushell step took, and a three-way merge of the two heads against 8cfe5ea conflicts in .github/actions/tend-setup/action.yaml (SKILL.md, which both also touch, merges clean). Resolution is just "keep both steps" — flagging it so it isn't a surprise for whichever lands second.
Other things checked, no action needed
- All eight rendered
sandbox_setup:blocks match.config/tend.yaml's new four-tool probe verbatim. - The pin is level with the four existing
setup-nucall sites anddev/codex.sh, all on0.115.0; theSKILL.mdbullet's "Five call sites" enumerates 3 + 2, and.github/CLAUDE.md's "asserts all four" matches the probe list. - All eight workflows call
tend-setupwith default inputs, so the newif: inputs.install-shells == 'true'guard can't leave the unconditionalnuprobe stranded today. Worth knowing that it now could:install-shells: falsewould fail every tend job at the probe, the same coupling the cargo-install block's comment spells out but this one doesn't. setup-nu'sgithub-tokendefaults to${{ github.token }}, which the tend jobs have, so the release lookup authenticates; it runs before the tend action starts its proxy, so nothing intercepts the download.
…chability # Conflicts: # .github/actions/tend-setup/action.yaml
## Summary Weekly CI renovation. Rust stable moved to 1.98.0 on 2026-08-20, so MSRV and the development toolchain go to 1.97 (latest stable − 1); one cargo-install pin had drifted. Everything else is already current. - **MSRV + toolchain: 1.96 → 1.97** — `Cargo.toml`, `tests/helpers/wt-perf/Cargo.toml`, `rust-toolchain.toml` (`1.97.0`), plus the `flake.lock` refresh the channel bump requires. - **`cargo-llvm-cov`: 0.8.7 → 0.9.0** — `coverage.yaml`. MSRV 1.87, well under the pinned toolchain. Toolchain compatibility for every other pinned crate against 1.97.0: `cargo-affected` 0.4.0 (1.94), `cargo-insta` 1.48.0 (1.66.0), `cargo-nextest` 0.9.143 (1.91), `cargo-llvm-cov` 0.9.0 (1.87), `cargo-msrv` 0.19.3 (1.91.1), `lychee` 0.24.2 (1.88.0), `worktrunk` 0.74.0 (1.96), `cargo-udeps` 0.1.61 (unspecified). All build under 1.97.0. - **Pinned nightly: `nightly-2026-03-01` → `nightly-2026-08-01`** — `nightly.yaml` ×2. Not drift: the MSRV bump *broke* these two jobs, see below. - **The skill's `flake.lock` recipe** — the in-session Nix install it pointed at can never run. The setup step that fixes that lives in #3891, not here; see below. The remaining commits are fallout from the same sweep: `cargo-llvm-cov` 0.9.0 changes the shape of the `--show-missing-lines` column `tests/CLAUDE.md` sends you to during a codecov investigation, and the weekly statusline cache-check has been reporting two duplicates that are artifacts of its own `-vv` flag. ## The MSRV bump broke two nightly jobs; that is fixed here `check-unused-dependencies` and `minimal-versions` each pin their own toolchain, and `nightly-2026-03-01` is `1.96.0-nightly` — so raising `rust-version` to 1.97 made cargo refuse the workspace outright, before either job ran its actual check: ``` error: rustc 1.96.0-nightly is not supported by the following packages: [email protected] requires rustc 1.97 ``` Both are now on `nightly-2026-08-01` (`1.99.0-nightly`), which clears the new MSRV with headroom rather than landing on it. Reproduced locally in both directions: `cargo +nightly-2026-03-01 check` fails with the error above, `cargo +nightly-2026-08-01 check` passes. The coupling is easy to miss because neither failure mentions udeps or minimal versions, so both lines now say so, and the weekly MSRV file table gained a row for the pins. The rule on that row is a date, not a version: bump only when the pinned date is more than three months old. Nightly runs two channels ahead of stable and MSRV tracks stable − 1, so a pin that recent is still a release above the new MSRV — which makes staleness checkable from the pinned date alone, where reading it off the rustc version means fetching that day's `channel-rust-nightly.toml`. `nightly-2026-03-01` was five and a half months old, which is exactly what the rule catches. ## The `flake.lock` bump was computed by hand — and the recipe that forced that is fixed here `rust-toolchain.toml` moving to `1.97.0` forces a lock refresh: the locked `rust-overlay` (`4a408e1f`, 2026-06-02) carries stable manifests only up to `1.96.0`, so `nix flake check` cannot resolve the new channel. `rust-overlay` is bumped to `f60c1b57` (2026-08-23), which has `1.97.0.nix`. `nixpkgs` and `crane` are left alone — only `rust-overlay` has to know about the new channel, and a full `nix flake update` is a wider change than this PR needs. This session could not run `nix flake update`: the weekly runner has no Nix, and the agent runs as a sandbox user with no sudo, so the installer the skill pointed at stops at `sudo: a password is required`. The lock entry was therefore computed directly from the NAR serialisation, and the method was validated first by recomputing the **existing** `rust-overlay` entry from its own revision and getting `sha256-7mDa7OBAaf7MU6ZovT9ENfD62kH911SsSazBb4KTDF0=` back byte-for-byte — the value already in `flake.lock`. The same script then produced the new entry. That should not have been the answer, and it no longer is. #3891 has merged (`2960bfb`), so `tend-setup` installs Nix and next week's refresh runs `nix flake update rust-overlay` for real. This branch briefly carried its own `cachix/install-nix-action@v31` step in the same file; `adbeb76` dropped it in favour of #3891's, which asserts the multi-user install branch directly and doesn't couple to `github.workflow == 'tend-weekly'`, a gate that stops firing if the generated workflow is renamed. `.github/actions/tend-setup/action.yaml` on this branch is byte-identical to `main`. What stays here is the skill side: the in-session install recipe and the NAR-serialisation fallback are both deleted, because the Determinate installer they rest on cannot run in the sandbox. Both PRs rewrote that section and converged on nearly the same wording, so they merged clean while both were open — but #3891's squash collapsed its five commits into one, and its last two had moved the "if `nix` isn't on the PATH" line and folded the flake-input rationale into the code block. That turned the section into the merge's one conflict, resolved by taking `main`'s wording wholesale; the section is now byte-identical to `main`'s, and this branch's own additions to that file are untouched by it. That is a strong check but not the real one. `nightly`'s `nix-flake` job runs `nix flake check` and fires on this PR (the paths filter matches `rust-toolchain.toml`, `Cargo.toml`, and `flake.lock`), so it is the gate that actually proves the lock evaluates. **It has now run on this head and passed**, so the computed lock resolves the 1.97.0 channel and the flake's checks build under it. Flagging the provenance anyway, since a hand-written lock entry deserves a second look on review. <details><summary>How the hash was computed</summary> Nix serialises the unpacked flake input as a NAR and reports SHA-256 of that stream in SRI form. The format is length-prefixed strings padded to 8 bytes, with directory entries in bytewise-sorted order; a ~90-line Python script reproduces it from the GitHub tarball with the top-level `<repo>-<rev>` directory stripped, which is the same tree Nix hashes. ``` rust-overlay 4a408e1fc99ad517b4cb402fd0de7464f40c05e1 (currently locked) computed sha256-7mDa7OBAaf7MU6ZovT9ENfD62kH911SsSazBb4KTDF0= in lock sha256-7mDa7OBAaf7MU6ZovT9ENfD62kH911SsSazBb4KTDF0= ✓ rust-overlay f60c1b57ff805a46b5175c76fc981fb4f81efbcc (new) computed sha256-r4LDUF+zmJnkftvCVkCrUhSJazsf6EVJF+V2l4/MYbI= lastModified 1787454509 (committer date 2026-08-23T03:08:29Z) ``` </details> ## Already up to date - `cargo-affected` 0.4.0, `cargo-insta` 1.48.0, `cargo-nextest` 0.9.143, `cargo-msrv` 0.19.3, `cargo-udeps` 0.1.61, `lychee` 0.24.2, `worktrunk` 0.74.0 (matches the newest crates.io release) - Nushell 0.115.0 — all four call sites, and `dev/codex.sh` - Codex Cloud pins in `dev/codex.sh`: pre-commit 4.6.2, cargo-insta 1.48.0, cargo-nextest 0.9.143, PowerShell 7.6.5; `setup-web`'s own Nushell and PowerShell pins agree - Runner images `ubuntu-24.04` and `windows-2022` (the latter deliberately pinned — actions/runner-images#12677) ## Found, not bumped: `macos-15` is no longer what `macos-latest` resolves to `ci.yaml`'s header comment says `ubuntu-24.04, macos-15` are "pinned to current -latest equivalents". That is still true of Ubuntu but no longer of macOS: `macos-latest` now resolves to **macOS 26 arm64**, and `macos-15` has become the older of the two GA images — which, under the runner-images deprecation policy ("deprecation of the oldest image label begins once the newest OS image label has been released to GA"), is the one that starts aging out next. `macos-14` already carries the deprecated badge. Not bumped here, because it is an OS upgrade rather than a version pin, and this repo drives PTY and shell-integration snapshots on macOS that a new image and Xcode can move. There is also nothing this session can do to check it — the only macOS available to it is the `test (macos)` job on a PR, and a red macOS matrix would have blocked the MSRV bump alongside it. Flagging rather than guessing at the timing: whether to take macOS 26 now or wait for the deprecation announcement is a call about this repo's snapshot surface. Happy to open it as its own PR if you want the signal. ## CI Fully green on `7940a97`, the first merge of `main`: all 33 non-skipped checks, including `msrv`, all three `test` legs, `full-tests` on every platform, `nix-flake`, `minimal-versions`, `check-unused-dependencies`, `check-docs`, `link-check`, `feature-powerset`, and `codecov/patch`. That head is where the hand-written lock entry and the nightly pins were proven against the current `main`. `main` has since moved four commits (#3886, #3893, #3895, #3897) and is merged in again at `d8d1553`, alongside the nightly-pin rule above. #3895 touches `nightly.yaml`, so the pins were re-checked after that merge: still exactly two sites, `minimal-versions` and `check-unused-dependencies`, both on `nightly-2026-08-01`. Locally `pre-commit run --all-files` and `test_docs_are_in_sync` pass on this head. ## Weekly checks that produced no change - **LLM model pins** — no drift. `gpt-5.6-luna` is still how OpenAI's models page positions the "fast and affordable … lowest cost in the family" 5.6 variant; `gpt-5.3-codex-spark` is a Pro-only research preview, not a default. `haiku` / `claude-haiku-4.5` is still the smallest current Anthropic model. - **Statusline cache-check** — clean. `command_count` was 27, which includes the three calls the `-vv` diagnostic collector makes after the render, so the render itself is ~24 against a ~29 baseline measured before the recipe used `-vv`. The two duplicates the report flagged (`gh --version`, `git worktree list --porcelain`) are that same collector, not the render. Both the baseline arithmetic and the trap are now written down in the skill. - **Agent app integration surfaces** — nothing that changes what Worktrunk consumes. Claude Code 2.1.239 fixed `metadata.pluginRoot` resolution, but `.claude-plugin/marketplace.json` names an explicit `./plugins/worktrunk` source rather than a bare name, so it is unaffected; the `WorktreeCreate`/`WorktreeRemove` hooks and the statusline stdin schema are unchanged (`workspace.git_worktree` and `workspace.repo` exist but predate this window by several hundred releases). Codex, Gemini CLI, and OpenCode shipped only routine releases. - **README month** — already "August 2026". - **Dependency PRs** — none open. <details><summary>Verification</summary> - `rustup` resolves the new channel: `cargo 1.97.0 (c980f4866 2026-06-30)`, `rustc 1.97.0 (2d8144b78 2026-07-07)`, `clippy 0.1.97`. - `cargo clippy --all-targets --all-features -- -D warnings` passes on 1.97.0 — the check that matters most for a toolchain bump, since it compiles every target and feature under the new rustc and holds the new clippy to zero warnings. Doctests passed too. - Unit tests pass on 1.97.0: 979 + 11 + 1, zero failures. - Integration tests: 2000 passed, 1 failed — `test_copy_ignored_preserves_file_executable_permissions`, which expects `0644` and got `0664`. That is this sandbox's `umask 0002`, not the toolchain; the `test (linux|macos|windows)` matrix is the real gate. - `cargo run -- hook pre-merge --yes` is not a clean local signal on this runner: it ends on `pre-commit: exit status: 127` because pre-commit isn't installed in the tend sandbox, unrelated to the bump. - `cargo msrv verify` was not run locally (it rebuilds the graph per candidate); `ci.yaml`'s `msrv` job covers it. - Every version above was read from its upstream source of truth: `cargo info` / crates.io for the cargo tools, `static.rust-lang.org/dist/channel-rust-stable.toml` for Rust stable (1.98.0, 2026-08-20), the `nushell/nushell` and `PowerShell/PowerShell` release APIs, PyPI for pre-commit, `actions/runner-images` README for the image labels, and the vendors' own model pages for the LLM pins. - `rust-overlay` at the currently-locked revision was confirmed to stop at `1.96.0.nix`, and at the new revision to contain `1.97.0.nix` — this is why the lock has to move at all. </details> > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Maximilian Roos <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
The agent tend runs as,
tend-sandbox, could not reachcargo-insta,cargo-nextest, orpre-commit— all three of the toolscargo run -- hook pre-merge --yesinvokes. That command is whatCLAUDE.mdand.claude/skills/running-tend/SKILL.mdtell the bot to verify its work with, and in the sandbox it died at✗ pre-merge command failed: pre-commit: exit status: 127.Tend derives the sandbox's PATH from the runner's, rewriting a leading
/home/runnerto/home/tend-sandboxand keeping an entry only where the rewritten directory exists.useradd -mseeds the sandbox home from/etc/skel, so a toolchain baked into the runner image has a sibling there and survives; anythingtend-setupinstalls at runtime into the runner's home has none and is dropped, with nothing logged.baptiste0928/cargo-installforces--root $HOME/.cargo-install/<crate>anduv tool installwrites to the runner's~/.local/bin, so all three went the second way.uvitself stayed reachable only becauseastral-sh/setup-uvputs it under/opt/hostedtoolcache, a system path the rewrite leaves alone.sandbox_setup:runs as the sandbox user once its PATH is built, with~/.local/binalready first on it.pre-commitinstalls into the sandbox's own home so uv's shim shebang resolves there; the cargo binaries are copied from wheretend-setupalready built them, at the versions pinned there. The closing probe is the assertion —sandbox-setup.shruns the block underbash -eo pipefail, so a tool that goes missing again fails the job and files atend-outageissue naming it, rather than degrading quietly.A fourth tool needed the same treatment by a different route. The gate's
instastep runs--all-features, which turns onshell-integration-tests; that needsnuas much as zsh and fish, and two tests.expect()it outright.tend-setupapt-installed only zsh and fish, so the probe would have cleared the agent to run a gate that then died on a missing shell.hustcer/setup-nuinstalls under/opt/hostedtoolcache, a system path the derivation carries across verbatim, sonuneeds nosandbox_setup:line — it just needed installing. Pinned at 0.115.0, level withtest-setupanddev/codex.sh;running-tend's weekly pin-bump recipe enumerates thesetup-nucall sites, so it gains the fifth.The remaining
shell-integration-testsprerequisites — bash, zsh, fish, pwsh, jq — all resolve from/usr/bin, which the derivation keeps, so they were never affected. The probe deliberately covers only the four toolstend-setupprovisions for the agent rather than everything the gate touches.The generated
tend-*.yamlfiles areuvx tend@latest initoutput (still 0.1.18); the only change in each is thesandbox_setup:block.#3891 landed mid-review and appended its Nix steps at the same end-of-file anchor as the nushell step, so this branch carries a merge resolving that — keeping both, nushell next to the shells it belongs with. Its Nix comment restated the "system PATH entries carry into the sandbox verbatim" rule that this PR centralizes in
.github/CLAUDE.md, which would have left the rule written three times in one file, so it now points there and keeps only what's specific to Nix. Every #3891 step is unchanged.Evidence, and what it cost
Sandbox PATH, captured from the agent's own launch env in tend-weekly run 32630901712:
error: no such command: instaappears in runs 31332910927, 31465475753 and 32436240803;pre-commit: command not foundin 32662391023. Across 3,057 captured Bash calls the bot never once invokedcargo nextest, and substitutedcargo testwithINSTA_UPDATE=alwaysorINSTA_FORCE_UPDATE=1fifteen times — which writes snapshots rather than checking them, and never runs--checkor--unreferenced reject.Since 2026-06-18, when #3122 moved the repo to tend 0.1.6 and the agent first ran sandboxed, 16 of 197 bot PRs pushed a first commit with the
lintjob red. Over the same window 4 of 350 of the maintainer's own PRs did. #3845 is the shape: a closurecargo fmtwanted on one line, caught by CI rather than locally.Verified by simulating the block under
bash -eo pipefailagainst a fake runner home, in both directions: all three tools land on PATH and it exits 0; remove one and it prints the::error::naming it and exits 1. Two things changed after that test —install -Dis GNU-only, so the parent directory is created explicitly, andcommand -v a b cexits 0 when any one resolves, so the assertion is a loop rather than a single call.