[PR #1713] [MERGED] fix(native): retain failed command cleanup owners #4772

Closed
opened 2026-10-31 00:54:54 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/native-command-cleanup-owner-20261011


📝 Commits (1)

  • b70c5cd fix(native): retain failed command cleanup owners

📊 Changes

6 files changed (+724 additions, -41 deletions)

View changed files

📝 src/artifacts/MachOSliceArtifactReader.test.ts (+145 -1)
📝 src/artifacts/MachOSliceArtifactReader.ts (+70 -3)
📝 src/native/CommandRunner.ts (+174 -26)
📝 src/native/NativeMacOSProvider.ts (+69 -10)
📝 tests/boundary/providers/native/nativeCommandTermination.test.ts (+151 -1)
📝 tests/boundary/providers/native/nativeProvider.test.ts (+115 -0)

📄 Description

Native command capture kept partial output and cleanup diagnostics but discarded the typed process supervisor when converting OwnedCommandFailure. The xcrun resolver wrapped that failure again, also losing the owner. The runner now retains failed owners from both launches, retries every retained supervisor before another command, and reports every still-incomplete cleanup without discarding resources or reasons.

Native clients and Mach-O slice readers wait for their own launched commands at close before the final cleanup retry. Closed consumers cannot launch more commands; cleanup failures remain retryable on subsequent close. The shared runner stays usable by other clients, and active commands are not cancelled by another client's close. Named failure options carry cleanup ownership without adding positional constructor arguments. Reader cleanup uses an explicit failure observation instead of an undefined sentinel; even an undefined rejection now reports cleanup failure and still closes the source. Remove the weaker standalone projection test after the concurrent-close workflow covers that same retry behavior.

Validation: 42 focused native runner/provider/slice-reader tests, including real Linux child-process output, selected environment, cancellation, signal termination and output-budget controls. Injected launch/cleanup failures exercise the production capture/supervisor boundary, xcrun resolution, two retained owners, blocked relaunch, recovery, concurrent close and complete diagnostic projection. A controlled red/green probe removed only owner transfer and reproduced the missing-owner assertion, then restored the source. Pinned single-thread typecheck, full lint/module boundaries, architecture guards and formatting passed. Built REA also passed complete CLI/SDK-MCP JavaScript controls on a 6,686-byte target. A 2,197-byte ZIP artifact containing a tiny ELF also passed complete CLI/SDK-MCP result parity and session close; the ELF CLI inspection succeeded separately. Actual macOS Xcode tools and a real kernel cleanup failure were not reproduced locally; injected provider tests do not establish those behaviors.

Refs #740.


🔄 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/1713 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/native-command-cleanup-owner-20261011` --- ### 📝 Commits (1) - [`b70c5cd`](https://github.com/morluto/rea/commit/b70c5cd0004ac12efe49a9ccaccbea75465f836b) fix(native): retain failed command cleanup owners ### 📊 Changes **6 files changed** (+724 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/MachOSliceArtifactReader.test.ts` (+145 -1) 📝 `src/artifacts/MachOSliceArtifactReader.ts` (+70 -3) 📝 `src/native/CommandRunner.ts` (+174 -26) 📝 `src/native/NativeMacOSProvider.ts` (+69 -10) 📝 `tests/boundary/providers/native/nativeCommandTermination.test.ts` (+151 -1) 📝 `tests/boundary/providers/native/nativeProvider.test.ts` (+115 -0) </details> ### 📄 Description Native command capture kept partial output and cleanup diagnostics but discarded the typed process supervisor when converting `OwnedCommandFailure`. The xcrun resolver wrapped that failure again, also losing the owner. The runner now retains failed owners from both launches, retries every retained supervisor before another command, and reports every still-incomplete cleanup without discarding resources or reasons. Native clients and Mach-O slice readers wait for their own launched commands at close before the final cleanup retry. Closed consumers cannot launch more commands; cleanup failures remain retryable on subsequent close. The shared runner stays usable by other clients, and active commands are not cancelled by another client's close. Named failure options carry cleanup ownership without adding positional constructor arguments. Reader cleanup uses an explicit failure observation instead of an undefined sentinel; even an undefined rejection now reports cleanup failure and still closes the source. Remove the weaker standalone projection test after the concurrent-close workflow covers that same retry behavior. Validation: 42 focused native runner/provider/slice-reader tests, including real Linux child-process output, selected environment, cancellation, signal termination and output-budget controls. Injected launch/cleanup failures exercise the production capture/supervisor boundary, xcrun resolution, two retained owners, blocked relaunch, recovery, concurrent close and complete diagnostic projection. A controlled red/green probe removed only owner transfer and reproduced the missing-owner assertion, then restored the source. Pinned single-thread typecheck, full lint/module boundaries, architecture guards and formatting passed. Built REA also passed complete CLI/SDK-MCP JavaScript controls on a 6,686-byte target. A 2,197-byte ZIP artifact containing a tiny ELF also passed complete CLI/SDK-MCP result parity and session close; the ELF CLI inspection succeeded separately. Actual macOS Xcode tools and a real kernel cleanup failure were not reproduced locally; injected provider tests do not establish those behaviors. Refs #740. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:54:54 +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#4772
No description provided.