Skip to content

fix(sandbox): keep the image's tools on PATH in login shells - #5019

Merged
yannickmonney merged 1 commit into
mainfrom
fix/sandbox-login-shell-path
Oct 19, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/sandbox-login-shell-path

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Summary

A login shell in the sandbox runtime image does not find node, npm, npx, the agent CLIs (codex, claude, ...) or a package a session installed, because Debian's /etc/profile resets PATH and the image sets its own only through ENV. This installs the same directories from /etc/profile.d/tale-path.sh.

Evidence, on the published image ghcr.io/tale-project/tale/tale-sandbox-runtime:0.5.91 (the Dockerfile has no /etc/profile.d entry on main either):

  • bash -c 'command -v npm node codex' finds all three; bash -lc finds none (as uid 10001 and 65534). PATH becomes /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games.
  • Two things run login shells here: runnerd's shell exec form (bash -lc, daemon/src/exec-manager.ts) and the shell tool of the Codex harness. The pinned Codex, driven against a stand-in model server in that image, ran /bin/bash -lc and found none of npm, node, codex.
  • With the file in a layer over the same image, both find everything, and Codex's tool sees /agent/.runtime/deps/python/bin:/agent/.runtime/deps/node/bin:/opt/agents/bin:/opt/node/bin:/usr/local/bin:....

Found by the Incus lab on #5017, whose new registry-cache test runs npm ci through the shell form and got npm: command not found.

Why the image and not the daemon: switching runnerd to bash -c would fix only its own shell form and leave Codex's shell tool without node. The file is root-owned in the image, covers every login shell, and keeps the session's dependency directories (entrypoint.sh) in front for the agent, never for root.

Checklist

  • bun run check passes (format, lint, typecheck, all tests). Not run as a whole locally: this Mac runs at load 8-9 and 5 s test timeouts flake (entrypoint-dispatch /dev/shm, a Trivy SARIF fixture). The daemon workspace's tests, lint, typecheck and format pass otherwise; CI runs the rest.
  • bun run lint:sast passes (Opengrep) — ran in the pre-commit hook on the staged files.
  • Translations: N/A, no user-visible string.
  • Docs: N/A, no user-visible change; the runtime README says what the file is for.
  • README.md / README.de.md / README.fr.md: N/A.

Test plan

  • services/sandbox-runtime/daemon/src/login-shell-path.test.ts (Unit): runs the file as /etc/profile would, for uid 10001 and root, against the directories parsed from the Dockerfile's ENV PATH and entrypoint.sh; fails if any of the three drifts. Checked to fail with the file broken.
  • Image conformance (container-sandbox-runtime-test.ts, Build): a login shell finds node, npm, npx, nodejs, bun, uv, codex and claude, and PATH starts with the session and image directories.
  • Incus lab (lifecycle.e2e.ts, new step): shell and command execs resolve the same tools to the same paths on a real session. The lab job runs on this pull request because it touches services/sandbox-runtime/**.

The runtime image puts node, npm and the agent CLIs on PATH with ENV, and
entrypoint.sh puts the session's pip and npm prefixes in front. A login
shell discards all of it: Debian's /etc/profile resets PATH, then reads
/etc/profile.d. On the published image (0.5.91), `bash -lc 'command -v
npm node codex'` finds none of them, as uid 10001 and as 65534; only
bun, uv and python3 in /usr/local/bin survive.

Two things run login shells: runnerd's `shell` exec form (`bash -lc`) and
the shell tool of the Codex harness, which the pinned Codex runs as
`/bin/bash -lc`. Against a stand-in model server, that tool found none of
node, npm or codex in the image.

Install the same directories from /etc/profile.d/tale-path.sh, in front of
what /etc/profile built. Root gets only the image's directories, never the
session's, which the agent can write. A daemon test holds the file to the
Dockerfile's ENV PATH and to entrypoint.sh; the image conformance test and
the Incus lab each run a login shell and look for the tools.
@yannickmonney
yannickmonney force-pushed the fix/sandbox-login-shell-path branch from 929b462 to c6f759a Compare October 19, 2026 14:50
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 19, 2026
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 19, 2026
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 19, 2026
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 19, 2026
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 19, 2026
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit de0caf1 Oct 19, 2026
@yannickmonney
yannickmonney deleted the fix/sandbox-login-shell-path branch October 19, 2026 17:52
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