Skip to content

fix(desktop): renderer-lifecycle diagnostics + crash recovery for every window - #83567

Merged
teknium1 merged 5 commits into
mainfrom
salvage/81533-window-lifecycle
Aug 11, 2026
Merged

fix(desktop): renderer-lifecycle diagnostics + crash recovery for every window#83567
teknium1 merged 5 commits into
mainfrom
salvage/81533-window-lifecycle

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Secondary, instance, HUD, quick-entry, overlay, wake, and login windows now log renderer death (render-process-gone / unresponsive / main-frame did-fail-load) and recover crashed chat windows under a shared crash-loop budget — a peer window can no longer turn permanently black with zero evidence in desktop.log.

Salvage of #81533 by @Enough1122 (all 4 commits cherry-picked with authorship preserved; branch was 114 commits stale), fixing #81290 (@akivavh — three reproduced black secondary windows on Windows, each with empty render-process-gone/unresponsive/did-fail-load lookups because nothing was listening).

What the contributor built

  • electron/window-renderer-lifecycle.ts — Electron-free, dependency-injectable per-window lifecycle wiring, installed on every BrowserWindow:
  • 377-line behavioral test suite for the reload policy, crash-loop budget, teardown detection, and listener disposal

Follow-up commit (reconciliation with #83535, which landed after the PR branched)

  • Single-owner console capture: the helper's console-message handling is removed — renderer-log.ts (from fix(desktop): persist renderer crashes to desktop.log + ban inline render() (React #310 class) #83535) owns it. One owner means no double-logged renderer errors, and OAuth/portal windows (lifecycle-wired for process events) cannot spill third-party page console output — potentially tokens/PII — into desktop.log.
  • Wake window keeps console coverage via the shared capture; HUD window (newer than the PR branch) gets log-only lifecycle coverage.
  • Lifecycle tests now assert the helper attaches NO console-message listener.

Validation

Result
vitest window-renderer-lifecycle + wake-indicator + renderer-log 27/27 pass
npm run typecheck (renderer + electron + e2e) pass
eslint electron/ src/ --quiet 0 errors
Stale-base gate 0 behind, 5-file diff

Fixes #81290

Infographic

Window Guardian — per-window renderer lifecycle

Enough1122 and others added 5 commits August 10, 2026 17:55
…al login windows (#81290 follow-up)

@spfcraze's triage review noted the PR description claimed "every
BrowserWindow" but the OAuth and portal sign-in windows were not wired:
a crashed sign-in renderer leaves the window's promise path never
settling, with no trace in desktop.log.

Wire both with the same log-only lifecycle diagnostics as the overlay
and quick windows — `kind: 'oauth'` and `kind: 'portal'` respectively.
Neither window gets crash-reload treatment (a sign-in window that
reloads itself mid-auth would be surprising); the lifecycle helper's
log-only callback is the exact contract needed here.

window-renderer-lifecycle.test.ts: 17/17 pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…re window-reveal (#81290)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reconcile the salvaged #81533 lifecycle helper with the renderer-log
console pipeline that landed in #83535 (the two PRs raced):

- window-renderer-lifecycle.ts no longer handles console-message —
  renderer-log.ts is the single owner (per-window labels, boundary
  reports). One owner means no double-logged errors on windows wearing
  both, and OAuth/portal windows (lifecycle-wired for process events)
  cannot spill third-party page console output into desktop.log.
- wake indicator window gets attachRendererConsoleCapture, keeping the
  console coverage it previously got from the helper.
- HUD window (added after the PR branched) gets log-only lifecycle
  coverage — it was the one renderer window the PR couldn't have known
  about.
- Tests updated: lifecycle helper asserts it attaches NO console-message
  listener; parser tests live in renderer-log.test.ts.
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 126c9f7 — fix(desktop): single-owner console capture + HUD lifecycle c

⚠️ Warnings

OSV vulnerability scan · View job

2 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 5m19s vs 5m32s (-3.9%). 5 job(s) slower, 9 faster, 3 unchanged.

  • JS & TS checks / ui-tui / check: -31.0s
  • JS & TS checks / apps/desktop / check:lint: -17.0s
  • JS & TS checks / tests-js / check: -16.0s
  • JS & TS checks / apps/desktop / check:test:ui: -13.0s
  • JS & TS checks / apps/bootstrap-installer / check: +12.0s

@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) platform/windows Native Windows-specific behavior or breakage P2 Medium — degraded but workaround exists sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Aug 11, 2026
@teknium1
teknium1 merged commit 0a60b16 into main Aug 11, 2026
39 checks passed
@teknium1
teknium1 deleted the salvage/81533-window-lifecycle branch August 11, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Secondary Desktop window stays black with no lifecycle diagnostics or recovery

3 participants