Skip to content

Open pstack fail to run grok on a Claude code cloud session #56

Closed

Description

@nirdrang

It fails due to the sandbox request on a Claude code cloud session .

Activity

  1. nirdrang commented on Sep 9, 2026

    @nirdrang
    Author

    Grok lanes refuse to start on Claude Code on the web: the cloud kernel has no Landlock, and the runner only passes Landlock-backed sandbox profiles

    Summary

    Open Pstack launches every Grok lane with --sandbox read-only (read-only lanes) or --sandbox workspace (isolated-write lanes). Grok Build 1.0.13 enforces those profiles with Landlock on Linux and refuses to start when the kernel cannot apply them. The Claude Code on the web VM kernel is built without Landlock, so every Grok lane exits in about two seconds with child-failed (runner exit code 70). The runner's preflight (grok models) passes, so the failure is only visible at lane start.

    Claude and Codex lanes on the same session are unaffected.

    Environment

    • Claude Code on the web (cloud session), Firecracker VM, kernel 6.18.44-fc-v24
    • Kernel config: CONFIG_SECURITY_LANDLOCK is not set; CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor,bpf"; /sys/kernel/security/lsm does not exist
    • landlock_create_ruleset(NULL, 0, LANDLOCK_CREATE_RULESET_VERSION) returns -1, errno 38 ENOSYS
    • Open Pstack 1.3.0 from the marketplace; main at c8481f7 builds the same Grok flags
    • Grok Build 1.0.13, stable, 5e9a58528b76, static binary
    • Claude parent, OAuth authentication, model grok-4.6 listed by grok models
    • bubblewrap is not in the cloud image; I installed 0.9.0 by hand after the first failure (see Additional observations)

    Reproduction

    Every step below was re-run on 2026-09-09 and failed as described.

    Run pstack-runner with these relevant options:

    --parent claude
    --provider grok
    --model grok-4.6
    --effort xhigh
    --mode read-only
    

    Use any prompt; a one-line prompt is enough.

    The runner builds this Grok command (from the receipt's argv):

    grok --prompt-file <prompt.md> --model grok-4.6 --reasoning-effort xhigh
         --permission-mode plan --sandbox read-only
         --tools read_file,grep,list_dir,run_terminal_cmd
         --disallowed-tools Agent,search_tool,use_tool
         --output-format streaming-messages-json --cwd <repo>
         --no-subagents --disable-web-search --verbatim
    

    Grok exits 1 after about 2 s with one line on stderr:

    error: could not apply the 'read-only' sandbox profile; see the warning above for the cause. Refusing to start with its protections missing.
    

    The runner receipt:

    preflight.status: passed  (authenticated; model grok-4.6 available)
    exitCode: 1
    status: child-failed
    elapsedMs: 1884
    error.message: child exited with status 1
    

    Runner exit code 70.

    The same happens for --mode isolated-write (--sandbox workspace, --permission-mode acceptEdits, runner exit 70 after 2.1 s), for --sandbox strict, and for the GROK_SANDBOX=read-only environment form. Grok alone reproduces it without the runner:

    grok --sandbox read-only -p "reply ok" --output-format json; echo "exit $?"
    

    Only --sandbox off and --sandbox devbox start on this kernel; both answer the prompt with exit 0.

    To check a host before running a lane:

    perl -e 'my $r=syscall(444,0,0,1); print "landlock_create_ruleset -> $r errno=$!\n"'
    

    On the cloud kernel this prints errno=Function not implemented. On a kernel with Landlock it prints the ABI version.

    If a grok wrapper is on PATH (see the workaround below), put the real binary first before reproducing: PATH=/root/.local/bin:$PATH.

    Expected result

    Either the runner detects a host that cannot apply the profile in preflight and reports it as such, in two seconds, with a receipt status that names the cause; or the runner lets the caller choose the Grok sandbox profile per host; or the docs say that Grok lanes need a Linux kernel with Landlock plus bubblewrap, so Claude Code on the web is a known unsupported host.

    Verified local workaround

    A wrapper first on PATH, named grok, that rewrites --sandbox read-only and --sandbox workspace to --sandbox devbox when the probe above says Landlock is absent, and is a no-op otherwise. Through it, read-only and isolated-write lanes complete with status: complete, reportedModel: grok-4.6-build, modelVerified: true. The wrapper also needs the two permission changes from issue #34 (see below), because devbox fences nothing and Grok then asks.

    This is a workaround, not a proposed fix: devbox runs the lane unconfined.

    Additional observations

    1. bubblewrap comes first. On the stock cloud image the first refusal is a different one, in about 1.6 s, and grok models still passes:

       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.
      

      After apt install -y bubblewrap the Landlock refusal above appears. So a Grok lane needs two host prerequisites that the runner's preflight does not check.

    2. Grok's docs disagree with its behavior. ~/.grok/docs/user-guide/18-sandbox.md says "If the sandbox cannot be applied (e.g., unsupported kernel, missing entitlements), Grok logs a warning and continues without enforcement. The exception is an explicitly-requested custom profile". The built-in read-only, workspace and strict profiles refuse instead. The same file also says "Profiles that require it refuse to start if the kernel policy cannot be applied". The error text says "see the warning above", and no warning is printed in headless mode; --debug prints nothing more, and --debug-file <f> does not create the file.

    3. Once Grok starts on devbox, headless permission prompts cancel the lane. This is issue Grok isolated-write lanes cancel headless edit permissions #34, and my trail matches it exactly: an isolated-write lane's first search_replace (creating a new file inside the lane's cwd) logged permission_requested, permission_resolved decision=cancelled wait_ms=0, turn_ended cancellation_category=permission_cancelled; runner status malformed-output, exit 65, after 12.9 minutes of work. The read-only variant is not in Grok isolated-write lanes cancel headless edit permissions #34: in --permission-mode plan, a shell command that writes a file (cat > report.md << 'EOF') logged the same three lines with tool_name=run_terminal_command and wait_ms=3, and the lane died after 7 minutes. A built-in read-only command (git log -1 --oneline) did not prompt.

    4. What did not help: --debug, --debug-file, and the GROK_SANDBOX environment form, all with the same refusal.

  2. ericlitman commented on Sep 23, 2026

    @ericlitman
    Owner

    Factory plan review: revise (operator review of the plan dated 2026-09-11, card revision 14)

    The investigation is sound: the bug is still present on main. The runner has no handling for a host without Landlock or bwrap, and it reports child-failed/70 after grok models passes. The plan cannot be approved yet, for these reasons:

    1. Post the complete plan in the thread. The last round wrote the plan to a sandbox file (.mastracode/plans/issue-56-grok-cloud-sandbox.md) and posted only a short summary. The next round must post the full plan as its final message, using every section of the planning template: Goal, Scope (In/Out), Kind, Findings, Phases, Expected files, Risks, Assumptions, Open questions, Acceptance evidence.

    2. List the receipt-contract choice under Open questions; don't decide it in the plan. The previous plan bumped the receipt schemaVersion from 1 to 2 on its own. The maintainer should choose between these three options:

      • (a) A new unavailable-sandbox status with exit code 69 and a schema bump.
      • (b) The same status without a schema bump.
      • (c) A docs-only change stating that Claude Code cloud sessions without Landlock or bwrap are unsupported for Grok lanes.

      Give a recommendation, but leave the choice open.

    3. Plan the order against the open runner PRs. fix(runner): preserve Grok cancellation evidence and restrict read-only tools #79, fix(runner): let headless Grok writers run shell commands #81 and fix(runner): pre-approve file edits for headless Grok writers #84 all change run.ts, types.ts, parse-output.ts or commands.ts. fix(runner): preserve Grok cancellation evidence and restrict read-only tools #79 also changes the RunnerReceipt fields. State which order the plan assumes and how the fix is rebased if those merge first.

    4. Re-check the Grok CLI version. The reporter's evidence is from Grok 1.0.13. fix(runner): let headless Grok writers run shell commands #81 and fix(runner): pre-approve file edits for headless Grok writers #84 describe Grok CLI 1.0.41. Confirm, or record as an assumption, whether --sandbox read-only and --sandbox workspace still refuse to start without Landlock or bwrap on the current CLI.

    Never substitute --sandbox devbox or off, as the earlier plan already said.

  3. ericlitman commented on Oct 1, 2026

    @ericlitman
    Owner

    Maintainer decision (2026-10-01): option (c). Document that Claude Code cloud sessions without Landlock or bwrap can't run Grok lanes. When the runner hits that refusal, the existing child-failed result names the cause. There's no new receipt status and no schema bump. Never substitute --sandbox devbox or off. Prior art: #82.

  4. Repository owner deleted a comment from mast-factory on Oct 2, 2026
  5. ericlitman commented on Oct 4, 2026

    @ericlitman
    Owner

    Factory plan verdict: revise

    • Card: Delivery 82a76bf6, plan-review revision 17.
    • Plan reviewed: the plan thread posted 2026-09-23 against de67e6b.
    • Planner model: gpt-5.6-sol, from the plan session's message metadata.
    • Reviewer model: Claude Opus 5.5, reviewing in a separate context.
    • Rubric: the factory-adjudicate plan checklist.

    Why revise

    1. Conflicts with a settled decision. On 2026-10-01 the maintainer chose option (c): documentation only. The plan still carries a code path.
      • The plan says "If the operator selects a code option, narrowly recognize Grok model-stage refusal…".
      • Its Kind section treats the receipt contract as an open choice.
      • What passes: a docs-only plan with no runner, receipt, status or schema change. The existing child-failed result already carries Grok's own refusal text in its evidence, and the docs point readers to it.
    2. Stale dependencies. Phase 1 blocks on "PRs fix(runner): preserve Grok cancellation evidence and restrict read-only tools #79, fix(runner): let headless Grok writers run shell commands #81, and fix(runner): pre-approve file edits for headless Grok writers #84" and on PR docs(dispatch): note that Grok lanes need an unsandboxed Codex parent #82. All four are closed. fix(runner): run headless Grok lanes in auto permission mode and keep the terminal error in receipts #116 has merged, and Grok now runs in auto mode in both access modes.
      • What passes: drop Phase 1's ordering gate. Base the change on current main (be66d68) and remove the references to those PRs.

    What the revised plan should contain

    • Scope. Add a host-prerequisite note to plugins/pstack/skills/poteto-mode/references/provider-dispatch.md, next to the existing parent-sandbox paragraph at line 72. The note says:
      • Grok's read-only and workspace sandboxes need Landlock, plus bubblewrap on Linux.
      • Hosts without them cannot run Grok lanes. Claude Code cloud sessions are one example.
      • On such a host the lane fails as child-failed, and the receipt evidence contains Grok's refusal text.
      • Open Pstack never substitutes devbox or off.
    • Setup. Add a matching one-line note to setup-pstack so a failed Grok probe on such a host points to that section.
    • Wording. Keep the wording generic so it holds for any host that lacks these kernel features, not only one vendor's VM.
    • Coordination with Codex default sandbox blocks external pstack lanes; setup should detect and explain it #124. Codex default sandbox blocks external pstack lanes; setup should detect and explain it #124 adds a sibling note about the Codex default sandbox in the same section. Whichever change lands second rebases onto the first, so the section has one "host and parent prerequisites" list and no duplicates.
    • Files. The plan lists the expected files and their upstream status. provider-dispatch.md is a port-owned file. Check UPSTREAM.md before editing.

    Build conditions

    • No change under scripts/runner/.
    • The static invariants and plugin validation pass.
    • Live gate: install the exact candidate and confirm from a Claude Code parent and a Codex parent that the installed provider-dispatch.md and setup-pstack show the new text. The change is docs only, so no Landlock-less host is needed.
  6. ericlitman commented on Oct 4, 2026

    @ericlitman
    Owner

    Factory plan verdict: approve

    • Card: Delivery 82a76bf6, plan-review revision 20.
    • Plan reviewed: the docs-only plan posted after the revise verdict of 2026-10-04.
    • Planner model: gpt-6.1-sol, from the plan session's message metadata.
    • Reviewer model: Claude Opus 5.5, reviewing in a separate context.
    • Rubric: the factory-adjudicate plan checklist.

    Why approve

    Every gate passes, and Open questions is None.

    • The plan follows the maintainer's option (c): documentation only. It has no runner, receipt or schema change, and its scope proof (git diff --exit-code … scripts/runner/) enforces that.
    • The anchors hold on main (be66d68):
      • provider-dispatch.md:72 is the parent-sandbox paragraph.
      • provider-dispatch.md:83 is the Grok auto-mode paragraph, which the plan preserves.
      • setup-pstack/SKILL.md contains the probe section.
    • The wording risks have early checks:
      • Prerequisites are scoped to Linux.
      • Claude Code cloud sessions are named as an example of an affected host, not all cloud sessions.
      • Not every child-failed is tied to this cause.
    • Coordination with Codex default sandbox blocks external pstack lanes; setup should detect and explain it #124 is non-blocking, with one shared "Host and parent prerequisites" list.
    • The live gate is proportionate for a docs change: inspect the installed text from fresh Claude Code and Codex parents.

    Build conditions

    1. Add one line under Unreleased in CHANGES.md, matching what recent PRs do (Prevent project startup configuration from overriding runner authentication [#25] #113, Honor active harness config homes in setup-pstack [#120] #123). That file records this port's adaptations, and setup-pstack/SKILL.md is upstream-derived.
    2. Keep the setup cross-reference to one sentence. Check that the relative anchor resolves in the installed tree, not only in the source checkout.
    3. Before opening the PR, run the CI-equivalent checks in a Bun-enabled environment and report each exit status. If the build host lacks Bun or the harness CLIs, fix the host. Don't skip the checks.
  7. added a commit that references this issue on Oct 4, 2026
  8. added 2 commits that reference this issue on Oct 4, 2026
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