fix(vfs): provision user home directory so $HOME is writable#2135
Merged
Conversation
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
Deploying with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
A configured
username("eval")setsHOME=/home/eval, but the in-memory VFS only ever created/home/user. So a script writing to its own home directory failed:The same latent gap affects the default user:
DEFAULT_USERNAMEissandbox, soHOME=/home/sandbox— also never created — meaning evenecho x > $HOME/ffailed out of the box.Found in the LLM eval run 2026-06-27 (mira harness);
file_path_organizerfailed 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 bothBash::new()(default user) andBashBuilder::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 synchronousInMemoryFs::add_dir(path, mode)helper (mirrors the existingadd_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(~/$HOMEwrite)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