Skip to content

Deliver durable cloud usage notices - #8942

Merged
lawrencecchen merged 19 commits into
mainfrom
feat-cloud-usage-warning-events
Jul 26, 2026
Merged

lawrencecchen merged 19 commits into
mainfrom
feat-cloud-usage-warning-events

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add durable provider notice subscribe and acknowledgement methods with additive outer delivery metadata
  • preserve one process-stable consumer across reconnects and acknowledge only after a successful Ratatui paint
  • bound retained notices and priority queues while preserving keyboard, paste, and mouse input
  • document the negotiated protocol contract

Verification

  • cargo clippy -p cmux-tui --all-targets -- -D warnings
  • cargo test -p cmux-tui-machine-protocol
  • cargo test -p cmux-tui --no-fail-fast (493 unit, 10 CLI, and 3 host-mode tests passed; three unrelated timing cases passed on isolated rerun)
  • tagged macOS build uwntc rendered through /tmp/cmux-debug-uwntc.sock

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

Adds durable cloud usage notices with a color‑coded bottom banner and paint‑gated, action‑aware acknowledgements, plus an outbound machine-agent for secure external pairing. Coalesces provider snapshot invalidations to cut redundant refreshes and reduce UI churn.

  • New Features

    • durable-notices-v1 with subscribe_notices and acknowledge_notice, FIFO delivery, bounded queues, and a bottom banner by level; capability negotiation and spec updated.
    • Banner shows level markers and theme colors; docs describe mouse click handling.
    • New machine-agent subcommand and cmux machine register flow via cmux-tui-machine-protocol, with one‑time pairing codes and strict SSH host verification.
    • TUI surfaces provider‑advertised pairing and routes external machine pairing through providers.
  • Bug Fixes

    • Safer durable notice delivery: acknowledgements only for the painted delivery and deferred during machine actions; replay buffered until the negotiated resume cursor, with tests for wait‑to‑resume and ack‑after‑action.
    • Coalesced provider snapshot invalidations with tests to avoid bursty refreshes.
    • More reliable external pairing recovery with paced reconnects, authoritative retries, preserved recovery state, and surfaced startup/host verification errors; bounded concurrent local opens keep the agent responsive.
    • Cancel ambiguous external pairing on provider selection or scope changes.
    • Localized help/startup messages and corrected machine-agent CLI parsing.

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

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added durable provider notices with reliable delivery, bounded replay, strict ordering, and client-driven acknowledgements.
    • Render a bottom-row, severity-styled durable notice banner; notices advance after successful paint and can be dismissed via keyboard, mouse, or paste.
    • Persist notice delivery state across reconnects while preventing duplicate redisplay.
  • Bug Fixes
    • Improved bounded queuing/retention, strict wire validation for durable metadata, and robust ack failure handling with controlled retry/reconnect behavior.
    • Tightened sensitive credential/safety handling and stricter external machine specifier validation.
  • Documentation
    • Updated the machine-provider v1 spec with durable-notices capability gating and acknowledgement semantics.
  • Tests
    • Expanded durable-notice coverage for FIFO/paint gating, replay behavior, rendering constraints, and reconnect scenarios.

@coderabbitai

coderabbitai Bot commented Jul 26, 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: 1dda30d7-7b88-43ea-9a34-5571de2f841c

📥 Commits

Reviewing files that changed from the base of the PR and between 642ac9e and c3a18d4.

📒 Files selected for processing (4)
  • cmux-tui/crates/cmux-tui/src/app.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_client.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs
  • cmux-tui/spec/machine-provider.md

📝 Walkthrough

Walkthrough

The PR adds durable provider notices across the machine-provider protocol, provider client, runtime update stream, and TUI. It defines delivery metadata and subscription/acknowledgement methods, retains and replays notices, renders and dismisses them, and acknowledges them after successful painting.

Changes

Durable provider notices

Layer / File(s) Summary
Protocol contract and validation
cmux-tui/crates/cmux-tui-machine-protocol/src/lib.rs, cmux-tui/spec/machine-provider.md
Adds durable-notice capability negotiation, subscription and acknowledgement wire types, additive delivery metadata, strict validation, credential comparison hardening, and protocol documentation.
Provider retention and acknowledgement
cmux-tui/crates/cmux-tui/src/machine_provider_client.rs
Wraps provider events with delivery metadata, validates ordering and replay identity, retains bounded durable notices, handles queue overflow, and exposes subscription and acknowledgement APIs.
Machine update transport and runtime
cmux-tui/crates/cmux-tui/src/machine.rs, cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs, cmux-tui/crates/cmux-tui/src/machine_agent/runtime.rs
Carries UI and durable-notice updates through the machine stream, reuses a consumer id across reconnects, routes notices independently of snapshot refreshes, and suppresses duplicate legacy notices when durable delivery is active.
TUI notice lifecycle and rendering
cmux-tui/crates/cmux-tui/src/app.rs, cmux-tui/crates/cmux-tui/src/ui/mod.rs
Queues, paints, dismisses, expires, deduplicates, and acknowledges durable notices with bounded retry and reconnect handling.

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

Sequence Diagram(s)

sequenceDiagram
  participant Provider
  participant ProviderClient
  participant ProviderMachineRuntime
  participant App
  participant UI
  Provider->>ProviderClient: publish notice with delivery metadata
  ProviderClient->>ProviderMachineRuntime: deliver retained notice
  ProviderMachineRuntime->>App: send MachineUpdate::DurableNotice
  App->>UI: paint durable notice banner
  UI->>App: record successful paint
  App->>ProviderMachineRuntime: acknowledge durable notice
  ProviderMachineRuntime->>ProviderClient: acknowledge_notice
  ProviderClient->>Provider: advance acknowledgement cursor
Loading
🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.31% 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
Title check ✅ Passed The title matches the main change: adding durable notices, though "cloud usage" is less precise than the code changes.
Description check ✅ Passed It includes a solid summary and verification section; the Demo Video, Review Trigger, and Checklist sections are missing but the description is mostly complete.
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 Patch is Rust-only; no Swift files or actor-isolation-related changes are introduced, so the Swift rule is not applicable.
Cmux Swift Blocking Runtime ✅ Passed PASS: The PR range changes only Rust/docs files; no Swift files are modified, so the Swift blocking-runtime rule is not applicable.
Cmux Browser Automation Off-Main ✅ Passed Only snapshot-invalidation coalescing changed in machine_provider_runtime.rs; no browser.* commands, routing, or WebKit/AppKit wait paths were touched.
Cmux Expensive Synchronous Load ✅ Passed This PR changes only Rust code; no Swift files were modified, so the Swift main-actor sync-load rule is not triggered.
Cmux Cache Substitution Correctness ✅ Passed Fresh snapshot loads remain authoritative (client.snapshot/load_*), while retained durable notices are event-driven and used only to suppress transient UI banner text.
Cmux No Hacky Sleeps ✅ Passed The only changed runtime file adds atomic gating and try_send logic; no new sleep/poll/delay calls were introduced, and the pre-existing 250ms recv_timeout is unchanged.
Cmux Algorithmic Complexity ✅ Passed The new scans operate only on explicitly bounded 64-item deques; I found no nested full-collection rescans or repeated sort/filter loops on scalable records.
Cmux Swift Concurrency ✅ Passed No Swift files are changed in this PR; the diff is Rust/spec-only, so the Swift concurrency modernization rule is not applicable.
Cmux Swift @Concurrent ✅ Passed PR diff touches only Rust/markdown files; no Swift changes or @concurrent annotations are present, so the Swift rule is not applicable.
Cmux Swift Package Boundaries ✅ Passed PR changes touch only Rust/spec files; no Swift production code was modified, so the boundary rule is not applicable.
Cmux Swiftpm Lockfiles ✅ Passed Diff only touches cmux-tui/src/machine_provider_runtime.rs; no SwiftPM/Xcode/.gitignore/workflow/dependency changes, so the lockfile rule doesn't apply.
Cmux Swift Logging ✅ Passed PASS: the PR diff only touches Rust/Markdown files; no Swift production code or Swift logging changes are present.
Cmux User-Facing Error Privacy ✅ Passed The only production diff is refresh dedup logic; no new user-facing errors, alerts, or recovery copy were added or changed.
Cmux Full Internationalization ✅ Passed No Swift/web locale assets changed; the new TUI banner uses provider-supplied notice text plus fixed symbols, and the spec changes are developer-facing.
Cmux Swiftui State Layout ✅ Passed PR diff changes Rust/Markdown only; no SwiftUI files or state/layout patterns from the rule are present.
Cmux Architecture Rethink ✅ Passed PASS: HEAD changes only a Rust file (machine_provider_runtime.rs); no Swift files were touched, so the Swift architectural-rethink rule doesn’t apply.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed The PR diff only changes Rust code in cmux-tui; it introduces no Swift window code, so the auxiliary-window close-shortcut rule is not applicable.
Cmux Source Artifacts ✅ Passed All changed paths are intentional source/docs files; none match the rule’s artifact/temp/build/cache patterns.
Cmux No Test Or Debug Seam In Production Source ✅ Passed PR changes only Rust files and docs; no Swift files under Sources/ or Tests/ are modified.
Cmux No Ambient Global State ✅ Passed No new ambient globals found; added state lives in App, ProviderClientInner, and ProviderMachineRuntime, with only private file-scope helpers/constants added.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-cloud-usage-warning-events

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.

@greptile-apps

greptile-apps Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds capability-gated durable provider notices across the machine protocol and TUI.

  • Defines subscription, delivery, sequencing, and acknowledgement wire contracts.
  • Preserves a process-stable notice consumer across provider reconnects.
  • Buffers replay until subscription negotiation completes and bounds retained event queues.
  • Displays severity-styled notices and acknowledges them only after successful Ratatui painting.
  • Defers acknowledgement while machine actions or provider replacement are active.
  • Documents the durable-notice protocol contract.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains within the scope of this follow-up review.

Important Files Changed

Filename Overview
cmux-tui/crates/cmux-tui-machine-protocol/src/lib.rs Adds capability-gated durable-notice request, result, and delivery metadata types with strict wire validation.
cmux-tui/crates/cmux-tui/src/app.rs Adds bounded notice presentation and paint-gated acknowledgement state to the TUI event loop.
cmux-tui/crates/cmux-tui/src/machine.rs Extends machine update and controller abstractions with durable notice delivery and acknowledgement.
cmux-tui/crates/cmux-tui/src/machine_agent/runtime.rs Adapts the machine-agent runtime to the extended machine controller contract.
cmux-tui/crates/cmux-tui/src/machine_provider_client.rs Implements durable subscription sequencing, replay buffering, bounded priority delivery, and acknowledgement RPCs.
cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs Integrates stable consumer identity, durable updates, reconnect handling, and coalesced provider refreshes.
cmux-tui/crates/cmux-tui/src/ui/mod.rs Renders the durable notice banner with level-specific styling.
cmux-tui/spec/machine-provider.md Documents capability negotiation and durable notice delivery and acknowledgement semantics.

Sequence Diagram

sequenceDiagram
  participant TUI
  participant Client as Provider Client
  participant Provider
  TUI->>Client: Connect with stable consumer ID
  Client->>Provider: hello
  Provider-->>Client: durable-notices-v1 capability
  Client->>Provider: subscribe_notices(consumer_id)
  Provider-->>Client: resume sequence
  Provider-->>Client: retained/live notice + delivery metadata
  Client-->>TUI: DurableProviderNotice
  TUI->>TUI: Paint notice banner successfully
  TUI->>Client: acknowledge_notice(id, sequence)
  Client->>Provider: acknowledge_notice(id, sequence)
Loading

Reviews (11): Last reviewed commit: "Coalesce provider snapshot invalidations" | Re-trigger Greptile

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

🤖 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/src/app.rs`:
- Around line 6239-6250: Update the AppEvent::Input mouse handling to consume
mouse presses that land on the durable notice banner while it is displayed:
dismiss the notice and return the appropriate redraw action without forwarding
the event to handle_mouse. Preserve normal mouse handling for events outside the
banner and keep non-press dismissal behavior unchanged.
- Around line 4462-4479: Separate durable-notice acknowledgement backoff from
shared provider reconnect state by adding and using a dedicated
durable_notice_ack_retry_at field in the acknowledgement failure and
submit_pending_durable_notice_ack paths. Ensure successful acknowledgement or
explicit acknowledgement-state reset clears both durable_notice_ack_retry_at and
durable_notice_ack_failures, while provider reconnect handling no longer affects
either value.

In `@cmux-tui/crates/cmux-tui/src/ui/mod.rs`:
- Around line 77-80: Update the style construction near the status-level
rendering to make the intended colors explicit: remove Modifier::REVERSED for
colored text on app.chrome.status_bg, or, if a solid color bar is intended, swap
the foreground and background to fg(app.chrome.status_bg).bg(color) without
reversal. Adjust the paired visibility test to validate the rendered color
arrangement rather than only the stored pre-reversal foreground.
🪄 Autofix (Beta)

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: 34327e8d-30dd-4a8a-854a-80faffe2b2b5

📥 Commits

Reviewing files that changed from the base of the PR and between f193d6b and c56c8b9.

📒 Files selected for processing (7)
  • cmux-tui/crates/cmux-tui-machine-protocol/src/lib.rs
  • cmux-tui/crates/cmux-tui/src/app.rs
  • cmux-tui/crates/cmux-tui/src/machine.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_client.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs
  • cmux-tui/crates/cmux-tui/src/ui/mod.rs
  • cmux-tui/spec/machine-provider.md

Comment thread cmux-tui/crates/cmux-tui/src/app.rs
Comment thread cmux-tui/crates/cmux-tui/src/app.rs
Comment thread cmux-tui/crates/cmux-tui/src/ui/mod.rs Outdated
# Conflicts:
#	cmux-tui/crates/cmux-tui-machine-protocol/src/lib.rs
#	cmux-tui/crates/cmux-tui/src/app.rs
#	cmux-tui/crates/cmux-tui/src/machine_provider_client.rs
#	cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs
#	cmux-tui/crates/cmux-tui/src/ui/mod.rs
#	cmux-tui/spec/machine-provider.md
@cursor

cursor Bot commented Jul 26, 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 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: 10

🤖 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/src/machine_agent/identity.rs`:
- Around line 128-149: Update the concurrent fallback in load_or_create around
the existing load(path) calls to retry load once when verify_private_file
reports the specific transient “must have exactly one link” failure caused by
the hard-link window. Keep the hardlink validation unchanged, and propagate all
other errors immediately; after the bounded retry, preserve the existing
load-or-create result behavior.

In `@cmux-tui/crates/cmux-tui/src/machine_agent/mod.rs`:
- Around line 190-198: Update
cmux-tui/crates/cmux-tui/src/machine_agent/mod.rs:190-198 around
StderrReporter::new to defer opening the pairing terminal until a pairing code
actually needs to be printed, allowing supervised reconnects without /dev/tty;
alternatively preserve the fail-closed behavior only if it is explicitly
documented. Update cmux-tui/docs/getting-started.md:66-73 to state that npx cmux
machine-agent requires an interactive terminal. Update
cmux-tui/docs/machines.md:97-103 with the same prerequisite for sharing a local
machine, and move the ssh cmux.cloud rationale above the agent-start command.
- Around line 55-64: Update the run_agent error handling in run so the
user-facing result remains the localized messages.runtime_failed, while the
original error is retained and emitted through the existing
CMUX_MACHINE_AGENT_DEBUG path or logging sink when enabled. Do not expose raw
failure details in the normal user-facing error.

In `@cmux-tui/crates/cmux-tui/src/machine_agent/runtime.rs`:
- Around line 1127-1129: The cloud write path in the `send` method has no
timeout and can block the worker loop indefinitely. Guard
`protocol_io::write_frame` with a deadline or equivalent bounded write control,
reusing the existing `ReadDeadline`-style mechanism used during handshake, and
preserve the current error propagation when the deadline or write fails.

In `@cmux-tui/crates/cmux-tui/src/machine_agent/transport.rs`:
- Around line 89-97: Add the SSH option terminator before the destination in the
argument construction flow of the relevant transport method, placing “--”
immediately before destination and preserving the existing cmux machine register
arguments and ordering.

In `@cmux-tui/crates/cmux-tui/src/main.rs`:
- Line 250: Update the USAGE block’s machine_agent_usage placeholder handling in
main.rs so unsupported platforms remove the entire indented line, including its
surrounding whitespace, rather than substituting an empty string. Apply the same
trimming behavior to the additional occurrence referenced by the comment.
- Around line 707-716: Update the machine-agent error handling across
machine_agent::run and the main dispatch block so help text is emitted only for
argument-parse errors. Preserve the concise error-only stderr output for runtime
failures such as reconnect, lock, socket, or SSH errors, using a typed or
otherwise explicit distinction from run rather than matching the opaque message.

In `@cmux-tui/crates/cmux-tui/tests/cli.rs`:
- Around line 349-363: Update
machine_agent_runtime_failures_are_stable_and_localized to exercise an
argument-level parse failure that cannot be masked by StderrReporter or /dev/tty
setup, such as an invalid value handled by parse_args. Assert the command fails
with the expected localized argument error and does not rely on the generic
runtime_failed output or empty-session validation.

In `@cmux-tui/docs/getting-started.md`:
- Around line 66-73: Update the machine-agent instructions near the npx cmux
machine-agent command to explicitly state that it must be run from an
interactive terminal with /dev/tty available. Keep the existing session-sharing
command and pairing-code guidance unchanged.

In `@cmux-tui/docs/machines.md`:
- Around line 97-103: Update the setup instructions around the outbound agent
and interactive SSH steps: move the rationale for running the one-time
interactive ssh cmux.cloud command before the agent-start command, adjacent to
the initial SSH instructions, and explicitly state that the agent requires a
controlling terminal and hard-fails without one, including on restarts where no
pairing code is printed.
🪄 Autofix (Beta)

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: 80e91707-bef8-48e7-8e67-bf1db428fee0

📥 Commits

Reviewing files that changed from the base of the PR and between c56c8b9 and dbd0bea.

⛔ Files ignored due to path filters (1)
  • cmux-tui/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (31)
  • cmux-tui/Cargo.toml
  • cmux-tui/README.md
  • cmux-tui/crates/cmux-tui-machine-agent-protocol/Cargo.toml
  • cmux-tui/crates/cmux-tui-machine-agent-protocol/src/lib.rs
  • cmux-tui/crates/cmux-tui-machine-protocol/Cargo.toml
  • cmux-tui/crates/cmux-tui-machine-protocol/src/lib.rs
  • cmux-tui/crates/cmux-tui/Cargo.toml
  • cmux-tui/crates/cmux-tui/src/app.rs
  • cmux-tui/crates/cmux-tui/src/localization.rs
  • cmux-tui/crates/cmux-tui/src/machine.rs
  • cmux-tui/crates/cmux-tui/src/machine_agent/identity.rs
  • cmux-tui/crates/cmux-tui/src/machine_agent/mod.rs
  • cmux-tui/crates/cmux-tui/src/machine_agent/protocol_io.rs
  • cmux-tui/crates/cmux-tui/src/machine_agent/runtime.rs
  • cmux-tui/crates/cmux-tui/src/machine_agent/transport.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_client.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_transport.rs
  • cmux-tui/crates/cmux-tui/src/main.rs
  • cmux-tui/crates/cmux-tui/src/ui/mod.rs
  • cmux-tui/crates/cmux-tui/src/ui/rail.rs
  • cmux-tui/crates/cmux-tui/tests/cli.rs
  • cmux-tui/docs/README.md
  • cmux-tui/docs/configuration.md
  • cmux-tui/docs/getting-started.md
  • cmux-tui/docs/machines.md
  • cmux-tui/docs/mouse.md
  • cmux-tui/spec/README.md
  • cmux-tui/spec/cli.md
  • cmux-tui/spec/machine-agent.md
  • cmux-tui/spec/machine-provider.md

Comment thread cmux-tui/crates/cmux-tui/src/machine_agent/identity.rs
Comment thread cmux-tui/crates/cmux-tui/src/machine_agent/mod.rs Outdated
Comment thread cmux-tui/crates/cmux-tui/src/machine_agent/mod.rs
Comment thread cmux-tui/crates/cmux-tui/src/machine_agent/runtime.rs
Comment thread cmux-tui/crates/cmux-tui/src/machine_agent/transport.rs
Comment thread cmux-tui/crates/cmux-tui/src/main.rs
Comment thread cmux-tui/crates/cmux-tui/src/main.rs
Comment thread cmux-tui/crates/cmux-tui/tests/cli.rs
Comment thread cmux-tui/docs/getting-started.md
Comment thread cmux-tui/docs/machines.md Outdated
@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Exact union head is 8a1598e. It composes durable usage notices with external pairing and the bounded concurrent local-open fix. Local validation passed 586 unit tests, 52 integration and protocol tests, and clippy with warnings denied. @codex review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@greptileai review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

🤖 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/src/machine_agent/runtime.rs`:
- Line 28: Shorten the thread name assigned by spawn_local_connectors so it
remains within Linux’s 16-byte pthread name limit while retaining each worker’s
index. Replace the current “machine-agent-local-connector-{index}” naming format
with a compact format such as “mx-local-open-{index}”, and apply the same naming
change to the corresponding worker-spawn path.
🪄 Autofix (Beta)

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: 0f394031-9027-4449-b272-a0ded143a74b

📥 Commits

Reviewing files that changed from the base of the PR and between dbd0bea and 8a1598e.

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

Comment thread cmux-tui/crates/cmux-tui/src/machine_agent/runtime.rs

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a1598efbe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmux-tui/crates/cmux-tui/src/machine_agent/runtime.rs Outdated
@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Exact head is b4699fa. It adds PR8748 exact-review fixes to the durable notice/external pairing union. Local validation passed 588 unit tests, 54 integration/protocol tests, and clippy with warnings denied. @codex review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@greptileai review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4699faabb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs
@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Exact post-PR8748 integration head is 906c5a2. It preserves provider-switch UI overlays while forwarding durable notice updates unchanged. The 602 unit tests, 14 CLI tests, focused durable-notice tests, and workspace clippy with warnings denied passed. One unrelated terminal-host saturation test timed out twice on this heavily loaded host; this branch does not modify its code. @codex review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@greptileai review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Unknown error
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@codex review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Exact head is 642ac9e. The final documentation commit makes the contract match the reviewed click behavior: keyboard, paste, scroll, and outside-banner presses pass through, while a press on the banner row is consumed to block hidden status targets. Runtime code is unchanged from c2e413a. @codex review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@greptileai review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 642ac9ee09

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmux-tui/crates/cmux-tui/src/machine_provider_client.rs Outdated

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

Caution

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

⚠️ Outside diff range comments (4)
cmux-tui/spec/machine-provider.md (1)

83-85: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Establish the resume cursor before accepting replayed deliveries.

A new control generation starts at cursor zero, while the current test permits a notice event before subscribe_notices responds. After reconnecting a consumer already acknowledged through sequence N, a valid pre-response replay at N + 1 is rejected as expecting sequence 1, causing a reconnect loop.

  • cmux-tui/spec/machine-provider.md#L83-L85: require a successful subscribe_notices response to precede durable deliveries, or explicitly define pre-response buffering.
  • cmux-tui/crates/cmux-tui/src/machine_provider_client.rs#L431-L440: do not apply contiguity validation against the default cursor while subscription initialization is pending; add a reconnect regression with cursor N and delivery N + 1.
🤖 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/spec/machine-provider.md` around lines 83 - 85, Ensure subscription
initialization establishes the resume cursor before durable deliveries undergo
contiguity validation: update cmux-tui/spec/machine-provider.md lines 83-85 to
require a successful subscribe_notices response before deliveries, or define
buffering, and update machine_provider_client.rs lines 431-440 to avoid
validating against the default cursor while subscription is pending; add a
reconnect regression covering an acknowledged cursor N followed by delivery N+1.
cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs (2)

829-1108: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the repeated "disconnected/failed UI" construction in subscribe_ui_updates.

The refresh worker builds a near-identical machine_ui_state(...) + notice + MachineRequest::ReconnectProvider block roughly five times (overflow check, ProviderRefreshSignal::Disconnected, channel-disconnected fallback, snapshot/lifecycle/workspace load failures). This is already flagged as a code_block_complexity_high segment; extracting a small helper (e.g. fn disconnected_ui(...) / fn failed_ui(..., message)) would shrink duplication and make the four failure branches easier to keep in sync.

🤖 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/src/machine_provider_runtime.rs` around lines 829 -
1108, Extract the repeated disconnected/failed UI construction from
subscribe_ui_updates into a small helper near the surrounding UI helpers,
accepting the current snapshots, keys, and optional notice text. Have it build
machine_ui_state with the existing disconnected flags, set the notice and
ReconnectProvider request, then replace the overflow, disconnect, and
snapshot/lifecycle/workspace error branches with calls to that helper while
preserving their existing messages and control flow.

114-114: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Clear pending_provider_switch whenever a pending replacement is aborted.

pending_provider_switch is set when a provider-directed pairing succeeds, but abort_replacement() only clears pending_active_local. If that replacement fails, is cancelled, or is replaced by a stale command, the flag stays true; future provider Switch(...) updates can then clear the currently-active local active_local via merge_local_machine_ui_for_provider_switch.

🐛 Proposed fix
     fn abort_replacement(&mut self) {
         self.provider.abort_replacement();
         self.pending_active_local = None;
+        self.pending_provider_switch = false;
     }
🤖 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/src/machine_provider_runtime.rs` at line 114, Update
abort_replacement() to clear pending_provider_switch alongside
pending_active_local whenever a pending replacement is aborted. Ensure all
failure, cancellation, and stale-command paths that invoke abort_replacement()
leave the flag false so later provider Switch(...) updates cannot clear the
active local state.
cmux-tui/crates/cmux-tui/src/app.rs (1)

6628-6645: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Scroll wheel on the banner row still reaches the covered rail's scroll handling.

Only MouseEventKind::Down(_) on the banner row short-circuits before handle_mouse (consuming the click so covered ScreenEntry/NewScreen/rail hits can't fire — the fix from the earlier review). Scroll events (ScrollUp/ScrollDown/ScrollLeft/ScrollRight) on that same row only dismiss the notice via the generic dismissed flag but still fall through to handle_mouse → handle_scroll, which can mutate machine_rail_scroll/workspace_rail_scroll since both sidebar Rects are sized with content_area.height.saturating_add(1) and therefore extend into the banner row (durable_notice_banner_row() computes exactly that row). A mouse wheel scroll on the banner row can silently scroll a hidden rail while the user intends to interact with (or just dismiss) the notice.

Consider including the scroll variants in the early-return condition, mirroring the Down case:

🐛 Proposed fix
             AppEvent::Input(Event::Mouse(mouse)) => {
-                if matches!(mouse.kind, MouseEventKind::Down(_))
+                if matches!(
+                    mouse.kind,
+                    MouseEventKind::Down(_)
+                        | MouseEventKind::ScrollUp
+                        | MouseEventKind::ScrollDown
+                        | MouseEventKind::ScrollLeft
+                        | MouseEventKind::ScrollRight
+                )
                     && self.durable_notice_banner_row() == Some(mouse.row)
                     && self.dismiss_painted_durable_notice()
                 {
                     return Ok(RenderAction::Draw);
                 }
🤖 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/src/app.rs` around lines 6628 - 6645, Update the
early-return condition in the AppEvent::Input mouse handler to treat ScrollUp,
ScrollDown, ScrollLeft, and ScrollRight on durable_notice_banner_row() like Down
events. When dismiss_painted_durable_notice() succeeds for any of these events,
return RenderAction::Draw before calling handle_mouse, preventing covered rail
scrolling while preserving normal handling elsewhere.
🤖 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.

Outside diff comments:
In `@cmux-tui/crates/cmux-tui/src/app.rs`:
- Around line 6628-6645: Update the early-return condition in the
AppEvent::Input mouse handler to treat ScrollUp, ScrollDown, ScrollLeft, and
ScrollRight on durable_notice_banner_row() like Down events. When
dismiss_painted_durable_notice() succeeds for any of these events, return
RenderAction::Draw before calling handle_mouse, preventing covered rail
scrolling while preserving normal handling elsewhere.

In `@cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs`:
- Around line 829-1108: Extract the repeated disconnected/failed UI construction
from subscribe_ui_updates into a small helper near the surrounding UI helpers,
accepting the current snapshots, keys, and optional notice text. Have it build
machine_ui_state with the existing disconnected flags, set the notice and
ReconnectProvider request, then replace the overflow, disconnect, and
snapshot/lifecycle/workspace error branches with calls to that helper while
preserving their existing messages and control flow.
- Line 114: Update abort_replacement() to clear pending_provider_switch
alongside pending_active_local whenever a pending replacement is aborted. Ensure
all failure, cancellation, and stale-command paths that invoke
abort_replacement() leave the flag false so later provider Switch(...) updates
cannot clear the active local state.

In `@cmux-tui/spec/machine-provider.md`:
- Around line 83-85: Ensure subscription initialization establishes the resume
cursor before durable deliveries undergo contiguity validation: update
cmux-tui/spec/machine-provider.md lines 83-85 to require a successful
subscribe_notices response before deliveries, or define buffering, and update
machine_provider_client.rs lines 431-440 to avoid validating against the default
cursor while subscription is pending; add a reconnect regression covering an
acknowledged cursor N followed by delivery N+1.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 66225fc3-7393-43d3-8fdd-6f78de78289d

📥 Commits

Reviewing files that changed from the base of the PR and between b4699fa and c2e413a.

📒 Files selected for processing (7)
  • cmux-tui/crates/cmux-tui/src/app.rs
  • cmux-tui/crates/cmux-tui/src/machine.rs
  • cmux-tui/crates/cmux-tui/src/machine_agent/runtime.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_client.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs
  • cmux-tui/crates/cmux-tui/src/ui/mod.rs
  • cmux-tui/spec/machine-provider.md

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Caution

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

⚠️ Outside diff range comments (1)
cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs (1)

857-916: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate "provider disconnected" UI construction (3x) in the refresh worker.

The overflow-check branch, ProviderRefreshSignal::Disconnected arm, and the RecvTimeoutError::Disconnected arm all build an identical disconnected MachineUiState (same machine_ui_state(...) call, same notice, same ReconnectProvider request, same send-and-break). Extract a small helper closure capturing last_snapshot, last_machine_lifecycle_snapshot, last_workspace_snapshot, keys, and refresh_output to build+send this once.

♻️ Proposed refactor sketch
+                let emit_disconnected = |last_snapshot: &protocol::SnapshotResult,
+                                          last_machine_lifecycle_snapshot: &protocol::MachineLifecycleSnapshotResult,
+                                          last_workspace_snapshot: Option<&protocol::WorkspaceSnapshotResult>| {
+                    let mut ui = machine_ui_state(
+                        last_snapshot,
+                        last_machine_lifecycle_snapshot,
+                        last_workspace_snapshot,
+                        &keys,
+                        false,
+                        false,
+                    );
+                    ui.notice = Some(localization::catalog().sidebar.machine_provider_disconnected.into());
+                    ui.request = Some(MachineRequest::ReconnectProvider);
+                    let _ = refresh_output.send(MachineUpdate::Ui(Box::new(ui)));
+                };

Then replace each of the three inline blocks with a call to emit_disconnected(&last_snapshot, &last_machine_lifecycle_snapshot, last_workspace_snapshot.as_ref()).

🤖 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/src/machine_provider_runtime.rs` around lines 857 -
916, Extract the duplicated disconnected-UI construction in the refresh worker
into an emit_disconnected helper closure capturing keys and refresh_output, with
snapshot arguments as needed. Have it build the machine_ui_state, set the
disconnected notice and ReconnectProvider request, and send the UI update;
replace the overflow, ProviderRefreshSignal::Disconnected, and conditional
RecvTimeoutError::Disconnected blocks with calls to this helper while preserving
their existing break and overflow behavior.
🤖 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.

Outside diff comments:
In `@cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs`:
- Around line 857-916: Extract the duplicated disconnected-UI construction in
the refresh worker into an emit_disconnected helper closure capturing keys and
refresh_output, with snapshot arguments as needed. Have it build the
machine_ui_state, set the disconnected notice and ReconnectProvider request, and
send the UI update; replace the overflow, ProviderRefreshSignal::Disconnected,
and conditional RecvTimeoutError::Disconnected blocks with calls to this helper
while preserving their existing break and overflow behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fc7c90b2-a338-49f9-ae62-278b8d526d38

📥 Commits

Reviewing files that changed from the base of the PR and between b4699fa and 642ac9e.

📒 Files selected for processing (7)
  • cmux-tui/crates/cmux-tui/src/app.rs
  • cmux-tui/crates/cmux-tui/src/machine.rs
  • cmux-tui/crates/cmux-tui/src/machine_agent/runtime.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_client.rs
  • cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs
  • cmux-tui/crates/cmux-tui/src/ui/mod.rs
  • cmux-tui/spec/machine-provider.md

@cursor

cursor Bot commented Jul 26, 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

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d45ef4d948

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmux-tui/crates/cmux-tui/src/app.rs
@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db49438b37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmux-tui/crates/cmux-tui/src/machine_provider_runtime.rs
@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@codex review

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: c3a18d4631

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lawrencecchen
lawrencecchen merged commit 015b603 into main Jul 26, 2026
8 checks passed
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