Codumentor logo Codumentor Enterprise

Workspace Isolation Plugin

The Workspace Isolation plugin gives each conversation an isolated Linux sandbox (bubblewrap). Agents can edit files, run shell commands, and use git without changing other conversations or the host checkout.

If the plugin is enabled but the sandbox cannot start, all tool operations fail with a clear error. There is no silent fallback to running on the host.

Requirements

Modes

modeWhat the agent seesTypical use
overlay (default)Configured repos at /workspace behind a copy-on-write overlay. Snapshots and project setup apply.Development / coding
host_readonlyThe whole host filesystem read-only at identical paths, plus a discarded scratch overlay on the launch directory. Snapshots and project setup are forced off.Investigate flavor

Configuration

plugins:
  - module: codumentor.plugins.workspace_isolation
    class: WorkspaceIsolationPlugin
    priority: 5
    args:
      enabled: true
      mode: overlay                    # or host_readonly
      workspace_base: ~/.codumentor/workspaces
      workspace_ttl: 86400             # orphaned snapshot TTL (24h)
      persistent_home: true
      session_tmp: true

      sandbox:
        unshare_net: true
        seccomp: default
        allow_nested_sandboxes: false
        env_mode: minimal

      snapshots:
        enabled: true
        shared: true
        upper_dir_ttl: 2592000         # 30 days
        cleanup_interval: 3600
        min_free_gb: 5

      project_setup:
        enabled: true
        timeout_s: 600
        cache_budget_bytes: 5368709120 # 5 GiB
        failed_ttl_s: 86400
        auto_build: true

Top-level

OptionTypeDefaultDescription
enabledbooltrueEnable isolation
modestring"overlay""overlay" or "host_readonly". Invalid values fall back to "overlay"
workspace_basepath~/.codumentor/workspacesDirectory for session workspaces
workspace_ttlint86400Seconds before an orphaned snapshot (no active sessions) is deleted
persistent_homebooltrueBind-mount a persistent $HOME for the session (shared by the main agent, subagents, and external agents). false = ephemeral tmpfs HOME
session_tmpbooltrueBind-mount a per-session /tmp so files survive across shell calls in the same conversation (overlay only). false = fresh tmpfs per command

Subagents always run in their parent's sandbox and see each other's changes
immediately. The former per-subagent sandbox mode and its integration:
options were removed; a config that still sets those keys loads with a
one-time warning and they are ignored.

Sandbox hardening (sandbox:)

Network isolation is on by default. Other flags default off. Unknown keys are ignored.

OptionTypeDefaultDescription
unshare_netbooltrueIsolate the network namespace (no outbound/inbound networking)
unshare_utsboolfalseIsolate hostname. Setting hostname turns this on automatically
unshare_cgroupboolfalseIsolate cgroups
hostnamestringnullHostname inside the sandbox
new_sessionboolfalseNew session ID (setsid)
scrub_host_identitybooltrueBind synthesized /etc/passwd, /etc/group and /etc/resolv.conf over the host's, so the sandbox sees only root/itself/nobody and no internal DNS search domains. Set false if sandboxed builds must resolve short internal host names through that search list
seccompstring"default"Syscall filter: "default" / "enforce" (block), "log" (audit only), "off" (no filter). If a filter is requested but cannot be loaded, the sandbox fails closed (tools disabled) rather than running unfiltered — set off to run without a filter
allow_nested_sandboxesboolfalseTargeted enforcing profile for nested bwrap: permits userns creation and legacy mount setup, keeps other rules and the own-PID ptrace distinction. Actual YAML boolean; restart/new session required. Increases kernel attack surface; host policy/inherited filters may still block it. See security trade-off
env_modestring"minimal""minimal": only a baseline env (PATH, HOME, LANG, TERM, …). "inherit_all": copy the host environment
inherit_env_varslist[]Extra host env vars to forward in minimal mode
clearenvbooltrueLegacy. clearenv: false maps to env_mode: inherit_all if env_mode is unset
allowed_env_varslist[]Deprecated alias for inherit_env_vars

Snapshots (snapshots:)

Snapshots freeze the overlay base at session start so an ingestion pull mid-session does not change what the agent sees.

OptionTypeDefaultDescription
enabledbooltrueSnapshot repos at session start
sharedbooltrueSessions at the same commit share one snapshot
upper_dir_ttlint2592000Seconds before an idle session's writable overlay (file edits) is deleted. Default 30 days — those edits cannot be regenerated from git
cleanup_intervalint3600How often expired workspaces and orphaned snapshots are swept. 0 disables the loop
min_free_gbfloat5When free space on the snapshots filesystem drops below this, orphaned snapshots are pruned oldest-first. 0 disables

Approximate snapshot cost: git uses a detached worktree (cheap); SVN exports at the pinned revision (full copy); non-VCS dirs use a hardlink copy.

Project setup (project_setup:)

On first session for a repo, .codumentor/setup.sh (if present) runs inside the sandbox. Built artifacts (e.g. .venv) are cached on the host and reused.

OptionTypeDefaultDescription
enabledbooltrueRun project setup scripts
timeout_sfloat600Per-repo setup timeout (seconds)
cache_budget_bytesint5368709120Per-repo cap on cached setup artifacts (5 GiB)
failed_ttl_sint86400How long a failed setup cache is kept before retry
auto_buildbooltrueWarm the setup cache after a webhook re-ingest so the next conversation does not pay the build cost

Host read-only (host_readonly: — mode: host_readonly only)

OptionTypeDefaultDescription
scratch_overlaybooltrueWritable overlay on the launch directory; writes are discarded with the session
expose_host_tmpbooltrueHost /tmp visible read-only at /tmp/host
unshare_pidboolfalsePID namespace isolation. Off by default so ps / /proc see host processes
networkstring"ask""share" (host network), "isolate" (no network), or "ask" (prompt once per conversation; headless falls back to "isolate"). Invalid values fall back to "ask"

In this mode the agent can read host paths (logs, configs, journalctl) but cannot write the host. systemctl and unix-socket clients fail because the root is read-only.

Overlay vs host checkout

In overlay mode the host repositories stay read-only. All writes go to a per-session upper layer under workspace_base. Branch Switching checkouts and SCM Push commits happen in that overlay, not on the host working copy.

When /workspace holds several repositories (or none), the agent also gets a scratch folder, /workspace/.scratch, named in its <environment> note. It is for render scripts, downloads and other temporary output: the same path for the shell and the file tools, outside every repository so it is never committed, kept as long as the session's upper layer, and listed under All files in the Files browser. A single-repository workspace has none: there /workspace is the repository, and a git add -A before a commit would stage it.

Reading a dormant workspace

A conversation's overlay outlives its sandbox: the upper layer is on disk until upper_dir_ttl, while the live sandbox dies with the process (or with an LRU eviction). Two read-only paths recover it for the UI, both needing no live sandbox:

See also