claude-code-session-manager 0.17.2 → 0.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -276,6 +276,7 @@ async function rebootApp() {
276
276
  logReboot('falling back to app.relaunch()');
277
277
  app.relaunch();
278
278
  }
279
+ runShutdownCleanup(); // app.exit bypasses will-quit
279
280
  app.exit(0);
280
281
  }
281
282
 
@@ -338,6 +339,7 @@ function createWindow() {
338
339
  // instead of blindly trying http://localhost:5173, which would (a) load
339
340
  // remote content and (b) almost always fail in a packaged install.
340
341
  console.error('[main] dist/index.html missing and SM_DEV is not set — refusing to load remote content. Reinstall or set SM_DEV=1 for dev.');
342
+ runShutdownCleanup(); // app.exit bypasses will-quit
341
343
  app.exit(1);
342
344
  return;
343
345
  }
@@ -732,7 +734,13 @@ app.whenReady().then(async () => {
732
734
  // uncleanly (the silent OOM-kill we've been chasing), then starts the memory
733
735
  // heartbeat + render/child-process-gone hooks for this run. See
734
736
  // crashDiagnostics.cjs for the full rationale.
735
- crashDiagnostics.init({ logs, getPowerBlockerId: () => powerBlockerId });
737
+ crashDiagnostics.init({
738
+ logs,
739
+ getPowerBlockerId: () => powerBlockerId,
740
+ // If a suspend ever fires while we're alive, the OS lock lapsed — re-assert
741
+ // our block-mode systemd-inhibit so the next idle window stays covered.
742
+ onSuspendWhileAlive: () => { stopSystemdInhibit(); startSystemdInhibit(); },
743
+ });
736
744
 
737
745
  // Boot-time detection 1: surface `claude` binary resolution so a missing
738
746
  // install becomes visible to the renderer instead of failing silently on
@@ -941,7 +949,15 @@ app.whenReady().then(async () => {
941
949
  });
942
950
  });
943
951
 
944
- app.on('will-quit', () => {
952
+ // Centralized teardown. `will-quit` fires on a normal quit, but `app.exit()`
953
+ // (in-app reboot, dist-missing abort) bypasses will-quit entirely — so those
954
+ // sites must call this directly, otherwise markCleanShutdown never runs and the
955
+ // next boot misreports a clean reboot as an UNCLEAN OOM crash, and the
956
+ // powerSaveBlocker/inhibitor leak until process death.
957
+ let teardownDone = false;
958
+ function runShutdownCleanup() {
959
+ if (teardownDone) return; // idempotent — will-quit may still fire after an app.exit path
960
+ teardownDone = true;
945
961
  // Mark a clean exit so the next boot can distinguish a graceful quit from an
946
962
  // OOM-kill / native crash (which leaves the sentinel `open`).
947
963
  crashDiagnostics.markCleanShutdown();
@@ -953,7 +969,9 @@ app.on('will-quit', () => {
953
969
  powerBlockerId = -1;
954
970
  }
955
971
  stopSystemdInhibit();
956
- });
972
+ }
973
+
974
+ app.on('will-quit', runShutdownCleanup);
957
975
 
958
976
  app.on('window-all-closed', () => {
959
977
  if (rebooting) return; // new window is about to be created