Repository navigation
Support an opt-in agent backend for masked-proc containers - #182
Closed
Kimiyu-186 wants to merge 2 commits into
Closed
Kimiyu-186 wants to merge 2 commits into
Kimiyu-186 wants to merge 2 commits into
Conversation
## Problem Box cannot mount its nested proc view inside a container that retains the runtime's proc masks. Native copies and atomic publication also fail under the current syscall results, and the shell alias loses piped stdin. ## Solution Add an explicit container-agent mode with a PID-1 trampoline, prepared descriptor handoff and supervisor lifetime tracking. Keep the masked proc view and workload policy. Admit only the container rename mode and namespace-local signals, and return ENOSYS for still-denied copy optimizations. Repair alias descriptor cleanup and input forwarding. Update operator and containment documentation and record version. ## Tests On the refreshed main base, cargo fmt passes and 126 containment library tests pass on macOS. Focused Clippy completes with existing vendored and hosted.rs warnings; strict -D warnings fails. The focused stdin regression result is recorded in the PR. Fresh Linux port and complete integration verification remain pending. Earlier Linux and 32-case native OCE acceptance qualify the earlier source snapshot only. Independent review found a remaining large-stdin flow-control limitation, documented as draft follow-up.
This was referenced Oct 27, 2026
Closed
Closed
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Box's default Linux backend creates a nested PID namespace and mounts a fresh
/proc. That mount fails inside a container whose runtime masks/proc. An outer seccomp allowance alone does not remove this kernel constraint.This draft adds an opt-in
container-agentbackend. A trusted Box supervisor prepares the authorized filesystem view. A trampoline in a separate workload container accepts the prepared launch as that container's sole PID 1. It uses the runtime's private PID namespace, preserves its proc masks, binds that proc view read-only, and applies Box's remaining restrictions. Loss of the supervisor terminates the workload namespace. Default standalone behavior stays on the existing backend. Hosted tool/MCP configurations remain refused in container mode.The motivating deployment is OCE with one provider Pod per Agent revision. OCE owns Pod/PVC selection, authentication, readiness, routing, and the exact setup seccomp profile. These remain adapter responsibilities. This PR adds no Kubernetes dependency.
Upstream ownership and dependencies
This revision includes merged main
e0af331d457222d7fb189f9548653b92492eaa15. It uses the upstream mount-target and metadata-only-parent fixes from #159 and #157. It does not copy their implementation into a separate path.recvmsggrant or executable-memory exception is added here.The draft should shrink further if upstream supplies an equivalent supported path. It must not be treated as a competing implementation of #140 or #188.
Remaining changes and necessity
renameat2(RENAME_NOREPLACE)EPERM; check-then-rename loses atomicity.killsendfileandcopy_file_rangereturnENOSYSEPERMinstead of using their existing read/write fallback.close_rangeis unavailable. No arbitrary descriptor cap.The syscall policy keeps upstream's existing constructor signature. Only container-mode callers select the additional scoped permits. No broad remount-flags rewrite, workload FD-import permission, direct network grant, or outer unconfined profile is included. Record version 24 represents the explicit backend choice.
Related Issues
Refs #26 for the masked-proc constraint. This draft does not establish support for all Kata configurations and does not close that issue.
OCE architecture proposal: openclaw/openclaw-enterprise#3230
Type of Change
New experimental backend, focused compatibility fixes, and operator/design documentation.
Testing
Prepared commit:
05efc455d65dfea67734f5cb71ca27b0ff5e9582. Tested source tree:eb04b1ab9249dc3964445755add7ad279d3e8d34, based on maine0af331d457222d7fb189f9548653b92492eaa15.cargo fmt --all --checkpassed.hosted.rs, also present in the prior baseline. This is not a clean workspace-D warningsresult.The focused Linux tests include:
ordinary_process_cannot_borrow_procfsandordinary_process_cannot_be_a_container_receiverfor container-entry refusals.descriptor_handoff_preserves_the_opened_file_and_cloexecandunframed_transport_data_is_refusedfor the private handoff.no_replace_rename_preserves_collisions_and_refuses_other_modesfor the atomic rename permit.child_termination_does_not_admit_init_or_broadcast_targetsfor signal targets.optimized_copy_calls_remain_unavailable_for_read_write_fallbacksfor denied-copy errno behavior.ordinary_namespace_keeps_container_compatibility_calls_refusedfor default-backend isolation.container_receive_cannot_import_descriptorsfor refused workload FD import.Separate upstream composition check: owner #140 at
aa1b8e419cf0deaad25113ab68d45451fef05450applies cleanly to this source. Combined tree7cafba29bdc8cb7db1b2db9512bb2a4bd0c15d20compiled on Linux ARM64 and passed 33 alias tests and all 3 stdin regression tests, with no skip diagnostics. The alias tests includeboth_linux_cleanup_paths_close_descriptors_above_a_lowered_limit. The stdin tests cover silent open input, Python leaving input for later commands, and release of the broker's byte budget. This composition is a test artifact; #140 is not copied into this branch.PO-9 diagnosis: the host PATH resolves
gitto a corporateogwrapper. Box correctly recorded a default-deny for that resolved executable, but the test expected a denial naminggit. The single case passed with a task-local PATH selecting/usr/bin/git, without changing Box policy, test source, or global PATH. The original full-run RED is retained. This is not a fresh-main baseline or a green full-suite rerun.The initial package-wide test attempt inside the coding tool's macOS execution sandbox failed on filesystem and nested-sandbox permissions. The affected runtime targets were then run in the native host environment and passed as listed above, with Box's own restrictions unchanged.
scripts/test-all.shcould not unpack a dependency in that execution sandbox. A complete workspace suite has not been qualified in this revision. These limits remain merge gates.Integration and merge gates
Checklist
AI assisted the implementation and review. The repository's preferred Opus reviewer was unavailable; a separate Codex reviewer assessed the change and its checks.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.