[PR #1139] [MERGED] fix(process): avoid cold ownership helper deadline exhaustion #2676

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

📋 Pull Request Information

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

Base: main ← Head: codex/fix-macos-ownership-helper-cold-start


📝 Commits (4)

  • d7fcf24 fix(process): avoid cold ownership helper deadline exhaustion
  • d7c8000 test(process): fix cold ownership test deadlines and cleanup
  • 7c8b2bc fix(process): isolate Swift cache overrides and retain diagnostics
  • d652f4c test(electron): assert blank path rejection without trim assumptions

📊 Changes

6 files changed (+156 additions, -16 deletions)

View changed files

📝 src/javascript/sourceMaps/SourceMapCommand.ts (+21 -0)
📝 src/process/DarwinProcessRunTokenReader.ts (+8 -9)
📝 tests/acceptance/applications/electronBlankPathCli.test.ts (+1 -1)
📝 tests/acceptance/webSourceLocationCli.test.ts (+10 -3)
📝 tests/boundary/javascript/sourceMapDecoder.test.ts (+27 -1)
📝 tests/boundary/process/darwinProcessRunTokenReader.test.ts (+89 -2)

📄 Description

Summary

  • let Swift use its compiler-managed module cache instead of rebuilding macOS system modules in a fresh per-process cache for every ownership helper
  • prepare process ownership inspection before starting the source-map codec's advertised 20-second execution deadline
  • align the acceptance harness with legitimate first-time ownership-helper preparation while preserving cancellation and cleanup behavior

Problem and behavior change

On a cold macOS CLI process, compiling the native process-ownership helper took about 18.6 seconds. That prerequisite ran inside the source-map codec's 20-second deadline and the acceptance harness's 15-second subprocess deadline, so valid source-map work could be cancelled before the codec launched.

This change preserves the helper's PID/start-identity and run-token ownership checks, but avoids intentionally cold system-module compilation on every REA process. Ownership preparation remains abort-aware and completes before the codec-specific deadline begins. Preparation failures retain the source-map operation, map path, failed phase, and underlying error.

Fixes #1137.

Verification

  • npm run test:focused -- tests/boundary/process/darwinProcessRunTokenReader.test.ts tests/boundary/javascript/sourceMapDecoder.test.ts
  • npm run test:focused -- tests/acceptance/webSourceLocationCli.test.ts
  • npm run check:fast
  • npm run verify:package
  • installed package advertised 138 MCP tools and reported verified process lineage
  • real cancellation removed the owned codec process and private request root

Coverage limits

The exact CLI/stdio MCP parity acceptance was run on a warm compiler-cache path and passed. A separate real cold ownership preparation took about 18.6 seconds and was followed by successful real codec execution. Deterministic deadline-separation, compiler-cache, cancellation, and cleanup regressions cover the cold behavior independently.

Optional Hopper, Ghidra, and IDA verification was not performed; those providers are not involved in this process/source-map boundary change.


🔄 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/1139 **Author:** [@MegaPhoenix92](https://github.com/MegaPhoenix92) **Created:** 10/8/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/fix-macos-ownership-helper-cold-start` --- ### 📝 Commits (4) - [`d7fcf24`](https://github.com/morluto/rea/commit/d7fcf2443d8e750ba8b0042714c79ba4eabbee9a) fix(process): avoid cold ownership helper deadline exhaustion - [`d7c8000`](https://github.com/morluto/rea/commit/d7c8000e3863a3df0d148b514f11bcf4d1845ba5) test(process): fix cold ownership test deadlines and cleanup - [`7c8b2bc`](https://github.com/morluto/rea/commit/7c8b2bc076fb5ea6ca0d05997260d5a9c1e4cb89) fix(process): isolate Swift cache overrides and retain diagnostics - [`d652f4c`](https://github.com/morluto/rea/commit/d652f4cb1c5ef759c24c4006abe1a57dbb6b710a) test(electron): assert blank path rejection without trim assumptions ### 📊 Changes **6 files changed** (+156 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `src/javascript/sourceMaps/SourceMapCommand.ts` (+21 -0) 📝 `src/process/DarwinProcessRunTokenReader.ts` (+8 -9) 📝 `tests/acceptance/applications/electronBlankPathCli.test.ts` (+1 -1) 📝 `tests/acceptance/webSourceLocationCli.test.ts` (+10 -3) 📝 `tests/boundary/javascript/sourceMapDecoder.test.ts` (+27 -1) 📝 `tests/boundary/process/darwinProcessRunTokenReader.test.ts` (+89 -2) </details> ### 📄 Description ## Summary - let Swift use its compiler-managed module cache instead of rebuilding macOS system modules in a fresh per-process cache for every ownership helper - prepare process ownership inspection before starting the source-map codec's advertised 20-second execution deadline - align the acceptance harness with legitimate first-time ownership-helper preparation while preserving cancellation and cleanup behavior ## Problem and behavior change On a cold macOS CLI process, compiling the native process-ownership helper took about 18.6 seconds. That prerequisite ran inside the source-map codec's 20-second deadline and the acceptance harness's 15-second subprocess deadline, so valid source-map work could be cancelled before the codec launched. This change preserves the helper's PID/start-identity and run-token ownership checks, but avoids intentionally cold system-module compilation on every REA process. Ownership preparation remains abort-aware and completes before the codec-specific deadline begins. Preparation failures retain the source-map operation, map path, failed phase, and underlying error. Fixes #1137. ## Verification - `npm run test:focused -- tests/boundary/process/darwinProcessRunTokenReader.test.ts tests/boundary/javascript/sourceMapDecoder.test.ts` - `npm run test:focused -- tests/acceptance/webSourceLocationCli.test.ts` - `npm run check:fast` - `npm run verify:package` - installed package advertised 138 MCP tools and reported verified process lineage - real cancellation removed the owned codec process and private request root ## Coverage limits The exact CLI/stdio MCP parity acceptance was run on a warm compiler-cache path and passed. A separate real cold ownership preparation took about 18.6 seconds and was followed by successful real codec execution. Deterministic deadline-separation, compiler-cache, cancellation, and cleanup regressions cover the cold behavior independently. Optional Hopper, Ghidra, and IDA verification was not performed; those providers are not involved in this process/source-map boundary change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:08:56 +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#2676
No description provided.