Skip to content

fix: probe for the sandbox enforcer instead of assuming one (#1) - #2

Merged
lroolle merged 1 commit into
mainfrom
fix/sandbox-enforcer-probe
Aug 25, 2026
Merged

fix: probe for the sandbox enforcer instead of assuming one (#1)#2
lroolle merged 1 commit into
mainfrom
fix/sandbox-enforcer-probe

Conversation

@lroolle

@lroolle lroolle commented Aug 25, 2026

Copy link
Copy Markdown
Member

Fixes #1, reported by @roy7 with a live repro on WSL2 Ubuntu / grok 1.0.3.

The bug

buildHeadlessArgs pushed --sandbox unconditionally for both task modes.
Grok's Linux enforcer is bubblewrap, which plain Debian/Ubuntu and WSL
images do not ship, and grok 1.0.3 does not warn-and-continue — it refuses:

error: this sandbox could not enforce its deny list on Linux: bwrap exec failed:
No such file or directory (os error 2). Install bubblewrap with
`apt install -y bubblewrap`. Refusing to start with denied paths unprotected.

Exit 1, empty stdout. Every sandboxed invocation failed with the cause several
layers from the symptom.

The fix

Probe first, then answer differently per mode — the asymmetry is the point:

Machine rescue (read-leaning) rescue --write
enforcer present --sandbox read-only + deny list --sandbox workspace
enforcer missing runs, deny list only refuses, names the fix

Read-leaning rescues are guarded primarily by the tool deny list, which needs
no kernel — losing the sandbox costs one belt out of two. For --write the
sandbox is the only thing bounding edits, so degrading it silently would be
worse than failing. GROK_COMPANION_SANDBOX=on|off overrides the probe.

Also: --sandbox is no longer re-sent on --resume. Per @roy7's own
correction in the thread, omitting it is always accepted and only a differing
profile is a hard error — so not sending it is the simple safe rule.

Docs were wrong too

The README's Security Model said the sandbox silently degrades under
Landlock, "verified empirically". That was true of an older Grok and is the
opposite of 1.0.3's behaviour. Corrected in README and llms.txt.

Tests

58 pass. The gap that let this ship: the fake grok cannot tell the suite
whether the box can enforce a sandbox, so every sandbox assertion ran once, on
the happy machine. GROK_COMPANION_SANDBOX now stands in for the machine and
they run twice — including a companion-level test that --write exits 1 with
bubblewrap in the message.

grok 1.0.3's Linux enforcer is bubblewrap, which plain Debian/Ubuntu and
WSL images do not ship. It does not warn and continue — it refuses to
start with exit 1 and empty stdout, so from the plugin's side every
sandboxed invocation just failed, several layers from the cause.
@roy7 reported it with a live repro.

The two modes get different answers on purpose. A read-leaning rescue's
primary guard is the tool deny list, which needs no kernel, so it drops
the flag and runs with one belt instead of two. `--write` refuses: there
the workspace sandbox is the only thing bounding edits, and degrading it
silently would hand an agent the whole disk. The error carries
`apt install -y bubblewrap`.

Also stops re-asserting --sandbox on --resume. Passing a profile that
differs from the session's saved one is a hard error and omitting it is
always accepted, so the safe rule is to not send it again.

The README claimed the opposite behaviour — silent degradation under
Landlock, verified empirically against an older Grok. Corrected, with
the asymmetry and the override documented.

Tests cover both machines, which is the part that was missing: the fake
grok cannot tell the suite whether this box can enforce a sandbox, so
GROK_COMPANION_SANDBOX stands in for the machine and every sandbox
assertion now runs twice.
@lroolle
lroolle merged commit f8958f6 into main Aug 25, 2026
2 checks passed
@lroolle
lroolle deleted the fix/sandbox-enforcer-probe branch August 25, 2026 07:24
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.

--sandbox read-only makes grok refuse to start on Linux without bubblewrap (live repro on grok 1.0.3)

1 participant