Collapse spinner-frame titles before ingress dedup (~31% main-thread reduction under title churn)

Closed
SO
2mo ago
+138-2

Ports TerminalTitleChurnFilter from #6907 (credit @austinywang, co-authored-by on the commit) into GhosttyTitleUpdateIngress.submit. Spinner frames (⠋ Working -> ⠙ Working) always differ, so the existing update != lastSubmittedUpdate guard never fires - every frame pays yield -> task enqueue -> workqueue syscall on the main thread. That's 31.2% of main-thread samples under heavy churn, and 3-5x worse click latency vs constant titles at matched rates.

What changed vs #6907:

  1. Filter loses @MainActor - submit runs in ghostty's serialized per-view callback, same argument the ingress already makes for its own state (lines 13-15)
  2. Per-surface LRU dropped - the ingress is per-view, so it collapses to a single lastStableTitle
  3. FIFO drain gone - superseded by the AsyncStream + dispatcher that landed on main

What survives is the ~30 lines that matter: the braille U+2800-28FF leading-run collapse + its tests.

To be clear, this doesn't fix saturation-level unresponsiveness (https://github.com/manaflow-ai/cmux/issues/9092). Closes nothing, should help #6599.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Collapses leading Braille spinner glyphs in terminal titles before GhosttyTitleUpdateIngress dedup so animated frames become one stable string and spinner-only frames are dropped. Cuts ~31% main-thread time under heavy title churn and improves click latency.

  • Performance
    • Added TerminalTitleChurnFilter with tests: strips leading Braille (U+2800–U+28FF) spinner glyphs and whitespace so frames collapse to the same label; pure spinner frames are ignored.
    • Applied in GhosttyTitleUpdateIngress.submit before existing dedup to avoid per-frame AsyncStream yields and global-executor enqueues.

Summary by CodeRabbit

  • New Features

    • Terminal titles now remain stable while spinner animations update, reducing visible title flicker.
    • Spinner-only title updates no longer replace an existing meaningful title with a blank value.
  • Bug Fixes

    • Preserved intentional spacing and embedded Braille characters in unaffected titles.
    • Prevented duplicate stabilized title updates from being submitted.