Skip to content

fix(vfs): provision user home directory so $HOME is writable#2135

Merged
chaliy merged 1 commit into
mainfrom
fix/vfs-user-home
Jun 28, 2026
Merged

fix(vfs): provision user home directory so $HOME is writable#2135
chaliy merged 1 commit into
mainfrom
fix/vfs-user-home

Conversation

@chaliy

@chaliy chaliy commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Motivation

A configured username("eval") sets HOME=/home/eval, but the in-memory VFS only ever created /home/user. So a script writing to its own home directory failed:

bash: /home/eval/organize.sh: io error: parent directory not found

The same latent gap affects the default user: DEFAULT_USERNAME is sandbox, so HOME=/home/sandbox — also never created — meaning even echo x > $HOME/f failed out of the box.

Found in the LLM eval run 2026-06-27 (mira harness); file_path_organizer failed across all five models for this reason.

Closes #2128.

Changes

  • crates/bashkit/src/lib.rs: provision /home/<username> when bashkit constructs the default in-memory filesystem, in both Bash::new() (default user) and BashBuilder::build() (custom user). Home-dir provisioning lives in Bash construction so the FS layer stays unaware of the "user" concept. (When a caller supplies their own .fs(...), they own provisioning, as before.)
  • crates/bashkit/src/fs/memory.rs: add a synchronous InMemoryFs::add_dir(path, mode) helper (mirrors the existing add_file) for initial setup; creates parents and is idempotent.

Testing

  • cargo test -p bashkit --features http_client,ssh,sqlite --lib — new tests pass:
    • test_custom_username_provisions_home_dir (writes to /home/eval/...)
    • test_custom_username_home_tilde_write (~/$HOME write)
    • test_default_username_provisions_home_dir (default user $HOME)
  • cargo test -p bashkit --doc add_dir, cargo clippy -p bashkit --features http_client,ssh,sqlite --lib — clean.

Generated by Claude Code

A configured `username(...)` set HOME=/home/<user> (and the default user
maps to /home/sandbox), but the in-memory VFS only ever created
/home/user. Writes to `~` / `$HOME` therefore failed with
"parent directory not found".

Provision /home/<username> when bashkit constructs the default in-memory
filesystem, in both `Bash::new()` (default user) and
`BashBuilder::build()` (custom user). Adds a synchronous
`InMemoryFs::add_dir` helper mirroring `add_file` for initial setup.
Home-dir provisioning lives in Bash construction, keeping the FS layer
unaware of the "user" concept.

Closes #2128
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit bf5a650 Commit Preview URL

Branch Preview URL
Jun 28 2026, 09:29 AM

@chaliy chaliy merged commit 7886969 into main Jun 28, 2026
36 checks passed
@chaliy chaliy deleted the fix/vfs-user-home branch June 28, 2026 09:43
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.

bug(vfs): user home directory not created for username(...) → writes to $HOME fail

1 participant