[PR #230] [MERGED] fix(process): gate sampling on initialized PTY roots #1881

Closed
opened 2026-10-16 21:12:07 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/230
Author: @N0zoM1z0
Created: 7/14/2026
Status: ✅ Merged
Merged: 7/14/2026
Merged by: @morluto

Base: main ← Head: agent/process-sampling-initialization


📝 Commits (2)

  • 57938a8 fix(process): gate sampling on initialized PTY root
  • d92441e Merge branch 'main' into agent/process-sampling-initialization

📊 Changes

4 files changed (+151 additions, -19 deletions)

View changed files

📝 src/application/ProcessHarness.ts (+6 -5)
📝 src/application/ProcessOwnership.ts (+7 -0)
📝 src/application/ProcessSampling.ts (+94 -13)
📝 tests/processCapture.test.ts (+44 -1)

📄 Description

Summary

  • wait to sample a forkpty root until its PID, process group, session, and start identity are stable
  • require the capture's REA_PROCESS_RUN_ID token before accepting the first process-tree observation
  • seed PID-reuse tracking from the verified root identity
  • cover transient parent-group observations and prevent the host forks.js command from entering captured evidence

Root cause

On Linux, the parent can observe the forkpty child before child-side session setup and exec have completed. That transient process still has the host runner's PGID/SID and command. Sampling it promoted unrelated host process-group metadata into later cleanup.

This fixes the observation boundary itself. It is an alternative to #219: filtering to observed group leaders avoids the transient group, but can also discard legitimate descendant groups after their leaders exit. This change admits no samples before initialization, then retains the existing complete descendant-group behavior and fail-closed token checks.

Verification

  • npx vitest run --coverage=false tests/processOwnership.test.ts tests/processCapture.test.ts — 35 passed
  • npm run typecheck
  • focused oxlint
  • focused Prettier check
  • git diff --check

Related to #149.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/230 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 7/14/2026 **Status:** ✅ Merged **Merged:** 7/14/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `agent/process-sampling-initialization` --- ### 📝 Commits (2) - [`57938a8`](https://github.com/morluto/rea/commit/57938a8465add2d6e89dae13e66059bad7f72a45) fix(process): gate sampling on initialized PTY root - [`d92441e`](https://github.com/morluto/rea/commit/d92441e6b7250a7350c298d5c09738bcd62016e3) Merge branch 'main' into agent/process-sampling-initialization ### 📊 Changes **4 files changed** (+151 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `src/application/ProcessHarness.ts` (+6 -5) 📝 `src/application/ProcessOwnership.ts` (+7 -0) 📝 `src/application/ProcessSampling.ts` (+94 -13) 📝 `tests/processCapture.test.ts` (+44 -1) </details> ### 📄 Description ## Summary - wait to sample a forkpty root until its PID, process group, session, and start identity are stable - require the capture's `REA_PROCESS_RUN_ID` token before accepting the first process-tree observation - seed PID-reuse tracking from the verified root identity - cover transient parent-group observations and prevent the host `forks.js` command from entering captured evidence ## Root cause On Linux, the parent can observe the forkpty child before child-side session setup and exec have completed. That transient process still has the host runner's PGID/SID and command. Sampling it promoted unrelated host process-group metadata into later cleanup. This fixes the observation boundary itself. It is an alternative to #219: filtering to observed group leaders avoids the transient group, but can also discard legitimate descendant groups after their leaders exit. This change admits no samples before initialization, then retains the existing complete descendant-group behavior and fail-closed token checks. ## Verification - `npx vitest run --coverage=false tests/processOwnership.test.ts tests/processCapture.test.ts` — 35 passed - `npm run typecheck` - focused oxlint - focused Prettier check - `git diff --check` Related to #149. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:12:07 +00:00
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#1881
No description provided.