fix(desktop): attach renderer-lifecycle diagnostics to all BrowserWindow instances (#81290) - #81533
Conversation
6d466c6 to
c213f99
Compare
|
PR cleanup: removed developer-process docs (INVESTIGATION.md / PLAN.md / STATUS.md) and the accidental .omc/ .gitignore entry that were committed with the fix; normalized the new TS files to LF line endings. The change is now scoped to the desktop renderer-lifecycle fix only. |
|
This was generated by AI during triage. Summary: Problems:
Solution: Checked against |
ab9a785 to
518cab6
Compare
…al login windows (NousResearch#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>
518cab6 to
0709827
Compare
…re window-reveal (NousResearch#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.
|
Merged via PR #83567 — thank you for the excellent work here! All four of your commits were cherry-picked onto current main with your authorship preserved in git log (your branch had fallen ~114 commits behind). One reconciliation was needed on top: PR #83535 landed after your branch and gave console-message capture a dedicated owner ( The Electron-free dependency-injected design made this salvage painless — nice architecture. |
Reconcile the salvaged NousResearch#81533 lifecycle helper with the renderer-log console pipeline that landed in NousResearch#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.
Summary
Secondary session windows and full-instance windows on Hermes Desktop previously attached no renderer-lifecycle diagnostics (
render-process-gone,unresponsive,oom, console errors). A peer renderer crash therefore produced a permanently black window with no log evidence and no recovery, exactly as described in #81290 by @akivavh (three reproductions, sanitized live captures, allrender-process-gone/unresponsive/did-fail-loadlookups returning empty for the affected HWND).Root cause
The main window had a hand-rolled crash handler attached directly.
spawnSecondaryWindow()andcreateInstanceWindow()only attached navigation / shortcut / zoom / context-menu wiring; nothing listened for renderer death. The diagnostic gap and the recovery gap were the same gap.Fix
Promote the primary-window crash handling into a shared, Electron-free, dependency-injectable helper
electron/window-renderer-lifecycle.tsand install it on everyBrowserWindowwe create:main/secondary/instance#38216Windows sandbox-relaunch callback, which is wired throughcallbacks.onCrashLoopSuppressedand only fires forkind: 'main'.overlay/quick/wakeLogs carry the window kind so black-window reports become attributable, e.g.:
This is the "黑窗有据可查" property requested in the issue.
Why this is the whole-bug-class fix
Sibling call paths (
spawnSecondaryWindow,createInstanceWindow,createOverlayWindow,createQuickWindow,createWakeIndicatorWindowController) all route through the new helper, so any future window added tomain.tsonly needs the helper call — it inherits the same diagnostics and budget.Verification
pnpm -C apps/desktop test(electron project) — new + wake-indicator suitestsc -p tsconfig.electron.json --noEmiteslint apps/desktop/electron/HEADstash — environmental, not introduced (verified by stash)code-revieweragent review#38216guard inversion, console dual-shape parsing)Out of scope (deliberate)
Related
#38216Windows sandbox-relaunch path with no behavioral change (windows-sandbox-fallback.tsis unchanged; the new helper consults it via theonCrashLoopSuppressedcallback only forkind: 'main').