Skip to content

fix(deploy): let the hub's sandboxes run under bubblewrap - #29

Merged
TheGreatAxios merged 3 commits into
mainfrom
fix/compose-sandbox-userns
Oct 31, 2026
Merged

TheGreatAxios merged 3 commits into
mainfrom
fix/compose-sandbox-userns

Conversation

@brianjfox

@brianjfox brianjfox commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Closes #30

What changed

The hub service in deploy/compose.yml now runs with seccomp=unconfined, apparmor=unconfined and systempaths=unconfined; its capabilities stay dropped. docs/SELF_HOST.md gains a "Sandboxes" section covering the requirement, the Ubuntu 24.04 sysctl, and the error text seen without it.

Why

With the Compose deployment, every designer tool call fails, including reading a project document:

sandbox_tool_process_failed: bwrap: No permissions to create a new namespace, likely because the kernel does not allow non-privileged user namespaces.

The coder and designer run their commands under bubblewrap through @anthropic-ai/sandbox-runtime, which gives each command its own user, pid and mount namespaces with a fresh /proc. Docker's defaults block that three ways inside the hub container, and each one surfaces only after the previous is lifted:

  1. The default seccomp profile refuses namespace creation without CAP_SYS_ADMIN: "No permissions to create a new namespace".
  2. The default AppArmor profile refuses the mount propagation change bubblewrap makes: "Failed to make / slave: Permission denied".
  3. The masked /proc paths make a fresh /proc mount impossible from a user namespace: "Can't mount proc on /proc: Operation not permitted".

On Ubuntu 24.04 hosts, including the VM Colima runs, kernel.apparmor_restrict_unprivileged_userns=1 additionally strips the capabilities from unprivileged user namespaces ("setting up uid map: Permission denied"). That is host configuration, so it is documented rather than changed here.

How it was verified

  • docker compose --env-file .env.hub --project-directory . -f deploy/compose.yml config renders the three security_opt entries on the hub service.
  • bunx prettier --check deploy/compose.yml docs/SELF_HOST.md passes.
  • On Colima 0.10.3 (Ubuntu 24.04.4, kernel 6.8.0-100-generic) with the sysctl set to 0, throwaway containers from the hub image ran the sandbox runtime's own srt command with the image's ripgrep. With only seccomp and apparmor unconfined it fails at the /proc mount; with all three it runs the sandboxed command, which could read /proc and write under /tmp.
  • The run history of a stuck designer (git grep over the workflow-run repository) shows the sandbox_tool_process_failed result on every file read and write, which is how the fault was traced.

The follow-up fixes to the sandbox code itself, which surfaced once the sandbox could start, are in a separate pull request.

The coder and designer run every command under bubblewrap, which makes a
user namespace for each one. Docker's default seccomp profile refuses that
without CAP_SYS_ADMIN, so inside the Compose hub every designer tool call
failed with "bwrap: No permissions to create a new namespace" and the
coordinator reported the workspaces as broken.

Run the hub service with seccomp=unconfined and keep its capabilities
dropped. Document the Ubuntu 24.04 sysctl that strips capabilities from
unprivileged user namespaces, which also blocks bubblewrap on such hosts,
including the VM that Colima runs.
@corbits-triage

corbits-triage Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Triage: Pass

No changes needed from you. A maintainer will review this pull request.

Notes:

  • changes sensitive paths: ci: deploy/compose.yml

Changed since the last verdict (Fail at 5d23af6): 25 new commits.

@brianjfox brianjfox changed the title fix(deploy): let the hub's sandboxes create user namespaces fix(deploy): let the hub's sandboxes run under bubblewrap Oct 31, 2026
With only seccomp relaxed, bubblewrap gets past namespace creation and
then fails twice more inside the Compose hub: Docker's AppArmor profile
refuses the mount propagation change ("Failed to make / slave"), and the
masked /proc paths make the fresh /proc mount impossible from a user
namespace ("Can't mount proc on /proc"). The sandbox runtime's own srt
command runs only once all three are lifted, so run the hub without them;
its capabilities stay dropped.

Closes #30
@TheGreatAxios
TheGreatAxios added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 904d270 Oct 31, 2026
8 checks passed
@brianjfox brianjfox changed the title fix(deploy): let the hub's sandboxes run under bubblewrap fix(deploy): let the hub's agents run their sandboxes in the Compose hub Nov 2, 2026
@brianjfox brianjfox changed the title fix(deploy): let the hub's agents run their sandboxes in the Compose hub fix(deploy): let the hub's sandboxes run under bubblewrap Nov 2, 2026
@linear-code

linear-code Bot commented Nov 3, 2026

Copy link
Copy Markdown

CL-11875

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Designer and coder sandboxes fail inside the Compose hub: bwrap cannot create a user namespace

2 participants