feat(sandbox): PID 1 process tree lifecycle and ownership reaper #6

Closed
opened 2026-09-09 10:08:48 +00:00 by larandar · 1 comment
Owner

Proposal

Make workflow process-tree cleanup bounded and ownership-safe, including orphan reaping and timeout termination.

Design

Run the sandbox with PID 1 semantics so the kernel can orphan-reap descendants. Watch wall-clock deadlines and use instance.nu ownership records to signal only proven run-root PIDs, escalating from SIGTERM to SIGKILL after five seconds.

Tasks

  • 2.3 Enable --unshare-pid and PID 1 orphan reaping.
  • 2.6 Implement the wall-clock timeout watcher and instance.nu ownership law (signal only proven run-root PIDs; SIGTERM, five-second grace, then SIGKILL).

Gherkin Specification Delta

must.contracts.ting-workflows.executor.process-tree-reaper

Scenario: Reap a timed-out workflow process tree

  • GIVEN a sandboxed workflow with a proven run-root PID and an expired wall-clock deadline
  • WHEN the timeout watcher fires
  • THEN only the owned run root is signaled with SIGTERM
  • AND after five seconds any remaining owned process is signaled with SIGKILL
  • AND orphaned descendants are reaped by PID 1.
## Proposal Make workflow process-tree cleanup bounded and ownership-safe, including orphan reaping and timeout termination. ## Design Run the sandbox with PID 1 semantics so the kernel can orphan-reap descendants. Watch wall-clock deadlines and use `instance.nu` ownership records to signal only proven run-root PIDs, escalating from SIGTERM to SIGKILL after five seconds. ## Tasks - 2.3 Enable `--unshare-pid` and PID 1 orphan reaping. - 2.6 Implement the wall-clock timeout watcher and `instance.nu` ownership law (signal only proven run-root PIDs; SIGTERM, five-second grace, then SIGKILL). ## Gherkin Specification Delta ### must.contracts.ting-workflows.executor.process-tree-reaper **Scenario: Reap a timed-out workflow process tree** - **GIVEN** a sandboxed workflow with a proven run-root PID and an expired wall-clock deadline - **WHEN** the timeout watcher fires - **THEN** only the owned run root is signaled with SIGTERM - **AND** after five seconds any remaining owned process is signaled with SIGKILL - **AND** orphaned descendants are reaped by PID 1.
Author
Owner

Superseded by 1-feature deliverable decomposition per freeholder ruling (issues #11+).

Superseded by 1-feature deliverable decomposition per freeholder ruling (issues #11+).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Ting/workflows#6
No description provided.