Repository navigation
fix(electron): preserve runtime rejection and exception policies - #8542
Merged
morluto merged 3 commits intoNov 1, 2026
Merged
Conversation
13 of 14 tasks
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The changes appear safe to merge; no actionable issue was found. SummaryThe hook now records process rejection and exception events without installing handlers that change application behavior.
Reviews (1) · Last reviewed commit: "merge: retain Electron rejection and arg..." · Reviewed by Greptile |
coyoteXujie
pushed a commit
to coyoteXujie/rea
that referenced
this pull request
Nov 2, 2026
…luto#8542) * fix(electron): preserve runtime rejection and exception policies * fix(electron): retain rejection handlers for revoked proxies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #8489 at the author's explicit request to resubmit this contribution after resolving its main conflict. Uses published branch
codex/fix-electron-rejection-policyat HEAD7e3e7b0bec07f59d1c4f54ba2765d202688c205f. The original discussion and validation history are retained at #8489. Earlier validation keeps its stated execution points; this new PR requires its own hosted CI and a specific human declaration for this new PR ID.Supersedes #8253 at the author's explicit request to resubmit the existing PR. This replacement reuses verified head 0d08990 and preserves the original discussion and validation record at #8160. Historical validation and its limitations below remain at their stated execution points. This new PR must pass its own hosted CI.
Review follow-up: revoked rejection reasons
A P1 review identified that
Array.isArraythrows for a revoked Proxy before the application's rejection handler receives its original reason. This was reproduced on the initial PR head: 1 failed / 107 passed. Shape collection now checks arrays only for object values and treats an inaccessible revoked object's shape asobject; callable reasons retainfunction. The added regression verifies original reason/promise identity for revoked object, array, and callable proxies, with an unrevoked array-proxy control. The final complete file is 108 passed. A real Electron 33.4.11/public CLI scenario with an application rejection handler also completed 6/6 actions; its later ping requires that the original handler received the revoked reason. No review thread was automatically replied to or resolved.Summary
Fixes #8146. Recording an unhandled rejection must not turn Electron's warning-only behavior into an uncaught exception or change its existing exception-handler policy.
Problem and expected behavior
The active hook installed
oncelisteners forunhandledRejectionanduncaughtExceptionand threw from both. In a real Windows Electron 33.4.11 process, the same rejection continued with warnings without the hook but terminated with exit code 7 with it. A public CLI scenario using the baseline hook did not complete within a 30-second watchdog; its owned process tree was then terminated.Change and scope
Observe
unhandledRejectionanduncaughtExceptionMonitorat process event dispatch, forwarding the original receiver, arguments, return value, and thrown exception. Add no exception listeners. This leaves the runtime's default rejection mode and Electron/application listener counts intact, and records subsequent rejections too. Borrowedemitcalls on other emitters are forwarded without process-event evidence.The existing active-hook owner changes; no new provider, execution authority, public schema, limit, or cleanup mechanism is introduced. Maintainer scope decision: not applicable to this ordinary correction within the existing active-capture boundary.
Contract and boundary impact
scripts/electron-active-hook.cjs; its existing process-lifecycle timeline consumer and event shapes are retained.throw/strictfatal behavior. Do not replace Electron's exception policy with a new fallback.Expected effects of the existing operation:
Validation
npm run test:focused -- tests/boundary/browser/electronActiveHook.test.ts: 108 passed, 3 prerequisite build tasks passed. Six new cases cover revoked rejection reasons, warning-only ordinary and blocked-shell rejections, listener identity/throws and borrowed emit, Electron-style listener-count handling, and both fatal rejection modes. All 102 existing cases remain.e5c46dff034fef432e772f669bc309f512a6b186, with the initial five regressions: 5 failed / 102 passed. Executed bytes matched the Git baseline SHA-256; the patch was restored byte-for-byte infinally.capture-electron-scenario: fixed hook completed all 6/6 actions, retaining 2 unhandled-rejection events, the blocked shell attempt, and the laterpingIPC invocation. The result retained its normalpartial_attachcoverage. The baseline run exceeded the external 30-second watchdog with no JSON result; only its owned process tree was terminated. A subsequent process inventory found no remaining probe processes.npm run check:fast: 2/2 passed (31.59s); normal pre-commit passed; all three committed files match the verified hashes; normal pre-push 2/2 cached passed (288ms).Compatibility, safety, and release
No breaking schema or migration. Payload values remain excluded from the timeline. Validation used the existing local Electron cache and Node 24.22.1; it does not establish Electron 44.7.0/Linux/Xvfb or macOS coverage from the report. No full repository suite or real MCP result is claimed. The CLI watchdog result is a bounded incomplete baseline run, not a successful cancellation/partial-Evidence test.
Author readiness
Human owner: @ShuaixinHuang
Before merge
type(scope): outcome.This replacement preserves the prior PR discussion and validation history at #8253. It reuses the verified published head and requires its own hosted CI.
Main compatibility before resubmission (2026-11-01)
Merged main
aa48d494e9726d469a1b9ed917f021d8a1a4c7eainto the published branch without rewriting history. Merge commit7e3e7b0bec07f59d1c4f54ba2765d202688c205fpreserves both main's argv fixtures that intentionally avoid hook preloading and this PR's per-child Node rejection-mode arguments. The only manual conflict resolution was the shared test runner's argument signature and its two non-preload call sites; no assertion or production guard was removed.Windows x64, Node 24.22.1 / npm 10.9.3 (repository pins npm 11.16.0): the complete
electronActiveHook.test.tspasses 116/116, all 3 build prerequisite tasks succeeded,node --check scripts/electron-active-hook.cjspassed, andcheck:fastpasses 2/2 in 1m24.809s. No dependency changes. These are controlled Node child-process tests with synthetic Electron fixtures, not a fresh installed-Electron/Linux/macOS run. Historical real-Electron verification above retains its original execution point. This new PR and HEAD require independent hosted CI.