[GH-ISSUE #142] fix(application): continue process group ownership cleanup despite per-process read failures #90

Closed
opened 2026-10-15 18:21:00 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @morluto on GitHub (Jul 14, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/142

Description

cleanupOwnedProcessGroup in src/application/ProcessOwnership.ts returns { cleaned: false } as soon as getProcessOwner fails for any PID. A transient read/parsing failure for one PID currently aborts cleanup for all remaining members.

Impact

This can leave a partially-owned process group uncleared even when other members are safe to signal/terminate, which breaks cleanup guarantees and may leak analysis artifacts.

Reproduction

  1. Trigger process cleanup on a mixed group where one PID returns an unparsable environment/read failure.
  2. Observe cleanup exits early and remaining PIDs are not processed.

Expected behavior

Attempt best-effort cleanup for all enumerated members, aggregate failures, and report complete outcome metadata.

Files

  • src/application/ProcessOwnership.ts (around lines 127-136)
Originally created by @morluto on GitHub (Jul 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/142 ## Description `cleanupOwnedProcessGroup` in `src/application/ProcessOwnership.ts` returns `{ cleaned: false }` as soon as `getProcessOwner` fails for any PID. A transient read/parsing failure for one PID currently aborts cleanup for all remaining members. ## Impact This can leave a partially-owned process group uncleared even when other members are safe to signal/terminate, which breaks cleanup guarantees and may leak analysis artifacts. ## Reproduction 1. Trigger process cleanup on a mixed group where one PID returns an unparsable environment/read failure. 2. Observe cleanup exits early and remaining PIDs are not processed. ## Expected behavior Attempt best-effort cleanup for all enumerated members, aggregate failures, and report complete outcome metadata. ## Files - `src/application/ProcessOwnership.ts` (around lines 127-136)
bsakaguchi 2026-10-15 18:21:00 +00:00
Author
Owner

@morluto commented on GitHub (Jul 17, 2026):

Re-evaluated against current main.

The cited application-layer implementation no longer exists. The current src/process/ProcessOwnership.ts::cleanupOwnedProcessGroup enumerates every live member, attempts environment validation for each one, aggregates all unreadable and run-token-mismatch failures, and returns structured failures metadata.

It intentionally does not signal the process group when any member cannot be revalidated. POSIX group signaling is group-wide; there is no safe way to terminate only the "known-owned remaining members" through kill(-pgid, ...). Signaling after partial validation could terminate an unrelated PID-reused or injected group member, contradicting REA's ownership invariant and #27.

The actionable diagnostic portion of this issue is implemented; the requested best-effort signaling after incomplete ownership validation is unsafe. Closing as not planned. A future OS-owned containment backend can provide stronger cleanup without weakening fail-closed identity checks.

<!-- gh-comment-id:5001373153 --> @morluto commented on GitHub (Jul 17, 2026): Re-evaluated against current main. The cited application-layer implementation no longer exists. The current `src/process/ProcessOwnership.ts::cleanupOwnedProcessGroup` enumerates every live member, attempts environment validation for each one, aggregates all unreadable and run-token-mismatch failures, and returns structured `failures` metadata. It intentionally does not signal the process group when any member cannot be revalidated. POSIX group signaling is group-wide; there is no safe way to terminate only the "known-owned remaining members" through `kill(-pgid, ...)`. Signaling after partial validation could terminate an unrelated PID-reused or injected group member, contradicting REA's ownership invariant and #27. The actionable diagnostic portion of this issue is implemented; the requested best-effort signaling after incomplete ownership validation is unsafe. Closing as not planned. A future OS-owned containment backend can provide stronger cleanup without weakening fail-closed identity checks.
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.

Dependencies

No dependencies set.

Reference
morluto/rea#90
No description provided.