Skip to content

fix(sandbox): stop Docker recreating deleted files in the project - #44

Merged
radim10 merged 2 commits into
masterfrom
fix/docker-sandbox-phantom-mounts
Sep 26, 2026
Merged

radim10 merged 2 commits into
masterfrom
fix/docker-sandbox-phantom-mounts

Conversation

@radim10

@radim10 radim10 commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes deleted files reappearing in the project after starting a new Docker sandbox session.

Problem

append_filesystem_mounts added a bind mount for every denied-read and denied-write path inside the project, whether or not the path exists on the host. When a mount target is missing inside the bind-mounted project folder, Docker creates a placeholder at that path on the host: an empty file for denied-read file paths, an empty directory for denied-write paths.

So when a user deleted one of these files (manually or via git) and started a new sandboxed session, the file came back every time.

Fix

Skip the mount for a denied path that doesn't exist on the host (src/handlers/run/docker_sandbox.rs). There's nothing to hide or protect, and it's the same kind of check already applied to paths outside the project folder.

Trade-offs

Paths that exist when the session starts behave exactly as before. For paths that don't exist at startup:

  • Denied-write: the agent can now create the path and write into it. Before, it was blocked, at the cost of leaving the placeholder behind.
  • Denied-read: a file created on the host during a session (e.g. a new .env) is visible to the agent. Before, the placeholder mount hid it for the whole session.

Possible follow-up: mount missing paths as empty in-memory mounts inside the container and delete any placeholders the sandbox itself created when the session ends. That would keep strict protection without leaving files behind.

Testing

  • Added docker_run_command_skips_mounts_for_nonexistent_denied_paths
  • All 52 docker sandbox tests pass (cargo test docker_sandbox)

@radim10 radim10 self-assigned this Sep 26, 2026
@radim10 radim10 changed the title feat(docker): enhance mount handling in Docker sandbox to skip nonexi… fix(sandbox): stop Docker recreating deleted files in the project Sep 26, 2026
@radim10
radim10 merged commit 7990369 into master Sep 26, 2026
3 checks passed
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.

1 participant