Repository navigation
fix(electron): preserve runtime rejection and exception policies - #8160
ShuaixinHuang wants to merge 2 commits into
Conversation
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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Low impact] The PR appears safe to merge; the previous handler-blocking failure is fixed and no new actionable issues were found. SummaryThe hook observes process errors without adding exception handlers or replacing the runtime's existing policy.
Reviews (2) · Last reviewed commit: "fix(electron): retain rejection handlers..." · Reviewed by Greptile |
Superseded by #8253 at the author's request: #8253 . The replacement uses the same verified head commit; this PR retains the original discussion and validation record.
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.