[PR #928] [MERGED] fix(process): retain provider output until streams close #2357

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

📋 Pull Request Information

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

Base: main ← Head: codex/process-output-close


📝 Commits (1)

  • 5cb1f5e fix(process): retain provider output until streams close

📊 Changes

5 files changed (+149 additions, -6 deletions)

View changed files

📝 src/hopper/LinuxPrivateDisplayProbe.ts (+4 -4)
📝 src/javascript/recovery/WakaruCommand.test.ts (+114 -1)
📝 src/javascript/recovery/WakaruCommand.ts (+1 -1)
📝 tests/boundary/providers/hopper/linuxPrivateDisplay.test.ts (+21 -0)
➕ tests/fixtures/x11ProbeOutput.py (+9 -0)

📄 Description

Summary

Retain complete Wakaru command output and private-display probe diagnostics when stdout/stderr remain open after the launcher exits. This confirmed producer/consumer boundary failure was found during the whole-codebase audit; no separate issue is linked.

Problem and expected behavior

Node's process exit event does not establish complete output: inherited streams can remain open while a child writes its final bytes. Both callers waited for exit, then detached capture or performed group cleanup before consuming the snapshot. A source-owned producer writing first, exiting its launcher, and later writing last therefore returned only first; Wakaru also dropped late stderr. Late diagnostics could bypass its byte-limit check.

Successful output collection must wait for stream closure while preserving the existing execution deadline, cancellation, resource checks, and cleanup requirements.

Change and scope

Use ProviderProcessSupervisor.waitForOutputClose in the existing Wakaru polling loop and bounded private-display probe wait. Keep the same budgets and cleanup paths. The supervisor, process authority, and provider protocols are unchanged.

Contract and boundary impact

  • Semantic owner/earliest changed stage: recovery command and private-display adapter output settlement.
  • CLI/MCP/tool catalog: schemas and inventory unchanged; returned diagnostics now include final bytes.
  • Provider/platform compatibility: existing Wakaru Linux x64 and Hopper Linux bring-your-own boundaries unchanged.
  • Evidence/artifact/provenance: preserve complete captured stdout/stderr, exit status, command, and arguments.
  • Execution/authorization/cleanup: existing owned-group cleanup, timeout, and cancellation remain in force.
  • Generated metadata/package/installation: none; generated documents checked.

Evidence and regression coverage

Executed baseline/candidate comparison on macOS arm64/Node 24.18.0 using actual owned processes, without asserting Wakaru or Xvfb engine behavior:

  • Injected Wakaru launcher runs a source-owned Node process group. Its child inherits stdout/stderr and writes after root exit. Baseline returns stdout: "first", stderr: ""; candidate returns stdout: "firstlast", stderr: "diagnostic" after verified group cleanup.
  • Public runLinuxPrivateDisplayProbe runs a source-owned Python helper whose child inherits stderr. Baseline reports 5 bytes (first); candidate reports all 9 bytes (firstlast).

Regression tests cover late stdout/stderr, a late diagnostic byte-limit violation, deadline expiry, cancellation with open streams, and the actual inherited-stderr producer.

Validation performed

  • npm run build:cached — passed.
  • npm run check:fast — passed.
  • npm run docs:check — passed.
  • npm run test:focused -- src/javascript/recovery/WakaruCommand.test.ts src/process/ProviderProcessOutput.test.ts tests/boundary/providers/hopper/linuxPrivateDisplay.test.ts tests/boundary/javascript-recovery/wakaruIntegration.test.ts — 15 passed; 23 Linux-only integration cases skipped on this macOS host.
  • Standalone compiled real owned-process baseline/candidate reproduction — passed as described above.
  • Independent Standards and Spec reviews — no findings.

Compatibility, safety, and release

  • Breaking changes/migrations: none.
  • Real Wakaru/Xvfb/Linux Hopper verification: not performed; the matching engine lanes require Linux and their configured toolchains. The actual-process checks prove stream settlement only.
  • Real macOS Hopper/Ghidra verification: not applicable to these Linux adapter callers.
  • Release metadata/security/privacy/authority: unchanged.

Review checklist

  • One focused outcome with Conventional Commit title.
  • Reason for no separate issue stated above.
  • Tests cover output completion and meaningful failure paths.
  • Contracts/generated metadata checked; no changes needed.
  • Baseline/candidate output evidence included above.
  • Final diff checked for unrelated changes and unsupported claims.

🔄 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/928 **Author:** [@morluto](https://github.com/morluto) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/process-output-close` --- ### 📝 Commits (1) - [`5cb1f5e`](https://github.com/morluto/rea/commit/5cb1f5e35154f8626e25ffa6a5fcf149409ca090) fix(process): retain provider output until streams close ### 📊 Changes **5 files changed** (+149 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/hopper/LinuxPrivateDisplayProbe.ts` (+4 -4) 📝 `src/javascript/recovery/WakaruCommand.test.ts` (+114 -1) 📝 `src/javascript/recovery/WakaruCommand.ts` (+1 -1) 📝 `tests/boundary/providers/hopper/linuxPrivateDisplay.test.ts` (+21 -0) ➕ `tests/fixtures/x11ProbeOutput.py` (+9 -0) </details> ### 📄 Description ## Summary Retain complete Wakaru command output and private-display probe diagnostics when stdout/stderr remain open after the launcher exits. This confirmed producer/consumer boundary failure was found during the whole-codebase audit; no separate issue is linked. ## Problem and expected behavior Node's process `exit` event does not establish complete output: inherited streams can remain open while a child writes its final bytes. Both callers waited for exit, then detached capture or performed group cleanup before consuming the snapshot. A source-owned producer writing `first`, exiting its launcher, and later writing `last` therefore returned only `first`; Wakaru also dropped late stderr. Late diagnostics could bypass its byte-limit check. Successful output collection must wait for stream closure while preserving the existing execution deadline, cancellation, resource checks, and cleanup requirements. ## Change and scope Use `ProviderProcessSupervisor.waitForOutputClose` in the existing Wakaru polling loop and bounded private-display probe wait. Keep the same budgets and cleanup paths. The supervisor, process authority, and provider protocols are unchanged. ## Contract and boundary impact - Semantic owner/earliest changed stage: recovery command and private-display adapter output settlement. - CLI/MCP/tool catalog: schemas and inventory unchanged; returned diagnostics now include final bytes. - Provider/platform compatibility: existing Wakaru Linux x64 and Hopper Linux bring-your-own boundaries unchanged. - Evidence/artifact/provenance: preserve complete captured stdout/stderr, exit status, command, and arguments. - Execution/authorization/cleanup: existing owned-group cleanup, timeout, and cancellation remain in force. - Generated metadata/package/installation: none; generated documents checked. ## Evidence and regression coverage Executed baseline/candidate comparison on macOS arm64/Node 24.18.0 using actual owned processes, without asserting Wakaru or Xvfb engine behavior: - Injected Wakaru launcher runs a source-owned Node process group. Its child inherits stdout/stderr and writes after root exit. Baseline returns `stdout: "first", stderr: ""`; candidate returns `stdout: "firstlast", stderr: "diagnostic"` after verified group cleanup. - Public `runLinuxPrivateDisplayProbe` runs a source-owned Python helper whose child inherits stderr. Baseline reports 5 bytes (`first`); candidate reports all 9 bytes (`firstlast`). Regression tests cover late stdout/stderr, a late diagnostic byte-limit violation, deadline expiry, cancellation with open streams, and the actual inherited-stderr producer. ## Validation performed - `npm run build:cached` — passed. - `npm run check:fast` — passed. - `npm run docs:check` — passed. - `npm run test:focused -- src/javascript/recovery/WakaruCommand.test.ts src/process/ProviderProcessOutput.test.ts tests/boundary/providers/hopper/linuxPrivateDisplay.test.ts tests/boundary/javascript-recovery/wakaruIntegration.test.ts` — 15 passed; 23 Linux-only integration cases skipped on this macOS host. - Standalone compiled real owned-process baseline/candidate reproduction — passed as described above. - Independent Standards and Spec reviews — no findings. ## Compatibility, safety, and release - Breaking changes/migrations: none. - Real Wakaru/Xvfb/Linux Hopper verification: not performed; the matching engine lanes require Linux and their configured toolchains. The actual-process checks prove stream settlement only. - Real macOS Hopper/Ghidra verification: not applicable to these Linux adapter callers. - Release metadata/security/privacy/authority: unchanged. ## Review checklist - [x] One focused outcome with Conventional Commit title. - [x] Reason for no separate issue stated above. - [x] Tests cover output completion and meaningful failure paths. - [x] Contracts/generated metadata checked; no changes needed. - [x] Baseline/candidate output evidence included above. - [x] Final diff checked for unrelated changes and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:17:46 +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#2357
No description provided.