Repository navigation
feat(sandbox): sandbox the mission --verify command (#748) - #845
Merged
Merged
Conversation
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
…fore the first turn, say what a sandboxed verify cannot see (#748)
… the verify, and the docs say so (#748)
ajianaz
added a commit
that referenced
this pull request
Nov 15, 2026
…review items (#748) Adds [sandbox.consumers] turnend = "off" | "optional" | "required" (user config only, default off). Stop gates run in the existing command profile with the whole-.git protection. A refusal (no working sandbox, a workspace layout the profile refuses, an unspawnable launcher, or a non-zero exit with no command exit code from bwrap) is a deny with a reason, never a pass. Consumer::always_unattended now covers verify and turnend, so optional has no unsandboxed fallback for a stop gate. A gate timeout keeps the old non-blocking contract (#110), documented as a residual. Also folds in the three low items from the #845 review: the fd 3 doc wording, the doctor warning strings, and real-bwrap tests that exit codes 125/126/127 and forged fd 3 lines do not change the classification. Refs #748 (stays open for cron scripts and deliveries).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Second slice of #748, part 1 of 2 (this PR: the mission
--verifycommand; theon_turnendstop gates follow in a stacked PR, opened after this one merges).[sandbox.consumers] verify = "off" | "optional" | "required"(user config only, defaultoff) runs thesh -c <verify>oftole missionin the existingcommandprofile, including the #849 protection of the whole.gitdirectory, nested gitdirs and.tole. Refs #748 (stays open for the stop gates, cron scripts and deliveries).Why
The verify command runs code the agent just wrote (
cargo testruns build scripts and tests) with no approval (#676). Opt-in first, as decided on 2026-11-14; makingverifysandboxed by default is a later phase (plan indocs/sandbox-design.md§9.4, not done here).Changes
tole-coresandbox/command.rs:Consumer::Verify,Consumers.verify,Consumer::ALL,command_in_cwd(same ascommand_for, workspace = the process's working directory, which is where verify ran before; only looked up when the sandbox is on),preflight(the refusal a launch would give, without running anything).launch_commandpassesunattended || consumer.always_unattended(): a mission is unattended, sooptionalcounts asrequiredfor verify whatever the process flag says. Launcher status viabwrap --json-status-fd:command_exit_codeisSomeonly when the command itself ran and ended. Doctor lines list the consumer; anoptionalverify without a sandbox is an ERROR (a mission cannot fall back), a toolchain-under-$HOMEwarning, and the stop gates are still reported "not sandboxed yet". Commands still readconsumers(), neversession_policy().tole-climission.rs:run_verifygoes throughcommand_in_cwdand returnsVerify::{Passed, Failed, Refused}. What "verify refused" does to a mission: a refusal ends the mission with statusverify_refusedand a non-zero exit. A start-up check (preflight) runs before the first turn, so no model turn is spent on a mission that cannot be verified. Refusals: no working sandbox (required or optional), no workspace, a workspace layout thecommandprofile refuses (uninitialized or nested submodule, linked worktree inside the workspace, a.gitlink chain it cannot protect; the reason is printed), a launcher that fails to start (spawn error, or a non-zero exit with no command exit code frombwrap).MISSION_COMPLETEis not honoured,verify_failuresstays 0, the session stays resumable, no skill outcome is recorded. It is never a pass and never an unsandboxed run: a mission is unattended, sooptionalhas no fallback (run_commandfalls back with a human attached; verify cannot). A command that runs and fails (or times out) is unchanged: output back to the model, 3 strikesverify_failed.sh -c, same scrub for consumerverify, same timeout and output tail). On: same exit status, output capture, timeout, cwd, ENV-1 scrub (applied to thebwrapprocess).config/mod.rs:verifykey (validated,config check, user layer only).main.rs:--verifyhelp mentionsverify_refused.docs/sandbox-design.md§9.2/9.3/9.4 (call site, semantics, refusal incl. profile-refused layouts, residual: toolchains in~/.cargoare not visible), epics, threat model, CHANGELOG. CI:Sandbox (bubblewrap)job also runs thetole-clitargetverify_sandbox.Callers and impact (cora is absent here; grep, every one checked):
Consumer/Consumers/command_for/launch_command:run_command.rsandjobs.rs(unchanged behaviour,command_foris a wrapper ofcommand_prepared),sandbox/report.rs(doctor_grant_linesloopsConsumer::ALL),config/mod.rs,main.rs(set_consumers),doctor.rs(command::doctor_lines); struct-literal users in tests use..Default.run_verify: onlymission.rs.classify_mission(skill/outcome.rs):verify_refusedfalls under the existingSkiparm.command_tests.rs,command_sandbox{,_none}.rs,sandbox_no_flag.rs,sandbox_profile_flag.rs,sandbox_consumers.rs,mission_e2e.rs,verify_sandbox.rs, config unit tests,layering.detect()says "no sandbox on this platform" andtole doctorand the refusal repeat it.Testing
command_tests.rs): same argv asrun_command, protected paths read-only, the string stays one argv element after--,optionalisrequired, refusal text namessandbox.consumers.verify, doctor lines, the launcher report parser.command_sandbox_none.rs,verify_sandbox.rs, real binary + mock provider): verify off (default and explicit) unchanged;requiredandoptionalwithoutbwraprefuse:status: verify_refused, non-zero exit, the command never ran,turns: 0,verify failures: 0, nevercomplete.command_sandbox.rs,verify_sandbox.rs; skip with aSKIPPED:line whenbwrapis absent, CI'sSandbox (bubblewrap)job runs them withTOLE_REQUIRE_BWRAP=1): a sandboxed verify writes the workspace but cannot write.git,.tole, sees no$HOMEor data dir, keeps its exit status and output; a failing sandboxed verify isverify_failedafter 3 strikes; a layout the profile refuses (uninitialized submodule, linked worktree) in bothrequiredandoptionalisverify_refusedwith the profile's reason,turns: 0, the command never ran; fake-bwraptests: a launcher failure and an unspawnable launcher are refusals, not verify failures.run_verifyback to a plainsh -c=> the refusal and.gitwrite tests fail;always_unattendedmadefalse=> the unit,command_sandbox_noneand doctor tests fail;Refusedmapped toFailed=> both refusal e2e tests fail.cargo fmt --all --check;cargo clippy --workspace --all-targets --all-features -- -D warnings;cargo clippy -p tole-core -p tole-cli -p tole-tui --no-default-features --all-targets -- -D warnings;cargo testof tole-core and tole-cli (default) and of tole-core, tole-cli, tole-tui with--no-default-features, all withTOLE_REQUIRE_BWRAP=1: green, no SKIPPED.scripts/review-local.sh: cora is not installed here (exit 1, not a pass). Self-review as adversarial reviewer ofgit diff origin/develop...HEAD: a refusal can never reach the pass branch (theVerifyenum has no default arm andRefusedbreaks before any continuation); the workspace is canonicalised and refused for$HOME/ancestors/data dir bycheck_grant; thesh -cstring is one argv element after--; the scrub is on thebwrapprocess;command_in_cwdnever callssession_policy()so--sandbox/--no-sandboxcannot reach verify; an unknown cwd refuses. Residual documented:--workspaceis not the sandbox workspace (the process cwd is, as before), toolchains outside system dirs are not visible, and the security: the command sandbox profile protects .git/hooks and .git/config by leaf mounts only; renaming .git aside bypasses them #849 residuals of thecommandprofile apply to verify too.