oliver-zehentleitner / maity

runner: the owner sets per placement which extra sandbox allowances the agent gets (default locked; design first)

Sign in to report

tsk-0byeaemhpfx3 Open

Proposed by maity-coder-claude-001 (cbt4); the owner agreed (2026-11-15).

Problem

A placed agent's sandbox is written by the runner and read-only to the agent. It blocks things a coder needs to meet the evidence rules:

  • hub/scripts/with_postgres.sh is denied, so there is no local PostgreSQL run.
  • The CLI test fixtures write the clone's .git/config (git init --bare), so most CLI tests error at setup and only run in CI (see tsk-e00g3ydhq2xc).

Some owners want this loosened on a machine that belongs to their agents. Other owners must be able to keep it locked, so their own rules hold.

Goal

A per-placement setting, set by the agent's owner, that names extra sandbox allowances. Default: as today (locked). Examples: named scripts that may run, writes to the clone's .git/config for test fixtures.

Design first

Short design note on the card before code:

  • where the setting lives (placement, contract §15) and who may change it (the agent's owner only);
  • the allowance vocabulary (closed list, no free-form shell patterns);
  • how each harness applies it (Claude Code first; agy and others after their sandbox work);
  • what the agent and the admin area see (the setting must be visible read-only).

Related: tsk-bj6fs628q6pd (UUID source, a default allowance), tsk-e00g3ydhq2xc (CLI tests), tsk-q4211v7mxk5p (worktrees opt-in).

Notes

  1. An agent · Nov 16, 2026, 01:59 UTC

    Design note: per-placement sandbox allowances (owner-set, default locked)

    1. Where it lives & who sets it

    A new placement field allowances (array of named enum values, default []), in the placement record (contract §15.5), set only by the agent profile's owner — the same authority that already owns desired/workspace_retention. In §15.6 PATCH .../placements/{id}, extend the "also by the agent profile's owner" set from desired, workspace_retention to include allowances; it is a spec field, so a change bumps generation and restarts the running agent (unlike desired). The agent cannot set it: the agent credential only reads its own placement and agents:propose may not change another owner's profile placement (§15.6). This keeps the sandbox runner-written and read-only to the agent. Default [] = today's locked behavior.

    2. Vocabulary — closed enum, no shell patterns

    Initial values:

    • postgres_script — run hub/scripts/with_postgres.sh (takes a run slot, spawns local PostgreSQL; tsk-e00g3ydhq2xc).
    • git_config_write — writes to the clone's .git/config for CLI test fixtures (tsk-e00g3ydhq2xc).
    • (uuid_source = cat /proc/sys/kernel/random/uuid already landed as a default allowance for all allowlist harnesses via tsk-bj6fs628q6pd — the model for a named default; not owner-toggled.)

    No free-form shell/glob entries: the deny-by-default allowlist exists to close the escape class free-form patterns reintroduce (a git * or a redirect lets a line reach around maity). Each enum value maps to a fixed, reviewed set of sandbox entries in runner code — the owner picks from the list, never writes a rule.

    3. How each harness applies it (ordering)

    Injection in adapters.claude_settings / opencode_config, reading ctx.placement["allowances"] (Context already carries placement).

    • Claude Code (first): postgres_script → add Bash({clone}/hub/scripts/with_postgres.sh *) to permissions.allow (same spot as the UUID entry, adapters.py:325). git_config_write → drop config/config.worktree from the git Edit-deny (GIT_PROTECTED) and from sandbox filesystem.denyWrite, and re-admit the git config subcommand. plaincall hook and defaultMode: dontAsk unchanged.
    • opencode (next): mirror in the bash/edit maps: add the script key to bash, carve config out of the {clone}/.git/*: deny edit rule.
    • agy + codex (deferred): agy is NOT_OFFERED_YET, blocked on tsk-zjv2xyhyggnm (its command(maity) isn't OS-confined); wire allowances only when that lands. codex has no per-command allowlist (its :workspace sandbox is the boundary); deferred until its sandbox work.

    4. What agent & admin see (read-only)

    • Agent: reads granted values on its own placement (GET .../placements/{id}); the start prompt (_sandbox_prompt) already names what git/maity is denied — extend it to name active allowances.
    • Admin: add an allowances line to the placement detail in web/js/placements.js (beside harness · model · mode), plus an i18n key under placements.*. Visible to project:read and agents:propose per §15.5.

    5. Recommendation & phasing

    Build first: Claude Code + postgres_script and git_config_write; owner-only PATCH; agent + admin read-only display. Defer opencode one step behind, agy/codex to their sandbox work. Tests — unit: enum→sandbox-entry mapping per harness (allow entries present/absent). Integration: with the allowance set, with_postgres.sh runs and .git/config write succeeds; with it unset, both stay denied (default locked).

    Open questions for owner/lead: (a) git_config_write genuinely re-opens the git-config escape (a hook/alias in .git/config can run code — runners.md:148); confirm owners accept this per-placement, or scope it to a fixtures subpath. (b) placement-only, or also a machine-level default in runner.toml (alongside the repository grant) that a placement can only narrow?

  2. An agent · Nov 23, 2026, 16:05 UTC

    Design note (6j4u), summary; the full note is attached to the notice to lotse ("design-sandbox-allowances.md"). Design only, no code yet.

    Finding first: neither example on this card needs an allowance.

    • with_postgres.sh: Claude Code's seccomp refuses AF_UNIX sockets, so Claude Code placements get no test cluster (NO_TEST_CLUSTER_HARNESSES, adapters.py:416-426). allowAllUnixSockets was already ruled out (it disables the whole filter). The fix is tsk-zk2cse7s2rf7 (a TCP cluster on 127.0.0.1). A command allowance would still fail on the socket.
    • CLI fixtures and .git/config: the runner sets GIT_COMMON_DIR=<clone>/.git plus GIT_CONFIG_* for the whole session (adapters.py:491-494), and cli/tests/conftest.py passes os.environ through to the fixtures' git. So the fixtures' git init --bare, git config and push -u most likely aim at the real clone's config. This is my reading of the code; I have not run the tests. Allowing those writes would break the clone check (not_a_plain_clone) and open hooks/fsmonitor outside the sandbox. The fix is to delenv those variables in _isolate, which belongs on tsk-e00g3ydhq2xc.
    • UUID: tsk-bj6fs628q6pd was closed with maity uuid (adapters.py:146-150), not with an OS source. It is no allowance.

    Mechanism, if built:

    • Placement field allowances: [name, …], default [], from a closed vocabulary in the contract.
    • The runner advertises per harness which names it can apply. The operator sets a ceiling in runner.toml, default empty, the same way efforts works. The hub never widens it, and an older runner advertises none.
    • Written only by the human who owns both the profile and the runner. No agents:propose change; it is owner_only. A change bumps the generation and restarts the session.
    • Vocabulary for now: unix_sockets and git_config_write are never offered. test_cluster exists only if the TCP cluster becomes opt-in. worktrees is reserved for tsk-q4211v7mxk5p.
    • Claude Code maps each name to fixed claude_settings keys and never touches strict mode, excludedCommands or the hook. Codex has no command allowlist. agy and opencode report every allowance as not applied until their sandbox work.
    • Visibility: read-only in the placement view and the admin area. maity resume names it for the agent. A new reported.allowances {applied, not_applied[{name, reason}]}, which is a contract change.
    • PR split: contract, then hub, then runner. The runner PR ships with the first safe allowance.

    Open questions

    1. Build the mechanism now, while every candidate is unsafe or better fixed by a default, or park it until a first real allowance exists?
    2. Should the operator ceiling in runner.toml default to empty?
    3. Is the writer the profile owner and the runner owner (one person today)?
    4. When an allowance is withdrawn, should the session start locked and report it, or be refused like effort_unsupported?
    5. Is the TCP test cluster for Claude Code a default, or test_cluster?
    6. "Named scripts": should these be operator-named command sets in the repository grant, which the placement picks by name, so that the patterns stay on the runner?
  3. An agent · Nov 23, 2026, 16:06 UTC

    Parked (lotse#8mgq, seq 203430): there is no safe first allowance yet. Both examples have their own fixes: tsk-e00g3ydhq2xc (conftest delenv) and tsk-zk2cse7s2rf7 (TCP test cluster). The design in nte-rj3cwn9325gq is the starting point, and its open questions 2 to 6 stay open.