Skip to content

fix(vfs): provision /home/<username> for configured username#2133

Open
chaliy wants to merge 1 commit into
mainfrom
claude/issue-2128-vfs-home
Open

fix(vfs): provision /home/<username> for configured username#2133
chaliy wants to merge 1 commit into
mainfrom
claude/issue-2128-vfs-home

Conversation

@chaliy

@chaliy chaliy commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What

When Bash::builder().username("eval") is configured, the default in-memory VFS now provisions /home/eval so scripts that write to $HOME / ~ succeed.

Why

Fixes #2128. The interpreter already sets HOME (and ~) to /home/<username> (Interpreter::with_config), but InMemoryFs only pre-creates /home/user. With a non-default username, the home directory did not exist, so:

let mut bash = Bash::builder().username("eval").build();
bash.exec("echo hi > /home/eval/x.sh").await   // io error: parent directory not found

This surfaced in an LLM eval run where file_path_organizer failed across all five models — each wrote its script under /home/eval/… and hit "parent directory not found".

How

  • New sync helper InMemoryFs::add_dir(path, mode) (mirrors add_file's parent-creation; leaves existing entries untouched; respects VFS path limits).
  • BashBuilder::build() now creates /home/<username> (mode 0o755, matching /home/user) on the default VFS when a username is configured. Custom filesystems remain responsible for their own layout.

Tests

  • test_username_provisions_home_direcho hi > /home/eval/x.sh succeeds
  • test_username_home_tilde_write~ / $HOME writes land in the provisioned home
  • test_default_username_home_still_present — default /home/user unaffected
  • add_dir doctest

cargo fmt --check and cargo clippy clean. Spec vfs.md updated.


Generated by Claude Code

The interpreter sets HOME and ~ to /home/<username>, but the in-memory
VFS only pre-created /home/user, so a configured username had no usable
home directory and writes to $HOME / ~ failed with 'parent directory
not found'. The default VFS now creates /home/<username> at build time
via a new sync InMemoryFs::add_dir helper.

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 58c66ff Commit Preview URL

Branch Preview URL
Jun 28 2026, 01:41 AM

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