Skip to content

fix(sandbox): remove nsjail runner - #581

Merged
delete-cloud merged 1 commit into
mainfrom
feat/sandbox-cleanup
Jun 12, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
feat/sandbox-cleanup

Conversation

@delete-cloud

@delete-cloud delete-cloud commented Jun 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • remove the unreachable NsjailSandboxRunner implementation now that sandbox_mode=nsjail is rejected by validation
  • remove the Helm nsjail sidecar ConfigMap, env, volume, container, and values blocks
  • update ADR-0060/current safety docs to record that the temporary runner and Helm sidecar are gone, and make historical ADR wording explicit
  • add regression coverage that the runner is absent and legacy Helm sandbox.sidecar.enabled=true values no longer render sidecar artifacts

Scope Notes

This is Phase 3.2 only. It intentionally keeps sandbox_mode=nsjail rejection tests as the public contract and does not include the Phase 3.3 Linux bwrap CI work or the Phase 3.4 minimum-isolation policy audit.

Review Fixes

Local fallback review found one P2 docs-contract issue: ADR-0060 still had historical wording that read like current state (none, nsjail, docker) and said the runner was temporarily retained. This branch now makes that wording explicitly historical and records that the cleanup is complete.

Verification

  • red tests first:
    • uv run pytest tests/tools/test_shell.py::TestNativeSandboxResolution::test_nsjail_runner_is_removed -q failed before runner removal
    • uv run pytest tests/deploy/test_helm_chart.py::test_helm_chart_ignores_legacy_sandbox_sidecar_values -q failed before Helm cleanup
  • uv run pytest tests/tools/test_shell.py::TestNativeSandboxResolution::test_nsjail_runner_is_removed tests/tools/test_shell.py::TestNativeSandboxResolution::test_nsjail_mode_is_rejected_by_validation -q (2 passed)
  • uv run pytest tests/deploy/test_helm_chart.py::test_helm_chart_ignores_legacy_sandbox_sidecar_values -q (1 passed)
  • uv run pytest tests/tools/test_shell.py -k "native or podman or nsjail or sandbox" -q (36 passed, 21 deselected)
  • uv run pytest tests/deploy/test_helm_chart.py -q (13 passed)
  • helm lint helm
  • helm template coding-agent helm
  • helm template coding-agent helm -f helm/values-orbstack.yaml
  • helm template coding-agent helm -f helm/values-orbstack-kimi.yaml
  • uv run ruff format --check src/coding_agent/tools/sandbox.py tests/tools/test_shell.py tests/deploy/test_helm_chart.py
  • uv run ruff check src/coding_agent/tools/sandbox.py src/coding_agent/tools/shell.py tests/tools/test_shell.py tests/deploy/test_helm_chart.py
  • rg -n 'maps one-to-one|left temporarily|remain in \sandbox.py`|slated for removal' docs/adr/0060-native-platform-sandbox-backends.md src tests helm docs/action_safety/CURRENT_STATE.md || true` (no matches)
  • git diff --check origin/main...HEAD
  • git diff --cached --check
  • uv run pytest tests/ -q -ra (3671 passed, 4 skipped, 20 xfailed)

@coderabbitai

coderabbitai Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR removes the nsjail-based sandbox backend completely: deleting the NsjailSandboxRunner class, cleaning up all nsjail sidecar configuration from Helm templates and values, and adding tests to verify the removal is thorough. Documentation is updated to reflect that native and podman are now the primary non-containerized sandbox options.

Changes

Remove nsjail sandbox backend and sidecar infrastructure

Layer / File(s) Summary
Remove NsjailSandboxRunner implementation
src/coding_agent/tools/sandbox.py
Deletes the NsjailSandboxRunner class entirely, removing Linux-only enforcement, nsjail binary path checks, and nsjail command assembly with CPU/memory limit flags. Remaining backends are none, native, podman, and docker.
Clean up nsjail sidecar from Helm templates and values
helm/templates/deployment.yaml, helm/values.yaml, helm/values-orbstack.yaml, helm/values-orbstack-kimi.yaml
Removes the nsjail sidecar container definition, sandbox-config ConfigMap volume, SANDBOX_NSJAIL_CONFIG_PATH environment variable, and volume mounts from the deployment template. Deletes sandbox.sidecar configuration blocks from base and environment-specific Helm values files.
Add regression tests for nsjail removal
tests/tools/test_shell.py, tests/deploy/test_helm_chart.py
Adds test_nsjail_runner_is_removed to verify the class is no longer exposed on the sandbox module. Introduces _objects_of_kind helper and test_helm_chart_ignores_legacy_sandbox_sidecar_values to render the Helm chart with sandbox.sidecar.enabled=true and assert that no legacy sandbox ConfigMaps, environment variables, volume mounts, or volumes are present.
Update documentation to reflect nsjail removal
docs/action_safety/CURRENT_STATE.md, docs/adr/0060-native-platform-sandbox-backends.md
Updates bash_run sandbox-mode delegation list to replace nsjail with native and podman. Updates ADR-0060 to document that NsjailSandboxRunner and Helm nsjail sidecar template were removed, and that fail-closed native resolution plus the removal of temporary scaffolding are now complete.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#532: Directly related prior work on ADR-0060 that removes nsjail from sandbox_mode validation and makes NsjailSandboxRunner unreachable; this PR completes the removal by deleting the class entirely and cleaning up all Helm sidecar infrastructure.

Poem

🐰 Hops with delight
Nsjail hops away, native takes the stage,
Podman spins containers with modern-day rage.
Helm charts grow lighter, config's clean and bright,
Tests guard the removal—no sidecar in sight!
✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(sandbox): remove nsjail runner' directly summarizes the main change—removing the NsjailSandboxRunner implementation and Helm nsjail sidecar artifacts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sandbox-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@delete-cloud
delete-cloud force-pushed the feat/sandbox-cleanup branch from fba2b17 to 0882550 Compare June 12, 2026 15:17
@delete-cloud
delete-cloud merged commit fef4273 into main Jun 12, 2026
2 checks passed
@delete-cloud
delete-cloud deleted the feat/sandbox-cleanup branch June 12, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant