Skip to content

Decouple terminal resources from layout views - #9903

Closed
lawrencecchen wants to merge 71 commits into
mainfrom
feat-pty-resource-graph
Closed

lawrencecchen wants to merge 71 commits into
mainfrom
feat-pty-resource-graph

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Make TerminalResource own the PTY, terminal emulator, process lifetime, and event identity.
  • Make each Surface a view placement with its own tab data and viewport.
  • Keep terminals alive with zero, one, or many views, including views in different workspaces.
  • Route terminal APIs and runtime events through stable terminal identity, then fan visible updates out to all views.
  • Keep image budgets and cell-size work on terminal resources instead of one selected view.

Verification

Migration seam

Legacy terminal-only code can request an unregistered Surface adapter. The adapter has no layout identity and does not own terminal lifetime. A later cleanup can move those method signatures to TerminalResource without changing this ownership model.


Note

High Risk
This is a large refactor of mux core state, terminal lifecycle, client sizing, Kitty budgets, and hosted exit/reconnect paths—areas where subtle regressions affect every terminal session and multiview layout.

Overview
Terminal ownership is split from layout views. TerminalResource now holds the PTY, emulator state, and process lifetime; each Surface is only a tab/view placement with its own viewport. The terminal_catalog stores Arc<TerminalResource> instead of catalog surfaces, and closing the last tab detaches the view while the terminal can remain alive with zero projections.

Runtime behavior routes through stable terminal identity. Terminal output, title, resize, scroll, and bell events use TerminalEventTarget and fan out to every materialized view of that resource. emit_terminal_view_snapshot replays retained state when a new view appears after output already arrived. Layout lookups use surface(); sizing and host I/O use viewer_target_surface() so runtime IDs are not confused with placement IDs.

Shared infrastructure is keyed by terminal runtime, not one selected tab. Kitty graphics budgets, cell-pixel updates, and geometry authority (terminal_runtime_by_viewer, set_terminal_client_size_participation) operate on the resource and report or resize across all views. Exit and host reconnect paths accept callbacks while the resource is still pending publication (TerminalHostCallbackTarget::Pending vs Live), and terminal_resource_exited can finish cleanup without any live view.

Legacy callers still get an unregistered compatibility_surface() adapter from the catalog; agents, notifications, and close/detach semantics are updated so zero-view terminals remain addressable by public terminal ID or runtime ID until explicit close.

Reviewed by Cursor Bugbot for commit df06bf8. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Terminal sessions remain available after their displayed surface is detached or closed.
    • Terminal events, notifications, resizing, rendering, and client attachments work across multiple views.
    • Added terminal viewer selection and sizing participation controls.
    • Detached terminals can be resolved by ID or name.
  • Bug Fixes

    • Improved cleanup of closed and moved surfaces.
    • Ensured terminal exits remove all associated views and resources correctly.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Terminal PTY state now lives in persistent TerminalResource objects. PtySurface objects represent independent view placements. Mux lifecycle, event routing, sizing, projections, selectors, server operations, and tests use stable terminal runtime identities.

Changes

Terminal resource separation

Layer / File(s) Summary
Terminal resource contracts
cmux-tui/crates/cmux-tui-core/src/surface.rs, cmux-tui/crates/cmux-tui-core/src/model.rs, cmux-tui/crates/cmux-tui-core/src/lib.rs
TerminalResource stores shared runtime state. PtySurface represents an independent placement.
Terminal creation and event wiring
cmux-tui/crates/cmux-tui-core/src/surface.rs
Terminal creation, hosted callbacks, reconnects, exits, and test fixtures use runtime IDs and TerminalEventTarget.
Mux resource catalog and lifecycle
cmux-tui/crates/cmux-tui-core/src/mux.rs
Mux lookup, sizing, Kitty budgets, cell-pixel updates, event routing, removal, and exit handling use terminal resources.
Resource API and server integration
cmux-tui/crates/cmux-tui-core/src/mux/*, cmux-tui/crates/cmux-tui-core/src/resource_*.rs, cmux-tui/crates/cmux-tui-core/src/server.rs, cmux-tui/crates/cmux-tui/src/app.rs
Snapshots, selectors, notifications, terminal effects, server operations, and tests resolve terminal resources and compatibility surfaces.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Server
  participant Mux
  participant TerminalResource
  participant PtySurface
  Client->>Server: attach or resize terminal
  Server->>Mux: resolve terminal resource and viewer
  Mux->>TerminalResource: obtain runtime identity and compatibility surface
  TerminalResource->>PtySurface: project updates to active placements
  Mux-->>Server: return sizing or attachment result
  Server-->>Client: publish terminal state
Loading

Possibly related PRs


Important

Pre-merge checks failed

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

❌ Failed checks (2 errors, 1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Cmux Algorithmic Complexity ❌ Error mux.rs:7531-7535 loops over terminal viewers and runs report_order.retain over all reports for each viewer, creating O(V×R) cleanup work for scalable multiview terminals. Collect affected viewers into a HashSet, then run one report_order.retain pass; remove viewer maps in linear passes or add a runtime-to-report index.
Cmux Full Internationalization ❌ Error The PR changes hardcoded API error copy to "unknown surface or terminal viewer {id}" in mux.rs; server.rs returns it in ResourceError.message, with no locale-specific source or locale entries updated. Route changed API error copy through the project’s locale-specific source and add matching entries for every supported locale, or avoid changing the user-visible message.
Docstring Coverage ⚠️ Warning Docstring coverage is 37.10% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Cmux User-Facing Error Privacy ❓ Inconclusive Investigation is still in progress; no final assessment submitted yet. Inspect changed production error paths and confirm whether any raw or internal diagnostics reach user-visible API responses.
✅ Passed checks (21 passed)
Check name Status Explanation
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 The HEAD^..HEAD diff changes only Rust files; no production Swift files or Swift declarations changed, so this actor-isolation check is not applicable.
Cmux Swift Blocking Runtime ✅ Passed The patch changes only Rust files; it introduces no production Swift changes or Swift blocking/timing primitives.
Cmux Browser Automation Off-Main ✅ Passed The commit changes only cmux-tui Rust files; both rule-scoped browser automation files are unchanged, with no browser/WebKit/socket-worker terms in the diff.
Cmux Expensive Synchronous Load ✅ Passed The patch changes 13 Rust files and zero Swift files; no specified expensive Swift loader or interactive-path change is present.
Cmux Cache Substitution Correctness ✅ Passed The PR changes only Rust files (.rs); it contains no production Swift, TypeScript, or JavaScript changes covered by this check.
Cmux No Hacky Sleeps ✅ Passed The PR changes only 13 Rust files. It introduces no TypeScript, JavaScript, shell, or build/runtime-script changes covered by this rule.
Cmux Swift Concurrency ✅ Passed The PR diff changes only Rust files; it introduces no cmux-owned Swift code or Swift concurrency patterns.
Cmux Swift @Concurrent ✅ Passed The pull request diff contains only Rust files under cmux-tui; it changes no Swift source or Swift project files, so the Swift @concurrent check is not applicable.
Cmux Swift Package Boundaries ✅ Passed The PR changes only Rust files under cmux-tui and contains no Swift or Package.swift diff, so Swift package-boundary rules do not apply.
Cmux Swiftpm Lockfiles ✅ Passed The PR changes only Rust source files; no Package.swift, Package.resolved, Xcode project, .gitignore, workflow, or dependency-file paths changed, so the SwiftPM lockfile policy is not applicable.
Cmux Swift Logging ✅ Passed The PR diff changes only Rust files; it adds or materially changes no Swift logging, so the Swift logging rule is not applicable.
Cmux Swiftui State Layout ✅ Passed The PR diff changes 13 Rust files only; it contains no Swift, SwiftUI, or Objective-C files and no SwiftUI state/layout patterns.
Cmux Architecture Rethink ✅ Passed The rule applies to Swift changes, but all 13 changed paths are Rust; no Swift files or Swift symptom patterns appear in the diff.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed The PR commit changes 13 Rust files only and no Swift, Xcode, or window-related paths; the auxiliary-window shortcut check is not applicable.
Cmux Source Artifacts ✅ Passed All 13 changed paths are modified Rust source files under cmux-tui source directories; no artifact-like paths, generated files, or scratch directories appear in the diff.
Cmux No Test Or Debug Seam In Production Source ✅ Passed The PR diff contains 13 Rust files and no Swift paths or Swift hunks, so the production Swift seam rule is not applicable.
Cmux No Ambient Global State ✅ Passed The PR changes 13 Rust files only; the Swift-family diff is empty, so the production Swift ambient-global-state rule is not applicable.
Title check ✅ Passed The title clearly and concisely describes the primary refactor: separating terminal resources from layout views.
Description check ✅ Passed The description explains the changes and provides detailed verification evidence, but it omits the template checklist, review trigger, and demo video section.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-pty-resource-graph

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.

Comment thread cmux-tui/crates/cmux-tui-core/src/mux.rs Outdated
Comment thread cmux-tui/crates/cmux-tui-core/src/model.rs
@lawrencecchen
lawrencecchen force-pushed the feat-pty-resource-graph branch 2 times, most recently from c1ce4b0 to cf9aa86 Compare August 10, 2026 06:01

@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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
cmux-tui/crates/cmux-tui-core/src/mux.rs (4)

8982-9006: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Non-terminal surfaces no longer receive a redraw event after a default-color change.

unique_surface_runtimes returns one compatibility surface per terminal resource plus every non-terminal surface (Line 14284). All three loops apply set_default_colors to every returned surface, including browser and sidebar-plugin surfaces. The emit is now guarded by surface.terminal_event_target(), which is None for a non-terminal surface. Those surfaces change their default colors and never emit SurfaceOutput, so the frontend does not repaint them until unrelated output arrives.

Emit a placement-scoped output event when the surface has no terminal event target.

🐛 Proposed fix for all three loops
         for surface in surfaces {
             surface.set_default_colors(colors);
-            if let Some(target) = surface.terminal_event_target() {
-                self.emit_terminal_output(target);
-            }
+            match surface.terminal_event_target() {
+                Some(target) => self.emit_terminal_output(target),
+                None => self.emit(MuxEvent::SurfaceOutput(surface.id)),
+            }
         }

Also applies to: 9057-9066

🤖 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 `@cmux-tui/crates/cmux-tui-core/src/mux.rs` around lines 8982 - 9006, Update
all three default-color propagation loops, including
seed_default_colors_if_no_durable_override, to emit a placement-scoped output
event when surface.terminal_event_target() returns None, while preserving the
existing terminal-target emission path. Ensure terminal, browser, and
sidebar-plugin surfaces receive the appropriate redraw notification after
set_default_colors.

14130-14163: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy lift

Missing host-terminal-ID index forces full catalog scans with a per-entry compatibility_surface() allocation. State indexes terminals by TerminalPublicId and by runtime SurfaceId, but not by the durable host terminal_id. Every host lookup therefore walks state.terminal_catalog and materializes an Arc<Surface> per entry. The change adds that per-entry allocation to scans that previously only read the stored surface. Add a HashMap<String, TerminalPublicId> host index to State, maintain it next to terminal_catalog_by_runtime, and replace all three scans with a single lookup.

  • cmux-tui/crates/cmux-tui-core/src/mux.rs#L14130-L14163: replace the duplicate-host scan in register_terminal_runtime_checked with one index lookup; this scan makes restoring N terminals O(N²).
  • cmux-tui/crates/cmux-tui-core/src/mux.rs#L7957-L7970: replace the catalog_terminal_by_host scan with one index lookup, and drop the per-candidate reserved_in_process_terminals lock.
  • cmux-tui/crates/cmux-tui-core/src/mux.rs#L6772-L6779: replace the legacy catalog fallback in close_terminal_with_mutation with the same index lookup.

As per coding guidelines: "Avoid repeated full scans, sorting, filtering, or per-item nested scans over scalable collections in production code... When reporting a violation, identify the file and line, collection, estimated complexity, expected scale, and smallest source-of-truth fix."

🤖 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 `@cmux-tui/crates/cmux-tui-core/src/mux.rs` around lines 14130 - 14163, In
cmux-tui/crates/cmux-tui-core/src/mux.rs#L14130-L14163, add and maintain a State
host-terminal-ID index (HashMap<String, TerminalPublicId>) alongside
terminal_catalog_by_runtime, then replace the duplicate-host scan in
register_terminal_runtime_checked with a single index lookup. In
cmux-tui/crates/cmux-tui-core/src/mux.rs#L7957-L7970, update
catalog_terminal_by_host to use the same index and remove the per-candidate
reserved_in_process_terminals lock; in
cmux-tui/crates/cmux-tui-core/src/mux.rs#L6772-L6779, replace the legacy catalog
fallback in close_terminal_with_mutation with that index lookup.

Source: Coding guidelines


9118-9128: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not fail the resize after the PTY has already been resized.

Line 9109 applies the resize and Line 9122 then returns Err when terminal_event_target() is None. Callers treat that Err as a failed resize and roll back their sizing bookkeeping (Line 5856 and Line 5911), while the PTY keeps the new geometry. The recorded client size and the real PTY size then disagree.

Resolve the event target before the resize, or degrade to skipping the event instead of returning an error.

The error text also names an internal concept. As per coding guidelines: "Do not expose internal provider names, provider-specific flags, templates, snapshots, manifests, environment variable names, database or migration details" and "User-facing errors should state what happened in product terms".

🐛 Proposed fix
         let (cols, rows) = surface.size();
-        self.emit_terminal_resized(
-            surface.terminal_event_target().context("PTY omitted its event target")?,
-            cols,
-            rows,
-            None,
-        );
+        if let Some(target) = surface.terminal_event_target() {
+            self.emit_terminal_resized(target, cols, rows, None);
+        } else {
+            self.emit(MuxEvent::SurfaceResized {
+                surface: surface.id,
+                cols,
+                rows,
+                reservation_id: None,
+            });
+        }
         Ok((true, None))
🤖 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 `@cmux-tui/crates/cmux-tui-core/src/mux.rs` around lines 9118 - 9128, Update
the resize flow around the PTY resize operation and terminal_event_target() so a
missing event target cannot return an error after the PTY has been resized.
Resolve the target before resizing, or skip emit_terminal_resized when
unavailable while still returning successful resize status; replace the internal
“PTY omitted its event target” message with product-facing wording if an error
remains.

Source: Coding guidelines


212-216: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Use terminal runtime IDs consistently for Kitty budget entries.

reserve_kitty_image_surface currently accepts SurfaceId::RuntimeId, but callers pass next_terminal_runtime_id(&mux, id), whose generated runtime IDs may not reuse existing terminal runtime identities. kitty_image_limits_for_reconnect and reconcile_reconnected_kitty_image_surface both load budget entries by the current terminal.runtime_id(), so reconnect can miss an existing reservation and the weak reference will not bind against entry.surface. Keep the established terminal runtime ID as the budget key, or align the reconnect/unregister lookup path to the reservation key.

🤖 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 `@cmux-tui/crates/cmux-tui-core/src/mux.rs` around lines 212 - 216, Use the
established terminal runtime ID consistently for Kitty image budget reservations
and lookups. Update reserve_kitty_image_surface and its callers to key entries
with terminal.runtime_id(), or otherwise make kitty_image_limits_for_reconnect
and reconcile_reconnected_kitty_image_surface use the exact reservation key;
ensure reconnect finds the existing entry and binds its weak surface reference.
🤖 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 `@cmux-tui/crates/cmux-tui-core/src/mux.rs`:
- Around line 8745-8798: Add a concise comment at the wrapped reporter closure
in set_cell_pixel_size_reporting stating that callers must not invoke the
reporter while holding the mux state lock, since cell_pixel_report_targets
acquires self.state. Do not change the reporter behavior.
- Around line 5486-5489: Update the in-process terminal branch in
spawn_surface_with to replace the expect on surface.terminal_runtime_id() with
an error return when no runtime identity exists. Before returning the error,
preserve the existing terminal-exit persistence and surface-kill cleanup used by
other spawn failures, and only insert into reserved_in_process_terminals after
obtaining a valid runtime ID.

In `@cmux-tui/crates/cmux-tui-core/src/surface.rs`:
- Around line 2648-2650: Use the existing local event_target binding as the
authoritative value in both PtyTerminalRuntime constructors: at
cmux-tui/crates/cmux-tui-core/src/surface.rs#L2648-L2650 and `#L3592-L3594`, move
event_target into the runtime field instead of re-deriving it, preserving the
existing callback clone usage and eliminating the unnecessary clone.
- Around line 1927-1929: Change next_terminal_runtime_id to return
Option<SurfaceId> and remove the placement fallback, yielding None when
Weak<Mux> cannot upgrade. Update every call site to propagate failure with ?,
including the terminal spawn path, so spawning aborts when the mux is
unavailable and runtime IDs never reuse placement IDs.

---

Outside diff comments:
In `@cmux-tui/crates/cmux-tui-core/src/mux.rs`:
- Around line 8982-9006: Update all three default-color propagation loops,
including seed_default_colors_if_no_durable_override, to emit a placement-scoped
output event when surface.terminal_event_target() returns None, while preserving
the existing terminal-target emission path. Ensure terminal, browser, and
sidebar-plugin surfaces receive the appropriate redraw notification after
set_default_colors.
- Around line 14130-14163: In
cmux-tui/crates/cmux-tui-core/src/mux.rs#L14130-L14163, add and maintain a State
host-terminal-ID index (HashMap<String, TerminalPublicId>) alongside
terminal_catalog_by_runtime, then replace the duplicate-host scan in
register_terminal_runtime_checked with a single index lookup. In
cmux-tui/crates/cmux-tui-core/src/mux.rs#L7957-L7970, update
catalog_terminal_by_host to use the same index and remove the per-candidate
reserved_in_process_terminals lock; in
cmux-tui/crates/cmux-tui-core/src/mux.rs#L6772-L6779, replace the legacy catalog
fallback in close_terminal_with_mutation with that index lookup.
- Around line 9118-9128: Update the resize flow around the PTY resize operation
and terminal_event_target() so a missing event target cannot return an error
after the PTY has been resized. Resolve the target before resizing, or skip
emit_terminal_resized when unavailable while still returning successful resize
status; replace the internal “PTY omitted its event target” message with
product-facing wording if an error remains.
- Around line 212-216: Use the established terminal runtime ID consistently for
Kitty image budget reservations and lookups. Update reserve_kitty_image_surface
and its callers to key entries with terminal.runtime_id(), or otherwise make
kitty_image_limits_for_reconnect and reconcile_reconnected_kitty_image_surface
use the exact reservation key; ensure reconnect finds the existing entry and
binds its weak surface reference.
🪄 Autofix

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: 14d561c8-b7c3-4c6b-acf0-9901b218913e

📥 Commits

Reviewing files that changed from the base of the PR and between be29dfa and 958a602.

📒 Files selected for processing (12)
  • cmux-tui/crates/cmux-tui-core/src/lib.rs
  • cmux-tui/crates/cmux-tui-core/src/model.rs
  • cmux-tui/crates/cmux-tui-core/src/mux.rs
  • cmux-tui/crates/cmux-tui-core/src/mux/public_projections.rs
  • cmux-tui/crates/cmux-tui-core/src/mux/resource_content.rs
  • cmux-tui/crates/cmux-tui-core/src/mux/resource_topology.rs
  • cmux-tui/crates/cmux-tui-core/src/resource_api.rs
  • cmux-tui/crates/cmux-tui-core/src/resource_router.rs
  • cmux-tui/crates/cmux-tui-core/src/resource_router/content.rs
  • cmux-tui/crates/cmux-tui-core/src/resource_selector.rs
  • cmux-tui/crates/cmux-tui-core/src/server.rs
  • cmux-tui/crates/cmux-tui-core/src/surface.rs

Comment thread cmux-tui/crates/cmux-tui-core/src/mux.rs Outdated
Comment thread cmux-tui/crates/cmux-tui-core/src/mux.rs Outdated
Comment thread cmux-tui/crates/cmux-tui-core/src/surface.rs Outdated
Comment thread cmux-tui/crates/cmux-tui-core/src/surface.rs Outdated
Comment thread cmux-tui/crates/cmux-tui-core/src/mux.rs
@lawrencecchen
lawrencecchen force-pushed the feat-pty-resource-graph branch from cf9aa86 to c5d393b Compare August 10, 2026 06:21
Comment thread cmux-tui/crates/cmux-tui-core/src/mux.rs Outdated
Comment thread cmux-tui/crates/cmux-tui/src/app.rs Outdated
@lawrencecchen
lawrencecchen force-pushed the feat-pty-resource-graph branch 2 times, most recently from d38e044 to c4d6222 Compare August 10, 2026 07:09
Comment thread cmux-tui/crates/cmux-tui-core/src/resource_selector.rs
@lawrencecchen
lawrencecchen force-pushed the feat-pty-resource-graph branch from c4d6222 to c2d36b0 Compare August 10, 2026 07:14
Comment thread cmux-tui/crates/cmux-tui-core/src/mux.rs

@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: 2

🤖 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 `@cmux-tui/crates/cmux-tui-core/src/mux.rs`:
- Around line 8892-8916: Update project_cell_pixel_update to acquire self.state
once before processing all resizes and failures, then resolve each runtime or
failure surface’s report targets using that shared guard. Refactor or reuse the
lookup logic so cell_pixel_report_targets does not reacquire the lock per entry,
while preserving the existing projection and failure handling behavior.
- Around line 6300-6347: Move the shared viewer filtering and report-order
sorting into a ClientSizingState method, such as
terminal_client_viewers(runtime, client), preserving the existing ordering.
Update Mux::terminal_client_viewers to lock and delegate to that method, and
replace the duplicated latest computation in
set_terminal_client_size_participation with the delegated result’s last viewer
while retaining the existing lock ownership.
🪄 Autofix

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: 30466f6c-9e2e-478c-b85b-0ab9390804c8

📥 Commits

Reviewing files that changed from the base of the PR and between cf9aa86 and c4d6222.

📒 Files selected for processing (5)
  • cmux-tui/crates/cmux-tui-core/src/lib.rs
  • cmux-tui/crates/cmux-tui-core/src/mux.rs
  • cmux-tui/crates/cmux-tui-core/src/resource_selector.rs
  • cmux-tui/crates/cmux-tui-core/src/server.rs
  • cmux-tui/crates/cmux-tui/src/app.rs

Comment thread cmux-tui/crates/cmux-tui-core/src/mux.rs
Comment thread cmux-tui/crates/cmux-tui-core/src/mux.rs
@lawrencecchen
lawrencecchen force-pushed the feat-pty-resource-graph branch 7 times, most recently from 2245a6d to 8bcab24 Compare August 10, 2026 08:59
Comment thread cmux-tui/crates/cmux-tui-core/src/resource_router/content.rs
@lawrencecchen
lawrencecchen force-pushed the feat-pty-resource-graph branch from 8bcab24 to a80be0d Compare August 10, 2026 09:16
@blacksmith-sh

This comment has been minimized.

Comment thread cmux-tui/crates/cmux-tui-core/src/mux.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale-revisit Closed after 30+ days without activity; preserved for possible revisit or reopening.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants