Skip to content

feat: expose MountableFs for live mount/unmount without interpreter rebuild #782

Closed

Description

@chaliy

Problem

Currently mount operations are only available on BashBuilder (pre-build). After builder.build(), there's no way to add or remove mounts on a live Bash instance.

PR #768 (Python FS bindings) worked around this by accumulating mount configs and calling reset(), which rebuilds the entire interpreter — losing env vars, cwd, and all in-flight state. That's surprising semantics for callers expecting a "live mount."

Proposal

Store an Arc<MountableFs> reference inside the Bash struct so that post-build code can call mount() / unmount() directly — no rebuild needed.

Rust-side changes

  1. Keep Arc<MountableFs> accessible post-build

    • BashBuilder::build() already creates a MountableFs when real mounts are configured (lib.rs ~L1481-1495)
    • Store the Arc<MountableFs> as a field on Bash (alongside the existing Arc<dyn FileSystem>)
    • If no real mounts are configured, lazily wrap the root FS in a MountableFs on first mount() call, or always use MountableFs as the root
  2. Add methods on Bash

    impl Bash {
        pub fn mount(&self, vfs_path: &str, fs: Arc<dyn FileSystem>) -> Result<()>;
        pub fn unmount(&self, vfs_path: &str) -> Result<()>;
    }
  3. MountableFs already supports dynamic mounts — mount(path, fs) works at runtime with longest-prefix matching. No new VFS plumbing needed.

Python-side changes (follow-up to #768)

Once Rust exposes live mount, Python bindings can offer:

bash = Bash()
bash.mount("/workspace", real_readwrite("/host/path"))
# No reset, no state loss
bash.unmount("/workspace")

What this unblocks

  • Live host directory attachment mid-session (agent workflows)
  • Mount/unmount without losing shell state (env vars, cwd, history)
  • Clean Python mount API that mirrors actual Rust capability

Context

  • MountableFs: crates/bashkit/src/fs/mountable.rs
  • BashBuilder mount methods: crates/bashkit/src/lib.rs ~L1272-1431
  • Builder layering (MountableFs + OverlayFs): crates/bashkit/src/lib.rs ~L1481-1495
  • VFS spec: specs/003-vfs.md
  • Related PR: feat(python): expose filesystem and realfs mount APIs #768

Activity

  1. added a commit that references this issue on Mar 22, 2026
    ffda775
  2. added a commit that references this issue on Mar 22, 2026
    bb283f7
  3. added a commit that references this issue on May 30, 2026
    c160019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions