Skip to content

fix(electron): reject non-executable files before Playwright launch - #2501

Closed
chqcjq wants to merge 1 commit into
morluto:mainfrom
chqcjq:fix/electron-launch-validation
Closed

chqcjq wants to merge 1 commit into
morluto:mainfrom
chqcjq:fix/electron-launch-validation

Conversation

@chqcjq

@chqcjq chqcjq commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chqcjq chqcjq closed this by deleting the head repository Oct 13, 2026
@morluto morluto added the bug Something isn't working label Oct 14, 2026
@morluto morluto added the provider: electron Analysis provider / engine: electron label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working provider: electron Analysis provider / engine: electron

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] capture_electron_scenario kills the REA process (MCP server exits) when executable_path is an existing non-executable file

2 participants