Skip to content

Sandbox interface: a probed level, and a user-level default (TD-5294, TD-5295) - #122

Merged
captcrock merged 2 commits into
mainfrom
td/5294-sandbox-interface
Nov 23, 2026
Merged

captcrock merged 2 commits into
mainfrom
td/5294-sandbox-interface

Conversation

@captcrock

Copy link
Copy Markdown
Contributor

Milestone: the sandbox interface (R1 of the sandboxing design, approved in the build order).

TD-5294: the sandbox says how strongly it holds

  • New core/tstd/sandbox/: a SandboxBackend protocol, BackendStatus (full / partial / none, gaps against a fixed promise list, and the fix), and a probe cache.
  • The bubblewrap probe starts a real sandbox, then checks whether a command inside can map root in its own user namespace. If it can, or if that can't be checked, the level is partial with the pins named.
  • The probe runs off the event loop at start, again when Doctor opens, and again after bubblewrap itself fails.
  • auto_allow promotes only when the level is full. A promised call is refused if the level dropped in between.
  • The result note names the backend and level. Doctor has a sandbox row. Approval cards for shell calls carry one line saying what the command runs in.
  • CI sets TST_REQUIRE_SANDBOX=1, so the real-run sandbox tests fail instead of skipping.
  • The guard tests that matched the bare word "sandbox" in session.py, loop.py and daemon.py now match the autonomy container module they were written to keep out.

TD-5295: a user-level default

  • sandbox: in the daemon config: default (off / on / require), on_partial, auto_allow, hidden_paths. The shipped default stays off.
  • Under on or require, a repo's enabled: false, exclude or auto_allow waits for the trust card.
  • In a partial sandbox a command that would have run unasked now asks. refuse and require refuse it.

Checks

  • Core: 8963 passed, 13 skipped with TST_REQUIRE_SANDBOX=1. The 4 failures from that run (the over-broad guard tests, and a merge that didn't keep None) are fixed; their files pass (127 tests). ruff and mypy are clean.
  • UI: tsc, svelte-check, vitest (2873) and build are clean.

🤖 Generated with Claude Code

captcrock and others added 2 commits November 23, 2026 21:56
…skips an ask

New core/tstd/sandbox/: a SandboxBackend protocol, BackendStatus (backend,
full / partial / none, gaps against a fixed promise list, and why it cannot
run) and a per-process probe cache. The bubblewrap probe starts a real
sandbox and then checks whether a command inside can map root in a user
namespace of its own; if it can, or that cannot be checked, the level is
partial with the pins named as the gap.

The probe runs once off the loop at daemon start, again when Doctor opens
and again after bubblewrap itself fails to start a command. auto_allow now
promotes only under full, and a promised call is refused if the level
dropped before it ran. The result note names backend and level. Doctor has
a sandbox row, and an approval card for a shell call carries a sandbox
object with one line ("Runs in the sandbox (bwrap, full)", partial with its
gaps, or "Runs on your computer, outside the sandbox").

CI sets TST_REQUIRE_SANDBOX=1 so the real-run tests fail rather than skip.
The bwrap argv is unchanged. Class B entry in DECISIONS.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… quietly turn it off

The daemon's config gains a sandbox: section (SandboxDefaults: default
off | on | require, on_partial ask | refuse, auto_allow, hidden_paths).
The shipped default stays off. A workspace's sandbox.enabled becomes
bool | None, None following the default, and shell_sandbox.effective
merges the two on every boundary reload: what the workspace says wins,
auto-run is on when either asks for it, hidden paths add up.

Under on or require, a workspace file's enabled: false, a non-empty
exclude and auto_allow: true are loosenings that wait for the trust card;
the trust store carries the user's default for that. Under off nothing
changes from TD-5138. In a partial sandbox, a command that would have run
unasked asks, naming the gap; on_partial: refuse and require refuse it.
A bare YAML off / on reads as the word. Class B entry in DECISIONS.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@captcrock
captcrock force-pushed the td/5294-sandbox-interface branch from bee6582 to 6a3d459 Compare November 23, 2026 21:56
@captcrock
captcrock merged commit 61c7ddd into main Nov 23, 2026
4 checks passed
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.

1 participant