Files
orca/src
Neil 17b7ad2d36 fix(pty): restore the webContents liveness guard dropped by #15927 (STA-5373)
Release blocker. #15927 replaced a two-condition renderer-liveness guard with a
one-condition one, dropping the `webContents.isDestroyed()` half:

  v1.4.188 src/main/ipc/pty.ts   webContents.isDestroyed  x4
  main     src/main/ipc/pty.ts   webContents.isDestroyed  x0

A window can be alive while its webContents is already destroyed — teardown, a
renderer crash, a reload in flight. `webContents.send()` throws in that state,
and neither affected call site is inside a try/catch: the daemon-death fan-out
at ipc/pty.ts:4067 and reportUnavailablePtyWrite at :7236. main-process-error-guards
exempts only EIO/EPIPE and re-throws everything else on the next tick, so the
whole app exits and takes every terminal with it.

The original guard (STA-2373, #10065) also carried a typeof check so a stubbed or
partially torn down webContents could not make the liveness check itself throw.
Both halves are restored.

Verified in both directions: reverting to the shipped one-condition version fails
three of the seven new tests, including the send path.

That the refactor was behaviour-preserving everywhere else is why this slipped —
the guard was the one place where collapsing two conditions into "renderer gone"
was not equivalent.
2026-08-24 19:08:32 -07:00
..