Skip to content

fix(sandbox): dependency installs fail when image HOME is missing - #192390

Merged
steipete merged 2 commits into
mainfrom
steipete/perf-micro-sandbox-builder-home-missing-pnpm-enoent-20260919
Nov 4, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/perf-micro-sandbox-builder-home-missing-pnpm-enoent-20260919

Conversation

@steipete

@steipete steipete commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Dependency-template installation fails with ENOENT when a custom sandbox image points HOME at a missing directory and the builder has a read-only root.

User Impact

Dependency builders can initialize package-manager state without writing into staged workspace artifacts. Offline registry packages still require preprovisioned metadata/content; this change does not enable network access. Runtime tool containers retain their existing environment policy.

Why This Change Was Made

The credential-free builder deliberately replaces the session environment. Give that owner a private tmpfs with explicit HOME/XDG paths and pass pnpm's store directory explicitly, including for pnpm versions that otherwise choose a project-local store. The existing template identity incorporates the changed config. No new OpenClaw option, cache, or schema is introduced.

Evidence

  • Actual Docker regression through prepareSandboxDependencyTemplate and production create-argument construction: non-root user, absent HOME, read-only root, no network, no configured tmpfs. Fails on base 34007820fa2c with pnpm ENOENT; passes on this change. pnpm 10.23 reports the missing /home/sandbox parent; the reported production error named /home/sandbox/.local. The production image binary was not inspected.
  • Final integrated candidate: all 13 installer/lifecycle tests passed (wrapper wall 40.80 s including compiler setup); both affected core and agents-root typechecks passed. The optional Docker test is enabled with OPENCLAW_TEST_SANDBOX_HOME_IMAGE after building test/fixtures/sandbox-home/Dockerfile.
  • A nonempty local package installed with pnpm 12.15 remains loadable from a fresh read-only container after the builder and its scratch store are removed. A registry-dependent fixture reaches ERR_PNPM_NO_OFFLINE_META; package/network policy is deliberately left for a separate decision.
  • Five interleaved cold pairs on a synthetic 62,000-file, 1.1 GiB btrfs workspace: failing startup median 252 ms / 293 ms CPU / 39.1 MB sampled allocations; successful startup 280 ms / 368 ms CPU / 41.1 MB. Two A/A pairs had 273/255 ms median wall. These measure installer startup, not complete workspace preparation, and establish no production speedup. No agent database workload is involved at this boundary.
  • Fresh Codex autoreview of the final change against integrated main dbecd558192e: scoped-clean at P0–P2, no actionable findings.
  • pnpm check:changed completed: lint, format, and remaining guards passed; core/core-test typechecks and the production dead-export scan failed identically on exact parent 34007820fa2c. The missing McpCatalogTool import was introduced by refactor(agents): separate MCP catalog metadata contracts #192302 (f32ee258e309) and is repaired on main by dbecd558192e. Four unused node-plugin-tool-snapshot exports were introduced by feat: let node-hosted MCP tools ask questions through the Gateway #191589 (e0ac3370bbe3) when their production callers moved into the same module. The initial CI SDK build hit that same MCP defect, so the branch now integrates main through dbecd558192e; the affected typechecks and focused tests pass. The Knip defect remains an attributed main follow-up. Exact-head CI remains required before landing.

Production grows by 7 lines to define the disposable storage contract. The 84 added test lines are allocated separately for the real read-only-container regression; the shared test budget is unchanged.

Keep builder HOME, XDG directories and the pnpm store in disposable tmpfs outside staged workspace artifacts. Preserve offline policy and runtime environment configuration. Include a real-container regression for missing image HOME under a read-only root.
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime docker Docker and sandbox tooling agents Agent runtime and tooling size: S labels Nov 3, 2026
@steipete
steipete marked this pull request as ready for review November 3, 2026 23:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T00:02:42.877329Z 4e70924 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 4e70924987f9f63afaedc52ed7d6d52a299cc7fe
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox/dependency-template.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 4, 2026
@steipete
steipete merged commit 7c300ea into main Nov 4, 2026
124 of 125 checks passed
@steipete
steipete deleted the steipete/perf-micro-sandbox-builder-home-missing-pnpm-enoent-20260919 branch November 4, 2026 00:13
@steipete

steipete commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
Keep builder HOME, XDG directories and the pnpm store in disposable tmpfs outside staged workspace artifacts. Preserve offline policy and runtime environment configuration. Include a real-container regression for missing image HOME under a read-only root.
vincentkoc added a commit that referenced this pull request Nov 4, 2026
* commit 'b4ebd3673fea4932296b92bbc07b7abc4bdc792d':
  fix(ci): allow serial SDK API reports to finish (#192196)
  fix(ci): run PostgreSQL checks when its shard planner changes (#191963)
  fix(ci): model native Linux updater asset entry
  improve(test): speed up config and device binding browser tests (#192404)
  improve(ui): show arrivals top right with a contextual session status (#192016)
  improve(ui): mark error toasts and split two-sentence copy (#192015)
  fix(sandbox): give dependency builders a writable home (#192390)
  fix(worktrees): keep archive manifest checks off the main thread (#192358)
  fix(cron): preserve admitted runs and pacing across unrelated MCP reloads (#192399)
  improve(ui): stack toasts in a center lane and an arrivals lane (#192014)
  fix: reclaim abandoned read-only database snapshots (#192368)
  improve(ui): rebuild the toast on one component with variants and a hover dismiss (#192013)
  docs: consolidate team server and team setup into one Multiplayer page
  fix(ci): reconcile remaining unallocated test lines
  feat: run admitted MCP tools on the worker node that hosts them (#191387)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime security-sensitive-changed size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant