Skip to content

perf(cmux-tui): avoid front-shifting layout nodes - #11860

Merged
lawrencecchen merged 1 commit into
mainfrom
feat-tui-layout-vecdeque
Sep 3, 2026
Merged

lawrencecchen merged 1 commit into
mainfrom
feat-tui-layout-vecdeque

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace recursive Vec::remove(0) with VecDeque::pop_front in layout equality.
  • Preserve public APIs and pane order.

Verification

  • Existing layout order tests remain in place.
  • Rustfmt and diff checks pass.
  • Blacksmith Rust tests are pending.

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

Speeds up layout construction in cmux-tui by replacing front-shifting Vec::remove(0) calls with VecDeque::pop_front(), so building equal-split trees is now O(1) per node instead of O(n). Public APIs and pane ordering are unchanged.

Written for commit 49001c3. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Refactor
    • Improved the internal layout tree construction process without changing user-visible layout behavior.

@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 3, 2026 11:37pm UTC
cmux41 Ready Ready Preview Sep 3, 2026 11:37pm 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: 43df1605-f0e0-42fa-9dd7-bc5226345567

📥 Commits

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

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

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


📝 Walkthrough

Walkthrough

Changes

Layout Construction

Layer / File(s) Summary
Use VecDeque for balanced node construction
cmux-tui/crates/cmux-tui-core/src/layout.rs
The default Zellij layout converts its columns to VecDeque. equal_nodes consumes nodes with pop_front and uses explicit expectation messages.

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

Merge Risk: ⚪ Minimal · up to 49001

Balanced layout construction now consumes nodes efficiently with VecDeque while preserving pane ordering and layout behavior. No current merge-blocking 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 3 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 describes the main performance change: avoiding front-shifting layout nodes by replacing inefficient front removal.
Description check ✅ Passed The description explains what changed, why it changed, and how it was verified. It also identifies that Blacksmith Rust tests are pending. The missing checklist and review-trigger sections are non-cri…
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 changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The complete HEAD^..HEAD diff contains no Swift paths. Therefore, the Swift actor-isolation check is i…
Cmux Swift Blocking Runtime ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The exact commit diff changes Vec to VecDeque and replaces remove(0) with pop_front(). It introd…
Cmux Browser Automation Off-Main ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs. The diff replaces Vec::remove(0) with VecDeque::pop_front() in equal_nodes and changes no browser command, sock…
Cmux Expensive Synchronous Load ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs (5 additions, 5 deletions). It replaces Rust Vec front removal with VecDeque::pop_front; it adds no Swift code and…
Cmux Cache Substitution Correctness ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, which is Rust. The custom check applies only to production Swift, TypeScript, and JavaScript changes. Therefore, its …
Cmux No Hacky Sleeps ✅ Passed PASS: The PR changes only Rust code in cmux-tui/crates/cmux-tui-core/src/layout.rs. The diff replaces Vec::remove(0) with VecDeque::pop_front() and adds no TypeScript, JavaScript, shell, or buil…
Cmux Algorithmic Complexity ✅ Passed PASS. The PR changes only Rust code in cmux-tui-core/src/layout.rs. It replaces Vec::remove(0) with VecDeque::pop_front() in equal_nodes, changing repeated front removal from quadratic behavio…
Cmux Swift Concurrency ✅ Passed PASS: The pull-request diff changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, which is Rust. It adds VecDeque and replaces Vec::remove(0) with pop_front() in equal_nodes. No Swift fi…
Cmux Swift @Concurrent ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The exact commit has Rust=1, Swift=0, and no Swift paths in its patch. The Swift concurrency rule th…
Cmux Swift Package Boundaries ✅ Passed PASS: The exact PR commit changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The diff contains no .swift paths or Swift content changes. Therefore, the Swift package-boundary c…
Full details: Description check

Explanation

The description explains what changed, why it changed, and how it was verified. It also identifies that Blacksmith Rust tests are pending. The missing checklist and review-trigger sections are non-critical, and no demo is needed because this is an internal performance change without a UI change.

Full details: Cmux Swift Actor Isolation

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The complete HEAD^..HEAD diff contains no Swift paths. Therefore, the Swift actor-isolation check is inapplicable.

Full details: Cmux Swift Blocking Runtime

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The exact commit diff changes Vec to VecDeque and replaces remove(0) with pop_front(). It introduces no Swift file or Swift blocking/timing primitive, so the custom check is not applicable.

Full details: Cmux Browser Automation Off-Main

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs. The diff replaces Vec::remove(0) with VecDeque::pop_front() in equal_nodes and changes no browser command, socket-worker policy, WebKit/AppKit access, main-actor routing, or policy tests. The custom check is therefore not applicable.

Full details: Cmux Expensive Synchronous Load

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs (5 additions, 5 deletions). It replaces Rust Vec front removal with VecDeque::pop_front; it adds no Swift code and no agent-history load or interactive-path call. The custom check does not apply.

Full details: Cmux Cache Substitution Correctness

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, which is Rust. The custom check applies only to production Swift, TypeScript, and JavaScript changes. Therefore, its cache-substitution failure condition is not applicable.

Full details: Cmux No Hacky Sleeps

Explanation

PASS: The PR changes only Rust code in cmux-tui/crates/cmux-tui-core/src/layout.rs. The diff replaces Vec::remove(0) with VecDeque::pop_front() and adds no TypeScript, JavaScript, shell, or build/runtime-script changes. The custom check applies only to those non-Swift languages, so no hacky-sleep failure condition is applicable.

Full details: Cmux Algorithmic Complexity

Explanation

PASS. The PR changes only Rust code in cmux-tui-core/src/layout.rs. It replaces Vec::remove(0) with VecDeque::pop_front() in equal_nodes, changing repeated front removal from quadratic behavior to linear behavior. The change does not introduce any forbidden scan, rescan, sort, filter, join, or slower algorithm.

Full details: Cmux Swift Concurrency

Explanation

PASS: The pull-request diff changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, which is Rust. It adds VecDeque and replaces Vec::remove(0) with pop_front() in equal_nodes. No Swift file or Swift concurrency pattern changed, so this check is inapplicable.

Full details: Cmux Swift `@Concurrent`

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The exact commit has Rust=1, Swift=0, and no Swift paths in its patch. The Swift concurrency rule therefore does not apply.

Full details: Cmux Swift Package Boundaries

Explanation

PASS: The exact PR commit changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The diff contains no .swift paths or Swift content changes. Therefore, the Swift package-boundary check is not applicable.

  • 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-tui-layout-vecdeque

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 feat-tui-layout-vecdeque branch from 23b96c1 to 49001c3 Compare September 3, 2026 23:32
@lawrencecchen
lawrencecchen merged commit bace77c into main Sep 3, 2026
53 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

This branch was successfully deployed

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