Repository navigation
Fix terminal black screen on macOS 26.3.1 by dispatching Ghostty callbacks to main thread - #1937
Conversation
Publishing changes from background threads is not allowed in macOS 26 (Tahoe). Ghostty action callbacks run on I/O threads but were modifying AppKit view properties and posting notifications without dispatching to the main thread. Fixes: - GHOSTTY_ACTION_SCROLLBAR: wrap in DispatchQueue.main.async - GHOSTTY_ACTION_CELL_SIZE: wrap in DispatchQueue.main.async - GHOSTTY_ACTION_COLOR_CHANGE: wrap background color updates in main async - GHOSTTY_ACTION_CONFIG_CHANGE: wrap background color clear in main async
|
@rerun0510 is attempting to deploy a commit to the Manaflow Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThreading refactoring in GhosttyTerminalView that dispatches UI updates for scrollbar, cell size, color changes, and config modifications explicitly onto the main queue instead of executing inline on callback threads. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required. |
Greptile SummaryThis PR fixes a black-screen regression on macOS 26.3.1 by dispatching AppKit property mutations and Key points:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant GT as Ghostty I/O Thread
participant MT as Main Thread (DispatchQueue.main)
Note over GT,MT: GHOSTTY_ACTION_SCROLLBAR / CELL_SIZE
GT->>GT: Build scrollbar/cellSize value
GT->>MT: DispatchQueue.main.async { set property + post notification }
GT-->>GT: return true (immediate)
Note over GT,MT: GHOSTTY_ACTION_COLOR_CHANGE
GT->>GT: Build newColor (NSColor)
GT->>GT: logBackground (pre-dispatch, background thread)
GT->>MT: DispatchQueue.main.async [self] { set backgroundColor + applySurfaceBackground + applyWindowBackgroundIfActive }
GT-->>GT: return true
Note over GT,MT: GHOSTTY_ACTION_CONFIG_CHANGE (new ordering)
GT->>MT: DispatchQueue.main.async [self] { clear staleOverride + applySurfaceBackground + applyWindowBackgroundIfActive }
GT->>GT: updateDefaultBackground(...) ← runs BEFORE async block executes
GT->>GT: logBackground (reads surfaceView.backgroundColor — potential race)
GT-->>GT: return true
MT->>MT: applySurfaceBackground() reads NEW defaultBackgroundColor
|
There was a problem hiding this comment.
No issues found across 1 file
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
|
Thank you for the contribution! |
…ound-thread Fix terminal black screen on macOS 26.3.1 by dispatching Ghostty callbacks to main thread
Summary
action_cbhandlers (SCROLLBAR,CELL_SIZE,COLOR_CHANGE,CONFIG_CHANGE) inDispatchQueue.main.asyncso that all AppKit view property mutations andNotificationCenterposts occur on the main thread."Publishing changes from background threads is not allowed"errors and causing the terminal to render as a completely black screen. Earlier macOS versions tolerated these off-main-thread mutations silently; macOS 26.3.1 enforces stricter main-thread checks that break the SwiftUI view update cycle.Testing
"Publishing changes from background threads"warnings in debug logDemo Video
2026-03-22.17.52.43.mov
2026-03-22.17.54.29.mov
Summary by cubic
Fixes the black screen on macOS 26.3.1 by moving Ghostty action callback UI updates to the main thread. Prevents background-thread AppKit mutations that break SwiftUI rendering.
SCROLLBAR,CELL_SIZE,COLOR_CHANGE, andCONFIG_CHANGEhandlers inDispatchQueue.main.asyncso view updates andNotificationCenterposts run on the main thread.Written for commit ad57e10. Summary will update on new commits.
Summary by CodeRabbit