Skip to content

PLX-259: the deploy job's install step writes mise's system shims into its own temp directory - #95

Merged
davidjalbers merged 9 commits into
plain-pipeline-2from
davidjalbers/plx-259-deploy-job-on-a-delivery-slot
Dec 3, 2026
Merged

davidjalbers merged 9 commits into
plain-pipeline-2from
davidjalbers/plx-259-deploy-job-on-a-delivery-slot

Conversation

@davidjalbers

@davidjalbers davidjalbers commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

PLX-259: the deploy job of on_push failed on a delivery slot of a runner host at Plexus 0.135.0, in the step mise use -g node@24 npm:@plexus-ms/cli@… npm:@plexus-ms/cli-ci@…, with failed to rebuild system shims and sudo requires a password but no TTY is available.

Cause

Three facts meet, and only together.

  1. The environment image carries plx-ci at the Plexus version, installed into mise's system directory (/usr/local/share/mise/installs) by mise install --system && mise reshim --system, as root.
    The deploy job names plx-ci at the same version, since a version stamps both.
    So mise use -g finds it "already installed" there, and counts a changed install path inside the system directory, which makes it rebuild the system shims (rebuild_shims_and_runtime_symlinks_for_changes in src/config/mod.rs of mise: system_changed is true when any of the named versions' install paths lies under system_installs_dir).
  2. The image's system shims are symlinks to the image's mise, /usr/local/bin/mise.
    The job runs the mise that jdx/mise-action downloads to ~/.local/share/mise/bin/mise.
    A shim counts as current only when it points at the running mise (is_current_owned_mise_shim, and system_install::links drops only the links that already match), so every system shim has to be rewritten.
  3. /usr/local/share/mise/shims is root's, so mise hands the rewrite to its privileged helper through sudo (system_install::needs_elevation, publish).
    A slot's container runs with --cap-drop ALL (since PLX-228), so sudo cannot change user, and mise reports it as above.

The job's log shows each: the action selected mise 2026.12.0 and put ~/.local/share/mise/bin on the path; mise ls listed npm:@plexus-ms/cli-ci 0.135.0 (system); the step printed npm:@plexus-ms/cli-ci@0.135.0 already installed, then the error.

The version of mise is not the cause.
The rebuild of system shims and the elevation through sudo are in mise 2026.11.8, the image's pin, as in 2026.12.0 (automatic elevation of system installs since feat(install): automatically elevate system installs with sudo, jdx/mise#13384, 2026-09-19; the line failed to rebuild system shims is in src/config/mod.rs at v2026.11.8, v2026.11.11 to v2026.11.16, v2026.12.0 and v2026.12.1).
None of the release notes from v2026.11.8 to v2026.12.1 changes this; the nearest is v2026.11.12's "mise reshim --system no longer drops the shim for a system version that you also have in your own installs directory".

Reproduced, in a container of ghcr.io/plexus-ms/ci-runner:0.135.0 as a delivery slot runs it (user runner, --cap-drop ALL, no mounts), the step run from a temp directory

Variant Exit
the action's mise, 2026.12.0, at ~/.local/share/mise/bin/mise (as the job) 1, the job's error word for word
the image's own mise, /usr/local/bin/mise 2026.11.8 0
mise 2026.11.8, the image's version, at the action's path 1, the same error
2026.12.0 with MISE_SYSTEM_DATA_DIR set to an absent directory 0, but every run warns No versions found for aqua:1password/cli, and plx-ci is downloaded again
2026.12.0 with MISE_SYSTEM_SHIMS_DIR set to a directory of the job's 0, no warning; a later step runs plx and plx-ci 0.135.0, op 2.42.0 and gh 2.106.0

And ci-runner:0.134.1 with the step naming 0.134.1: with --cap-drop ALL the same error; without it the image's passwordless sudo succeeds and the job's mise rewrites the image's system shims to point at itself.

Why the suite did not meet it

newborns/deploy-job.test.ts ran the steps on the host, with a system directory of the test's own that the test's user can write, and a stand-in plx-ci at 9.9.9, a version the workflow never names.
Neither the version match nor a root-owned system directory nor a sudo that fails was there.
newborns/pipeline.test.ts covers the job repo only.
The trial of PLX-244 in the runner image predates the slot's --cap-drop ALL or ran without it; not verifiable from here, but without it sudo succeeds silently (above).

Fix

The install step gets one variable:

      - working-directory: ${{ runner.temp }}
        env:
          MISE_SYSTEM_SHIMS_DIR: ${{ runner.temp }}/mise-system-shims
        run: mise use -g …

MISE_SYSTEM_SHIMS_DIR is mise's documented variable for the system shims' directory (setting system_shims_dir, present at v2026.11.8 and v2026.12.x; docs dev-tools/system-installs.md).
mise then writes the rebuilt system shims into the job's temp directory, which it can write and which nothing runs from; nothing elevates.
The step still uses the image's plx-ci where it is the version named, and the later steps run through the image's shims as before.
No job gets root, the image's system directory stays root's, a delivery slot mounts nothing new, and the step is still one command (§ 6.4, § 7.4).
On the forge's runners there is no system directory and the variable changes nothing.

Why here and not in the image: the image would need its system shims writable by the job's user (a writable system directory, against § 7.4) or the job would have to run the image's mise and not the action's, which the forge's runners do not have; and an image change reaches a host only when the host is replaced (§ 7.12).
MISE_SYSTEM_DATA_DIR would work too, but warns in every deploy log and downloads plx-ci again.

mise is not pinned for the job: jdx/mise-action takes the newest release older than 24 h (input version unset); the image pins its own by MISE_VERSION in the Dockerfile, which Renovate moves.
The fix does not depend on which mise version either side has, as long as the job's mise still honours MISE_SYSTEM_SHIMS_DIR: a setting of the young system-installs feature, which nothing but this newborn would notice disappearing (question below).

What a consumer and a host must do

  • An app repo gets the fix by taking the Plexus version that carries it (plx update); on_push.yml changes anyway with every version (§ 6.2).
  • No runner host needs replacing: the image is unchanged.
  • A repo at 0.135.0 keeps failing in this step on a delivery slot until it takes that version.
  • A repo on the released 0.135.0 can add the same two lines to the step by hand to deploy before then, but its next plx update conflicts at the step's run: line, since the hand-added lines sit next to the line whose version changes with every version (tried by the review with the engine's own merge call); the resolution is to take the template's side.

Tests

  • newborns/deploy-job.test.ts gains a case that builds a slim image from the environment image's own files and runs the job's steps up to setup in a container of it as ci-runner-slot starts a delivery slot: host network, --cap-drop ALL, user runner.
    • Taken from the Dockerfile word for word and in their order: the base, every ENV, the apt-get install that brings sudo, curl and zstd, the useradd of runner and its sudoers line (out of the instruction that also downloads the runner), the ARGs and download of mise at its pin, COPY mise.toml /etc/mise/config.toml, the RUN mise install --system … line, USER and WORKDIR.
      A pattern that no longer matches fails the test.
    • The system config is the image's own [settings] block and its plx-ci line.
    • Left out on purpose: the Actions runner, docker's client, the browsers' libraries, corepack, ci-mise-install, and the system config's other tools (op, gh, exo), none of which the step names; plx-ci alone makes mise rebuild the system shims.
    • The test asserts first that the image's pin is the version the workflow names.
    • Any RUN, COPY or ADD of the Dockerfile that the test neither takes nor leaves out by name fails it, and so does a ci-runner-slot without --cap-drop ALL, which the test types by hand.
    • The container is named for the run's directory, lives 30 minutes at most (sleep 1800, --rm) and is removed in after.
    • The image is tagged by a hash of its generated Dockerfile and config, so two checkouts with different Dockerfiles cannot test each other's image; older tags of the same name are removed where no container uses them, and the current one is kept between runs.
    • Cost: the action's mise is the one the file's before already downloaded, copied into the container, which the action verifies, fetching only its signed checksums, and does not download again. The image build downloads, cold, the base (Docker Hub, by digest), Debian's packages, mise at the image's pin (GitHub releases) and the image's plx-ci from npm, as the image's own build does; registries the other newborns use as well. Warm it builds from Docker's cache, and node is the one download. Measured: about two minutes cold with the base present; 15 s, 73 s and 173 s in three warm runs, as fast as node's download.
  • Red first (commit 413dfb0): the step failed with mise ERROR failed to rebuild system shims and sudo requires a password but no TTY is available, Version: 2026.12.0, exactly the job's lines; run with node newborns/scratch.ts node --test --test-name-pattern="delivery slot" newborns/deploy-job.test.ts, exit 1.
    With the image taken from the Dockerfile (1cd2b58), red again with the template's two lines removed in the working tree, same lines, exit 1.
  • Green after the fix: that case passes, and the whole file passes, 15 of 15, exit 0.
  • packages/lib/src/pipeline.test.ts pins the step's env.
  • mise run test exit 0, after merging plain-pipeline-2.
  • The fix held on a real delivery slot: the install step passed there (run by the maintainer).
  • Not tried: a run on a forge runner; mise 2026.12.1 and later; mise upgrade.

Readings, for the maintainer

  • The same rebuild would hit a step on a slot that runs mise use (and perhaps mise upgrade, not tried) naming a version the image holds in its system directory, with a mise other than the image's. mise install does not (the review tried it), which is why the job repo passed in the same run.
  • The comment in ansible/ci/roles/actions_runners/files/ci-runner/mise.toml, which said mise "never writes" its system directory, now says that only root can, and that a job's mise use naming a version installed there makes mise rebuild the shims through sudo (after PLX-248: plx-ci setup without a token and without op on the forge's runners #93 was merged). The Dockerfile's header, which named no-new-privileges as the reason sudo fails in a slot, now names ci-runner-slot's --cap-drop ALL.
  • Question, with no code for it: the job's mise is not pinned (jdx/mise-action takes the newest release at least a day old), the fix rests on a setting mise introduced a few months ago (system_shims_dir, beside the automatic elevation of September), and nothing would notice if a later mise dropped or renamed it, since mise ignores an unknown variable, except this newborn at the next cut.
  • Running mise use on a container where sudo works (the image's sudoers line, without --cap-drop ALL) silently re-points the image's system shims at the job's mise, as root; on a slot that cannot happen.

What the compendium owes

Nothing: no requirement changes, and the compendium's main does not describe the install step (searched for mise use, "installs plx" and "system directory").
A branch of the compendium that describes the step would say that it keeps mise's rebuild of the image's shims inside the job.

🤖 Generated with Claude Code

davidjalbers and others added 9 commits December 3, 2026 03:43
…ivery slot

A test that runs the job deploy's steps up to its setup in a container of the
environment image, as ci-runner-slot starts a delivery slot: the image's base,
its mise at the Dockerfile's pin, plx-ci at the version its mise.toml pins
installed and shimmed by the Dockerfile's own line into mise's system
directory, the user runner, the host's network and no capability. It fails as
the real job did: the image's plx-ci is the version the workflow names, mise
rebuilds the system shims, which point at another mise than the action's, and
sudo fails.

The steps of the file now run on a machine: this one, as before, or the slot's
container; a step's own environment is evaluated as its inputs are.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
…ts own temp directory

On a runner host's slot the environment image carries plx-ci at the Plexus
version, the one the job deploy names. `mise use -g` finds it installed in
mise's system directory and so rebuilds the system shims; those point at the
image's mise, not at the one jdx/mise-action downloaded, so mise must rewrite
them, as root, through sudo, which fails in a slot's container without
capabilities. MISE_SYSTEM_SHIMS_DIR on the step sends that rebuild into the
job's temp directory, which nothing runs from: the step installs plx with no
root and no writable system directory, and the later steps run the image's
shims as before. On the forge's runners there is no system directory and the
variable changes nothing.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
Co-Authored-By: Claude Opus <noreply@anthropic.com>
…n files

The newborn's image now takes its instructions from the environment image's
Dockerfile word for word and in their order (the base, every ENV, the
apt-get install that brings sudo, the user runner and the sudoers line, the
download of mise at its pin, the system config, the system install, USER and
WORKDIR), and its system config is the image's own [settings] block and
plx-ci line; a line it takes that the Dockerfile no longer has fails the test.
The image is kept between runs, as the other newborns' are. The container is
named for the run, lives thirty minutes at most, and a later run removes one
whose run is gone. The action verifies the mise it downloaded in `before`,
copied into the container, and downloads none. The header says what the case
downloads and how long it takes.

The image's Dockerfile names the reason sudo fails in a slot: ci-runner-slot
starts its container with no capability.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
Co-Authored-By: Claude Opus <noreply@anthropic.com>
Co-Authored-By: Claude Opus <noreply@anthropic.com>
…d against the image's instructions

The image is tagged by a hash of its generated Dockerfile and config, so two
checkouts with different Dockerfiles cannot test each other's image, and the
older tags of its name are removed where no container uses them. A RUN, COPY
or ADD of the image's Dockerfile that the test neither takes nor leaves out by
name fails it, and so does a ci-runner-slot that no longer starts a slot with
--cap-drop ALL. The sweep of other runs' containers is gone: the Docker daemon
is shared across pid namespaces, so a live run elsewhere could be taken for a
dead one; the container's own thirty minutes and `after` remove it.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
Co-Authored-By: Claude Opus <noreply@anthropic.com>
It said mise never writes the system directory. A user's mise does, through
sudo, when a `mise use` names a version installed there; in a slot that
fails, and the job deploy has the shims written elsewhere.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
@davidjalbers
davidjalbers merged commit e7c0ddb into plain-pipeline-2 Dec 3, 2026
1 of 2 checks passed
@davidjalbers
davidjalbers deleted the davidjalbers/plx-259-deploy-job-on-a-delivery-slot branch December 3, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant