Skip to content

Revert PR 8848 before Ghostty lag fix - #8893

Closed
lawrencecchen wants to merge 1 commit into
mainfrom
revert-pr-8848
Closed

lawrencecchen wants to merge 1 commit into
mainfrom
revert-pr-8848

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Reverts Austin Wang’s #8848 exactly.

The merged branch pins superseded Ghostty 50ad1963d, includes the owned-userdata API removed by current Ghostty fork main through manaflow-ai/ghostty#146, and adds a separate terminal shortcut-routing fast path that is not required by the IOSurface frame-reuse root cause.

This revert restores the exact tree from main immediately before PR 8848. The clean replacement is Lawrence Chen’s #8889, which retains Austin’s valid frame-slot rotation from manaflow-ai/ghostty#145 and will carry only the required iOS renderer continuation handler.


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

Reverts the typing‑lag investigation changes by removing the terminal typing shortcut fast path and the Ghostty owned‑userdata integration. Restores the pre-change ghostty integration and updates the iOS surface bridge to the borrowed‑userdata model.

  • Refactors

    • Remove GHOSTTY_ACTION_RENDER hook and related tests; external render continuation handled by the renderer as before.
    • Switch back to ghostty_surface_new with borrowed userdata; retain the bridge during surface free to prevent use‑after‑free.
    • Remove terminal typing shortcut fast path and its tests; keep standard shortcut routing.
    • Small cleanups: inline env flag read, simplify a modal result switch, fix minor test imports.
  • Dependencies

    • Pin ghostty to current fork main and update GhosttyKit checksum and fork docs.

Written for commit 9068ec4. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • Improved terminal surface cleanup and rendering recovery to prevent lifecycle-related issues during surface replacement or disposal.
    • Updated keyboard shortcut processing for more consistent event and configured-shortcut handling.
  • Documentation

    • Updated Ghostty integration documentation and pinned runtime version information.
  • Tests

    • Removed outdated tests for legacy terminal typing and rendering behaviors.
    • Updated test imports and project test configuration.

…ag-regression"

This reverts commit 67d8479, reversing
changes made to 590863f.
@cursor

cursor Bot commented Jul 25, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The changes revise Ghostty surface bridge ownership and render handling, remove a terminal shortcut bypass and its tests, refresh the Ghostty fork pin and checksums, simplify resume-policy mapping, and update two test imports.

Changes

Ghostty surface lifecycle

Layer / File(s) Summary
Surface bridge ownership and asynchronous cleanup
Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift, Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView+RenderRecovery.swift, Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceBridge.swift
Surface creation uses unretained bridge userdata, while asynchronous freeing retains the bridge through ghostty_surface_free.
Render action handling
Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttyRuntime.swift
Removes handling for GHOSTTY_ACTION_RENDER.
Pinned Ghostty fork refresh
ghostty, docs/ghostty-fork.md, scripts/ghosttykit-checksums.txt
Updates the Ghostty revision and archive references, and removes five checksum mappings.

Shortcut routing cleanup

Layer / File(s) Summary
Shortcut event processing
Sources/AppDelegate.swift, Sources/App/ShortcutBareStartRouting.swift
Removes the printable terminal-text bypass and predicate, normalizes characters earlier, and updates configured shortcut window matching.
Shortcut bypass test removal
cmuxTests/AppDelegateTerminalTypingShortcutFastPathTests.swift, cmux.xcodeproj/project.pbxproj
Removes the terminal typing fast-path tests and their Xcode project references.

Maintenance updates

Layer / File(s) Summary
Resume policy expression and test imports
Sources/ControlSurfaceResumeTarget.swift, cmuxTests/SidebarWorkspaceRowSuspensionTests.swift, cmuxTests/SidebarWorkspaceTableSuspensionTests.swift
Refactors alert policy mapping to a return-switch expression and changes sidebar test imports to AppKit.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GhosttySurfaceView
  participant outputQueue
  participant ghostty_surface_free
  participant GhosttySurfaceBridge
  GhosttySurfaceView->>outputQueue: enqueue surface free with bridge
  outputQueue->>GhosttySurfaceBridge: retain bridge
  outputQueue->>ghostty_surface_free: free surface
  ghostty_surface_free-->>outputQueue: free completes
  outputQueue->>GhosttySurfaceBridge: release bridge
Loading

Possibly related PRs

  • manaflow-ai/cmux#8853: Touches the printable Option-text shortcut bypass and related AppDelegate routing behavior.

Suggested reviewers: azooz2003-bit


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 2 warnings)

Check name Status Explanation Resolution
Cmux Architecture Rethink ❌ Error FAIL: teardown still splits UI ownership—disposeSurface() detaches the bridge before async free while makeSurface() passes self unretained to C, so a freed view can still be dereferenced. Pin or retain the GhosttySurfaceView through free completion, or replace raw uiview with one owned userdata object that owns both view and bridge.
Description check ⚠️ Warning The description has a solid Summary, but it omits required Testing, Review Trigger, Checklist, and Demo Video sections. Add the missing Testing section, demo video link if applicable, review-trigger block, and checklist items to match the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (22 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change set: reverting PR 8848 before the Ghostty lag fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed Changes stay in UI/MainActor code (AppDelegate, GhosttySurfaceView) and add no new isolated models/protocols or unsafe Sendable ref types.
Cmux Swift Blocking Runtime ✅ Passed The patch removes a render branch/test paths and adjusts bridge ownership/shortcut logic; it adds no new waits, sleeps, asyncAfter, sync calls, semaphores, or locks.
Cmux Browser Automation Off-Main ✅ Passed Rule targets browser socket automation files; this diff only changes Ghostty/shortcut-routing and test/project files, with no browser wait/router code.
Cmux Expensive Synchronous Load ✅ Passed Diff only changes Ghostty lifecycle, shortcut routing, and docs/tests; no new agent-history load lands on a main/interactive path, and existing load() remains in allowed cold-cache fallback.
Cmux Cache Substitution Correctness ✅ Passed The diff only changes Ghostty ownership/lifecycle, shortcut routing, and an alert switch; it does not swap a fresh authoritative read for cached data in any persistence/history/snapshot path.
Cmux No Hacky Sleeps ✅ Passed No changed TypeScript/JavaScript/shell/build-runtime files, and the diff shows no fixed sleeps, timers, polling, or wall-clock waits.
Cmux Algorithmic Complexity ✅ Passed No new scalable scans or batch rescans; added collection ops are only modifier-flag contains on a tiny fixed set, and the diff mostly removes/reworks hot-path fast paths.
Cmux Swift Concurrency ✅ Passed The diff only retains/releases the Ghostty bridge across an existing serial queue and removes code; it adds no new background queues, Combine, completion handlers, or lifecycle-less Tasks.
Cmux Swift @Concurrent ✅ Passed No changed Swift code adds or misuses @concurrent/nonisolated async; the async work still hops to MainActor or stays queue-bound, and the touched edits are synchronous.
Cmux Swift Package Boundaries ✅ Passed Diff only changes Ghostty/AppKit glue, shortcut-routing composition, and removes tests/docs; no new reusable domain logic is introduced in app Sources/.
Cmux Swiftpm Lockfiles ✅ Passed PASS: the pbxproj diff only removes test wiring; no SwiftPM package refs, .gitignore, or Package.resolved files changed, so the lockfile rule isn’t triggered.
Cmux Swift Logging ✅ Passed No added/changed print, debugPrint, dump, NSLog, or Logger usage appears in the diff; changes are logic, comments, and tests only.
Cmux User-Facing Error Privacy ✅ Passed The diff changes internals, tests, and docs only; the one user-facing alert in ControlSurfaceResumeTarget keeps the same copy and exposes no new implementation details.
Cmux Full Internationalization ✅ Passed Touched files only alter lifecycle, routing, docs, and tests; the remaining user-facing prompt uses existing String(localized:) keys, with no catalog/web locale changes.
Cmux Swiftui State Layout ✅ Passed PASS: The diff only changes UIKit/AppKit bridge and event-routing code; no new ObservableObject/@Published/GeometryReader/lazy-row store patterns or render-time SwiftUI state writes.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS: HEAD touches Ghostty/runtime, shortcut routing, tests, and docs only; no new user-visible NSWindow/NSPanel/WindowGroup or cmuxAuxiliaryWindowIdentifiers changes.
Cmux Source Artifacts ✅ Passed All changed paths are intentional source/docs/tests/config or the Ghostty submodule/checksum assets; no local outputs, caches, or scratch dirs were added.
Cmux No Test Or Debug Seam In Production Source ✅ Passed PASS: The production-source diff removes the DEBUG-only shortcut seam and test-style helper; no new debug/test-only accessor or wrapper was added in Sources/.
Cmux No Ambient Global State ✅ Passed No new ambient globals were added; the patch removes a top-level helper and rehomes lifetime handling inside GhosttySurfaceView.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-pr-8848

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift`:
- Around line 2498-2500: Update disposeSurface() and the enqueueSurfaceFree
teardown path so GhosttySurfaceView remains strongly retained until asynchronous
surface free and cleanup complete, rather than relying on currentBridge after it
is detached. Preserve the existing generation and queue coordination, and
release the view only from the free-completion path; alternatively, replace the
unretained uiview userdata created by makeSurface() with an ownership object
that remains pinned through teardown.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 744a538b-e80a-4b45-ae55-1a53bb9c77bb

📥 Commits

Reviewing files that changed from the base of the PR and between 67d8479 and 9068ec4.

📒 Files selected for processing (15)
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttyRuntime.swift
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceBridge.swift
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView+RenderRecovery.swift
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift
  • Packages/iOS/CmuxMobileTerminal/Tests/CmuxMobileTerminalTests/GhosttyRuntimeActionTests.swift
  • Sources/App/ShortcutBareStartRouting.swift
  • Sources/AppDelegate.swift
  • Sources/ControlSurfaceResumeTarget.swift
  • cmux.xcodeproj/project.pbxproj
  • cmuxTests/AppDelegateTerminalTypingShortcutFastPathTests.swift
  • cmuxTests/SidebarWorkspaceRowSuspensionTests.swift
  • cmuxTests/SidebarWorkspaceTableSuspensionTests.swift
  • docs/ghostty-fork.md
  • ghostty
  • scripts/ghosttykit-checksums.txt
💤 Files with no reviewable changes (8)
  • cmuxTests/SidebarWorkspaceTableSuspensionTests.swift
  • cmuxTests/AppDelegateTerminalTypingShortcutFastPathTests.swift
  • Packages/iOS/CmuxMobileTerminal/Tests/CmuxMobileTerminalTests/GhosttyRuntimeActionTests.swift
  • cmux.xcodeproj/project.pbxproj
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttyRuntime.swift
  • cmuxTests/SidebarWorkspaceRowSuspensionTests.swift
  • scripts/ghosttykit-checksums.txt
  • Sources/App/ShortcutBareStartRouting.swift

Comment on lines +2498 to +2500
// backlog drains before the free. (Retain the bridge across the hop; it
// owns the userdata libghostty still references until the free.)
enqueueSurfaceFree(surface, bridge: currentBridge, generation: surfaceGeneration, on: currentQueue)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n 'disposeSurface|enqueueSurfaceFree|ghostty_platform_ios_s|uiview|detach\(\)' \
  Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal ghostty

Repository: manaflow-ai/cmux

Length of output: 1866


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- GhosttySurfaceBridge.swift ---\n'
cat -n Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceBridge.swift

printf '\n--- GhosttySurfaceView.swift relevant sections ---\n'
sed -n '2460,2525p' Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift | cat -n
sed -n '1850,1892p' Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift | cat -n
sed -n '3448,3482p' Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift | cat -n

printf '\n--- RenderRecovery relevant section ---\n'
sed -n '180,225p' Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView+RenderRecovery.swift | cat -n

Repository: manaflow-ai/cmux

Length of output: 245


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- GhosttySurfaceBridge.swift ---'
cat -n Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceBridge.swift

echo
echo '--- GhosttySurfaceView.swift relevant sections ---'
sed -n '2460,2525p' Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift | cat -n
sed -n '1850,1892p' Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift | cat -n
sed -n '3448,3482p' Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift | cat -n

echo
echo '--- RenderRecovery relevant section ---'
sed -n '180,225p' Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView+RenderRecovery.swift | cat -n

Repository: manaflow-ai/cmux

Length of output: 13650


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- Locate Ghostty source files ---'
git ls-files | rg '(^ghostty/|^P|\.h$|ghostty_surface\.c|ghostty\.h|ghostty_platform)' | head -200

echo
echo '--- Search IOS platform code for uiview/uiview callbacks ---'
rg -n 'uiview|ghostty_platform_ios|GHOSTTY_PLATFORM_IOS' ghostty Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal 2>/dev/null | head -300

echo
echo '--- Search surface free implementation/usages in Ghostty source ---'
rg -n 'ghostty_surface_free|surface_free|free.*surface|ghostty_surface_new|surface_new' ghostty Packages/iOS/CmuxMobileTerminal 2>/dev/null | head -400

echo
echo '--- Search userdata ownership comments in Ghostty source ---'
rg -n 'userdata|platform|iOS|UIKit|UIView|ios\\.uiview' ghostty/Packages ghostty || true

Repository: manaflow-ai/cmux

Length of output: 17635


🌐 Web query:

Ghostty ghostty_surface_free userdata iOS uiview platform ownership

💡 Result:

In the Ghostty architecture, these components relate to how the terminal emulator interfaces with the host platform's UI and memory management: ghostty_surface_free This is a C API function provided by libghostty [1][2]. It is used to deallocate a terminal surface and its associated resources, such as Metal rendering structures and terminal grid state [3][4]. When called, it initiates the teardown of the renderer and associated platform-specific layers (like IOSurface or Metal layers on Apple platforms) [5]. userdata The userdata pointer is an arbitrary void* provided in the ghostty_surface_config_s configuration struct during the initialization of a surface [1][3]. It allows the embedding application to associate its own context (e.g., a Controller, ViewModel, or View object) with the Ghostty surface [2]. This pointer can be retrieved at any time using the ghostty_surface_userdata C API function [1][2]. iOS UIView and Platform Ownership On iOS, Ghostty uses a platform-native approach where the embedding application provides a UIView into which Ghostty renders using Metal [3][4]. - Platform Data: The platform-specific configuration for iOS is defined in the ghostty_platform_ios_s struct, which contains a void* member named uiview to hold a reference to the host application's view [1][3]. - Ownership: Ghostty's core (libghostty) manages the terminal emulation, grid state, and Metal rendering pipeline [6][4]. However, the embedding application typically retains ownership of the native UI objects (like the UIView). Because Ghostty's renderer may perform asynchronous operations (e.g., presenting frames via Metal or Core Animation), issues such as use-after-free can occur if the host application frees its UI resources before Ghostty has finished its internal cleanup, necessitating careful synchronization during surface teardown [5]. The "lazy/pull" architecture often employed by Ghostty-based apps means the Zig core owns the terminal state, while the Swift/native wrapper queries it as needed [7].

Citations:


🌐 Web query:

github ghostty-src ghostty_platform_ios.c ghostty_surface_free uiview

💡 Result:

In the Ghostty terminal emulator codebase, ghostty_surface_free is a C API function used to deallocate a surface and its associated resources [1][2][3]. When operating on iOS, the surface uses platform-specific configuration defined by ghostty_platform_ios_s, which contains a void* pointer to a UIView [4][2][3]. Technical details regarding this implementation include: 1. Function Purpose: ghostty_surface_free serves as the primary cleanup mechanism for a terminal surface [1][2]. Internally, it triggers the application to close the surface, subsequently calling deinitialization routines [5][6]. 2. iOS Platform Data: The ghostty_platform_ios_s structure is defined in include/ghostty.h as a wrapper for a UIView pointer, allowing the terminal to render its output into that native iOS view, typically utilizing Metal for GPU acceleration [2][3]. 3. Implementation Context: The underlying logic is handled in Zig [5][6]. When ghostty_surface_free is called, it typically involves tearing down the renderer (such as Metal-based swap chains), stopping terminal threads, and releasing GPU-related resources like IOSurfaces and textures [7]. 4. Potential Issues: Developers should be aware of lifecycle management complexities, such as potential use-after-free scenarios if Metal completion handlers or Core Animation transactions attempt to reference resources (like an IOSurface) after they have been freed during the surface teardown process [7]. The C API and related structures are found within the include/ghostty.h header, and the platform-specific logic is managed in files such as src/apprt/embedded.zig [4][5][3].

Citations:


🌐 Web query:

ghostty src embedded.zig uiview ghostty_platform_ios_s

💡 Result:

In the Ghostty terminal emulator codebase, ghostty_platform_ios_s is a C structure used within the embedded runtime API to provide platform-specific configuration for iOS [1][2]. It is defined in the public header file include/ghostty.h as follows: typedef struct { void* uiview; } ghostty_platform_ios_s; This structure contains a single member, uiview, which is a pointer to the UIView (cast to void*) where the terminal is intended to render [3][2]. The file src/apprt/embedded.zig acts as the Zig-side implementation of this embedded runtime [4][5]. Within this file, the Platform union (and its associated C compatibility union) handles the initialization and abstraction of these platform-specific views [6][7]. The init function in embedded.zig ensures that when the library is initialized, the uiview provided via the C ABI is properly cast and stored for use by Ghostty's rendering engine, which uses Metal to render to the specified view [6][3]. In practical usage, such as in the Swift-based surface view implementation, the host application passes a reference to its UIView—via an opaque pointer—to the libghostty configuration [8]. This allows Ghostty to function as an embedded component within a larger iOS application, rather than managing the entire application lifecycle itself [4][5].

Citations:


Keep the unretained platform view alive through teardown.

disposeSurface() detaches currentBridge before this asynchronous free, so retaining the bridge no longer keeps GhosttySurfaceView alive. Since makeSurface() stores self as an unretained ghostty_platform_ios_s.uiview, the pinned Ghostty teardown/cleanup path could still reference a released view. Retain the view on teardown until free completion, or replace the unretained platform userdata with a retained/pinned ownership object.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift`
around lines 2498 - 2500, Update disposeSurface() and the enqueueSurfaceFree
teardown path so GhosttySurfaceView remains strongly retained until asynchronous
surface free and cleanup complete, rather than relying on currentBridge after it
is detached. Preserve the existing generation and queue coordination, and
release the view only from the free-completion path; alternatively, replace the
unretained uiview userdata created by makeSurface() with an ownership object
that remains pinned through teardown.

@greptile-apps

greptile-apps Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reverts the entirety of PR #8848, rolling back the Ghostty submodule from 50ad1963d9 to c55514dd52 and removing the accompanying iOS renderer continuation handler, owned-userdata API usage, and terminal shortcut fast-path changes. The rollback is required because the pinned 50ad1963d9 revision includes ghostty_surface_new_with_owned_userdata, an API subsequently removed from the fork's main branch by ghostty/pull/146, making the PR 8848 tree incompatible with current upstream.

  • Ghostty submodule rolled back to c55514dd52; checksums file and docs/ghostty-fork.md updated in lockstep to match the pre-8848 state.
  • Bridge lifecycle restored to manual retain/release in enqueueSurfaceFree; ghostty_surface_new replaces the now-removed ghostty_surface_new_with_owned_userdata; the strong view↔bridge cycle and its tracking issue (iOS: dismantled GhosttySurfaceView leaks (view<->bridge retain cycle kept for libghostty uiview pointer safety) #7199) are re-documented.
  • Shortcut fast-path (terminalTextShortcutBypassTabManagerBeforeContextResolution) and its #if DEBUG production static removed; AppDelegate.swift reverted to direct ProcessInfo environment lookup per keystroke.

Confidence Score: 5/5

Clean revert to a known-good pre-8848 tree; the manual bridge retain/release pattern, submodule pin, and checksums are all internally consistent.

Every changed file is either a mechanical reversal to shipped code, a test file deletion whose production counterpart is also removed, or documentation updated to match the new submodule pin. The Ghostty submodule, GhosttyKit checksums, and ghostty-fork.md are updated in lockstep. The #if DEBUG production static from ShortcutBareStartRouting.swift is correctly excised. The bridge lifecycle (passUnretained in makeSurface, explicit passRetained/release in enqueueSurfaceFree) is the same pattern that was stable before PR 8848, and the known view↔bridge cycle is re-documented with its tracking issue. No new rule violations are introduced.

Files Needing Attention: No files require special attention. The acknowledged regression (serial frame-lease rotation from ghostty/pull/145) is intentional and tracked for reintroduction in PR #8889.

Important Files Changed

Filename Overview
Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttyRuntime.swift Removes the GHOSTTY_ACTION_RENDER handler that dispatched drawForWakeup; restores pre-8848 action dispatch logic. No new violations.
Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceBridge.swift Removes releaseRetainedOpaque static (was the owned-userdata destructor callback) and updates the strong-cycle comment to re-document the pre-8848 leak tracked as issue #7199.
Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift Restores manual Unmanaged.passRetained/release pattern in enqueueSurfaceFree; switches makeSurface back to ghostty_surface_new with passUnretained. Pre-8848 pattern is internally consistent.
Sources/App/ShortcutBareStartRouting.swift Removes terminalTextShortcutBypassTabManagerBeforeContextResolution, the #if DEBUG shortcutMonitorTraceEnvironmentEnabled cached static, and the cmuxIsPrintableTextInput NSEvent extension — all added by PR 8848.
Sources/AppDelegate.swift Reverts AppDelegate shortcut handler to skip the fast-path bypass and to read ProcessInfo.processInfo.environment directly rather than the removed cached static.
ghostty Submodule pointer rolled back from 50ad1963d9 to c55514dd52 — the revision before the owned-userdata API that is now removed from fork main.
scripts/ghosttykit-checksums.txt Removes checksums for the four intermediate Ghostty SHAs no longer in the active pin chain; c55514dd52 checksum retained.

Sequence Diagram

sequenceDiagram
    participant V as GhosttySurfaceView
    participant B as GhosttySurfaceBridge
    participant L as libghostty
    participant Q as WorkQueue

    V->>B: passUnretained(bridge) bridgePointer
    V->>L: ghostty_surface_new(app, surfaceConfig)
    L-->>V: createdSurface

    L->>B: io_write_cb via unretained bridgePointer
    B->>V: DispatchQueue.main.async handleOutboundBytes

    V->>B: currentBridge.detach()
    V->>Q: enqueueSurfaceFree(surface, bridge)
    Q->>Q: passRetained(bridge) retainedBridge
    Q->>L: ghostty_surface_free(surface)
    Q->>B: retainedBridge.release()
Loading

Reviews (1): Last reviewed commit: "Revert "Merge pull request #8848 from ma..." | Re-trigger Greptile

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Closing because canonical autoreview correctly rejected a wholesale revert: it would also remove valid bounded renderer progress, frame-slot rotation, Kitty graphics limits, the iOS continuation handler, and required test imports. The targeted correction remains #8889: keep those fixes, advance Ghostty to current 518ac28d5, and remove only the superseded owned-userdata integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant