Skip to content

Optimize cmux-tui startup configuration - #9933

Closed
lawrencecchen wants to merge 7 commits into
mainfrom
task-tui-startup-latency-optimization
Closed

lawrencecchen wants to merge 7 commits into
mainfrom
task-tui-startup-latency-optimization

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • resolve one non-cloneable configuration snapshot at process entry and move it through server, attach, machine, remote, TUI, and app startup
  • remove repeated startup configuration discovery, parsing, and normalization
  • keep remote help, invalid commands, and headless remote connections free of TUI configuration work
  • keep explicit runtime configuration reload separate from startup

Recut

Current main is exact 04ff18eea6ceb793252583e5c8f9df74b130a5e9. It was merged normally, without a rebase or force push. The exact PR head is cec2eb4ef4873ca0629ebd43ee360eb69d63bd13. It is zero commits behind current main. The product diff remains limited to app.rs, config.rs, main.rs, and remote_cli.rs.

The recut keeps the existing commit history. The startup regression test and implementation were already in the same original commit, so no history rewrite was used to manufacture a red-first commit.

Red evidence and fix

Full hosted run https://github.com/manaflow-ai/cmux/actions/runs/31863135689 found that adding the snapshot raised two app entry functions from seven to eight parameters. Clippy failed with too_many_arguments. Commit 9a86592305ba331108d0bb24a8beadd53cf0373e groups the paired machine UI and controller in MachineRunContext. It does not use a lint exception, and it does not change snapshot ownership or runtime reload behavior.

Current verification

The benchmark contract requires the trusted runner to be the measured baseline and an ancestor of the measured candidate. The runner has not landed on main. Baseline a4ff04bd6b6a9bdfada84ba9466438a44fa8816e is current main plus only the fixed trusted runner. Candidate 39764b92d1f3f47faa1d852cc5df757961f1b830 is a normal merge of exact PR head into that baseline. The four changed product files in the benchmark candidate are byte-identical to exact PR head. Their baseline versions are byte-identical to current main. This gives a contract-valid matched product comparison without changing this PR.

All runs against old bases or old heads are superseded.

@coderabbitai

coderabbitai Bot commented Aug 11, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6463207e-96c1-4a30-9629-d996818258de

📥 Commits

Reviewing files that changed from the base of the PR and between bfdd849 and 9a86592.

📒 Files selected for processing (2)
  • cmux-tui/crates/cmux-tui/src/app.rs
  • cmux-tui/crates/cmux-tui/src/main.rs

📝 Walkthrough

Walkthrough

Startup now loads configuration through StartupConfigSnapshot once. Local and remote execution paths pass the snapshot or its loader to application, server, machine-client, TUI, and remote connection flows.

Changes

Startup configuration reuse

Layer / File(s) Summary
Startup snapshot contract
cmux-tui/crates/cmux-tui/src/config.rs
StartupConfigSnapshot loads configuration once, supports shared access through Deref, and converts into Config. Tests verify loading and value preservation.
Startup and TUI wiring
cmux-tui/crates/cmux-tui/src/app.rs, cmux-tui/crates/cmux-tui/src/main.rs
Startup, server, attach, machine-client, and TUI paths receive and forward the shared snapshot. MachineRunContext bundles optional machine UI state and controller values.
Remote command lazy loading
cmux-tui/crates/cmux-tui/src/remote_cli.rs, cmux-tui/crates/cmux-tui/src/main.rs
Remote commands propagate a configuration loader. Interactive connections load configuration before TUI startup, while help and invalid-argument paths do not load it.

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

Merge Risk: ⚪ Minimal · up to 9a865

The change centralizes startup configuration handling without any supplied indication of a user-visible correctness, security, availability, or deployment regression. No actionable merge-blocking risk remains beyond normal checks.

Sequence Diagram(s)

sequenceDiagram
  participant Startup as Startup entry point
  participant Snapshot as StartupConfigSnapshot
  participant Server as run_server
  participant TUI as run_tui_once
  participant App as app::run_with_machine_updates
  Startup->>Snapshot: load configuration once
  Snapshot->>Server: pass startup snapshot
  Snapshot->>TUI: pass startup snapshot
  TUI->>App: pass startup snapshot
  App->>Snapshot: convert into Config
Loading

Possibly related PRs

  • manaflow-ai/cmux#9840: Shares startup and configuration propagation changes across app.rs, main.rs, and remote_cli.rs.
  • manaflow-ai/cmux#9876: Extends the same configuration-propagation paths with StartupConfigSnapshot and MachineRunContext.
🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 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 exact PR diff changes only four Rust files under cmux-tui; it introduces no production Swift changes, so Swift actor isolation is not applicable.
Cmux Swift Blocking Runtime ✅ Passed The PR diff changes only four Rust files; it contains no Swift files or introduced Swift blocking and timing primitives.
Cmux Browser Automation Off-Main ✅ Passed The diff changes only four Rust cmux-tui files. It changes no browser automation, WebKit/AppKit, socket-worker, or policy code, so this check is inapplicable.
Cmux Expensive Synchronous Load ✅ Passed The PR diff contains only four Rust files under cmux-tui; it adds no production Swift changes or agent-history loads covered by this check.
Cmux Cache Substitution Correctness ✅ Passed The PR-range diff contains only four Rust (.rs) files, so the Swift/TypeScript/JavaScript cache-substitution check is not applicable.
Cmux No Hacky Sleeps ✅ Passed The PR changes only four Rust source files; the rule covers TypeScript, JavaScript, shell, and non-Swift build/runtime scripts, so it is inapplicable.
Cmux Algorithmic Complexity ✅ Passed The diff changes only four Rust files and adds configuration/context plumbing plus a test; no scalable collection scans, nested rescans, sorting, filtering, joins, or slower algorithms were introdu...
Cmux Swift Concurrency ✅ Passed The verified PR range changes only four Rust files under cmux-tui and contains no Swift paths, so it introduces no Swift concurrency pattern covered by this check.
Cmux Swift @Concurrent ✅ Passed The pull request changes only four Rust files; it introduces no Swift async functions, @concurrent annotations, or Swift call sites for this check.
Cmux Swift Package Boundaries ✅ Passed The base-to-HEAD diff changes only four Rust files under cmux-tui and contains no Swift or SwiftPM changes, so this Swift boundary check is inapplicable.
Cmux Swiftpm Lockfiles ✅ Passed The diff contains only four Rust files; no Package.swift, Package.resolved, Xcode project, .gitignore, workflow, or dependency paths changed.
Cmux Swift Logging ✅ Passed The exact PR diff changes only four Rust files and contains no changed Swift logging statements, so the Swift logging check is inapplicable.
Cmux User-Facing Error Privacy ✅ Passed The scoped diff adds no production user-facing text; new quoted messages are test assertions, while production changes only pass a configuration snapshot and machine context.
Cmux Full Internationalization ✅ Passed The diff only changes Rust startup/config plumbing and tests; it adds no user-facing copy, Swift/web messages, or localization/catalog files.
Cmux Swiftui State Layout ✅ Passed The exact PR diff changes only four Rust files; it introduces no SwiftUI views, state wrappers, GeometryReader usage, lazy rows, or render-time state mutation.
Cmux Architecture Rethink ✅ Passed The PR diff changes only two Rust files under cmux-tui and contains no Swift paths or Swift architectural constructs; the Swift-specific check is inapplicable.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed The base-to-HEAD and exact PR-head diffs contain only four Rust files and no Swift paths, so no standalone Swift window change triggers this check.
Cmux Source Artifacts ✅ Passed The diff changes only four existing Rust source files under cmux-tui/.../src; no artifact directories, generated files, logs, screenshots, caches, or build outputs were added.
Cmux No Test Or Debug Seam In Production Source ✅ Passed The exact PR diff contains only four Rust files under cmux-tui; it contains no Swift file under a production Sources path, so this check does not apply.
Cmux No Ambient Global State ✅ Passed The pull request diff contains only four Rust .rs files and no changed Swift files, so the production Swift ambient-global-state check is not applicable.
Title check ✅ Passed The title clearly summarizes the main change: optimizing cmux-tui startup configuration.
Description check ✅ Passed The description provides detailed scope, rationale, regression evidence, and verification status, but omits some template boilerplate.
✨ 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 task-tui-startup-latency-optimization

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 task-tui-startup-latency-optimization branch from 55bfcd4 to 06c31b8 Compare August 13, 2026 04:51
@cursor

cursor Bot commented Aug 13, 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.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@cursor

cursor Bot commented Aug 15, 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.

@cursor

cursor Bot commented Aug 15, 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.

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Superseded by merged PR #10986. The merged current-main implementation preserves the one-snapshot startup contract, keeps help and parse-error paths lazy, and carries the same four-file scope. This historical branch is conflicting and no longer needs separate review.

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