[PR #1814] [MERGED] perf(mcp): reduce Windows startup module resolution #4831

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

📋 Pull Request Information

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

Base: main ← Head: perf/windows-startup-packaging-1685


📝 Commits (3)

  • e41e588 perf(mcp): bundle internal modules to reduce Windows startup I/O
  • 44f1fe7 Merge remote-tracking branch 'origin/main' into perf/windows-startup-packaging-1685
  • 2bc0dfa Merge remote-tracking branch 'origin/main' into perf/windows-startup-packaging-1685

📊 Changes

9 files changed (+240 additions, -30 deletions)

View changed files

📝 package-lock.json (+3 -20)
📝 package.json (+6 -5)
➕ scripts/bundle-mcp-runtime.d.mts (+1 -0)
➕ scripts/bundle-mcp-runtime.mjs (+104 -0)
📝 scripts/prepack.mjs (+1 -0)
📝 scripts/rea.mjs (+4 -4)
📝 tests/boundary/cli/dispatcher.test.ts (+2 -1)
➕ tests/boundary/process/mcpBundle.test.ts (+118 -0)
📝 turbo.json (+1 -0)

📄 Description

Windows MCP initialization can exceed the SDK’s default 60-second deadline. The Windows trace investigated in #1685 showed substantial module filesystem resolution.

Bundle REA’s internal MCP modules and route the packaged dispatcher to that entrypoint. Dependencies remain external and dynamic imports remain lazy. Original compiled files stay available to CLI and worker entrypoints; bundled code retains their module URLs for resources, native helpers and package resolution. Unsupported import metadata fails during the build.

Verified at 2bc0dfad7, based on main cdd9fe716:

Windows initialization Original entry Bundled entry
AB pair 35.26 s 9.55 s
BA pair 28.66 s 14.53 s

These are two observed pairs, not a stable latency estimate. Fresh processes used Node 24.18.0, SDK 2.3.1, two CPUs, BelowNormal priority and the unchanged 60-second initialization deadline. All four returned the same 171-tool catalog (1,967,836 bytes, identical SHA-256). First-call client validator compilation remains a separate cost.

Actual offline Windows installation completed through a guarded npm install repair after the bounded npm ci attempt expired. Every installed REA file matches its archive: 1,184 baseline files and 1,251 candidate files. Both packages pass normal SDK session, JavaScript worker analysis and subsequent ping; the full normalized analysis result and Evidence ID match, inputs stay unchanged and owned runtime files/processes are cleaned up. Linux passes the same public workflow. This does not verify Ghidra cold analysis or establish a memory improvement.

build:cached, normal npm pack/prepack, four process/dispatcher regression cases, check:fast, lint and docs checks pass under the 2,304 MiB family limit. Full local typechecking uses the compiler’s single-threaded mode. All 31 exact-head CI checks pass, including native package baselines.

Refs #1685.


🔄 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/1814 **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:** `perf/windows-startup-packaging-1685` --- ### 📝 Commits (3) - [`e41e588`](https://github.com/morluto/rea/commit/e41e58833169ddf99b9bb82c7a9bb4ab878464a1) perf(mcp): bundle internal modules to reduce Windows startup I/O - [`44f1fe7`](https://github.com/morluto/rea/commit/44f1fe78b69bd8959cff48439cd61b4d80f908fb) Merge remote-tracking branch 'origin/main' into perf/windows-startup-packaging-1685 - [`2bc0dfa`](https://github.com/morluto/rea/commit/2bc0dfad7af95612a413415e188e05ad83451737) Merge remote-tracking branch 'origin/main' into perf/windows-startup-packaging-1685 ### 📊 Changes **9 files changed** (+240 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `package-lock.json` (+3 -20) 📝 `package.json` (+6 -5) ➕ `scripts/bundle-mcp-runtime.d.mts` (+1 -0) ➕ `scripts/bundle-mcp-runtime.mjs` (+104 -0) 📝 `scripts/prepack.mjs` (+1 -0) 📝 `scripts/rea.mjs` (+4 -4) 📝 `tests/boundary/cli/dispatcher.test.ts` (+2 -1) ➕ `tests/boundary/process/mcpBundle.test.ts` (+118 -0) 📝 `turbo.json` (+1 -0) </details> ### 📄 Description Windows MCP initialization can exceed the SDK’s default 60-second deadline. The Windows trace investigated in #1685 showed substantial module filesystem resolution. Bundle REA’s internal MCP modules and route the packaged dispatcher to that entrypoint. Dependencies remain external and dynamic imports remain lazy. Original compiled files stay available to CLI and worker entrypoints; bundled code retains their module URLs for resources, native helpers and package resolution. Unsupported import metadata fails during the build. Verified at `2bc0dfad7`, based on main `cdd9fe716`: | Windows initialization | Original entry | Bundled entry | | --- | ---: | ---: | | AB pair | 35.26 s | 9.55 s | | BA pair | 28.66 s | 14.53 s | These are two observed pairs, not a stable latency estimate. Fresh processes used Node 24.18.0, SDK 2.3.1, two CPUs, BelowNormal priority and the unchanged 60-second initialization deadline. All four returned the same 171-tool catalog (1,967,836 bytes, identical SHA-256). First-call client validator compilation remains a separate cost. Actual offline Windows installation completed through a guarded `npm install` repair after the bounded `npm ci` attempt expired. Every installed REA file matches its archive: 1,184 baseline files and 1,251 candidate files. Both packages pass normal SDK session, JavaScript worker analysis and subsequent ping; the full normalized analysis result and Evidence ID match, inputs stay unchanged and owned runtime files/processes are cleaned up. Linux passes the same public workflow. This does not verify Ghidra cold analysis or establish a memory improvement. `build:cached`, normal `npm pack`/prepack, four process/dispatcher regression cases, `check:fast`, lint and docs checks pass under the 2,304 MiB family limit. Full local typechecking uses the compiler’s single-threaded mode. All 31 exact-head CI checks pass, including native package baselines. Refs #1685. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:55:31 +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#4831
No description provided.