Skip to content

fix: pass BUN_INSTALL to chroot to prevent Bun core dump#546

Merged
Mossaka merged 1 commit intomainfrom
fix/bun-chroot-crash
Feb 6, 2026
Merged

fix: pass BUN_INSTALL to chroot to prevent Bun core dump#546
Mossaka merged 1 commit intomainfrom
fix/bun-chroot-crash

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Feb 6, 2026

Summary

  • Bun crashes with a core dump when installed inside the chroot because /proc access is restricted to /proc/self only
  • Pass BUN_INSTALL from the host environment as AWF_BUN_INSTALL to the agent container, following the same pattern as GOROOT, CARGO_HOME, and JAVA_HOME
  • In entrypoint.sh, add $BUN_INSTALL/bin to PATH and export BUN_INSTALL in the chroot script
  • Bun should be pre-installed on the host via oven-sh/setup-bun action, not installed inside the chroot

Changes

  • src/docker-manager.ts — Pass process.env.BUN_INSTALL as AWF_BUN_INSTALL env var
  • containers/agent/entrypoint.sh — Add BUN_INSTALL/bin to PATH in chroot script (same pattern as Cargo/Java/Go)
  • src/docker-manager.test.ts — Add tests for AWF_BUN_INSTALL passthrough

Test plan

  • npm run build compiles
  • npm test — 729 unit tests pass (including 2 new tests)
  • npm run lint — no errors
  • Verify bun --version works in chroot when BUN_INSTALL is set on host

🤖 Generated with Claude Code

Bun crashes with a core dump when installed inside the chroot due to
restricted /proc access (/proc/self only). Instead, Bun should be
pre-installed on the host (via setup-bun action) and its install path
passed through to the chroot via AWF_BUN_INSTALL, following the same
pattern as GOROOT, CARGO_HOME, and JAVA_HOME.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 6, 2026 01:00
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Chroot tests failed Smoke Chroot failed - See logs for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.08% 82.10% 📈 +0.02%
Statements 82.12% 82.14% 📈 +0.02%
Functions 81.95% 81.95% ➡️ +0.00%
Branches 75.41% 75.44% 📈 +0.03%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 82.9% → 83.0% (+0.09%) 82.2% → 82.3% (+0.09%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Build Test: Rust - FAILED ❌

Error: Rust toolchain not available in test environment.

The Rust compiler (cargo, rustc) is not installed. Cannot execute build tests for fd and zoxide projects.

Required: Add Rust installation step to workflow (e.g., actions/rust-toolchain or rustup).

AI generated by Build Test Rust

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Smoke Test Results (Run #21734652937)

✅ GitHub MCP: Last 2 merged PRs: #541, #537
✅ Playwright: GitHub page title verified
✅ File Write: Test file created successfully
✅ Bash: File verification passed

Status: PASS

@Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Deno Build Test Results

Project Tests Status
oak 1/1 ✅ PASS
std 1/1 ✅ PASS

Overall: ✅ PASS

All Deno tests completed successfully.

AI generated by Build Test Deno

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

C++ Build Test Results

Project CMake Build Status
fmt PASS
json PASS

Overall: PASS

All C++ projects built successfully.

AI generated by Build Test C++

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Smoke Test Results for Claude

Last 2 Merged PRs:

Test Results:
✅ GitHub MCP - Retrieved PR data
✅ Playwright - GitHub page title verified
✅ File Writing - Created test file successfully
✅ Bash Tool - File read confirmed

Overall: PASS

AI generated by Smoke Claude

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Go Build Test Results

Project Download Tests Status
color 1/1 PASS
env 1/1 PASS
uuid 1/1 PASS

Overall: PASS

All Go projects built and tested successfully.

AI generated by Build Test Go

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Build Test: Node.js - Results

Project Install Tests Status
clsx PASS ✅ PASS
execa PASS ✅ PASS
p-limit PASS ✅ PASS

Overall: ✅ PASS

All Node.js build tests completed successfully.

AI generated by Build Test Node.js

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Build Test: Java - FAILED ❌

Status: ENVIRONMENT ERROR

Unable to execute Java build tests due to broken Java/Maven installation in the CI environment.

Issues Found:

  1. Java Runtime: Missing required library libjli.so - Java executables cannot run
  2. Maven: Configuration error - cannot execute binary file

Test Results:

Project Compile Tests Status
gson ❌ N/A N/A FAILED (env)
caffeine ❌ N/A N/A FAILED (env)

Overall: FAIL

Required Actions:

  • Ensure GitHub Actions runner has a properly configured Java 21 environment
  • Verify Maven installation is functional
  • Check that all Java native libraries are present

The test repository was successfully cloned, but cannot proceed with build/test execution.

AI generated by Build Test Java

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Bun core dump issue in chroot mode by passing the BUN_INSTALL environment variable from the host to the agent container. Bun crashes when installed inside chroot due to restricted /proc access, so it must be pre-installed on the host. The implementation follows the same established pattern as GOROOT, CARGO_HOME, and JAVA_HOME.

Changes:

  • Passes BUN_INSTALL as AWF_BUN_INSTALL to the agent container in chroot mode
  • Adds BUN_INSTALL/bin to PATH in the chroot script, following the same pattern as other language toolchains
  • Includes comprehensive test coverage for the new functionality

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/docker-manager.ts Adds conditional logic to pass BUN_INSTALL as AWF_BUN_INSTALL when chroot mode is enabled
src/docker-manager.test.ts Updates existing test to include BUN_INSTALL verification and adds new negative test case
containers/agent/entrypoint.sh Adds BUN_INSTALL/bin to PATH and exports BUN_INSTALL variable in chroot script when AWF_HOST_PATH is provided

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +356 to +358
// Bun: Pass BUN_INSTALL so entrypoint can add $BUN_INSTALL/bin to PATH
// Bun crashes with core dump when installed inside chroot (restricted /proc access),
// so it must be pre-installed on the host via setup-bun action
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding documentation for BUN_INSTALL similar to the GOROOT section in docs/chroot-mode.md. Since Bun has special requirements (crashes inside chroot due to restricted /proc access), users would benefit from documentation showing how to properly set up Bun in GitHub Actions workflows with chroot mode, similar to the existing GOROOT documentation at lines 114-133 in docs/chroot-mode.md.

Suggested change
// Bun: Pass BUN_INSTALL so entrypoint can add $BUN_INSTALL/bin to PATH
// Bun crashes with core dump when installed inside chroot (restricted /proc access),
// so it must be pre-installed on the host via setup-bun action
// Bun:
// - Bun crashes with a core dump when installed inside the chroot (restricted /proc access).
// - Bun must therefore be installed on the host (e.g. via oven-sh/setup-bun in a GitHub Actions
// workflow), which sets BUN_INSTALL to the host install directory.
// - We pass BUN_INSTALL through as AWF_BUN_INSTALL so entrypoint.sh can, in the chroot script,
// add "$BUN_INSTALL/bin" to PATH and make the host-installed Bun available inside the chroot.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Build Test: Bun - FAIL ❌

Environment Issue Detected: Bun test execution failed due to containerized environment incompatibility.

Test Results

Project Install Tests Status
elysia N/A 0/0 FAIL
hono N/A 0/0 FAIL

Overall: FAIL

Error Details

Root Cause: Bun runtime crashes with "Aborted (core dumped)" when attempting to run tests in the current execution environment.

Technical Details:

  • Bun version: 1.3.8 installed successfully
  • Repository cloned: ✅
  • Test execution: Both elysia and hono projects crash immediately with Aborted (core dumped) (exit code 134)
  • Missing system resources: /proc/cpuinfo not available in container
  • Container environment: Docker container lacking full /proc filesystem

Impact: Cannot verify Bun compatibility in this environment. The tests require access to CPU information (/proc/cpuinfo) which is not mounted in the containerized execution environment.

Recommendation: This test needs to run in a full VM environment or with proper /proc filesystem mounts to support Bun's runtime requirements.

AI generated by Build Test Bun

@Mossaka Mossaka merged commit cd98731 into main Feb 6, 2026
86 of 87 checks passed
@Mossaka Mossaka deleted the fix/bun-chroot-crash branch February 6, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant