Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
docs(ci): correct the tend sandbox model for 0.2.14's copy-on-write view (#4224)
Worktrunk Bota73730c9aff8
diff --git a/.claude/skills/running-tend/SKILL.md b/.claude/skills/running-tend/SKILL.mdindex b5990672a..518df8b88 100644--- a/.claude/skills/running-tend/SKILL.md+++ b/.claude/skills/running-tend/SKILL.md@@ -85,13 +85,13 @@ fixes a test here, not just issue triage.## Session Log Paths-The artifact directory is named after the agent's working directory, and from-tend 0.2.5 that is a per-run `tend-agent-workspace-*/checkout` whose parent-directory moves between tend releases — so the old-`-home-runner-work-worktrunk-worktrunk/` prefix appears only in runs predating-the bump, and there is no literal to match on any more. Use the bundled-`find "$DEST" -name '*.jsonl'` recipe; either shape is one `<session-id>.jsonl`-under a single slugified directory.+The artifact directory is named after the agent's working directory, which+moves between tend releases — 0.2.5–0.2.13 used a per-run+`tend-agent-workspace-*/checkout`, and from 0.2.14 the agent works in the+runner's own checkout, so `-home-runner-work-worktrunk-worktrunk/` is the+prefix again. Match on neither literal: use the bundled+`find "$DEST" -name '*.jsonl'` recipe, which holds across all of them — every+shape is one `<session-id>.jsonl` under a single slugified directory.## Labels@@ -288,13 +288,14 @@ succeed. A failure is reported in the PR, never worked around: leave the filealone if the update fails, `git checkout flake.lock` if the eval does, andhand-compute an entry in neither case.-**Expect both commands to fail with a permission error from tend 0.2.5 on.**-`nix` resolves on the agent's PATH, but the multi-user client reaches the store-by connecting to `/nix/var/nix/daemon-socket/socket`, and the sandbox blocks-`socket(AF_UNIX, …)` outright. That is the reported failure above, not a-problem with the bump: say so in the PR, leave `flake.lock` untouched, and-carry the rest of the toolchain change as normal. It clears when-max-sixty/tend#1197 gives the action a lever for it.+**Expect both commands to fail from tend 0.2.5 on, with `cannot create Unix+domain socket: Address family not supported by protocol`.** `nix` resolves on+the agent's PATH, but the multi-user client reaches the store by connecting to+`/nix/var/nix/daemon-socket/socket`, and the sandbox blocks+`socket(AF_UNIX, …)` outright — still true under 0.2.14's systemd unit. That+is the reported failure above, not a problem with the bump: say so in the PR,+leave `flake.lock` untouched, and carry the rest of the toolchain change as+normal. It clears when max-sixty/tend#1197 gives the action a lever for it.After bumping, run the full test suite (`cargo run -- hook pre-merge --yes`)and verify `cargo msrv verify` passes.diff --git a/.config/tend.yaml b/.config/tend.yamlindex 04e473953..f2d9fccb7 100644--- a/.config/tend.yaml+++ b/.config/tend.yaml@@ -1,16 +1,24 @@bot_name: worktrunk-botsetup:- uses: ./.github/actions/tend-setup-# `setup:` runs as `runner`, so what it installs into the runner's home never-# reaches the agent — and from tend 0.2.5 the sandbox denies reads there-# outright, so a line copying a binary out of it fails the whole lifecycle-# before the harness starts (see "Sandbox toolchain" in .github/CLAUDE.md).-# Only pre-commit is left: it installs into the sandbox's own home, where uv's-# shim shebang resolves, and needs no runner-owned file to do it. `cargo-insta`,-# `cargo-nextest`, `nu` and `nix` all take the system-location route in-# `tend-setup` instead and need no line here. The probe still 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.+# tend 0.2.14 deprecated `sandbox_setup:` and runs its commands as an ordinary+# `runner` step after `setup:`; the agent then sees what they install through a+# copy-on-write view of the job's home (see "Sandbox toolchain" in+# .github/CLAUDE.md). #4222 kept the key so a release reverting 0.2.14 would+# still find it, so this block outliving its original rationale is deliberate,+# not drift.+#+# What that rationale was: `setup:` ran as `runner` and the sandbox denied+# reads under the runner's home, so pre-commit had to be installed from here,+# into the sandbox's own home. It now duplicates `tend-setup`'s own pre-commit+# step and goes when the key does. The probe is what still earns its place:+# the block runs under `bash -eo pipefail`, so a tool that goes missing fails+# the job with an `::error::` annotation naming it. No tend-outage issue is+# filed any more — that is `report_failure.py`, a step inside the tend action+# under `if: failure()`, and the generator now emits this block ahead of that+# action, so a failure here skips it. Of the five tools it asserts, four are+# what the pre-merge gate needs, whichever step installed them; `nix` is for+# the weekly toolchain bump's `flake.lock` refresh.sandbox_setup:- mkdir -p ~/.local/bin- uv tool install --quiet pre-commitdiff --git a/.github/CLAUDE.md b/.github/CLAUDE.mdindex dd1a6d4a5..f293f2a8f 100644--- a/.github/CLAUDE.md+++ b/.github/CLAUDE.md@@ -81,31 +81,36 @@ running in that same `release` environment.## Sandbox toolchain-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 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. From tend-0.2.5 the runner's home isn't merely off-PATH but unreadable: the Sandbox-Runtime denies reads across it and the runner's checkout, so a `sandbox_setup:`-line that copies a binary out of `/home/runner` fails the whole lifecycle-before the harness starts.--So a tool the agent needs has to land in a system location, which carries-across verbatim: `/opt/hostedtoolcache/...` for `nu`,-`/nix/var/nix/profiles/default/bin` for `nix`, and `/usr/local/bin` for-`cargo-insta` and `cargo-nextest`, which `tend-setup` `sudo install`s there-after building them in the runner's home. Only `pre-commit` still comes from-`.config/tend.yaml`'s `sandbox_setup:`, because it installs into the sandbox's-own home and reads nothing runner-owned to do it. The block's closing probe-asserts every tool on both routes.--A system location gets the *binary* across, not what it talks to. `nix`-resolves on the agent's PATH but cannot reach the daemon: the sandbox blocks-`socket(AF_UNIX, …)`, so the weekly `flake.lock` refresh needs an upstream-lever (max-sixty/tend#1197). `command -v` can't see that distinction, which is-why the probe stays green while the weekly job would not.+The agent runs as `tend-sandbox`, but from tend 0.2.14 it works through a+copy-on-write view of the job's own checkout and home rather than a tree of+its own: `$HOME` is `/home/runner`, the cwd is the runner's checkout, and what+`setup:` installed is on PATH at the path it was installed to. Writes stay+inside the view, so nothing the agent writes reaches the runner or a later+step. A tool `tend-setup` installs anywhere the runner can reach is therefore a+tool the agent has, and no hand-off is needed to carry it across.++That replaced the arrangement 0.2.5–0.2.13 ran under, where the agent had a+home of its own, tend rewrote a leading `/home/runner` out of its PATH, and the+Sandbox Runtime denied reads across the runner's home and checkout. Machinery+this repo built for that is still in place and still runs, now as a second copy+rather than as the route:++- `tend-setup` `sudo install`s `cargo-insta` and `cargo-nextest` into+ `/usr/local/bin`. Both also resolve from `$HOME/.cargo-install/<crate>/bin`,+ which comes first on the agent's PATH.+- `.config/tend.yaml`'s `sandbox_setup:` installs `pre-commit`, which+ `tend-setup` installs too. 0.2.14 deprecated the key and runs its commands as+ an ordinary `runner` step after `setup:`; #4222 kept it so a release+ reverting 0.2.14 would still find it. Its closing probe still earns its place+ — it asserts the four tools the pre-merge gate needs, whichever step+ installed them, plus `nix` for the weekly toolchain bump.++Being on PATH gets the *binary* across, not what it talks to. `nix` resolves+for the agent but cannot reach the daemon: `socket(AF_UNIX, …)` is blocked, so+`nix store info` fails with "Address family not supported by protocol" and the+weekly `flake.lock` refresh needs an upstream lever (max-sixty/tend#1197).+`command -v` can't see that distinction, which is why the probe stays green+while the weekly job would not.## Build environment@@ -119,10 +124,11 @@ nightly.yaml carry theirs in a workflow-level `env:` block, always in placefirst. A miss is silent — the step succeeds having restored nothing — so drifthere shows up only as slow jobs.-The `tend-*.yaml` workflows are out of this scheme entirely. They can't carry a-workflow-level `env:` block, and from tend 0.2.5 there is nothing for one to-serve: the agent builds in a disposable `/tmp` clone, so a cache restored into-the runner's checkout and home is both unreachable and at the wrong path.-`tend-setup` therefore restores nothing and sets none of the three vars, and-tend sessions compile cold until max-sixty/tend#1198 gives the agent's own tree-a supported way to warm.+The `tend-*.yaml` workflows are out of this scheme: they can't carry a+workflow-level `env:` block, so `tend-setup` restores nothing, sets none of the+three vars, and tend sessions compile cold. What forced that between tend 0.2.5+and 0.2.13 — the agent building in a disposable `/tmp` clone, where a cache+restored into the runner's checkout and home was both unreachable and at the+wrong path — no longer holds, because 0.2.14 put the agent on the job's own+checkout and home. Whether a restore now pays for itself is a measurement+against the download cost in all eight workflows (max-sixty/tend#1198).diff --git a/.github/actions/tend-setup/action.yaml b/.github/actions/tend-setup/action.yamlindex fa3283789..b019dad86 100644--- a/.github/actions/tend-setup/action.yaml+++ b/.github/actions/tend-setup/action.yaml@@ -13,23 +13,25 @@ runs:using: compositesteps:# No rust-cache step here, and so no CARGO*/RUST* env block above one to- # match its key. From tend 0.2.5 the agent works in a disposable /tmp clone- # instead of the runner's checkout, and the sandbox denies reads under the- # runner's home, so a restored `~/.cargo` and `<runner checkout>/target`- # are both unreachable and at the wrong path — the restore warmed nothing- # and cost the download in all eight workflows. Tend sessions build cold- # until there is a supported way to warm the agent's own tree- # (max-sixty/tend#1198). Restoring here again needs that to land first.+ # match its key. The reason was tend 0.2.5–0.2.13: the agent worked in a+ # disposable /tmp clone and the sandbox denied reads under the runner's+ # home, so a restored `~/.cargo` and `<runner checkout>/target` were both+ # unreachable and at the wrong path — the restore warmed nothing and cost+ # the download in all eight workflows. 0.2.14 put the agent on the job's+ # own checkout and home, so both are now reachable at the path a restore+ # writes them to, and tend sessions still build cold only because nothing+ # restores them. Whether a cache pays for itself here is a measurement+ # (max-sixty/tend#1198), no longer a blocked one.- # The cargo tools reach the agent through `/usr/local/bin`, not through the- # runner's home: these `cargo-install` steps write- # `$HOME/.cargo-install/<crate>/bin` — the root this action hardcodes — and- # the sandbox denies that whole subtree, so `.config/tend.yaml` can no- # longer copy them across from `sandbox_setup:`. A system location crosses- # verbatim instead, the route `nu` and `nix` already take (see "Sandbox- # toolchain" in .github/CLAUDE.md). Swapping these steps for an action with- # a different layout, or dropping the publish step below, breaks every tend- # workflow at `.config/tend.yaml`'s probe; update both sides.+ # These `cargo-install` steps write `$HOME/.cargo-install/<crate>/bin` —+ # the root the publish step below hardcodes — and from tend 0.2.14 the+ # agent reads that directly, with the entry ahead of /usr/local/bin on its+ # PATH. The publish was the only route while the sandbox denied reads under+ # the runner's home (0.2.5–0.2.13) and is now a second copy of the same two+ # binaries; it stays as what keeps `.config/tend.yaml`'s probe green if+ # that isolation returns (see "Sandbox toolchain" in .github/CLAUDE.md).+ # Swapping these steps for an action with a different layout breaks the+ # publish step, which hardcodes this root; update both sides.- name: Install cargo-instaif: inputs.install-cargo-tools == 'true'uses: baptiste0928/cargo-install@v3@@ -83,10 +85,10 @@ runs:# The gate's `insta` step runs `--all-features`, which turns on# `shell-integration-tests` — that needs `nu` as much as zsh and fish, and- # two tests `.expect()` it outright. `setup-nu` installs into a system- # location, so the agent inherits it (see "Sandbox toolchain" in- # .github/CLAUDE.md) with no `sandbox_setup:` line the way the runner-home- # installs above need. Level with `test-setup`'s pin.+ # two tests `.expect()` it outright. `setup-nu` installs into+ # /opt/hostedtoolcache, which the agent has reached under every sandbox+ # arrangement so far (see "Sandbox toolchain" in .github/CLAUDE.md). Level+ # with `test-setup`'s pin.- name: Install nushellif: inputs.install-shells == 'true'uses: hustcer/setup-nu@v3@@ -100,19 +102,23 @@ runs:# 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.+ # `.config/tend.yaml`'s probe asserts `nix` 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 store is- # reached through the daemon.+ # The multi-user daemon install is what this repo standardized on: root+ # owns /nix and the store is reached through the daemon. The ~1 s+ # `nixbuild/nix-quick-install-action` was ruled out because it hands /nix+ # to the runner and puts only $HOME/.nix-profile/bin on $GITHUB_PATH, a+ # path the pre-0.2.14 /home/runner PATH rewrite dropped. That rewrite is+ # gone and so is the objection — but the daemon block below leaves the+ # agent without a working `nix` either way, so there is nothing to gain by+ # switching.## Reaching the daemon is what the agent can no longer do. From tend 0.2.5- # the sandbox blocks `socket(AF_UNIX, …)` outright, so connecting to- # /nix/var/nix/daemon-socket/socket fails with EPERM and the weekly job's+ # the sandbox blocks `socket(AF_UNIX, …)` outright — still true under+ # 0.2.14's systemd unit — so connecting to+ # /nix/var/nix/daemon-socket/socket fails and the weekly job's# `nix flake update` cannot run — it needs an upstream lever# (max-sixty/tend#1197). `command -v nix` still resolves, so the probe# below stays green and the gap surfaces only in that one job. The install