[PR #1357] [CLOSED] fix(process): handle launcher exit races and retain CommonJS regressions #2823

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1357
Author: @Y0UW1SH
Created: 10/9/2026
Status: ❌ Closed

Base: main ← Head: fix/commonjs-exports-reassignment


📝 Commits (10+)

  • f6781da fix(javascript): correct CommonJS exports reassignment
  • 199a621 fix(javascript): limit export recovery to CommonJS alias chains
  • 2204617 fix(process): settle launcher exit before rejecting stale identity
  • 665749c fix(process): retain detached cleanup uncertainty and validate current main
  • efb9054 fix(javascript): resolve CommonJS aliases through stable lexical bindings
  • 889c17b fix(javascript): preserve body parameter origins and stabilize verifier cleanup
  • 12e45d6 chore: merge main into CommonJS exports fix
  • f28feba fix(process): retain detached lineage during launcher refresh
  • a1537d3 fix(ci): merge upstream cleanup fixes into CommonJS branch
  • 583f048 fix(ci): compare decoded reference-source error paths

📊 Changes

8 files changed (+811 additions, -80 deletions)

View changed files

➕ scripts/fixtures/binary-layout-limited-python.c (+61 -0)
📝 scripts/verify-binary-layout.mjs (+84 -40)
📝 src/process/ProcessOwnership.ts (+57 -13)
📝 src/process/ProcessOwnership.validation.test.ts (+187 -22)
📝 src/process/ProcessOwnershipProcessTree.ts (+5 -4)
➕ tests/boundary/cli/commonJsExportsReassignment.test.ts (+73 -0)
📝 tests/boundary/cli/referenceSourceImportStatus.test.ts (+5 -1)
➕ tests/boundary/mcp/commonJsExportsReassignmentMcp.test.ts (+339 -0)

📄 Description

When a process-table snapshot races launcher exit, its stale command can make otherwise owned cleanup fail. This PR refreshes that snapshot only after a fresh table proves that the launcher PID has exited. Surviving or reused PIDs, unavailable inspection, foreign group members, and detached continuations retain cleanup uncertainty and the existing ownership checks.

The binary-layout verifier keeps its configured launcher alive while its resource-limited Python child runs, preserving process-group identity through timeout cleanup. Its memory fixture forces an allocation failure rather than racing section processing against a deadline.

The CommonJS correction is now present in upstream main, including assignment-chain and captured-receiver handling. This branch retains that implementation unchanged and adds CLI/MCP regressions using Node's real CommonJS loader as the oracle. Expectations now recognize discarded named exports as missing and resolve nested local assignment chains. A CLI regression also checks decoded error-message paths, including literal-backslash POSIX filenames.

The branch includes upstream main at f88c99021b88ce67e513025901f57478d8107d0c through merge commit 8d1dfc986a52e09b78443b025ce812c3d75f3dc1. Both histories are retained; no force push was used. GitHub reports the branch mergeable.

Validation with Node 24.18.0 and npm 11.16.0:

  • Runtime compilation and packaged skill generation pass.
  • npm run check:ci passes all eight tasks and architecture guards, including typechecking, lint, formatting, unused-code checks, metadata, duplication and debt-marker checks.
  • npm run docs:check passes.
  • 239 JavaScript domain regressions and 71 process-ownership tests pass.
  • One native host-identity test and the compiled CLI/MCP checks cannot be verified in this container: its PID namespace makes process inspection fail with fatal library error, lookup self. Those checks require GitHub's native runner; no production fallback or test assertion was weakened to bypass the restriction.

The PR remains draft while CI for the updated commit runs.


🔄 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/1357 **Author:** [@Y0UW1SH](https://github.com/Y0UW1SH) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/commonjs-exports-reassignment` --- ### 📝 Commits (10+) - [`f6781da`](https://github.com/morluto/rea/commit/f6781da3428c38dc19630c2750a280a759aed42f) fix(javascript): correct CommonJS exports reassignment - [`199a621`](https://github.com/morluto/rea/commit/199a621c5b04a7d161efe320e73e2e1d392d737c) fix(javascript): limit export recovery to CommonJS alias chains - [`2204617`](https://github.com/morluto/rea/commit/2204617753acc76d23bd3631f0b4dcd19fba9c7f) fix(process): settle launcher exit before rejecting stale identity - [`665749c`](https://github.com/morluto/rea/commit/665749ca7aebe1d6272282bf94973c522adfc2fd) fix(process): retain detached cleanup uncertainty and validate current main - [`efb9054`](https://github.com/morluto/rea/commit/efb9054e8371070226fd48096d5ab4f53896103a) fix(javascript): resolve CommonJS aliases through stable lexical bindings - [`889c17b`](https://github.com/morluto/rea/commit/889c17ba9d32606217e9629586b3126f28f59752) fix(javascript): preserve body parameter origins and stabilize verifier cleanup - [`12e45d6`](https://github.com/morluto/rea/commit/12e45d6fc61788f787891a73c2dc2bf86cb22c19) chore: merge main into CommonJS exports fix - [`f28feba`](https://github.com/morluto/rea/commit/f28febacbf6aaa51bb927baddcf90ec407b252db) fix(process): retain detached lineage during launcher refresh - [`a1537d3`](https://github.com/morluto/rea/commit/a1537d3c57bc11a6d60858f1313123b729b7e4fc) fix(ci): merge upstream cleanup fixes into CommonJS branch - [`583f048`](https://github.com/morluto/rea/commit/583f048230060187584bb28619e2bfca975dacfb) fix(ci): compare decoded reference-source error paths ### 📊 Changes **8 files changed** (+811 additions, -80 deletions) <details> <summary>View changed files</summary> ➕ `scripts/fixtures/binary-layout-limited-python.c` (+61 -0) 📝 `scripts/verify-binary-layout.mjs` (+84 -40) 📝 `src/process/ProcessOwnership.ts` (+57 -13) 📝 `src/process/ProcessOwnership.validation.test.ts` (+187 -22) 📝 `src/process/ProcessOwnershipProcessTree.ts` (+5 -4) ➕ `tests/boundary/cli/commonJsExportsReassignment.test.ts` (+73 -0) 📝 `tests/boundary/cli/referenceSourceImportStatus.test.ts` (+5 -1) ➕ `tests/boundary/mcp/commonJsExportsReassignmentMcp.test.ts` (+339 -0) </details> ### 📄 Description When a process-table snapshot races launcher exit, its stale command can make otherwise owned cleanup fail. This PR refreshes that snapshot only after a fresh table proves that the launcher PID has exited. Surviving or reused PIDs, unavailable inspection, foreign group members, and detached continuations retain cleanup uncertainty and the existing ownership checks. The binary-layout verifier keeps its configured launcher alive while its resource-limited Python child runs, preserving process-group identity through timeout cleanup. Its memory fixture forces an allocation failure rather than racing section processing against a deadline. The CommonJS correction is now present in upstream main, including assignment-chain and captured-receiver handling. This branch retains that implementation unchanged and adds CLI/MCP regressions using Node's real CommonJS loader as the oracle. Expectations now recognize discarded named exports as missing and resolve nested local assignment chains. A CLI regression also checks decoded error-message paths, including literal-backslash POSIX filenames. The branch includes upstream main at `f88c99021b88ce67e513025901f57478d8107d0c` through merge commit `8d1dfc986a52e09b78443b025ce812c3d75f3dc1`. Both histories are retained; no force push was used. GitHub reports the branch mergeable. Validation with Node 24.18.0 and npm 11.16.0: - Runtime compilation and packaged skill generation pass. - `npm run check:ci` passes all eight tasks and architecture guards, including typechecking, lint, formatting, unused-code checks, metadata, duplication and debt-marker checks. - `npm run docs:check` passes. - 239 JavaScript domain regressions and 71 process-ownership tests pass. - One native host-identity test and the compiled CLI/MCP checks cannot be verified in this container: its PID namespace makes process inspection fail with `fatal library error, lookup self`. Those checks require GitHub's native runner; no production fallback or test assertion was weakened to bypass the restriction. The PR remains draft while [CI for the updated commit](https://github.com/morluto/rea/actions/runs/38104527478) runs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:10:41 +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#2823
No description provided.