Skip to content

refactor(sandbox): make managed child ownership structural - #3156

Closed
elezar wants to merge 3 commits into
mainfrom
3154-managed-child-ownership/elezar
Closed

elezar wants to merge 3 commits into
mainfrom
3154-managed-child-ownership/elezar

Conversation

@elezar

@elezar elezar commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

🏗️ build-from-issue-agent

Summary

Make sandbox child lifecycle ownership structural after the RFC 0012 rearchitecture. Canonical processes and boundary-exec processes now share one cross-platform managed-child API; Linux orphan-reaper registration remains internal to that owner.

Related Issue

Closes #3154

Changes

  • Introduce a cross-platform ManagedChild<C> wrapper over the generation-safe Linux child registry.
  • Centralize wait, try_wait, drop cleanup, and ECHILD diagnostics in the wrapper.
  • Route the canonical Tokio process through ManagedChild<tokio::process::Child>.
  • Route both piped and PTY BoundaryExec processes through ManagedChild<std::process::Child>; this is the execution path used by SSH after RFC 0012.
  • Make raw registry mutation private so child-owning call sites cannot bypass the lifecycle owner.
  • Preserve boundary terminal observation, signal ordering, process-group tracking, and cancellation cleanup.

Deviations from Plan

The original plan targeted child spawning in openshell-supervisor-process and its SSH implementation. RFC 0012 moved that responsibility into openshell-sandbox; Revision 3 of the issue plan updates the scope to the canonical process and BoundaryExec implementations there.

Testing

  • mise run pre-commit passes
  • cargo test -p openshell-sandbox passes (83 passed, 1 expected ignored)
  • Existing managed-child and boundary-exec unit coverage retained
  • E2E changes not required; no files under e2e/ changed

Tests added or updated:

  • Unit: cross-platform standard/Tokio managed-child lifecycle, Linux registry/reaper interleavings, and existing piped/PTY boundary-exec lifecycle coverage.
  • Integration: full openshell-sandbox crate test suite.
  • E2E: N/A; the detached-fast-exit regression coverage from prerequisite PR fix(supervisor): serialize child registration with reaping #3142 is already on main.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

Documentation updated: None needed; this is an internal ownership refactor with no user-facing or configuration changes.

@johntmyers
johntmyers force-pushed the codex/fix-detached-fast-exit branch 4 times, most recently from 1b742ca to 9f0f48f Compare September 17, 2026 06:26
Base automatically changed from codex/fix-detached-fast-exit to main September 17, 2026 17:28
Closes #3154

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
@elezar
elezar force-pushed the 3154-managed-child-ownership/elezar branch from 67bf9af to f23a6d5 Compare September 18, 2026 07:51
Route RFC 0012 boundary exec children through ManagedChild so spawn registration, waiting, cleanup, and lost-child diagnostics remain structurally coupled.

Closes #3154

Signed-off-by: Evan Lezar <elezar@nvidia.com>
@elezar elezar changed the title refactor(supervisor): make managed child ownership structural refactor(sandbox): make managed child ownership structural Sep 18, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

This pull request has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity.

@github-actions github-actions Bot added the state:stale Inactive item at risk of automatic closure. label Oct 2, 2026
@elezar elezar closed this Oct 16, 2026
@elezar
elezar deleted the 3154-managed-child-ownership/elezar branch October 16, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:stale Inactive item at risk of automatic closure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(supervisor): make managed child ownership structural

1 participant