Skip to content

cmux-tui: simplify PTY error mapping - #11864

Merged
lawrencecchen merged 2 commits into
mainfrom
fix/cmux-tui-map-or-cleanup
Sep 3, 2026
Merged

lawrencecchen merged 2 commits into
mainfrom
fix/cmux-tui-map-or-cleanup

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace equivalent map/unwrap_or nesting with Option::map_or in pty_input.rs.
  • Preserve all existing PTY failure behavior.

Verification


Summary by cubic

Replaces the equivalent Option::map/unwrap_or chain in PTY error mapping with Option::map_or. It still returns the marked underlying error when available and the original error otherwise, so PTY failure behavior is unchanged.

Written for commit ccdad66. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Refactor
    • Simplified internal error-handling logic without changing user-visible behavior.

@cursor

cursor Bot commented Sep 3, 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.

@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 Ready Ready Preview Sep 4, 2026 12:51am UTC
cmux41 Ready Ready Preview Sep 4, 2026 12:51am UTC

@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: 32c1f41e-d2ed-430a-a701-908700cb751e

📥 Commits

Reviewing files that changed from the base of the PR and between aaa600a and ccdad66.

📒 Files selected for processing (1)
  • cmux-tui/crates/cmux-tui/src/pty_input.rs

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


📝 Walkthrough

Walkthrough

The change refactors underlying_operation_error to use Option::map_or. The fallback behavior remains unchanged.

Changes

PTY error handling cleanup

Layer / File(s) Summary
Refactor PTY error accessor
cmux-tui/crates/cmux-tui/src/pty_input.rs
underlying_operation_error uses map_or instead of chained map and unwrap_or.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to ccdad

This change simplifies PTY error fallback handling without changing returned errors. No merge-blocking production risk remains.

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: simplifying PTY error mapping.
Description check ✅ Passed The description explains what changed, why behavior remains unchanged, and how the change was verified. The missing checklist and review-trigger sections are non-critical for this small, non-UI refact…
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 pull request commits modify only cmux-tui/crates/cmux-tui/src/pty_input.rs. They introduce no production Swift changes, so they cannot introduce or worsen Swift actor-isolation mistakes.
Cmux Swift Blocking Runtime ✅ Passed PASS — The pull request does not introduce or materially expand a prohibited Swift blocking or timing primitive. The tip-to-base diff adds only the Rust pty_input.rs refactor in the latest commits. …
Cmux Browser Automation Off-Main ✅ Passed PASS. The PR changes only cmux-tui/crates/cmux-tui/src/pty_input.rs. The two PR commits replace an equivalent Option::map/unwrap_or expression with Option::map_or; they do not change browser s…
Cmux Expensive Synchronous Load ✅ Passed PASS: The pull-request range changes only cmux-tui/crates/cmux-tui/src/pty_input.rs, a Rust file. The patch only replaces nested Option::map/unwrap_or with Option::map_or; it adds no productio…
Cmux Cache Substitution Correctness ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/pty_input.rs, which is Rust. The diff only reformats an existing Option::map_or expression. The custom check applies only to produc…
Cmux No Hacky Sleeps ✅ Passed PASS: The PR changes only one Rust source file and replaces an existing map/unwrap_or expression with Option::map_or. It introduces no TypeScript, JavaScript, shell, or build/runtime-script chan…
Cmux Algorithmic Complexity ✅ Passed PASS. The PR changes only cmux-tui/crates/cmux-tui/src/pty_input.rs, which is Rust code. The change replaces an Option::map/unwrap_or expression with equivalent Option::map_or logic. It adds n…
Cmux Swift Concurrency ✅ Passed PASS. The committed diff changes only cmux-tui/crates/cmux-tui/src/pty_input.rs, a Rust file. It only rewrites underlying_operation_error from nested map/unwrap_or logic to map_or. The diff …
Cmux Swift @Concurrent ✅ Passed PASS: The pull request changes only Rust code in cmux-tui/crates/cmux-tui/src/pty_input.rs. The diff replaces map/unwrap_or with map_or; it contains no Swift files, nonisolated async changes…
Cmux Swift Package Boundaries ✅ Passed PASS: The PR commits after the prior base commit change only cmux-tui/crates/cmux-tui/src/pty_input.rs. They add no production Swift or SwiftPM files. The earlier Swift-heavy commit is separate (`#1…
Full details: Description check

Explanation

The description explains what changed, why behavior remains unchanged, and how the change was verified. The missing checklist and review-trigger sections are non-critical for this small, non-UI refactor.

Full details: Cmux Swift Blocking Runtime

Explanation

PASS — The pull request does not introduce or materially expand a prohibited Swift blocking or timing primitive. The tip-to-base diff adds only the Rust pty_input.rs refactor in the latest commits. The broader branch diff includes Swift compatibility changes, but added Swift lines contain no semaphore waits, blocking waits, sleeps, delayed dispatch, polling, main-queue sync, or manual locks. Existing ContinuousClock().sleep and timer code remain unchanged from the base revision.

Full details: Cmux Browser Automation Off-Main

Explanation

PASS. The PR changes only cmux-tui/crates/cmux-tui/src/pty_input.rs. The two PR commits replace an equivalent Option::map/unwrap_or expression with Option::map_or; they do not change browser socket commands, WebKit/AppKit access, actor routing, or worker policy tests. No browser automation debt is introduced or worsened.

Full details: Cmux Expensive Synchronous Load

Explanation

PASS: The pull-request range changes only cmux-tui/crates/cmux-tui/src/pty_input.rs, a Rust file. The patch only replaces nested Option::map/unwrap_or with Option::map_or; it adds no production Swift code and no synchronous agent-history load.

Full details: Cmux Cache Substitution Correctness

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/pty_input.rs, which is Rust. The diff only reformats an existing Option::map_or expression. The custom check applies only to production Swift, TypeScript, and JavaScript changes, so it is not applicable.

Full details: Cmux No Hacky Sleeps

Explanation

PASS: The PR changes only one Rust source file and replaces an existing map/unwrap_or expression with Option::map_or. It introduces no TypeScript, JavaScript, shell, or build/runtime-script changes, and the diff adds no sleep, timer, polling, or wall-clock wait. The custom check is therefore not applicable.

Full details: Cmux Algorithmic Complexity

Explanation

PASS. The PR changes only cmux-tui/crates/cmux-tui/src/pty_input.rs, which is Rust code. The change replaces an Option::map/unwrap_or expression with equivalent Option::map_or logic. It adds no collection scan, sorting, filtering, join, or batch rescan. The operation remains constant-time and does not match any failure condition in the algorithmic-complexity rule.

Full details: Cmux Swift Concurrency

Explanation

PASS. The committed diff changes only cmux-tui/crates/cmux-tui/src/pty_input.rs, a Rust file. It only rewrites underlying_operation_error from nested map/unwrap_or logic to map_or. The diff adds no Swift code and no DispatchQueue, Combine, completion-handler, or fire-and-forget Task pattern. The Swift concurrency check is therefore not applicable.

Full details: Cmux Swift `@Concurrent`

Explanation

PASS: The pull request changes only Rust code in cmux-tui/crates/cmux-tui/src/pty_input.rs. The diff replaces map/unwrap_or with map_or; it contains no Swift files, nonisolated async changes, @concurrent annotations, or Swift call-site changes. The Swift concurrency failure conditions are therefore not introduced.

Full details: Cmux Swift Package Boundaries

Explanation

PASS: The PR commits after the prior base commit change only cmux-tui/crates/cmux-tui/src/pty_input.rs. They add no production Swift or SwiftPM files. The earlier Swift-heavy commit is separate (#11341) and is not part of this refactor.

  • 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 fix/cmux-tui-map-or-cleanup

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.

@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.

@lawrencecchen
lawrencecchen force-pushed the fix/cmux-tui-map-or-cleanup branch from a832d20 to ccdad66 Compare September 3, 2026 23:34
@lawrencecchen
lawrencecchen merged commit 9f8a74f into main Sep 3, 2026
47 of 49 checks passed
rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 4, 2026
3812562 refactor(tui): centralize terminal input classification (manaflow-ai#11855)
7d0385f Axiom: failure rate and latency per third-party endpoint (Freestyle, Stack Auth, Stripe, ...) (manaflow-ai#11779)
ed5e826 refactor(tui): share frontend focus target mapping (manaflow-ai#11861)
7fa300e Revert "Fix terminal text bleed during live window resize (manaflow-ai#11530)" (manaflow-ai#11887)
bace77c perf(cmux-tui): avoid front-shifting layout nodes (manaflow-ai#11860)
9f8a74f cmux-tui: simplify PTY error mapping (manaflow-ai#11864)
2748329 refactor(cmux-tui): share stack row allocation (manaflow-ai#11867)
e7223a5 coderouter: PostHog traces + exceptions keyed by the cmux user, request ids, health endpoint, Slack alerts, upstream header timeout (manaflow-ai#11798)
aerickson pushed a commit to aerickson/cmux that referenced this pull request Sep 13, 2026
* refactor(cmux-tui): simplify operation error fallback

* style(cmux-tui): apply rustfmt to error fallback

This branch was successfully deployed

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