[GH-ISSUE #4522] [Bug] Darwin helper cleanup rejection replaces the compiler failure #1799

Closed
opened 2026-10-16 21:10:21 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @morluto on GitHub (Oct 16, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/4522

Before submitting

  • Searched current open issue/PR bodies and closed related cleanup reports.
  • Removed credentials and private target data.

Area

Native analysis or decompilation

Observed behavior

Source-only finding: runCompilation in src/process/DarwinProcessRunTokenReader.ts catches the compilation failure, awaits cleanupRoot(operationRoot) / rm, and only then rethrows the original cause. If removal rejects, JavaScript propagates that rejection and discards the original compiler failure and its structured command outcome. The retained root helps later retry, but the returned primary diagnostic is incorrect.

Reproduction

NOT_ENOUGH_INFO: no native Swift/compiler cleanup fault injected. Inspected runCompilation catch around lines 370-379 and cleanupRoot ownership release-after-success. Proposed control: fail the compiler, fail owned root removal once, assert both outcomes and retained owner, restore removal and retry cleanup.

Expected behavior

Preserve the physical compilation failure and report cleanup uncertainty separately, keeping the exact retained root owner. Successful retry should resolve cleanup uncertainty without erasing the original command outcome (AGENTS.md ownership/completion invariants).

Impact and scope

Source-derived diagnostic provenance loss in macOS process-ownership helper preparation shared by providers/capture. Real-world frequency is NOT_ENOUGH_INFO. Separate from #1173, which moved Swift intermediates under an owned root; this is failure composition when removing that root fails. #4517 cancellation provenance work led to this finding.

REA version

Source base fe2a398dd9 plus uncommitted audit changes; referenced ownership logic remains present.

Runtime and platform

Source review on macOS arm64 / Node 24.18.0. No native-engine or native Windows fault verification.

Target and artifact context

Source inspection only; no private artifact.

Interface

Other (shared provider/process boundary).

Earliest failure stage

Cleanup, cancellation, or lifecycle.

Originally created by @morluto on GitHub (Oct 16, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/4522 ### Before submitting - [x] Searched current open issue/PR bodies and closed related cleanup reports. - [x] Removed credentials and private target data. ### Area Native analysis or decompilation ### Observed behavior **Source-only finding:** `runCompilation` in `src/process/DarwinProcessRunTokenReader.ts` catches the compilation failure, awaits `cleanupRoot(operationRoot)` / `rm`, and only then rethrows the original cause. If removal rejects, JavaScript propagates that rejection and discards the original compiler failure and its structured command outcome. The retained root helps later retry, but the returned primary diagnostic is incorrect. ### Reproduction NOT_ENOUGH_INFO: no native Swift/compiler cleanup fault injected. Inspected `runCompilation` catch around lines 370-379 and `cleanupRoot` ownership release-after-success. Proposed control: fail the compiler, fail owned root removal once, assert both outcomes and retained owner, restore removal and retry cleanup. ### Expected behavior Preserve the physical compilation failure and report cleanup uncertainty separately, keeping the exact retained root owner. Successful retry should resolve cleanup uncertainty without erasing the original command outcome (AGENTS.md ownership/completion invariants). ### Impact and scope Source-derived diagnostic provenance loss in macOS process-ownership helper preparation shared by providers/capture. Real-world frequency is NOT_ENOUGH_INFO. Separate from #1173, which moved Swift intermediates under an owned root; this is failure composition when removing that root fails. #4517 cancellation provenance work led to this finding. ### REA version Source base fe2a398dd9ab290ba6cb3411403d319cec8d07a2 plus uncommitted audit changes; referenced ownership logic remains present. ### Runtime and platform Source review on macOS arm64 / Node 24.18.0. No native-engine or native Windows fault verification. ### Target and artifact context Source inspection only; no private artifact. ### Interface Other (shared provider/process boundary). ### Earliest failure stage Cleanup, cancellation, or lifecycle.
Author
Owner

@kaoru0822-kitauji commented on GitHub (Oct 17, 2026):

This appears fixed on current main (2092f90b7) by 9d940c2f2 and 0f61261e0 (the commit message references this issue).

Executed on main 2092f90b7 (macOS arm64, Node 24): npm run test:focused -- … including tests/process-global/darwinCompilerCleanup.test.ts (14 tests), tests/boundary/process/darwinProcessRunTokenReader.test.ts (32 tests) — all passed (205/205 across the 13 files checked in this batch).

I did not rerun the original fault injection from the report separately; the tests above are the regressions added with the fix. Leaving closure to a maintainer.

<!-- gh-comment-id:6232497980 --> @kaoru0822-kitauji commented on GitHub (Oct 17, 2026): This appears fixed on current main (2092f90b7) by 9d940c2f2 and 0f61261e0 (the commit message references this issue). Executed on main 2092f90b7 (macOS arm64, Node 24): `npm run test:focused -- …` including `tests/process-global/darwinCompilerCleanup.test.ts` (14 tests), `tests/boundary/process/darwinProcessRunTokenReader.test.ts` (32 tests) — all passed (205/205 across the 13 files checked in this batch). I did not rerun the original fault injection from the report separately; the tests above are the regressions added with the fix. Leaving closure to a maintainer.
Author
Owner

@morluto commented on GitHub (Oct 18, 2026):

Closing as fixed on main after reconciling this report with the landed owner/consumer changes.

  • 0f61261e0: fix(native): retain owned preparation failures through command adapters. Retain producer-owned compiler output and cleanup markers through xcrun resolution and native failure projection. Keep physical preparation failures primary and preserve separate command deadline classification for interrupted preparation. Omitted output facts stay unknown; client close does not resolve foreign helper cleanup. Include CLI failure output in native regression reports.
  • 9d940c2f2: fix(ghidra): preserve lifecycle ownership and failure provenance. Retain snapshot, endpoint, launch rollback and compiler cleanup owners. Join request finalization and cleanup cancellation. Preserve bounded compiler output and original byte counts through capture and Ghidra failures. Normalize execFile cancellation once at its producer.

Evidence scope: this closure uses the landed source, regression coverage and validation already recorded in the linked commits/thread. No new local tests or native-provider reproduction were run during this backlog pass; previously documented platform and real-provider gaps still apply.

<!-- gh-comment-id:6256007293 --> @morluto commented on GitHub (Oct 18, 2026): <!-- rea-backlog-reconciliation-2026-10-19-4522 --> Closing as fixed on `main` after reconciling this report with the landed owner/consumer changes. - [0f61261e0](https://github.com/morluto/rea/commit/0f61261e011ab520773fb51c07a494c98b6a73e5): fix(native): retain owned preparation failures through command adapters. Retain producer-owned compiler output and cleanup markers through xcrun resolution and native failure projection. Keep physical preparation failures primary and preserve separate command deadline classification for interrupted preparation. Omitted output facts stay unknown; client close does not resolve foreign helper cleanup. Include CLI failure output in native regression reports. - [9d940c2f2](https://github.com/morluto/rea/commit/9d940c2f284cc6f75b27900336e52ceeba4aa2af): fix(ghidra): preserve lifecycle ownership and failure provenance. Retain snapshot, endpoint, launch rollback and compiler cleanup owners. Join request finalization and cleanup cancellation. Preserve bounded compiler output and original byte counts through capture and Ghidra failures. Normalize execFile cancellation once at its producer. Evidence scope: this closure uses the landed source, regression coverage and validation already recorded in the linked commits/thread. No new local tests or native-provider reproduction were run during this backlog pass; previously documented platform and real-provider gaps still apply.
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#1799
No description provided.