[PR #2276] [CLOSED] fix(electron): reject non-executable files before Playwright launch #5131

Closed
opened 2026-10-31 01:04:13 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2276
Author: @chqcjq
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: fix/electron-launch-validation


📝 Commits (1)

  • 35f7e62 fix(electron): reject non-executable files before Playwright launch

📊 Changes

1 file changed (+36 additions, -1 deletions)

View changed files

📝 src/browser/PlaywrightElectronActiveProvider.ts (+36 -1)

📄 Description

Fixes #2269.

Problem

capture_electron_scenario terminates the whole REA process when executable_path names an existing file that is not a launchable Electron executable. The MCP server exits with code 1, and the client sees Error: Connection closed. All session state is lost.

Root cause

Playwright's _electron.launch() spawns the process and waits for Debugger listening on and DevTools listening on output patterns. When the executable is a non-executable file (e.g. a text file), the spawned process exits immediately without producing the expected output. Playwright's internal processLauncher then triggers process.exit() through its cleanup path, killing the entire REA server process.

Fix

canonicalPaths now validates that the executable path is a regular file and, on Windows, that it starts with a valid PE header (MZ + PE\0\0 signature). A non-executable file is rejected with target_not_allowed before launch is called, so Playwright never attempts to spawn it.

Verification

  • rea capture-electron-scenario with a text file as executable_path now returns {"error":"Electron analysis failed","code":"target_unavailable","category":"unavailable",...} instead of crashing the process.
  • npm run check, docs:check, and verify:test-discovery (943 files) all pass.

🔄 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/2276 **Author:** [@chqcjq](https://github.com/chqcjq) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/electron-launch-validation` --- ### 📝 Commits (1) - [`35f7e62`](https://github.com/morluto/rea/commit/35f7e6263a6175dcf891c10da112a3edb08dd07a) fix(electron): reject non-executable files before Playwright launch ### 📊 Changes **1 file changed** (+36 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/browser/PlaywrightElectronActiveProvider.ts` (+36 -1) </details> ### 📄 Description Fixes #2269. ## Problem `capture_electron_scenario` terminates the whole REA process when `executable_path` names an existing file that is not a launchable Electron executable. The MCP server exits with code 1, and the client sees `Error: Connection closed`. All session state is lost. ## Root cause Playwright's `_electron.launch()` spawns the process and waits for `Debugger listening on` and `DevTools listening on` output patterns. When the executable is a non-executable file (e.g. a text file), the spawned process exits immediately without producing the expected output. Playwright's internal `processLauncher` then triggers `process.exit()` through its cleanup path, killing the entire REA server process. ## Fix `canonicalPaths` now validates that the executable path is a regular file and, on Windows, that it starts with a valid PE header (MZ + PE\0\0 signature). A non-executable file is rejected with `target_not_allowed` before `launch` is called, so Playwright never attempts to spawn it. ## Verification - `rea capture-electron-scenario` with a text file as `executable_path` now returns `{"error":"Electron analysis failed","code":"target_unavailable","category":"unavailable",...}` instead of crashing the process. - `npm run check`, `docs:check`, and `verify:test-discovery` (943 files) all pass. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:04:13 +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#5131
No description provided.