feat(logging): record renderer and helper process crashes - #2972
Open
chris-yoshih wants to merge 1 commit into
Open
feat(logging): record renderer and helper process crashes#2972chris-yoshih wants to merge 1 commit into
chris-yoshih wants to merge 1 commit into
Conversation
A renderer, GPU, or utility process that dies takes no main-process code path with it. The window white-screens or a feature quietly stops working, `uncaughtException` never fires, and the session log simply ends. An OS-killed renderer — the shape a memory incident takes — is then reconstructible only from a platform crash report, if the machine kept one. Register `render-process-gone` and `child-process-gone` at the same point as the existing process error handlers, so the cause lands in emdash.log next to the rest of the session: the reason (`oom`, `crashed`, `launch-failed`, …), the exit code, the URL for a renderer, and the process type and service name for a helper. `clean-exit` is dropped — every helper reports it at shutdown, so logging it would put a crash line in every quit. The reporting decisions are pure functions over the detail payloads, with the Electron wiring narrowed to a stubbable event-source seam. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Greptile SummaryAdds app-wide logging for abnormal Electron renderer and helper-process exits.
Confidence Score: 5/5The PR appears safe to merge, with no concrete correctness or security failures identified in the changed paths. The new listeners match the intended Electron process-gone event flow, use the initialized non-throwing logger, suppress ordinary teardown events, and retain crash logging when renderer URL lookup fails.
|
| Filename | Overview |
|---|---|
| apps/emdash-desktop/src/main/app/process-crash-logging.ts | Adds focused process-exit report builders and Electron event registration with clean-exit filtering and safe URL lookup. |
| apps/emdash-desktop/src/main/app/process-crash-logging.test.ts | Covers renderer and helper crash reports, clean-exit suppression, registration wiring, and unavailable renderer URLs. |
| apps/emdash-desktop/src/main/index.ts | Registers process crash logging after file-logger initialization during synchronous main-process setup. |
Reviews (1): Last reviewed commit: "feat(logging): record renderer and helpe..." | Re-trigger Greptile
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.
Description
Another suggestion — independent of #2971, either can stand alone.
render-process-goneandchild-process-gonehave no handlers anywhere in therepo. When a renderer, GPU, or utility process dies, no main-process code path
runs: the window white-screens or a feature quietly stops working, and
uncaughtExceptionnever fires, soregisterProcessErrorLoggingdoesn't see iteither.
emdash.logjust ends mid-session.That's the worst case for the failure mode #80's memory watchdog exists for. An
OS-killed renderer is exactly what leaves no trace — the evidence is a platform
crash report (a macOS
JetsamEvent, say), outside the app, kept only if the OSfelt like it. This puts the cause in emdash's own log next to the rest of the
session, so
reasonandexitCodeare one grep away.clean-exitis dropped rather than recorded. Electron reports it for everyhelper that terminates normally at shutdown, so logging it would mean a burst of
errors on every ordinary quit. For a renderer death the report also carries the
WebContentsURL, which separates the app window from a browser-pane webview —a page in the in-app browser crashing says nothing about emdash.
Shape.
reportRenderProcessGone/reportChildProcessGoneare purefunctions returning a message plus fields, or
nullfor a clean exit — noElectron import, so the filtering and field selection are directly testable.
registerProcessCrashLogging(app, log)is the wiring, typed against a narrowedProcessCrashEventSourceinterface rather thanElectron.Appso a test canhand it a stub emitter. Same split as
dev-worktree-profile.tsandreap-dev-profiles.ts.index.tsgains one import and one call, next to theexisting
registerProcessErrorLogging.One thing worth flagging: reading
contents.getURL()on aWebContentsthat isalready tearing down can throw, so it's wrapped and the URL is simply omitted
when unavailable — the crash still gets logged.
Related issues
None filed. It came up while reading #80 — the watchdog catches the run-up to a
memory kill, but if the kill lands anyway there's nothing in the log to confirm
what happened.
Testing
oxfmt --check,oxlint,tsgo --noEmitonapps/emdash-desktop— all clean.vitest run --project node— 283 files / 2032 tests pass, including 10 newones:
oom/crashed/killedrenderer reasons,clean-exitsuppressedon both events, a missing URL falling back to
undefined, child-process typeand
serviceNamepassthrough, and the registration seam driven by a stubemitter (both handlers registered, both firing, clean exits producing no log
call).
pnpm run testacross every project. No manualcrash reproduction — I didn't want to guess at forcing an OOM kill on a real
session, so the Electron event payloads are taken from the documented shapes
and exercised through the stub rather than from a live crash. If you'd rather
see a real one in a log before taking this, that's fair.
Screenshot/Recording (if applicable)
n/a — log output only.
Checklist