Skip to content

cmux-tui: simplify JoinSet shutdown drains - #11745

Merged
lawrencecchen merged 1 commit into
mainfrom
feat-joinset-shutdown
Sep 3, 2026
Merged

lawrencecchen merged 1 commit into
mainfrom
feat-joinset-shutdown

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Replace production JoinSet::abort_all() plus ignored join_next() drain loops with JoinSet::shutdown().await at the four equivalent cleanup sites:

  • cmux-tui/crates/cmux-remote/src/bridge.rs:31-34, ForwardConnections::shutdown
  • cmux-tui/crates/cmux-remote/src/bridge.rs:207, serve_mux_bridge
  • cmux-tui/crates/cmux-remote/src/services.rs:332-334, DaemonServices::run_local
  • cmux-tui/crates/chatmux-relay/src/preview_proxy.rs:477, preview proxy task cleanup

Error-observing joins and intentional graceful-then-forced two-phase shutdown paths remain explicit.

Tokio documents that JoinSet::shutdown is equivalent to aborting all tasks and joining until the set is empty, while ignoring shutdown panics.

Base: b2a984ed59d6f7bfb109ebfbb90247dcc881465e
Head: 90e856ba3973d56e11a2264a11f1d4e5e839b0f2

Verification

  • rustfmt --edition 2024 --check on all three changed Rust files: passed
  • git diff --check: passed
  • cargo fmt --all -- --check: blocked by the local cmux-tui artifact guard because free space was 159.3 GiB, below the 250 GiB floor
  • No build or tests run, per the requested rustfmt/diff-only scope

@vercel

vercel Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cmux166 Canceled Canceled Sep 3, 2026 3:31pm UTC
cmux41 Canceled Canceled Sep 3, 2026 3:31pm UTC

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: d5752547-4f3f-46da-a844-dc431b5005c6

📥 Commits

Reviewing files that changed from the base of the PR and between 188190a and 2fd128e.

📒 Files selected for processing (3)
  • cmux-tui/crates/chatmux-relay/src/preview_proxy.rs
  • cmux-tui/crates/cmux-remote/src/bridge.rs
  • cmux-tui/crates/cmux-remote/src/services.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The preview proxy, mux bridge, and daemon shutdown paths now use JoinSet::shutdown().await instead of manual task abortion and draining loops.

Changes

Task shutdown paths

Layer / File(s) Summary
Replace manual task draining
cmux-tui/crates/chatmux-relay/src/preview_proxy.rs, cmux-tui/crates/cmux-remote/src/bridge.rs, cmux-tui/crates/cmux-remote/src/services.rs
Shutdown paths now call JoinSet::shutdown().await to terminate and await child tasks.
Estimated code review effort: 1 (Trivial) ~5 minutes

Merge Risk: ⚪ Minimal · up to 2fd12

Shutdown cleanup now uses Tokio’s built-in JoinSet shutdown helper at the existing abort-and-drain sites, preserving task termination and completion behavior while simplifying the implementation. No merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 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 PASS: The base-to-head diff changes only three Rust files, and all changed paths have the .rs extension. No Swift declaration, actor boundary, model, protocol, Sendable reference, or UI store change…
Cmux Swift Blocking Runtime ✅ Passed PASS. The declared diff changes only three Rust files: preview_proxy.rs, bridge.rs, and services.rs. It contains no Swift files or Swift runtime primitives. The Swift blocking-runtime check is t…
Cmux Browser Automation Off-Main ✅ Passed PASS: The pull request changes only three Rust files under cmux-tui/crates/... and replaces JoinSet cleanup drains with shutdown().await. The diff does not modify `Sources/TerminalController.swi…
Cmux Expensive Synchronous Load ✅ Passed PASS: The pull-request diff changes only three Rust files under cmux-tui and chatmux-relay. It replaces Tokio JoinSet shutdown cleanup calls and adds no Swift changes or agent-history loading. T…
Cmux Cache Substitution Correctness ✅ Passed PASS — The PR changes only three Rust files. The diff replaces Tokio JoinSet abort-and-drain cleanup with shutdown().await; it does not change a Swift, TypeScript, or JavaScript persistence, histo…
Cmux No Hacky Sleeps ✅ Passed PASS: The pull request changes only Rust files. The diff replaces JoinSet::abort_all() plus join_next() cleanup loops with JoinSet::shutdown().await; it does not add fixed sleeps, timers, pollin…
Cmux Algorithmic Complexity ✅ Passed PASS: The diff changes only three Rust (.rs) files. It replaces existing abort_all() plus join_next() drain loops with JoinSet::shutdown().await; it does not add nested collection scans, repea…
Cmux Swift Concurrency ✅ Passed PASS — The pull request diff contains only three Rust files and no .swift paths. The changes replace Rust JoinSet cleanup loops with shutdown().await; they do not introduce or expand any Swift c…
Cmux Swift @Concurrent ✅ Passed PASS: The pull request changes only three Rust files (.rs). The base-to-head diff contains no Swift files or Swift code changes. Therefore, the @concurrent and nonisolated async check is not app…
Cmux Swift Package Boundaries ✅ Passed PASS: The pull request changes only three Rust files: preview_proxy.rs, bridge.rs, and services.rs. The base-to-head diff contains no .swift, SwiftPM, or Swift package files. The Swift package…
Title check ✅ Passed The title clearly and concisely describes the main change: simplifying JoinSet shutdown drains.
Description check ✅ Passed The description explains what changed, identifies all four cleanup sites, preserves important exceptions, and documents verification results. It uses a "Verification" heading instead of the template's…
Full details: Cmux Swift Actor Isolation

Explanation

PASS: The base-to-head diff changes only three Rust files, and all changed paths have the .rs extension. No Swift declaration, actor boundary, model, protocol, Sendable reference, or UI store changed. The Swift actor-isolation check is therefore inapplicable.

Full details: Cmux Swift Blocking Runtime

Explanation

PASS. The declared diff changes only three Rust files: preview_proxy.rs, bridge.rs, and services.rs. It contains no Swift files or Swift runtime primitives. The Swift blocking-runtime check is therefore not applicable.

Full details: Cmux Browser Automation Off-Main

Explanation

PASS: The pull request changes only three Rust files under cmux-tui/crates/... and replaces JoinSet cleanup drains with shutdown().await. The diff does not modify Sources/TerminalController.swift, ControlCommandExecutionPolicy.swift, browser commands, WebKit/AppKit access, or worker-lane routing. The browser automation check is therefore not applicable.

Full details: Cmux Expensive Synchronous Load

Explanation

PASS: The pull-request diff changes only three Rust files under cmux-tui and chatmux-relay. It replaces Tokio JoinSet shutdown cleanup calls and adds no Swift changes or agent-history loading. The custom check applies only to production Swift changes that add or move expensive synchronous loads, so no failure condition is present.

Full details: Cmux Cache Substitution Correctness

Explanation

PASS — The PR changes only three Rust files. The diff replaces Tokio JoinSet abort-and-drain cleanup with shutdown().await; it does not change a Swift, TypeScript, or JavaScript persistence, history, undo, or snapshot read. The cache-substitution failure condition is therefore inapplicable.

Full details: Cmux No Hacky Sleeps

Explanation

PASS: The pull request changes only Rust files. The diff replaces JoinSet::abort_all() plus join_next() cleanup loops with JoinSet::shutdown().await; it does not add fixed sleeps, timers, polling, or wall-clock waits. The custom check applies only to TypeScript, JavaScript, shell, and non-Swift build/runtime scripts.

Full details: Cmux Algorithmic Complexity

Explanation

PASS: The diff changes only three Rust (.rs) files. It replaces existing abort_all() plus join_next() drain loops with JoinSet::shutdown().await; it does not add nested collection scans, repeated sorting/filtering, in-memory joins, or a slower batch algorithm. The algorithmic-complexity rule also permits existing inefficient code that the PR does not worsen.

Full details: Cmux Swift Concurrency

Explanation

PASS — The pull request diff contains only three Rust files and no .swift paths. The changes replace Rust JoinSet cleanup loops with shutdown().await; they do not introduce or expand any Swift concurrency pattern covered by this check.

Full details: Cmux Swift `@Concurrent`

Explanation

PASS: The pull request changes only three Rust files (.rs). The base-to-head diff contains no Swift files or Swift code changes. Therefore, the @concurrent and nonisolated async check is not applicable.

Full details: Cmux Swift Package Boundaries

Explanation

PASS: The pull request changes only three Rust files: preview_proxy.rs, bridge.rs, and services.rs. The base-to-head diff contains no .swift, SwiftPM, or Swift package files. The Swift package boundary check is therefore not applicable.

Full details: Description check

Explanation

The description explains what changed, identifies all four cleanup sites, preserves important exceptions, and documents verification results. It uses a "Verification" heading instead of the template's "Testing" heading and omits the review trigger and checklist, but the required change and testing information are mostly complete.

  • Fix all pre-merge checks with AI
✨ 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-joinset-shutdown

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.

@lawrencecchen
lawrencecchen force-pushed the feat-joinset-shutdown branch 4 times, most recently from a35248f to a2bc5ef Compare September 3, 2026 01:52
@blacksmith-sh

This comment has been minimized.

@lawrencecchen
lawrencecchen force-pushed the feat-joinset-shutdown branch 5 times, most recently from 2177a62 to 5c81d1f Compare September 3, 2026 02:38
@lawrencecchen
lawrencecchen merged commit 89e4701 into main Sep 3, 2026
29 of 31 checks passed
rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 3, 2026
3cce67c Vault: recency-first All Sessions view, session search, and checkpoints with fork (manaflow-ai#10215)
94f51fb Fix aggregate child memory pressure before compressor exhaustion (manaflow-ai#10773)
13006ef cloud: surface whether after() has waitUntil for deferred create work (manaflow-ai#11782)
75eee0e Cloud VMs: bake the TigerVNC desktop (dock, wallpaper, cua-driver, noVNC) into the devbox recipe and open it at the machine's private address (manaflow-ai#11776)
36b5536 Fix terminal text bleed during live window resize (manaflow-ai#11530)
44b42c1 Cloud VMs: machines usage decoder and refresh fixes, edge smoke diagnostics (manaflow-ai#11759)
f11be3a ci(tui): scope Valgrind test compilation (manaflow-ai#11750)
9184f4c coderouter: many Claude upstream accounts per team, routed with affinity and cooldown failover (manaflow-ai#11775)
d3b9cdd cloud: attach waits for the baked supervisor; edge probe span joins the create trace (manaflow-ai#11777)
c69e317 test: make the cmuxTests target compile again (main-actor call, CLI-only type) (manaflow-ai#11770)
8185825 fix(history): stop idle History menu graph rebuild loop (manaflow-ai#10661)
723958e Test bounded stale-port retirement after listener exit (manaflow-ai#11356)
367682e Fix native terminal Copy honoring Ghostty clipboard flavor (manaflow-ai#11515)
d59055d docs(tui): refresh SDK inventory counts (manaflow-ai#11766)
89e4701 cmux-tui: use JoinSet shutdown for simple drains (manaflow-ai#11745)

# Conflicts:
#	.github/workflows/cmux-tui.yml

This branch was successfully deployed

2 active deployments
Preview – cmux41 — 90e856ba Deployed Sep 3, 2026 by vercel[bot]
Preview – cmux166 — 90e856ba Deployed Sep 3, 2026 by vercel[bot]
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