8000 A sandbox that the daemon starts in a box's classifier leaf leaves its supervisor outside the leaf · Issue #3696 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

A sandbox that the daemon starts in a box's classifier leaf leaves its supervisor outside the leaf #3696

Open

Description

@norrietaylor

Defect

The daemon runs a package build or a task for a host-address box in a sandbox that carries the box's classifier leaf. The program of that sandbox joins the leaf before it execs. The sandbox supervisor does not join it. The supervisor stays in the daemon's own cgroup for as long as the run lasts.

NET-079 requires every process of a box to stay in the cgroup that the box's egress verdict is decided on. The box launch meets this since #3588: it moves the supervisor into the leaf, confirms the move, and refuses the launch when the move fails. The build path and the task path have no such step.

Where

Code read from main at 9fd4fa1f.

  • crates/sandbox/src/lib.rs:2741, Sandbox::run_with_cancel: spawns each invocation and does nothing with the supervisor's pid when config.classifier_leaf is set. A package build for a box runs through it (crates/op/src/specs.rs:407), and so does an in-box task run (crates/mctx/src/env.rs:1557).
  • crates/minimald/src/exec/process.rs:601: the daemon's task launch spawns the same way. Since #3610 a task of a host-address box carries the leaf of its box, and this spawn does not place the supervisor either.
  • crates/sandbox/src/lib.rs:1636: the only join. It runs in the program's pre-exec closure, which the supervisor never runs.
  • crates/minimald/src/box_runtime/enforcement.rs:973, place_box_processes: the move-and-confirm step that the box launch uses (crates/minimald/src/box_runtime/launcher.rs:1937). It is private to that module.

#3256 moves a box's package builds into build boxes that take no classifier leaf. The task path keeps the leaf after that change, so the defect stays for tasks.

Expected

  • Each sandbox that the daemon starts with a classifier leaf has its supervisor in that leaf. The daemon reads the leaf's cgroup.procs back and finds the supervisor there.
  • When the move fails, the run fails. The daemon kills and reaps the process, and the error says why the move failed.
  • A sandbox with no classifier leaf starts as it does today.
  • One function moves and confirms a supervisor for the box launch, a build and a task.

This is a residual of epic #1437 (NET).

Activity

  1. added
    bugSomething isn't working
    priority:should-haveShould be done. Applied by the inbox-route classifier or a human.
    on Nov 20, 2026
  2. norrietaylor commented on Nov 20, 2026

    @norrietaylor
    MemberAuthor

    Task

    Source: #3696

    Plan block
    ### D3696 — Every sandbox that the daemon starts in a box's classifier leaf has its supervisor in that leaf, or the run fails
      kind: task
      size: M
      est: 80 code, 140 tests
      executor: agent
      origin: residual
      epic: 1437
      layers:
        - sandbox:
          - crates/sandbox/src/lib.rs: classifier gains a function that moves a pid into a leaf and reads cgroup.procs back. run_with_cancel calls it for each spawned supervisor when the config has a classifier leaf. On an error it kills and reaps the process and fails the run.
          test: cargo test -p sandbox a_run_in_a_classifier_leaf_places_its_supervisor
        - minimald:
          - crates/minimald/src/exec/process.rs: The task launch moves the supervisor of each invocation into the leaf of its box after the spawn. A failed move kills and reaps the process and fails the task with the cause.
          - crates/minimald/src/exec/tests.rs: Add a test with a stand-in leaf that has no cgroup.procs. The task launch returns an error and the process is reaped.
          - crates/minimald/src/box_runtime/enforcement.rs: place_box_processes calls the sandbox function, so one function moves and confirms a supervisor for a box launch, a build and a task.
          - crates/minimald/tests/classifier_root_integration.rs: package_build_in_a_box_leaf_follows_its_verdict_over_a_loaded_table also asserts that the supervisor of the build is in the leaf while the build runs.
          test: cargo test -p minimald a_task_supervisor_the_leaf_refuses_stops_the_task
          test: just test-root-integration
      proof: While a package build or a task runs for a host-address box, the cgroup.procs of the box's leaf lists the sandbox supervisor, and the daemon's own cgroup holds no process of that run.
    
  3. norrietaylor commented on Nov 20, 2026

    @norrietaylor
    MemberAuthor

    /implement

  4. minimal-foundry commented on Nov 20, 2026

    @minimal-foundry
    Contributor

    Pull request #3711 is open for D3696.

    branch agent/3696-every-sandbox-that-the-daemon-starts-in-a-box-s · epic #1437

    test exit tail
    cargo test -p sandbox a_run_in_a_classifier_leaf_places_its_supervisor 0 running 2 tests test tests::a_run_in_a_classifier_leaf_places_its_supervisor_over_a_stand_in ... ok test tests::a_run_in_a_classifier_leaf_places_its_supervisor_in_the_real_tree ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 106 filtered out; finished in 0.00s running 0 tests
    cargo test -p minimald a_task_supervisor_the_leaf_refuses_stops_the_task 0 running 1 test test exec::tests::a_task_supervisor_the_leaf_refuses_stops_the_task ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1546 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; finished in 0.0
    just test-root-integration 1 fetch-gvproxy: building gvproxy-linux-amd64 v0.9.0 from the pinned source build-gvproxy: downloading https://go.dev/dl/go1.26.10.linux-amd64.tar.gz warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fie

    Verify min task run agent-verify: exit 100 — FAIL [ 0.008s] (1603/1680) sandbox session_bind::tests::a_swap_between_the_resolve_and_the_bind_cannot_change_what_is_mounted thread 'session_bind::tests::a_swap_between_the_resolve_and_the_bind_cannot_change_what_is_mounted' (11689) panicked at crates/sandbox/src/session_bind.rs:1226:

    Updated 2026-11-20T22:39:04.727Z.

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

    bugSomething isn't workingpriority:should-haveShould be done. Applied by the inbox-route classifier or a human.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0