tractor/ai/prompt-io/opencode/20260828T012205Z_9ae7cd86_p...

1.3 KiB

Raw output - enter inherited netns during child bootstrap

The human asked to continue the WireGuard Layer C implementation after the rebased branch landed the verified spawn._netns.enter_netns() primitive.

Generated code

git diff HEAD~1..HEAD -- tractor/_child.py tractor/spawn/_entry.py tests/test_netns_spawn.py

Add one optional atomic (namespace_fd, expected_inode) bootstrap capability to the multiprocessing entrypoint and Trio child bootloader. Enter and verify the namespace before Trio patching, actor construction, runtime state, logging, Trio startup, parent connection, sockets, or worker threads, then close the child-owned inherited FD before continuing.

Add privilege-free direct-entrypoint tests using real stand-in FDs and a fake namespace syscall boundary. Cover helper-level no-op behavior, successful entry ordering, exact FD closure, malformed-FD isolation, primary-error preservation, and failure cleanup for both child bootstrap paths.

Scope boundary

This increment does not transfer FDs through spawn backends or expose a public actor API. Backend-specific FD duplication, bootstrap failure reporting, and root-process namespace entry remain follow-up work.