renderer: harden bounded drains for external rendering
Merged
LA
4mo ago+202+202+012345678901234567890123456789-24-24-01234567890123456789
Summary
Austin Wang's https://github.com/manaflow-ai/ghostty/pull/135 bounds normal renderer mailbox turns and fixes the continuous-output latency regression from https://github.com/manaflow-ai/cmux/issues/8808.
This follow-up closes the external-rendering and error-path gaps found during review:
- drain one finite mailbox snapshot per synchronous render, then render immediately
- retain remaining work through the existing app-mailbox
.renderaction instead of spinning until empty - convert external xev wakeups into unconditional embedder render requests so coalescing cannot drop work
- preserve failed lifecycle requests without overwriting newer publications
- recheck work published during normal rendering before deciding whether to notify again
- make focus application transactional so a retry is not suppressed
The normal mailbox batching implementation from https://github.com/manaflow-ai/ghostty/pull/135 remains unchanged.
Tests
On the exact PR head with Zig 0.15.2:
synchronous renderer drains one finite batch and retains continuationsynchronous renderer retains continuation after drain errorsurface lifecycle retry restoration preserves newer publicationssurface lifecycle state bypasses a full renderer mailbox and keeps latest valuesvisibility regainsuite
The focused suite passes on cmuxs-mac-mini-3.1, a 48 GB fleet Mac running macOS 26.5.
Fixes the remaining external-render correctness gap exposed while investigating https://github.com/manaflow-ai/cmux/issues/8808.