@@ -30,6 +30,7 @@ import type { SuspensionService } from "./services/suspension/service";
3030import type { TaskLinkService } from "./services/task-link/service" ;
3131import type { UpdatesService } from "./services/updates/service" ;
3232import type { WorkspaceService } from "./services/workspace/service" ;
33+ import { collectMemorySnapshot } from "./utils/crash-diagnostics" ;
3334import { ensureClaudeConfigDir } from "./utils/env" ;
3435import {
3536 getChromiumLogFilePath ,
@@ -72,6 +73,8 @@ function isCrashLoop(): boolean {
7273}
7374
7475app . on ( "render-process-gone" , ( _event , webContents , details ) => {
76+ const memory = collectMemorySnapshot ( ( ) => app . getAppMetrics ( ) ) ;
77+ const chromiumLogTail = readChromiumLogTail ( ) ;
7578 const props = {
7679 source : "main" ,
7780 type : "render-process-gone" ,
@@ -80,15 +83,20 @@ app.on("render-process-gone", (_event, webContents, details) => {
8083 url : webContents . getURL ( ) ,
8184 title : webContents . getTitle ( ) ,
8285 webContentsId : String ( webContents . id ) ,
86+ appUptimeSeconds : Math . round ( process . uptime ( ) ) ,
87+ memoryTotalWorkingSetKb : memory ?. totalWorkingSetKb ,
88+ memoryPeakWorkingSetKb : memory ?. peakWorkingSetKb ,
89+ memoryProcessCount : memory ?. processCount ,
90+ memoryByType : memory ? JSON . stringify ( memory . byType ) : undefined ,
8391 } ;
84- log . error ( "Renderer process gone" , {
92+ log . error ( "Renderer process gone" , { ...props , chromiumLogTail } ) ;
93+ captureException ( new Error ( `Renderer process gone: ${ details . reason } ` ) , {
8594 ...props ,
86- chromiumLogTail : readChromiumLogTail ( ) ,
95+ chromiumLogTail,
96+ // Stack is always this handler, so default grouping collapses every
97+ // renderer death into one issue. Split by reason instead.
98+ $exception_fingerprint : [ "render-process-gone" , details . reason ] ,
8799 } ) ;
88- captureException (
89- new Error ( `Renderer process gone: ${ details . reason } ` ) ,
90- props ,
91- ) ;
92100 getPostHogClient ( )
93101 ?. flush ( )
94102 . catch ( ( ) => { } ) ;
@@ -121,6 +129,8 @@ app.on("render-process-gone", (_event, webContents, details) => {
121129} ) ;
122130
123131app . on ( "child-process-gone" , ( _event , details ) => {
132+ const memory = collectMemorySnapshot ( ( ) => app . getAppMetrics ( ) ) ;
133+ const chromiumLogTail = readChromiumLogTail ( ) ;
124134 const props = {
125135 source : "main" ,
126136 type : "child-process-gone" ,
@@ -129,14 +139,24 @@ app.on("child-process-gone", (_event, details) => {
129139 exitCode : String ( details . exitCode ) ,
130140 serviceName : details . serviceName ?? "" ,
131141 name : details . name ?? "" ,
142+ appUptimeSeconds : Math . round ( process . uptime ( ) ) ,
143+ memoryTotalWorkingSetKb : memory ?. totalWorkingSetKb ,
144+ memoryPeakWorkingSetKb : memory ?. peakWorkingSetKb ,
145+ memoryProcessCount : memory ?. processCount ,
146+ memoryByType : memory ? JSON . stringify ( memory . byType ) : undefined ,
132147 } ;
133- log . error ( "Child process gone" , {
134- ...props ,
135- chromiumLogTail : readChromiumLogTail ( ) ,
136- } ) ;
148+ log . error ( "Child process gone" , { ...props , chromiumLogTail } ) ;
137149 captureException (
138150 new Error ( `Child process gone (${ details . type } ): ${ details . reason } ` ) ,
139- props ,
151+ {
152+ ...props ,
153+ chromiumLogTail,
154+ $exception_fingerprint : [
155+ "child-process-gone" ,
156+ details . type ,
157+ details . reason ,
158+ ] ,
159+ } ,
140160 ) ;
141161 getPostHogClient ( )
142162 ?. flush ( )
0 commit comments