Skip to content

feat(*): move the sandbox to OpenShell and put its network under permissions - #1269

Merged
0xKT merged 86 commits into
mainfrom
feat/openshell_sandbox_backend
Nov 16, 2026
Merged

0xKT merged 86 commits into
mainfrom
feat/openshell_sandbox_backend

Conversation

@LivXue

@LivXue LivXue commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Sandboxed commands now run in NVIDIA OpenShell on its Docker driver, the boxlite micro-VM backend is retired, and what a sandbox may reach is part of the one permission set every agent follows: a connection the sandbox blocks while a command runs is settled the way a tool call is, through the same mode, grants and approval card. In this PR "gateway" means the local OpenShell gateway (a service on 127.0.0.1:17670 with mTLS), not raven gateway.

Why OpenShell: on the same Mac (colima), a sandbox was ready in 1.03 s against boxlite's 1.56 s, and eight at once took 2.08 s against 10.4 s; a single command round trip is slower (8.6 ms against 1.6 ms). The Linux figures are in the Performance section of the docs page.

Contract change: CONTRACTS_VERSION moves to 44. ApprovalResponder.await_approval takes a needs_person keyword, and the plugin ServiceLocator carries sandbox_gateway.

The OpenShell backend

  • OpenShellExecutor (raven/sandbox/openshell_executor.py) keeps the existing model of one sandbox per executor: the main loop owns one, and every subagent run and DAG node gets its own. All SDK calls sit behind an OpenShellControlPlane protocol. Commands run through ExecSandbox as sh -c, and stdio MCP servers through ExecSandboxInteractive. The workspace, extra volumes, /agent-home and /plugin-data are bind mounted at the guest paths boxlite used, and the path translation moved into raven/sandbox/mounts.py. A timeout reports exit -1 with "Command timed out", as the other executors do, and the command's own budget is the deadline: the gateway enforces it and reports its own exit 124, and a local backstop kills the call if the gateway does not answer. Any failure while the sandbox starts, its startup check included, is a SandboxInitError, which the agent loop logs and stays up on.
  • The sandbox's filesystem is narrower than the boxlite VM's: the system paths (/bin, /usr, /lib, /etc, /proc, /var/log, /dev/urandom) are read-only, /tmp and the mounted volumes are writable, and everything else is unreachable. pip install, apt-get and npm i -g therefore do not work in the sandbox, and neither does writing to $HOME outside the mounts.
  • Cleanup: OpenShell has no sandbox expiry, so each sandbox carries an owner label (a digest of host and uid) and the creating pid, and the first start in a process deletes sandboxes whose pid is gone. Deletes run in the background, and closing the agent loop's executor waits up to 20 s for the ones started on its loop. A create that fails after the gateway made the sandbox (a client deadline) deletes it too. An SDK client the executor built closes once the last delete queued on it ends, after stop() or a failed start, so neither a sandbox that failed to start nor the orphan sweep loses its delete to a closed client.
  • Config: a run-once loader floor (config version 16) rewrites backend: "auto" and "boxlite" to "openshell" and removes debug and diskSizeGb, with one notice per change. "auto" meant boxlite with no fallback, so the rewrite keeps failing closed when OpenShell is missing.
  • Removed: the raven sandbox command group, the sandbox debug server, scripts/boxlite_cli.py and docs/sandbox/. openshell sandbox list, exec and connect replace them.
  • Packaging and setup: the sandbox extra is anyio plus openshell>=0.1.8,<0.2 (not on win32), and uv.lock drops boxlite and adds openshell and grpcio. raven upgrade keeps the extra when the OpenShell SDK is installed. raven onboard checks that the SDK imports and that a gateway answers; on Windows it offers no sandbox choice and says why, and skipped or non-interactive onboarding there keeps a configured backend and says commands cannot run until Host (direct) is chosen or the backend is set to none (switching to the host takes the confirmation the interactive choice asks for).

One permission set for the network

  • permissions.network replaces tools.sandbox.allowNet: a default of open (every host name of three or more labels on every port, plus common package, code-hosting and model-provider names on common ports, the closest OpenShell allows to "any host", see NVIDIA/OpenShell#3856) or closed, and allow or deny rules by host (with OpenShell's * and ** wildcards, each standing for whole labels), ports and program. A loader floor (config version 17) moves an allowNet there with a notice; true is the open default, false closed, a host list those hosts on 80 and 443 with the default closed (a host:port entry becomes a rule for that port, and an entry no rule can hold, such as an address range, is left out and named in the notice), and "*" in a list keeps the open default. Every sandbox compiles its policy from it: the main loop's, spawns', DAG nodes', and the MCP servers a session or a playbook starts in one. A sandbox reads the live set (with an unpersisted allowNet still honoured) and applies a change through UpdateConfig before its next command, process start or MCP tool call (the compiled policies are compared as dicts, so an unchanged one costs microseconds, not a hash of 65,535 ports); every sandbox's reader (the main loop's, subagents' and a Playbook's MCP servers') keeps its last valid set across parsing, validation or OS read failures, and closes the network until a set has validated (only an absent file answers the open default); a command, process start or MCP tool call is not run while a change that takes something away has not loaded, one change is in flight per sandbox at a time, a version the gateway took but the sandbox has not loaded is checked again rather than sent again, and an executor built with no network source gets none.
  • A blocked connection is read back from the gateway's OCSF log for the time the command ran (ExecResult.denials). A failed command waits for the sandbox's "relay closed" line, which arrives after its denials (measured: 0.25 s idle, up to 1.85 s under load), so a denial is not missed under load or half-read. The log names the sandbox, not the command (measured: with two commands at once in one sandbox, the later one's result carried the earlier one's refusal, and no log line carries an id that ties it to a command), so refusals logged after the command ended (plus a quarter second) are left out, and the prompt says the connections were blocked while a command was running.
  • The exec tool settles denials through the gate (PermissionGate.authorize_runtime, asked from inside the tool body; a person deciding stops the tool's deadline): a target a deny rule names is refused; ask asks you (a sandbox.network card on the web, the usual approval prompt in the TUI and IM, a fetch permission request over ACP); smart lets a network-specific reviewer open what the command plainly needs; full opens it for the session (decision D3). The mode is held no looser than one a plugin gate over the call declares as permission_mode (raven-oncall's gate declares the owner's), and, for the main sandbox every conversation shares, than the configured permissions.mode, so one conversation's own looser mode does not open it for the others. With nobody to ask it stays blocked, the result says so and -m exits 3. Allow once opens it in that sandbox until it stops (D1), allow for this session in every sandbox of the conversation until Raven restarts; the main sandbox is shared by every conversation, which every prompt says, the TUI, IM and ACP ones included (D2). The model is told to run the command again, or, when the refused sandbox did not load the approval, that it may still be blocked; nothing is re-run for it.
  • A prompt line never shortens the address, only the program path the sandboxed command chose, so every surface shows what Allow opens; an address longer than any host name is not asked about and stays blocked, and the evidence caps program and reason so the web card always lists the targets.
  • An address given as an IP, or an internal name such as localhost or metadata.google.internal (anything not shaped like a public DNS name), is never opened by the mode or the reviewer, also when a Raven host runs the product as an ACP agent: the request carries raven.needsPerson in _meta, and the host's auto-approver refuses it. One prompt covers at most ten targets. Agents of one conversation that hit the same target share one prompt; a refusal or a session grant is shared, an allow-once for another agent's sandbox is asked again.
  • A deny rule wins over an allow rule for the same target, and over a session grant in the conversation's other sandboxes: a grant it refuses is left out of the compiled policy, and an allow rule loses the ports a deny rule takes from all of its hosts and programs. An allow rule a deny rule covers only in part (a wildcard host, or any program where the deny rule names one) stays whole and is warned about once. Under the open default, a deny rule for one of the built-in two-label names takes the ports it lists from that name, for every program, and the whole name when it lists none.
  • A sandboxed stdio MCP server's refusals during a tool call are settled the same way, and named as "a process in the sandbox", since the log does not say which process made a connection. A failed call waits up to one second for a refusal to reach the log, since a long-lived process has no relay close to wait for (measured: readable 0.04 to 0.51 s after the call).
  • In a sandbox whose network is closed, OpenShell's own reviewed proposal is approved (ApproveDraftChunk) when it opens exactly the grant and nothing else; otherwise Raven merges its own narrow rule.
  • Raven's own agents (Raven-Code and the rest) run under the host's permission set (they used to get only its refusals) and in the host's OpenShell sandbox where the platform supports it. A launcher keeps a mode its hosting pins: Raven-Code runs a one-shot turn at full and asks over ACP, and raven-oncall keeps its trunk gate at full because its own gate applies the owner's mode, which that gate declares for run-time asks.
  • The design engine's renderer always runs offline; its render.allowNetwork and render.networkAllowlist are retired (decision D11). Its render jobs run on the host's tools.sandbox.gateway, which the plugin service locator lends every factory as sandbox_gateway. It reads the browsers under its worker image's /ms-playwright, a read-only path OpenShellExecutor(read_only_paths=...) adds beside the system paths: without it the worker found no Chromium there and could not run one.

Decided, and left for the owner

  • No "always allow" on the network card. The web card offers one broader answer, a saved rule's undo removes exec patterns only, and the TUI's always row opens an exec-pattern editor. The backend path (allow_network_rule, one rule per target with its program) is in place; a permanent rule is added in permissions.network meanwhile.
  • A deny rule cannot block a host of three or more labels under the open default (feat(sandbox): enforce a network deny rule on a host the open default covers #1277): measured, the gateway refuses an L7 deny endpoint that overlaps the **.*.* rule (endpoint ambiguity: tls=0 vs 1). It still stops Raven from opening the host, and Raven warns once per such rule. A hard block needs default: closed.
  • What a person opened directly in the refused sandbox, once or for the session, stays there until that sandbox stops, also after a deny rule for it is added (for the main sandbox, until Raven restarts); the docs say so. Closing it would route a session grant to the refused sandbox through its policy source, with OpenShell's proposal approval then used for allow-once only.
  • Filesystem refusals are not reported (feat(sandbox): report the path a sandboxed command was refused #1278): measured, Landlock refuses a write in the kernel and the gateway logs nothing; the command's own error names the path.
  • The onboarding hint about the gateway's push delivery is dropped: GetGatewayConfig does not report the delivery mode. The docs explain OPENSHELL_CONFIG_DELIVERY_MODE=push (an approval then applies in 0.3 s instead of about 9 s).
  • A sandboxed external agent's permission requests still go through the auto-approver (decision D12's second half). Routing them to the owning turn's gate needs a per-session route like the elicitation one, and is left for a follow-up (feat(acp_client): settle a sandboxed agent's permission requests through the gate #1279).
  • Comments in the spawn and DAG modules still say "VM"; they go through a separate owner review.
  • A sandboxed MCP server's resource reads and prompt fetches do not sync the network policy first; its tool calls do.
  • In-process sub-agents build their tool registry without the plugin tool gates, so under raven-oncall their calls and run-time asks follow the trunk's full. This predates the network work.

Type

  • Fix
  • Feature
  • Docs
  • CI / tooling
  • Refactor
  • Other

Verification

At the current revision, after rebasing onto the latest main:

  • The following focused suite passed with 1222 passed, 1 skipped, with the strict idle ceiling enabled. The skip is the existing POSIX directory-permission test, which cannot enforce directory permissions when run as root.
uv run --no-sync pytest --idle-ceiling-strict \
  tests/test_config_live.py tests/test_playbook_mcp.py \
  tests/test_sandbox_openshell_executor.py tests/test_sandbox_network_policy.py \
  tests/test_sandbox_denials.py tests/test_sandbox_mounts.py \
  tests/test_permissions_sandbox_network.py tests/test_permissions_network_grants.py \
  tests/test_permissions_gate.py tests/test_mcp_client.py \
  tests/test_config_loader.py tests/test_config_schema.py \
  tests/test_shell_approval.py tests/test_contracts_two_tier_ledger.py \
  tests/test_kernel_budget.py tests/test_import_cycle_budget.py -q -x
  • Before the fixes, the new regression selection produced 8 failed, 1 passed: six cases cover permission, directory and generic OS read errors on the first read and after a valid policy; two cover closing the default and revoking an allowed host during Playbook preflight. The passing control removes a previously valid config file and checks that a genuinely absent file still uses the default. The same selection passed 9 tests after the fixes. The tests also cover recovery after reads resume and restoring a Playbook's network rules. The Playbook reader then moved onto the live reader the other sandboxes use: its new regression test failed 2 of 4 cases before the change (a torn or invalid read after a valid one dropped the Playbook sandbox's rules) and passed 4 of 4 after; the two first-read cases are passing controls that close the network.
  • env UV_NO_SYNC=1 make lint-python lint-imports lint-deps lint-types check-large-files check-source-language: exit 0; all 10 import contracts kept.
  • env UV_NO_SYNC=1 make check-commits: exit 0.
  • Full Python suite (uv run --frozen --python 3.12 --all-extras pytest -q -n 4): 40409 passed, 266 skipped, 2 xfailed, 8 failed. The eight were also reported failing without this branch on the same machine: five proxy-environment cases in tests/test_config_update_providers.py, the Node directory resolver case in tests/test_install_script.py, the legacy workbook case in tests/test_knowledge_parser_excel.py, and the unreadable-path case in tests/test_subagent_node_runtime.py when run as root.
  • git diff --check: exit 0. Each fix has its own commit, and so does the docstring reflow; the rebase preserved every earlier patch unchanged.

Earlier verification reported for this PR, not repeated for these fixes:

  • RAVEN_OPENSHELL_IT=1 pytest tests/integration/test_openshell_sandbox_real_gateway.py against OpenShell 0.1.8 on Ubuntu 24.04, kernel 6.8 and Docker 29: 14 passed with poll delivery and 14 passed with push delivery. This covered changing a running sandbox's network policy, narrowing the open set, denial reporting, grants, and approving OpenShell's own proposal. No real-gateway integration run was performed in the current fix round.

  • Docs strict build passed. The earlier frontend runs reported 4955 source tests and 314 gate tests in ui-web, and an up-to-date TUI i18n generator. These fixes change no frontend source.

  • Relevant tests pass locally

  • Relevant lint / type checks pass locally

  • User-facing docs or screenshots are updated when needed

Risk

  • Anyone on boxlite: the first load rewrites the config to "openshell", and the sandbox refuses to start until the OpenShell SDK and a gateway are installed. There is no fallback to running on the host. It needs Linux 6.2+ with Landlock ABI 3 and Docker 28+, or macOS with Docker Desktop or colima; Windows is not supported, and a Raven inside WSL 2 is a Linux host that can use it.

  • The default egress is narrower than boxlite's, which was fully open: a two-label domain outside the built-in list (for example example.com) is blocked until a rule or an approval opens it.

  • The writable filesystem is narrower than the boxlite VM's: only /tmp and the mounted volumes are writable. File-heavy work runs several times slower than on the host, because opening a file in an OpenShell sandbox costs about ten times what it does in a plain container.

  • On a root host the agent's sandbox cannot start: OpenShell refuses a root workload, so the sandbox runs as the image's user and cannot write a root-owned workspace.

  • Approving a blocked connection changes a running sandbox's policy. What is opened in the main sandbox reaches every conversation until Raven restarts, as the prompt says; in full mode a blocked public host is opened for the session without asking (decision D3), and stays open if the conversation is later switched back to ask. In the main sandbox that happens only when permissions.mode itself is full; a conversation switched to full on its own is asked there.

  • A refusal's time comes from the sandbox's clock and the window it is matched to from the host's. They are one clock on Linux; on macOS the Docker VM's clock must stay within a quarter second of the host's, or a command's own refusals can fall outside the window.

  • While the gateway cannot load a network change that removes or narrows a rule, sandboxed commands, process starts and MCP tool calls are refused with a message saying so (exit 1 for a command), and run again once it loads; a change that only adds rules never holds a command back.

  • A failed MCP call waits one second for a refusal; one held back longer (seen up to 1.85 s under heavy sandbox churn) is missed, and the call's own error stands without the policy note.

  • Raven's own agents now run with the owner's allow and ask rules, not only the refusals, and in an OpenShell sandbox when the host uses one. They take the owner's mode unless their hosting pins one (Raven-Code: full for a one-shot turn, ask over ACP).

  • CONTRACTS_VERSION 44: a plugin that implements ApprovalResponder must accept the needs_person keyword; the in-tree responders do.

  • A permissions.network rule with a wildcard inside a label (api*.example.com) fails validation at load. Such a rule never matched a refused host, and OpenShell does not activate a sandbox on that pattern.

  • raven sandbox is gone; scripts that called it need openshell sandbox ....

  • Rollback: revert the squash commit, then set tools.sandbox.backend back to "none" or "boxlite" by hand, and put an allowNet back if one was moved: an older build fails to load a config that says "openshell", and does not read permissions.network.

  • Security impact considered

  • Backward compatibility considered

  • Rollback path is clear for risky changes

Related Issues

Follow-ups, not closed by this PR: #1277, #1278, #1279

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers; this can merge as far as I am concerned.

I reviewed the full github/main...HEAD comparison and the PR OpenShell commits, then traced the executor factory and lifecycle, policy construction, mount/path translation, command and stdio MCP execution, main-agent/subagent/playbook/design-engine callers, config migration, onboarding, upgrade preservation, CLI removals, and compatibility behavior. I also checked AGENTS.md/CLAUDE.md and CONTEXT-MAP.md/CONTEXT.md, relevant history, and the test changes for weakened coverage; I found no plain error or blocker.

Verification: every GitHub check is green, including all four unit shards, coverage, Python lint, repository checks, docs, TUI, RPC, and Windows jobs. Locally, the filesystem had no space under /tmp, so a native uv run environment could not be created. Using an existing Raven environment with this checkout sources first on PYTHONPATH, the focused sandbox/config/onboarding/design/upgrade run printed 1036 passed, 14 skipped; the skips were OpenShell-SDK-dependent, and I interrupted only after that summary because borrowed-environment xdist workers did not exit. A metadata-dependent install-hint assertion was excluded from that rerun because the borrowed environment has base-revision installed package metadata rather than this revision requirement metadata.

@LivXue

LivXue commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Windows review — draft "feat(*): run sandboxed commands in OpenShell and retire boxlite"

Scope: head a0aac862f58e9fd8af20a5c78dd841271d6dc078 vs base 455faf9509210c67802ff4247f1c8e385316f781 (96 files). Reviewed on native Windows 11 (CPython 3.12, uv) in a detached worktree at this head, against the repo's own dev environment. No OpenShell gateway was available (none exists for Windows), so the sandbox lifecycle was read, not driven end to end.

MEDIUM — POSIX-only process identity in the new executor: 22 tests fail, and the failure text points at a Linux kernel

raven/sandbox/openshell_executor.py:303 calls os.getuid()/os.getgid() unconditionally in _start_locked; :187 (_owner_digest) calls os.getuid(); :190-197 (_pid_alive) probes liveness with os.kill(pid, 0).

On Windows:

  • pytest tests/test_sandbox_openshell_executor.py -q → 22 failed, 15 passed, 9 skipped in 9.17s. All 22 trace to module 'os' has no attribute 'getuid' — 18 surface it as SandboxInitError: Cannot create an OpenShell sandbox: module 'os' has no attribute 'getuid' (wrapped at :312), the other 4 are assertion mismatches whose chained cause is the same AttributeError.
  • The SandboxInitError text carries remediation a Windows user cannot act on: "The host needs Linux 6.2+ (Landlock ABI 3) and Docker 28+, with the gateway allowing bind mounts".
  • _reap_orphans hits the same call through _owner_digest() and only logs at :381: Could not list OpenShell sandboxes for cleanup: module 'os' has no attribute 'getuid' — orphan reaping silently never runs on Windows.
  • _pid_alive is unreachable on Windows only because _owner_digest() raises first. If the uid lookup is naively defaulted (e.g. getattr(os, "getuid", lambda: 0)()), reaping proceeds, and os.kill(pid, 0) on Windows calls TerminateProcess: probing a live Raven pid would kill that process.

Remedy: refuse the backend explicitly and early on Windows (a SandboxInitError stating OpenShell sandboxing is unsupported on this platform, before any lifecycle work), or make the executor platform-clean — guard uid/gid and replace the liveness probe with a Windows-safe one (OpenProcess + GetExitCodeProcess, or psutil) — and mark the executor test module skipif(sys.platform == "win32").

MEDIUM — the new cancellation test hangs on Windows instead of skipping

tests/test_design_engine_rendering_paths.py:189 (test_cancelling_a_sandboxed_job_stops_the_sandbox_and_removes_staging) replaces backend._executor (line 219) with a fake, but SandboxRenderBackend.run now checks importlib.util.find_spec("openshell") at plugins-dist/design-engine/raven_design/rendering/backend.py:93 and raises RenderError("renderer_unavailable") before the fake executor is consulted. openshell lives only in the sandbox extra and is marker-excluded on Windows (pyproject.toml:180), so started is never set and await started.wait() (line 231) waits forever.

Measured: the single test under a 150 s cap exited 124 with no pytest summary (hang); the same file without that test is 15 passed, 2 failed in 8.47s, and the two failures are symlink creation (WinError 1314 — needs Developer Mode or admin, unrelated). The product's clean RenderError is the right behavior on Windows; the test needs to match it, e.g. pytest.importorskip("openshell") or a bounded asyncio.wait_for(..., 5).

This is not Windows-only in kind: the test hangs wherever the SDK is absent, because the find_spec gate precedes the monkeypatched executor.

LOW — onboarding offers OpenShell on Windows and prints an install hint that cannot work there

raven/cli/onboard_commands.py:1820-1896 offers the "Sandbox isolation (OpenShell)" choice with no platform check. On Windows the probe returns missing, and sandbox_install_hint() (raven/sandbox/__init__.py:44-62) prints uv pip install --python '<win path>' 'openshell>=0.1.8,<0.2':

  • shlex.quote wraps the backslash-bearing interpreter path in POSIX single quotes, which cmd.exe passes through literally;
  • the spec drops the requirement's marker (requirement.split(";", 1)[0]), so it asks a Windows user to install a package that pyproject.toml:180 deliberately excludes on win32.

The only possible outcome is a repeated probe failure.

Remedy: hide or disable the choice on sys.platform == "win32" with an explicit unsupported-platform message; if Windows support is intended later, quote with the hosting shell's rules.

Verification (native Windows 11, CPython 3.12)

Command Result
pytest tests/test_sandbox_openshell_executor.py -q 22 failed, 15 passed, 9 skipped
pytest tests/test_design_engine_rendering_paths.py -q --deselect <cancellation test> 15 passed, 2 failed (WinError 1314)
pytest <cancellation test>, 150 s cap exit 124, no summary (hang)
pytest tests/test_sandbox_mounts.py -q 16 passed
pytest tests/test_sandbox_unit.py -q head 14 failed, 72 passed, 3 skipped; base 13 failed, 106 passed — the 13 failing IDs are identical at both ends
pytest tests/test_agent_loop_mcp_sync.py -q 56 passed
pytest tests/test_agent_loop_workdir.py / test_agents_code_flow_exec.py / test_config_update.py 1 / 9 / 4 failed — identical counts and IDs at base

The one head-only failure in test_sandbox_unit (TestSandboxInstallHint::test_targets_the_running_interpreter_with_the_pinned_spec) is a harness artifact: the shared venv's installed raven metadata still declares boxlite==0.9.5, so the hint cannot find the pinned OpenShell spec. Confirmed by reading importlib.metadata.requires("raven") from the venv.

Coverage gaps

The large CLI/RPC/serve suites touched by the diff were not run (each can exceed the run budget); two test files in the diff are deleted by the PR; no real OpenShell gateway was exercised; the UI is untouched.

@gloryfromca

Copy link
Copy Markdown
Member

Blocking: Windows onboarding and the missing-SDK test path must fail explicitly instead of offering an impossible install loop or hanging.

The new evidence makes my earlier clean stance stale. I reproduced tests/test_design_engine_rendering_paths.py::test_cancelling_a_sandboxed_job_stops_the_sandbox_and_removes_staging on Linux with the SDK absent; it produced no pytest result and the external 15-second cap exited 124. The find_spec("openshell") gate raises before the fake executor can set started, so the test waits forever exactly as reported.

For the executor itself, the public build_executor path normally stops at the missing-SDK import on Windows before reaching os.getuid, so I do not treat every direct-executor test failure as an independently reachable production failure. The ordinary onboarding path is reachable, though: it offers OpenShell on Windows, then prints a POSIX-quoted command for a dependency deliberately excluded by the Windows marker. That unsupported-platform path needs an explicit early refusal or hidden choice, and the executor/design tests need to skip or terminate deterministically when the platform or SDK is unsupported.

Focused verification: uv run --no-sync pytest -n 0 -q tests/test_design_engine_rendering_paths.py::test_cancelling_a_sandboxed_job_stops_the_sandbox_and_removes_staging under a Raven environment without OpenShell was externally capped at 15 seconds and exited 124 with no output.

@LivXue
LivXue force-pushed the feat/openshell_sandbox_backend branch from a0aac86 to da290a4 Compare November 12, 2026 07:34
@LivXue

LivXue commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Both blockers are fixed, and the missing-SDK case was not Windows-specific: the SDK probe sat in front of the monkeypatched executor, so on any host without the SDK the renderer's cancel case waited for a command that was never run.

The missing-SDK path fails explicitly (plugins-dist/design-engine/raven_design/rendering/backend.py). The renderer no longer probes for the SDK itself. It builds the executor, and the executor's own SandboxInitError ("The OpenShell SDK is not installed in this raven's environment...") becomes the renderer_unavailable error with that text. The cancel case now waits with a bound (asyncio.wait_for(started.wait(), 5)), so a gate in front of the executor fails the test instead of hanging it. Product behaviour is unchanged: the renderer still refuses to start without the SDK, with the same error code. Measured with the whole openshell package hidden from the import system, the design-engine rendering paths go from hanging (45 s cap, no pytest result) to 19 passed in 3.2 s.

Windows offers no sandbox choice and no impossible install command (raven/cli/onboard_commands.py, raven/sandbox/__init__.py). The wizard's OpenShell entry is hidden on win32 and the screen says why ("Sandbox isolation (OpenShell) needs Linux or macOS; commands on this host run directly"). The install hint keeps the requirement's platform condition and quotes for the host shell; on Windows it answers that the SDK is not published there instead of printing a command that cannot work. The extra == 'sandbox' clause is dropped from the command, because a direct install has no extra context and with that clause the requirement is unsatisfiable.

Also in this round, from my own review and from the earlier Windows review:

  • A root host now says why the sandbox user cannot write the workspace: OpenShell refuses a root workload, so the sandbox runs as the image's user. The design engine's 0777 workaround is deliberately not copied onto the user's real workspace.
  • The command's own budget is the deadline now. The local backstop no longer adds ten seconds to it (timeout=1 took 11.0 s before), the gateway's report of that budget arrives within a one second grace, and a stream that breaks is a failed command instead of an exception thrown at the caller. The integration test's bound is tightened to timeout + 3 s.
  • The host uid and gid are read where the platform has them, and the liveness probe is raven's own raven.utils.pid.pid_alive, which answers on Windows instead of terminating the process it asks about. The executor's test module skips on win32.
  • The orphan sweep is asked again after a gateway that could not list, instead of being switched off for the rest of the process.
  • build_executor(sandbox_dir=...), raven.config.paths.get_sandbox_dir and the owned_ids set are gone; the boxlite backend was their last reader.
  • The description now names the two narrowings (the writable filesystem, and the default egress), the root-host limit, and the single-replica-gateway limit, which the docs page also states: Raven sends its exec calls to the replica its client is bound to, so a replicated gateway cannot serve them.

The gateway is expected to be a single local replica; the failure advice now says so.

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers; this can merge as far as I am concerned.

The new commits resolve the prior blocker. I reproduced the formerly hanging missing-SDK cancellation case under a 20-second external cap; it and the explicit missing-SDK error test both passed. Windows onboarding now removes the unsupported OpenShell choice and returns platform-specific guidance, while the executor guards host identity and uses the shared cross-platform process-liveness helper.

I reviewed the full github/main...HEAD comparison using the earlier reviewed series plus range-diff and the six new commits. I covered AGENTS.md/CLAUDE.md and the context rules, the diff, factory and lifecycle callers, relevant history, backward compatibility, test changes for weakened coverage, and the OpenShell architecture constraints (single gateway replica, root-host behavior, deadlines, cleanup, mounts, and SDK/platform limits). I found no plain error.

Verification: the focused changed-file run was 815 passed, 13 skipped, 1 deselected. The skips require the unavailable OpenShell SDK. The deselected assertion reads installed Raven distribution metadata, which the borrowed environment does not contain; the initial run reached 757 passed and then failed only because it saw the documented no-metadata fallback. GitHub CI ran the real project environment and is fully green, including all four unit shards, coverage, Python lint, repository checks, docs, UI/RPC, and Windows jobs. No real OpenShell gateway was configured locally.

There are no review threads from me to resolve.

@LivXue

LivXue commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Windows review — head da290a43a4cb76a043ef2fb81bb2086bd4599cea

Scope: the delta since the reviewed head a0aac862: the branch rebased onto the new main tip 7c5c3a14 and adds six commits — 3c6dafc6f (drop the boxlite-era state plumbing), b2cc8014f (report sandbox failures with their cause and deadline), 554700217 (answer the Windows install question), 1c8e760d0 (no OpenShell choice on Windows), d4588caad (report a missing SDK instead of waiting), da290a43a (docs). git range-diff 455faf95..a0aac862 7c5c3a14..da290a43 shows the first nine commits patch-identical apart from docs wording, so this covers the new code.

The three findings from the previous review are fixed, and I re-measured each:

  • os.getuid()/os.getgid() are gone; _host_uid()/_host_gid() return None off-POSIX and sandbox_policy omits run_as_user, so no AttributeError on Windows (b2cc8014f).
  • The hand-rolled _pid_alive (os.kill(pid, 0), which terminates on Windows) is replaced by raven.utils.pid.pid_alive, whose Windows branch uses OpenProcess + a zero-timeout wait.
  • The executor test module is now skipped on win32: pytest tests/test_sandbox_openshell_executor.py -q → 52 skipped, so the 22 getuid failures are gone.
  • The install hint returns "The OpenShell SDK is not published for Windows…" and _step2_sandbox offers no OpenShell choice there, with a new passing test (test_windows_is_offered_no_sandbox_choice); the zh translation is added.
  • The design-engine gate is gone: the fake executor is reached again, await asyncio.wait_for(started.wait(), 5) bounds the cancellation test, SandboxInitError maps to RenderError("renderer_unavailable") with the cause text, and os.getuid() is getattr-guarded. Measured: the file is 17 passed, 2 failed, the two failures being the inherited symlink privilege WinError 1314 cases.

LOW — six tests assert the non-Windows branch without pinning the platform, so a Windows run is red

The new platform-dependent helpers are correct, but their tests call them on the host platform. Measured at this head (failures that do not exist at base 7c5c3a14):

  • tests/test_sandbox_unit.py:232 test_backend_openshell_without_the_sdk_raises_with_install_advice — asserts "uv pip install --python" in message; actual message: No sandbox backend available: … The OpenShell SDK is not published for Windows, so the OpenShell sandbox backend needs Linux or macOS.
  • tests/test_sandbox_unit.py:255 test_targets_the_running_interpreter_with_the_pinned_spec — same assertion, same actual hint.
  • tests/test_sandbox_unit.py:270 test_falls_back_to_the_bare_name_without_installed_metadata — expects the hint to end with " openshell".
  • tests/test_sandbox_unit.py:285 test_the_requirement_keeps_the_platform_marker — asserts 'sys_platform != "win32"' in hint.
  • tests/test_cli_onboard_commands.py:1401 test_sandbox_missing_sdk_advises_the_running_environment — asserts "uv pip install --python" in out; the captured screen carries the Windows message.
  • tests/test_cli_onboard_commands.py:1485 test_sandbox_keep_current_first_option — asserts "keep" in choices; actual ['none', <Back sentinel>] because the choice is hidden on win32.

Remedy: pin the platform for the POSIX-branch assertions the way the new win32 tests do in reverse — monkeypatch.setattr(raven.sandbox.sys, "platform", "linux"), monkeypatch.setattr(onboard_commands.sys, "platform", "linux"), and the same for the plain sys in test_sandbox_unit — or mark those tests skipif(sys.platform == "win32").

LOW — non-interactive onboarding still reports a sandbox on Windows

raven/cli/onboard_commands.py:1826-1828: the skip or non_interactive branch still prints Keeping run location: Sandbox (OpenShell). when the config names that backend — the interactive choice is hidden on Windows but this branch is not guarded. The backend now fails explicitly when built, so the impact is a misleading line, not a wrong run. Remedy: apply the same platform check here (or print the unsupported-platform note).

Verification (native Windows 11 10.0.26300, python 3.12.13; detached worktrees D:\tmp\rv-1269n at this head and D:\tmp\rv-base7 at base 7c5c3a14):

Command Head Base
pytest tests/test_sandbox_openshell_executor.py -q 52 skipped —
pytest tests/test_design_engine_rendering_paths.py -q 17 passed, 2 failed (WinError 1314) —
pytest tests/test_sandbox_unit.py -q 17 failed, 69 passed, 2 skipped 13 failed, 106 passed — same 13 IDs; the 4 head-only are above
pytest tests/test_cli_onboard_commands.py -q 5 failed, 369 passed, 2 skipped 3 failed, 367 passed — same 3 IDs; the 2 head-only are above
pytest tests/test_agent_loop_workdir.py tests/test_subagent_manager.py -q 12 failed, 282 passed 12 failed, 281 passed — identical IDs
pytest tests/test_config_update.py -q 4 failed, 142 passed 4 failed, 141 passed — identical IDs
pytest tests/test_sandbox_mounts.py -q 16 passed —

Coverage gaps: no OpenShell gateway exists on this host, so the Linux/macOS executor paths were code-read (and are skipped by the suite on win32); the full suite was not run; no live onboarding session beyond the tests.

@LivXue
LivXue force-pushed the feat/openshell_sandbox_backend branch from da290a4 to 86606eb Compare November 12, 2026 16:52
@LivXue LivXue changed the title feat(*): run sandboxed commands in OpenShell and retire boxlite feat(*): move the sandbox to OpenShell and put its network under permissions Nov 12, 2026

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers; this can merge as far as I am concerned.

I reviewed the full authored range and the final one-commit delta that arrived during this review. Coverage included AGENTS.md and the relevant context rules, the diff, sandbox-network callers and history, backward compatibility and config migration, whether tests were weakened, and the runtime-approval architecture.

The final delta makes the fake control plane match the real gateway contract by returning the relay-close event after a command. It removes the strict-idle regression without skipping, exempting, or loosening a test. Locally, the two formerly slow executor tests pass under --idle-ceiling-strict in 1.07s; the focused executor, denial, and network-policy set passes 152 tests with 16 skips because the OpenShell SDK is unavailable. Current GitHub checks are passing or still running, with no failures at this head. No real OpenShell gateway was available for an end-to-end run.

@LivXue

LivXue commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Windows review — draft "move the sandbox to OpenShell and put its network under permissions", head 37ccdc86fb3bd1bee1c5d76d3d47d5984067b777

Scope: since the last reviewed head da290a43 the branch was rebased onto ddcc9c168 and re-scoped to 132 files, +5494/−507 — the sandbox network-permission flow (runtime denials, grants, judge, approval surfaces) on top of the OpenShell move. This head adds one test-only commit (37ccdc86f, the fake gateway's relay-close line). This review covers the Windows-relevant slice — the executor build path, install hint and onboarding, the executor call sites, and the new permission/network modules plus their tests; the network-approval feature is platform-neutral and was not functionally reviewed end to end.

LOW — the Windows skip branch says commands will "run directly" but leaves the backend configured as OpenShell

raven/cli/onboard_commands.py:1826-1834: when skip/non_interactive runs on Windows over a config whose backend is not none, the branch prints "Sandbox isolation (OpenShell) needs Linux or macOS; commands on this host run directly." and returns without calling _persist_sandbox_backend, so tools.sandbox.backend stays openshell. Every executor construction then probes the SDK and raises: raven/agent/loop/main.py:624, raven/agent/subagent/manager.py:1780 and raven/playbook/mcp.py:208 call build_executor without catching SandboxInitError, and on Windows import openshell fails ("The OpenShell SDK is not published for Windows…"), so the loop fails to start rather than running directly. The scenario is reachable: the boxlite-era migration rewrites a config to openshell on disk, and this is exactly the config --skip keeps.

Remedy: persist none in that branch the way the interactive Host choice does, or keep the backend but say it cannot run and that the next start will fail until it is switched.

LOW — the new skip-path test fails on a Windows host because it asserts the POSIX message

tests/test_cli_onboard_commands.py:7096 test_step2_skip_path_reports_the_backend_it_actually_keeps monkeypatches _current_sandbox_backend to openshell, calls _step2_sandbox(skip=True), and asserts "Sandbox (OpenShell)" in out (line 7105). On Windows the branch above prints the platform note instead, so the assertion fails; the ID does not exist at the base. The test needs monkeypatch.setattr(onboard_commands.sys, "platform", "linux") (the pattern the install-hint tests now use), or a Windows-specific expectation.

The earlier install-hint test finding is addressed — those tests now pin sys.platform to linux. The one remaining hint failure here is the harness artifact reported before: TestSandboxInstallHint::test_targets_the_running_interpreter_with_the_pinned_spec fails at line 281 because the hint falls back to bare openshell; the shared venv's installed raven metadata still declares boxlite, so the pinned spec is not found. It passes in a checkout-built environment; not a code defect.

Verification (native Windows 11 10.0.26300, python 3.12.13; detached worktree D:\tmp\rv-1269r at this head):

  • pytest tests/test_sandbox_unit.py tests/test_sandbox_openshell_executor.py tests/test_sandbox_mounts.py tests/test_cli_onboard_commands.py -q → 18 failed, 460 passed, 95 skipped.
    • The same run at base ddcc9c168 (measured during the previous inspection, same harness) was 16 failed, 473 passed; 16 of the 18 are identical IDs: twelve TestDirectExecutor process-group/pipe/timeout cases, TestSandboxConfigValidators::test_extra_volumes_valid, and three test_cli_onboard_commands POSIX-mode/login-shell cases.
    • Head-only: test_step2_skip_path_reports_the_backend_it_actually_keeps (above) and the environment-artifact hint test.
    • tests/test_sandbox_mounts.py passes; the 95 skips include the whole OpenShell executor module (win32 skip) and POSIX-mode cases.
  • pytest tests/test_permissions_sandbox_network.py tests/test_permissions_network_grants.py -q → 56 passed.

Coverage gaps: no OpenShell gateway exists on this host, so executor and network-policy runtime behavior was read, not exercised; the UI/TUI approval surfaces were not run; the rest of the 132-file expansion was not reviewed for Windows beyond the files above.

@gloryfromca

Copy link
Copy Markdown
Member

No blockers; suggestions only, and they are marked inline.

I accept both Windows findings as concrete, and they change my stance from clean to nonblocking. The skip/non-interactive branch says commands run directly but leaves tools.sandbox.backend as openshell; the new test also needs its POSIX platform pinned or a Windows expectation.

This does not meet the late-round blocking bar. The product failure requires Windows, a pre-existing or migrated non-none backend, and skipped/non-interactive onboarding, so it is not ordinary reachability; an operator can recover by choosing Host in interactive onboarding or setting the backend to none. Please carry the Windows skip-path persistence/message mismatch and its platform-dependent test as the named follow-up.

Verification: the targeted test passes on Linux (1 passed in 4.40s). A simulated Windows skip run reproduced the mismatch: it printed that commands run directly while a persistence spy recorded no backend update. All current GitHub checks at this head are green.

@LivXue
LivXue force-pushed the feat/openshell_sandbox_backend branch from 37ccdc8 to dfba665 Compare November 13, 2026 08:05
@LivXue
LivXue marked this pull request as ready for review November 13, 2026 08:05
@LivXue
LivXue requested review from 0xKT and gloryfromca November 13, 2026 08:06

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers; suggestions only, and they are marked inline.

I reviewed the seven genuinely new sandbox commits after separating the rebase with git range-diff. I covered the repository rules and context terms, the new diff and its callers/history, compatibility with the newer main base, the migration and runtime approval paths, whether tests were weakened, and the sandbox-network architecture.

The new policy comparison, renderer read-only path, shorter MCP refusal wait, deny precedence, failed-grant feedback, shared-sandbox prompt note, and bounded denial window are consistent with their callers and tests. Focused verification completed with 191 passed and 16 skipped because the OpenShell SDK is unavailable. Current GitHub checks are passing or still running, with no failures reported at this head.

The existing named follow-up remains: on Windows, skipped/non-interactive onboarding can say commands run directly while retaining an openshell backend, and its POSIX-assuming test is not platform-pinned. That narrow, recoverable path remains nonblocking under the late-round bar; this revision can merge as it stands.

@LivXue
LivXue force-pushed the feat/openshell_sandbox_backend branch from dfba665 to e557cb5 Compare November 13, 2026 08:54

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers; this can merge as far as I am concerned.

I reviewed the one genuinely new commit after separating the rebase with git range-diff. I covered the repository rules, the delta and onboarding callers, compatibility with the rebased main, the existing Windows recovery behavior, and whether the tests were weakened.

The prior named follow-up is closed: skipped or non-interactive Windows onboarding now truthfully says the retained OpenShell backend cannot run commands on that host and gives both supported recovery paths, while the POSIX assertion explicitly pins Linux and two Windows cases cover skip and non-interactive modes. Focused verification: 4 passed, 377 deselected.

One GitHub unit shard is red only because the uv setup action timed out fetching its version manifest; it failed before dependency installation or test execution. Other checks are passing or still running, and this is not a code failure.

@LivXue

LivXue commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Windows review — "move the sandbox to OpenShell and put its network under permissions", head e557cb594ac5ffbe1f143c3a1bd740f7323555ad

Scope: the PR is now ready for review at 132 files, +8271/−8995 against current main 978cca85; 69 commits have landed since the last reviewed head 37ccdc86, mostly the runtime network-denial and grant flow (denial parsing, policy compilation, per-scope grants, approval surfaces, MCP refusals, config migration). This review re-verifies the Windows-facing slice — onboarding, the install hint, the executor build path, and the new policy/denial modules — and records the regression comparison; the network-approval feature itself is platform-neutral and was exercised through its unit suites, not end to end.

The two findings from the previous review are fixed.

  • e557cb594 rewrites the Windows skip/non-interactive branch (raven/cli/onboard_commands.py:1839-1849): it no longer claims commands "run directly", no longer warns about host privileges, says plainly that commands cannot run on this host yet, tells the reader to choose Host (direct) or set tools.sandbox.backend to none, and persists nothing — the new parametrized test asserts the wording, the absence of the old claims, and persisted == [].
  • test_step2_skip_path_reports_the_backend_it_actually_keeps now pins sys.platform to linux, and 813f8743f pinned the install-hint tests the same way, so the POSIX branches no longer run on a Windows host.

The one remaining head-only failure is the harness artifact reported before: TestSandboxInstallHint::test_targets_the_running_interpreter_with_the_pinned_spec falls back to bare openshell because the shared venv's installed raven metadata still declares boxlite; it passes in a checkout-built environment.

Windows checks of the new code: no new unguarded POSIX surface. _host_uid/_host_gid keep the getattr(os, "getuid", None) guard, the design-engine root branch keeps its getattr guard, and the onboarding/config paths keep their sys.platform checks; the new network_policy, denials, sandbox_network and network_grants modules are in-memory policy logic. The real-gateway integration test is gated by RAVEN_OPENSHELL_IT, so its POSIX-only helpers do not run here.

Verification (native Windows 11 10.0.26300, python 3.12.13; detached worktrees D:\tmp\rv-1269s at this head and D:\tmp\rv-b1269s at main 978cca85):

  • pytest tests/test_sandbox_unit.py tests/test_sandbox_openshell_executor.py tests/test_sandbox_mounts.py tests/test_cli_onboard_commands.py tests/test_permissions_sandbox_network.py tests/test_permissions_network_grants.py -q → 17 failed, 526 passed, 99 skipped.
  • The same run on the two files that exist at main (test_sandbox_unit.py, test_cli_onboard_commands.py) → 16 failed, 475 passed; those 16 IDs are identical at both ends (twelve TestDirectExecutor process-group/pipe/timeout cases, extra_volumes, three POSIX-mode/login-shell onboard cases). The head-only failure is the metadata artifact above; the new Windows onboarding test, the mounts suite and both permission suites pass, and the OpenShell executor module skips on win32 by design.

Coverage gaps: no OpenShell gateway exists on this host, so the executor and the real-gateway test were not driven; the approval surfaces (web/TUI) were not run; the rest of the 132-file expansion was reviewed for Windows only along the files above.

Comment thread raven/config/live.py Resolved
Comment thread raven/permissions/sandbox_network.py Resolved
@0xKT

0xKT commented Nov 13, 2026

Copy link
Copy Markdown
Member

Not a blocker -- two verified gaps worth a decision before merge.

Severity of this one finding, not a verdict on the pull request. Any blocking findings from this pass are review threads on the changed files; GitHub renders those collapsed, as a file name with no text.

  1. Raven-Code's shell still runs on the host. agents/raven-code/run.py writes plugins.config.code-flow.tools.exec.sandboxBackend from the product's own source config ('none') before product_render.inherit_host_permissions copies the host's openshell backend into the rendered config, and code-flow's make_exec decides on that slice alone. Probe on e557cb5 with a host config of openshell + network.default: closed: the loaded config says tools.sandbox.backend = openshell and permissions.network.default = closed, the loop builds an OpenShellExecutor, but the exec tool is code_flow CodeExecTool with a host CodeExecutor. The product ran on the host at base too, so nothing new is exposed, but the CHANGELOG line "Raven's own agents (Raven-Code and the rest) run ... in the host's OpenShell sandbox where the platform supports it" and the rendered config now say the opposite. Either compute the slice after the inheritance or drop the claim.

  2. A narrowing network change that does not load still lets the command run under the old policy. OpenShellExecutor.exec ignores the result of _sync_network; when the merge RPC errors, the policy status cannot be read, or the sandbox has not loaded the new version in time, _applied_policies keeps the old rules and the command runs with an empty stderr. Probe on the repo's fake gateway: sandbox created with allow example.com:443, the source switched to a deny for example.com, then exec('curl https://example.com'). For merge_rpc_error, status_unreadable and policy_not_loaded the old rule stays applied and the command runs (exit 0, stderr ''); the no-failure control removes it. Harmless for a change that opens something; for one that removes or denies, returning an error instead of running would keep a refusal a refusal.

@LivXue
LivXue force-pushed the feat/openshell_sandbox_backend branch from e557cb5 to 268251b Compare November 14, 2026 08:44
@LivXue

LivXue commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

On the two gaps in #1269 (comment): both are fixed in this push rather than deferred.

  1. Raven-Code's shell (5f5e4c4). product_render.inherited_sandbox(host) now answers which sandbox a product takes from the host: its OpenShell backend, gateway and image, on a platform that runs one, with a retired backend name counted the way the loader counts it. inherit_host_permissions uses it, and the Raven-Code launcher renders plugins.config.code-flow.tools.exec.sandboxBackend from the same answer, so make_exec returns None and the host's exec runs in the product's OpenShell sandbox; the CHANGELOG line now holds. test_the_shell_slice_names_the_sandbox_the_rendered_config_runs_in checks that the rendered config and the slice agree (openshell on linux, none on win32; the linux case was red at e557cb5). The launcher reaches the helper through getattr, so a raven without it keeps the product's own backend.

  2. A narrowing change that does not load (46373c2). A failed sync now says whether what did not load takes something away: a rule removed or changed, or a source that cannot be read. Then exec does not run the command and returns exit 1 with a stderr that says why; a change that only adds rules still runs the command under the narrower policy in force, so a gateway blip does not fail a command that only needed something opened. Tests on the fake plane cover a merge error and a policy that does not load, each for a removed and a changed rule, an unreadable source, and the opening control. A status that cannot be read comes out of wait_policy as an error or no load, the same path.

@LivXue
LivXue requested a review from 0xKT November 14, 2026 08:44

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers; this can merge as far as I am concerned.

Reviewed the five-commit delta from the previously reviewed equivalent head through 268251bbf1a3, including the two blocker fixes, Raven-Code sandbox inheritance, and fail-safe policy narrowing. I checked the repository rules and domain context, the changed code and callers, commit history/range-diff, backward-compatible launcher fallback, the OpenShell policy architecture, and the new tests for weakening or false-green coverage. Both original reproductions are closed by the implementation, and I found no new plain error.

Verification: PYTHONPATH=plugins-dist/everos-memory:plugins-dist/everos-cloud-memory:plugins-dist/design-engine:plugins-dist/ppt-engine uv run pytest -o addopts="" tests/test_config_live.py tests/test_permissions_sandbox_network.py tests/test_sandbox_openshell_executor.py tests/test_agents_code_launcher.py tests/test_config_product_render.py -q -> 549 passed, 18 skipped. The initial run without those source paths failed during autouse setup because optional plugin modules were unavailable; it did not execute the selected tests.

The two remaining open blocker threads were opened by @0xKT, so I acknowledged the verified fixes but did not resolve them.

…CP tool runs

The policy was synced only before exec, so a sandbox whose traffic came
from a stdio MCP server kept an older, wider policy after the user narrowed
permissions.network. start_process and every sandboxed MCP tool call now
sync first through ready_network, and neither runs while a change that takes
something away has not loaded.
…from allowNet

A wildcard inside a label (api*.example.com) passed validation but never
matched a refused host, so a deny rule naming one refused nothing, and
OpenShell stops a sandbox from activating on such a pattern. A wildcard now
stands for whole labels. The allowNet migration copied old entries
verbatim, and forms the old field took (host:port, an address range, a
two-label wildcard) made the migrated config fail validation at startup. A
host:port entry now becomes a rule for that port, and any other entry no
rule can hold is left out and named in the notice, which only narrows a
closed list.
Under the open default, any deny rule for one of the apex names removed that
name on every port and for every program, so blocking ssh to github.com on
port 22 also refused an https clone, while refusing_rule honoured the ports
and asked about it. A deny rule now takes the ports it lists from the name,
and the whole name only when it lists none. The open set names no program,
so another program refused one of those ports is asked about.
SandboxRenderBackend built its executor without a gateway, so render jobs
went to the CLI's active gateway whatever tools.sandbox.gateway named. The
service locator now lends the host's sandbox gateway to every plugin
factory, since whichever builds first may build what a plugin's tools
share, and the design engine passes it down to the render executor.
Every executor builds an SDK client, which holds a gRPC channel and any
OIDC refresher, and none was ever closed, so sub-agents, DAG nodes and
render jobs leaked sockets until garbage collection. stop() now closes a
client the executor built once its sandbox is deleted, and a restart builds
a fresh one; a control plane handed in stays its caller's.
…helper

supports_network_grants and DraftChunk.binary had no reader, and the
permissions package defined the same tail-shortening helper twice; judge
now owns it and sandbox_network imports it.
Comments cited a decision label that exists only in a pull request
description, and an upstream issue number; they now state the reason
itself.
Two tests assert that a warning is logged once but did not reset the
module-level set that remembers it, so a worker that had logged it earlier
would fail them.
… on it

A failed start queued the sandbox's delete, and a caller that then ran
stop(), as the design renderer does, closed the client the executor had
built before that delete ran. A sandbox the gateway had made then stayed
up until the process exited: its pid label names a live process, and the
orphan sweep runs once per process. The same close could cut off the
orphan sweep's own deletes, queued on that client by the first start,
and a start that failed inside `async with` never closed the client at
all. Each plane now counts the deletes running on it; stop() and a
failed start release a plane the executor built, and it closes when its
last delete ends.
needs_person is public in raven.acp_client.permissions, as host_refusal
is, but was missing from the module's __all__.
Treat only FileNotFoundError as missing preferences. Keep the last
readable config across other OS errors so a first failed read closes
sandbox networking and an existing policy keeps its rules.

Cover permission, directory and generic read failures, recovery, and
the distinct behavior of a genuinely missing file.
Pass the disk reader to the policy source instead of capturing the
network permissions when preflight starts.

Cover closing the default and replacing an allow rule with a deny rule
during a running preflight, including later recovery.
@LivXue
LivXue force-pushed the feat/openshell_sandbox_backend branch from 1bb0347 to c522af8 Compare November 16, 2026 02:51

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers; this can merge as far as I am concerned.

Reviewed github/main...HEAD and the effective delta from 1bb03476593a, including repository rules and runtime terminology, range-diff/history, changed code and callers, backward compatibility, test integrity, and the live-config/OpenShell policy-source architecture. The rebase preserves the previously reviewed patches; the two new fixes correctly retain a last valid network policy across read errors, fail closed when no policy was ever readable, and let a running playbook MCP sandbox narrow and recover its policy before later commands. I found no plain error worth raising.

Verification: the focused config, playbook, grant, and OpenShell suites passed with 279 passed, 16 skipped. After the repository source-language command recreated the Python 3.12 environment, the directly changed config and playbook suites passed again with 170 passed. git diff github/main...HEAD --check and scripts/check_source_language.py github/main...HEAD passed. (make is not installed in this worktree environment, so I ran the Makefile target's underlying uv command directly.)

…missions

Read the playbook sandbox's network permissions through a LiveConfig held
for the preflight, the reader the main loop and subagents already use. A
torn or invalid read now keeps the last valid set, where it used to close
the network and reopen it on the next read: two policy reloads, with a tool
call in between run without network. A config that has never validated
still closes the network, and a missing one still answers the open default.

Remove network_on_disk, which has no other caller. The live reader's tests
already cover each of its cases.

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers; this can merge as far as I am concerned.

Reviewed github/main...HEAD and the effective delta from c522af8167fe, covering the repository rules and runtime terminology, diff and history, callers, backward compatibility, test integrity, and the live-config/OpenShell policy-source architecture. The per-preflight LiveConfig is retained by the policy closure and correctly keeps the last valid network permissions across torn, invalid, and OS-error reads, while a first invalid read still closes and a genuinely missing file still uses the open default. Removing the PR-internal network_on_disk helper leaves no caller; its cases remain covered by the live-reader tests and the new playbook-level tests, so the deletion does not weaken coverage.

Verification: uv run pytest -o addopts='' tests/test_config_live.py tests/test_playbook_mcp.py tests/test_permissions_network_grants.py tests/test_sandbox_openshell_executor.py -q with the repository plugin sources on PYTHONPATH -> 279 passed, 16 skipped. git diff github/main...HEAD --check and scripts/check_source_language.py github/main...HEAD passed. No unresolved review thread opened by me remains.

@0xKT
0xKT merged commit ffebe27 into main Nov 16, 2026
24 checks passed
@0xKT
0xKT deleted the feat/openshell_sandbox_backend branch November 16, 2026 03:43
joei4cm added a commit to joei4cm/Raven that referenced this pull request Nov 16, 2026
The mounted-root path translator rewrites a host root only when the
character after it ends the string or is a separator, so /srv/workshop
is never read as /srv/work. Nothing pins that boundary at its current
home: if it ever slipped, a sibling directory sharing a prefix would be
rewritten to the workspace mount and the command would run against the
wrong files inside the VM.

Three tests pin it, on both the POSIX and the Windows spelling of the
root. No production code changes; the translator moved from
BoxliteExecutor into MountTable with the OpenShell migration (EverMind-AI#1269),
and these tests moved with it.

Co-authored-by: Claude (claude-fable-5-1) <noreply@anthropic.com>
0xKT pushed a commit that referenced this pull request Nov 16, 2026
…1295)

## Summary

Skills reached the model two ways, picked by `skillForge.discovery`.
Push ran an LLM query rewriter and an LLM gate on every turn and
rendered the chosen bodies into a `# Skills` segment. Pull, the default,
puts a short name and description menu in the turn's user envelope and
lets the model call `find_skill` and `read_skill`. Both read the same
`SkillForgeRouter`. This PR removes push, so pull is the only path and
no turn spends a model call choosing skills.

Removed:

- `SkillsSegmentBuilder`, `QueryRewriter`, `LLMGateFilter`,
`resolve_refs`, and the router renderer and delivery note only that
segment used;
- the gate model pin: `skill_gate_pin`, its rows in the config tool's
settings surface, its `settings.set` checks, and the skill gate role on
the web settings page with its i18n strings;
- the push-only config fields `discovery`, `rewriteMaxTokens`,
`injectionMode`, `injectMax`, six of the seven `llmGate*` fields, and
`router.topK` (`llmGateEnabled` and `rewriteEnabled` stay declared but
unread, see below);
- `scripts/skill_forge_full_e2e.py`, and the segment stage of two other
scripts.

Config compatibility: `SkillForgeConfig` forbids unknown keys, so
migration 18 drops those keys from older files, in both spellings,
including `topK` in a legacy top-level `skillRouter` block (that block
is nested into `skillForge.router` in memory only, after the migrations
run). A config that set `discovery: "push"` gets a notice that skills
now arrive as a menu. The strip also runs on every later load, so a
rollback that writes the keys back still loads. Two of the keys stay
declared on `SkillForgeConfig`, read by nothing and excluded from every
dump: `llmGateEnabled` and `rewriteEnabled`. Evolver is maintained on
its own and is not edited here, its activation probe builds the model
with both, and `ty`, which CI runs over `evolver/`, would refuse that
call without them. The migration still drops both from files, and
`settings.set` still refuses them.

Readers of old traces keep working: the trajectory view and the tracing
viewer still label `skill.gate` and `skill.rewrite` spans, though
nothing produces them now.

Also in this PR:

- The estimate prompt (`ContextBuilder.build_system_prompt`, used for
the token budget) stops rendering a skill directory that no request
carries.
- `read_skill` and `use_skill` stop pointing the model at a `# Skills`
context.

Three fixes found on the way or in review, kept here because they sit on
the same code:

- A raven-loop sub-agent fenced by `restrictToWorkspace` was told to
`read_file` a builtin SKILL.md that lives inside the installed package,
outside both roots it may read. It now registers `read_skill` over agent
home's catalog, held to the run's effective skill allow-list
(`skills_allow`, the row and node lists narrowed together) and the live
`skillForge.blocklist`, and its skill menu names that route when the
tool is there.
- `skill.read` spans took `skill.source` from the id prefix, so every
on-disk skill read as `local`. `read_skill` and `use_skill` now resolve
the layer through their registry (`builtin`, `workspace`, `hub`, ...);
an id the registry does not hold keeps its prefix.
- A memory-backend id (an evolved skill or a case from the agent track,
`everos/<id>`) had no body route. The menu and `find_skill` offered it,
but `read_skill` and `use_skill` looked a non-hub id up only on disk,
where the backend writes nothing, so every read failed, under pull on
main as well; push was the one path that carried those bodies, by
rendering the hit text into its segment. The router now holds the hits
it returned, the latest 256 by qualified id, and drops a source's hits
when a memory switch removes it or rebinds it in place to another
backend or agent; `read_skill` and `use_skill` serve a held hit's text
when the disk has no such skill, refusing a blocklisted name. After a
restart nothing is held, and the miss names `find_skill`, which puts
every id it returns back. A tool built without a router (a sub-agent's)
names no search on a miss.

PR #1292, which deleted the `skills_injected` sink this branch had also
edited, landed first; this branch takes its deletion.

Not done here: dropping `llmGateEnabled` and `rewriteEnabled` once
Evolver stops passing them; pull never had the push segment's
`deliver_files` note after a Hub body; the Evolver activation audit
still reads `skill_injections.jsonl`, whose writer was already
unreachable on main; a confined sub-agent can still `read_file` a skill
under agent home by path whatever its allow-list says, because agent
home is one of its two readable roots on main as well; and the registry
and local pool docstrings still describe an EverOS writer under
`skills/everos/` that no longer exists.

## Type

- [ ] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [x] Refactor
- [ ] Other

## Verification

This round, rebased onto `origin/main` c3be94a and run in a Python
3.12.13 env synced with `uv sync --frozen --all-extras --python 3.12`.
That main brings #1269, which takes config migrations 16 and 17, so this
PR's migration is now 18, #1292 and #1314; the rebase conflicts were
that number, the tests both sides appended to `test_config_loader.py`,
the sink code #1292 deleted, and the comment above `ROLE_ROWS` in the
settings skeleton, beside which #1314 added `PluginsWait` (both kept;
`ROLE_ROWS` stays 10, the length of `ROLES`).

- New tests for an in-place memory rebind:
`test_agent_loop_memory_rebind.py` gains one case per spelling (the same
name with another backend and agent, and a rename to `everos-cloud`)
that the old backend's held hits are forgotten, and
`test_skill_router_fusion.py` one that `forget` drops only its own
source's hits. Both rebind cases failed before the fix with the old
backend's body still held. A rebind that never forgets, a `forget` that
drops nothing, and a `forget` called after the rename each fail one of
them.
- New tests for the memory-backend reads: 4 in
`test_skill_router_fusion.py` (a returned hit is held, only the latest
are held, a hit returned again is held as new, removing a source drops
its hits); 12 in `test_skill_hub_tools.py` (for each tool: an id
`find_skill` listed and one the scent menu offered both read back, a
miss names the search that brings the id back, switching memory off
forgets the hits, a blocklisted held name is refused, and a tool with no
router names no search); and 1 in `test_agent_loop_skill_tools.py` that
drives the loop's own `find_skill`, `read_skill` and `use_skill` against
the engine's router. Before the code, that loop test failed with the
reported text ("Error: no everos skill 'sk_42' found. find_skill lists
the ids that resolve."), the two no-router cases failed on the old miss
text, and the rest could not import the helper they drive. The test this
PR had added, which pinned that miss as correct, is replaced by them.
- Mutations, each failing at least one of the new tests: no held lookup
in `read_skill`, or in `use_skill`; no blocklist check on the held name
in either; neither tool wired to the router in the loop; a router that
holds nothing, never evicts, never refreshes a returned hit, or keeps a
removed source's hits; a lookup bound to the first router instead of the
live one; and the miss hint given always, or never.
- Full suite, `pytest -q -n 4`, with the fixes on c3be94a: 40408
passed, 12 failed, 266 skipped. The 12 fail the same way on an
unmodified c3be94a on this machine, which has an environment HTTP
proxy, a system node 18, no converter for legacy `.xls`, and git 2.34,
whose `git apply` has no `--allow-empty`: five in
`test_config_update_providers.py`, four in `test_evolver_git_ops.py`
(added on main by #1273), and one each in `test_install_script.py`,
`test_knowledge_parser_excel.py` and `test_subagent_node_runtime.py`.
One run of `test_config_loader.py` on its own also failed
`test_a_current_sandbox_block_is_left_byte_for_byte` (from #1269) once,
then passed four times: it asserts the process-wide migration notice
list is empty without draining it first, and 30 earlier tests in that
file leave notices behind, on main as well as here, so it fails whenever
xdist puts one of them before it on the same worker. A full run on
d7c98c1 under an outside load spike (a 15-minute load average above
1000) also failed nine timing-bound tests, among them
`test_skill_router_fusion.py::TestSkillForgeRouterSelect::test_concurrent_execution`,
a wall-clock check from main; the nine passed three runs out of three on
their own, and every count quoted here comes from a run at normal load.
- `ruff check .`, `ruff format --check .`, and `ty check raven evolver
agents plugins-dist scripts`: clean. ui-tui `node scripts/gen-i18n.mjs
--check` and ui-web `npm run gen:check`: up to date after the rebase.
ui-web after the `Skeletons.tsx` conflict: `tsc --noEmit` clean, `eslint
src/features/settings` clean, `vitest run --no-file-parallelism
src/features/settings` 271 passed in 19 files.
- `scripts/check_commit_messages.py origin/main..HEAD`,
`scripts/check_source_language.py origin/main...HEAD` and
`scripts/check_large_files.py origin/main...HEAD`: exit 0.

Earlier rounds, on 978cca8 and then 51b40ee:

- New tests: the migration (5 in `test_config_loader.py`), the retired
fields (12 in `test_config_raven_sections.py`, one of them pinning that
the two kept fields are declared and never written), the estimate prompt
(`test_skill_forge_loader_parity.py`), the sub-agent route and its
allow-list (5 in `test_subagent_workdir.py`), and `skill.source` (4
cases in `test_tracing_api.py`). All were seen red before the code
except three guards that pin behaviour the change keeps: a migrated key
written back by a rollback, a sub-agent without `read_skill` keeping the
`read_file` route, and an unknown id keeping its prefix.
- Mutations: dropping the sub-agent's blocklist reader, passing it no
allow-list, disabling the allow-list check in `read_skill`, or turning
its menu back to `read_file`, each fails a new test. Kept code that the
deleted test files also reached was mutated too: disabling the
`autoInstall` consent gate still fails `test_skill_hub_policy.py`;
forcing `SkillHubClient.install` to fetch the detail again survived
every suite, on main as well, so `test_skill_hub_client.py` gains a test
that kills it.
- Full suite, `pytest -q -n 4`, after the rebase: 39918 passed, 9
failed, 1 error. Eight fail the same way on an unmodified main on this
machine, which has an environment HTTP proxy, a system node 18 and no
converter for legacy `.xls`: five in `test_config_update_providers.py`,
and one each in `test_install_script.py`,
`test_knowledge_parser_excel.py` and `test_subagent_node_runtime.py`.
The ninth,
`test_node_stderr_replay.py::test_a_reason_written_on_stderr_while_the_link_was_down_reaches_the_run_watching_it`
(its teardown is the error), hit a test deadline under load ("did not
happen in time"); it passes 3 of 3 runs on its own, and this change
touches nothing under `raven/node`.
- Evolver left as it is on main: with its activation probe back on the
main version, `tests/test_evolver_activation.py` failed 3 of 3 before
the two fields were kept (`extra_forbidden`) and passes with them;
removing either field, or the `exclude` on either, fails a test. Full
suite, `pytest -q --ignore=tests/integration` with the box's HTTP proxy
variables unset: 39923 passed, 3 failed, 266 skipped; the three are the
`test_install_script.py`, `test_knowledge_parser_excel.py` and
`test_subagent_node_runtime.py` cases named above.
- After rebasing onto 51b40ee, whose only change is under `ui-web/`:
the 42 test files that touch SkillForge config plus
`tests/test_evolver_activation.py`, 2953 passed, 1 skipped; `ty check
raven evolver agents plugins-dist scripts`, clean.
- T3.13 as rewritten: the four picks and four clears it describes,
replayed through the `settings.set` handler on a scratch config, each
returned only `applied` and `previous`; the config held the picks, then
null; `skillForge.llmGateModel` and `skillForge` were refused as not
writable. No live host or page was driven.
- ui-web: `vitest run --no-file-parallelism src/features/settings
src/features/trajectory` 723 passed in 41 files; `npm run type-check`,
`eslint src/features/settings` and `npm run gen:check` clean. ui-tui:
`node scripts/gen-i18n.mjs --check` up to date.
- `ruff check`, `ruff format --check`, and `ty check raven evolver
agents plugins-dist scripts`: clean.
- `scripts/check_commit_messages.py origin/main..HEAD`,
`scripts/check_source_language.py origin/main...HEAD`,
`scripts/check_large_files.py origin/main...HEAD`: exit 0.

- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed

Docs: `skills-and-extensions` (en and zh) describe the one path, and
their cost row no longer lists skill rewrite and gating; `tracing-api`
(en and zh) says what `skill.source` holds; `CONTEXT.md` updates every
entry that named push or the gate (Skill Discovery, Prompt Segments,
Turn Scratch, SkillForge and the LLM Purpose list among them), and Skill
Discovery says how a memory-backend id is read; under `docs/specs`,
acceptance row T3.13 and the A20 and `settings.set` rows of the settings
design are rewritten for curator and session naming, and the other
mentions carry a dated amendment. The docs site was not built locally.

## Risk

- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes

User-visible changes: a deployment that set `discovery: "push"` now gets
the menu and loses the per-turn rewriter and gate calls; the skill gate
role is gone from the settings page, and `settings.set` refuses its
keys; the `read_skill` and `use_skill` descriptions and the sub-agent
skill menu read differently to the model; trace readers that compared
`skill.source` with `local` now see the layer; a memory-backend skill or
case that the menu or `find_skill` names now reads back through
`read_skill` and `use_skill`.

Security: a sub-agent confined by `restrictToWorkspace` can now read
builtin skill bodies, which ship in the package, through `read_skill`;
it reads nothing else through it, and its effective skill allow-list and
the operator blocklist each apply to its menu and to the tool alike. The
hits a router holds belong to one agent's router, and a read by id
returns only text that a search of that agent's sources already
returned; a switch to another backend or agent forgets the old one's
hits, and a blocklisted name is refused on the read too.

Compatibility: `SkillsSegmentBuilder`, `QueryRewriter`, `LLMGateFilter`,
`RewriteResult`, `resolve_refs` and `skill_gate_pin` are gone from their
packages, so outside code importing them breaks; nothing in this
repository or its plugins does.

Rollback: revert the squash commit. A config already cleaned by
migration 18 keeps running on pull, the default, until the keys are set
again.

## Related Issues

N/A
@0xKT 0xKT mentioned this pull request Nov 17, 2026
4 of 12 tasks
0xKT added a commit that referenced this pull request Nov 17, 2026
## Summary

Bump the package version from 0.2.7 to 0.2.8 for the next release. Only
pyproject.toml and uv.lock change.

Since v0.2.7, main gained 124 commits: 28 features, 70 fixes, nine perf,
five dependency bumps, four refactors, three docs, three tests and two
chores. The larger changes are the sandbox moving from boxlite to
OpenShell
with its network under the permission set (#1269), handing a task's work
to
agents (#1259), carrying a replan's unfinished nodes into a successor
run
(#1206), switching the memory backend live from Settings (#1186), the
context window analysis opened from the composer (#1205, #1229), Agent
Plugin packages listed in web settings (#1314), session search on Cmd+K
(#1310), prompt recall in the web composer (#1189), and the DSH and
MiniMax
Code ACP presets (#1211, #1199).

Two changes remove something: #1269 retires the boxlite backend (a
boxlite-era `tools.sandbox` block is migrated to OpenShell on load) and
#1295 removes push skill discovery with its config fields. Neither
carries
a BREAKING CHANGE footer, and the release notes will call both out. The
maintainer chose a patch bump, the way v0.2.1 through v0.2.7 were for
their
features.

The stable tag goes straight on the merged commit, with no rc dry run
this
time; the release notes follow once the draft exists.

uv.lock is regenerated with uv 0.12.12, which leaves only the raven
version
line changed (uv 0.9.x rewrites unrelated dependency markers and uv
0.13.x
raises the lock revision).

## Type

- [ ] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [x] Other

## Verification

- `uvx --from uv==0.12.12 uv lock` on a clean worktree cut from
origin/main:
  Updated raven v0.2.7 -> v0.2.8
- `git diff --numstat origin/main..HEAD`: one line each in
pyproject.toml and
  uv.lock
- `uvx --from uv@latest uv lock --check` (uv 0.13.9): exit 0, so the
  `uv export --locked` step in release.yml accepts the lock
- `PYTHONPATH=. python3 scripts/check_commit_messages.py
origin/main..HEAD`:
  exit 0
- `npx commitlint --from origin/main --to HEAD --config
commitlint.config.cjs`:
  exit 0
- No test run: the change is version metadata only.

- [ ] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed

## Risk

No code change. Rollback is reverting this commit before any v0.2.8 tag
is
pushed.

- [ ] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes

## Related Issues

N/A

Co-authored-by: Claude (claude-fable-5-2) <noreply@anthropic.com>
joei4cm added a commit to joei4cm/Raven that referenced this pull request Nov 18, 2026
The mounted-root path translator rewrites a host root only when the
character after it ends the string or is a separator, so /srv/workshop
is never read as /srv/work. Nothing pins that boundary at its current
home: if it ever slipped, a sibling directory sharing a prefix would be
rewritten to the workspace mount and the command would run against the
wrong files inside the VM.

Three tests pin it, on both the POSIX and the Windows spelling of the
root. No production code changes; the translator moved from
BoxliteExecutor into MountTable with the OpenShell migration (EverMind-AI#1269),
and these tests moved with it.

Co-authored-by: Claude (claude-fable-5-1) <noreply@anthropic.com>
LivXue pushed a commit that referenced this pull request Nov 18, 2026
…aws (#1302)

## Summary

The mounted-root path translator rewrites a host root only when the
character after it ends the string or is a separator, so `/srv/workshop`
is never read as `/srv/work`. Nothing pinned that boundary at its
current home: if it ever slipped, a sibling directory that happens to
share a prefix would be rewritten to the workspace mount, and the
command would run against the wrong files inside the VM.

This PR originally pinned the boundary on
`BoxliteExecutor._translate_process_path`. The OpenShell migration
(#1269) removed the boxlite executor and moved the translator into
`MountTable.translate_process_path` (`raven/sandbox/mounts.py`), so the
three tests now live in `tests/test_sandbox_mounts.py` under the
existing `TestTranslateProcessPath` class, written against `MountTable`
with the same monkeypatched-roots pattern the neighbouring cases use.
The boundary itself is unchanged: the same `(?=$|[\\/])` guard.

The three tests pin the same four shapes on both the POSIX and the
Windows spelling of the root: the root alone (`/srv/work`,
`C:\workspace`) and the root with a child suffix (`/srv/work/d`,
`C:\workspace\pkgs`) translate, while a longer sibling (`/srv/workshop`,
`C:\workspaces`) and a dash-suffixed sibling (`/srv/work-old`,
`C:\workspace-old`) both stay untouched. No production code changes.

## Type

- [ ] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [x] Other (test-only: pins existing behaviour, no production code
changes)

## Verification

- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed (not
needed: no behaviour or user-facing surface changes)

- `uv run --frozen --python 3.12 pytest tests/test_sandbox_mounts.py -q`
-> `19 passed` (16 before, 3 new)
- `uv run --frozen --python 3.12 pytest tests/test_sandbox_mounts.py
tests/test_sandbox_unit.py -q` -> `106 passed, 4 skipped` (skips are
environment: no `openshell` module locally; with `openshell` importable
the same run is `110 passed`)
- `uv run --frozen --python 3.12 ruff check
tests/test_sandbox_mounts.py` -> `All checks passed!`
- `uv run --frozen --python 3.12 ruff format --check
tests/test_sandbox_mounts.py` -> `1 file already formatted`
- `make coverage-diff` (base `origin/main`) -> `Diff coverage: 100.00%
(0/0 executable changed lines)`

## Risk

- [x] Security impact considered: the tests only assert what the
translator already does; no path handling changes, and the boundary they
pin is the one that keeps a sibling directory out of the workspace
mount.
- [x] Backward compatibility considered: test-only.
`tests/test_sandbox_mounts.py` gains three cases and rewrites no case
that predates this branch; `tests/test_sandbox_unit.py` is untouched at
the new base.
- [x] Rollback path is clear for risky changes: revert the branch.

## Related Issues

#1116

---------

Co-authored-by: Claude (claude-fable-5-1) <noreply@anthropic.com>
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.

3 participants