fix(renderer): rotate serial frame leases
Fixes the remaining macOS typing batching reported in https://github.com/manaflow-ai/cmux/issues/8808 without reverting the new renderer scheduler or exact-slot ownership.
Root cause: https://github.com/manaflow-ai/ghostty/commit/8c645641a introduced exact-slot frame leases and replaced the prior rotating frame index with a first-free scan from slot zero. When typing slowly enough for each Metal frame to finish before the next key, every frame reacquires slot zero and reassigns the same IOSurface object. Core Animation can deduplicate that same-object contents assignment, so the IOSurface seed advances while the window waits for unrelated layer activity to recomposite.
This change preserves exact-slot ownership and backpressure while rotating the free-slot scan after every successful acquire.
Red proof: commit 3a43d5edc fails the new serial-frame assertion with expected slot 1, found slot 0.
Green proof: commit fcafac572 passes the assertion and the filtered Ghostty test run (73/73 tests). No Swift or user-facing strings changed.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Rotate frame lease acquisition across slots to stop macOS typing from batching frames while keeping the new renderer scheduler intact. This forces Core Animation to recomposite by using different IOSurfaces per serial frame.
- Bug Fixes
- Rotate the free-slot scan cursor after each successful acquire to distribute serial frames across IOSurfaces.
- Preserve exact-slot ownership and backpressure; no API or behavior regressions.
- Add a unit test that enforces 0 → 1 → 2 → 0 rotation for a 3-slot pool.
- No user-facing changes.