[GH-ISSUE #58] Implement a bounded macOS and Linux PTY capture adapter #45

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

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

Problem

Pipe-based subprocess capture does not reproduce terminal state, resizing, signal delivery, or interactive CLI behavior.

Outcome

Implement a true PTY adapter using a small Python standard-library helper on macOS/Linux.

Scope

  • Create an owned session and process group.
  • Apply timed input, resize, and signal events.
  • Capture ordered frames with relative monotonic timing.
  • Bound duration, frame count, bytes, and idle time.
  • Propagate cancellation.
  • Return exit code or terminating signal.
  • Report typed unavailability on Windows until ConPTY exists.

Safety

Use argument arrays, never shell interpolation. Run only the approved absolute executable. Inherit only allowlisted environment keys. Redact secret-derived content before evidence storage.

Acceptance criteria

Fixtures prove raw/canonical terminal modes, Unicode, resize handling, Ctrl-C, termination signals, timeout, cancellation, partial output, and descendant cleanup. The helper protocol is framed, bounded, parsed as unknown, and tested against malformed messages.

Dependencies

Parent: #48. Requires scenario contracts and explicit process ownership.

Non-goals

Windows ConPTY, SSH, container execution, or external terminals.

Originally created by @morluto on GitHub (Jul 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/58 ## Problem Pipe-based subprocess capture does not reproduce terminal state, resizing, signal delivery, or interactive CLI behavior. ## Outcome Implement a true PTY adapter using a small Python standard-library helper on macOS/Linux. ## Scope - Create an owned session and process group. - Apply timed input, resize, and signal events. - Capture ordered frames with relative monotonic timing. - Bound duration, frame count, bytes, and idle time. - Propagate cancellation. - Return exit code or terminating signal. - Report typed unavailability on Windows until ConPTY exists. ## Safety Use argument arrays, never shell interpolation. Run only the approved absolute executable. Inherit only allowlisted environment keys. Redact secret-derived content before evidence storage. ## Acceptance criteria Fixtures prove raw/canonical terminal modes, Unicode, resize handling, Ctrl-C, termination signals, timeout, cancellation, partial output, and descendant cleanup. The helper protocol is framed, bounded, parsed as unknown, and tested against malformed messages. ## Dependencies Parent: #48. Requires scenario contracts and explicit process ownership. ## Non-goals Windows ConPTY, SSH, container execution, or external terminals.
Author
Owner

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

Completed on current main. ProcessHarness uses node-pty to own a PTY/session and bounded timed events; ProcessCaptureLifecycle and ProcessOwnership provide cleanup and typed host availability. The process-capture tests cover PTY behavior, Unicode, resize, signals, denial, timeout, cancellation, and descendants. ConPTY remains a separately declared Windows availability gap rather than part of this shipped Unix/macOS outcome.

<!-- gh-comment-id:5001539821 --> @morluto commented on GitHub (Jul 17, 2026): Completed on current main. ProcessHarness uses node-pty to own a PTY/session and bounded timed events; ProcessCaptureLifecycle and ProcessOwnership provide cleanup and typed host availability. The process-capture tests cover PTY behavior, Unicode, resize, signals, denial, timeout, cancellation, and descendants. ConPTY remains a separately declared Windows availability gap rather than part of this shipped Unix/macOS outcome.
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#45
No description provided.