Skip to content

Test Cmd-click URLs while mouse reporting is active - #11949

Merged
austinywang merged 14 commits into
mainfrom
issue-2896-tmux-cmd-click
Sep 8, 2026
Merged

austinywang merged 14 commits into
mainfrom
issue-2896-tmux-cmd-click

Conversation

@austinywang

@austinywang austinywang commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Root cause

The requested tmux reproduction was already fixed on the current origin/main before this branch was fast-forwarded. The pinned Ghostty lineage admits the Cmd/Super link chord while mouse reporting is active, latches the left-click lifecycle, suppresses the tmux mouse reports, and emits the existing open_url action. cmux's URL routing is mode-independent.

What this PR adds

  • Extends the existing executable terminal UI harness with a plain https://github.com fixture and DECSET 1000 mouse reporting (the protocol state enabled by tmux mouse mode).
  • Adds TerminalCmdClickUITests/testStationaryCmdClickPlainURLWithMouseReportingOpensURL, which drives the production Cmd transition and click callbacks and asserts the captured open_url target.
  • Asserts that the fixture surface is genuinely in Ghostty's captured-mouse state before clicking, preventing a false pass outside the affected branch.
  • Links issue Cmd+click links don't work inside tmux sessions #2896 explicitly from the existing Ghostty fork history note.

No duplicate Ghostty runtime patch or new cmux routing branch is included; adding one would fork behavior that is already shipped in the checksum-backed GhosttyKit artifact.

Verification

  • Hosted real-build E2E run 34073087822 checked out exact final HEAD ce3520ead2d3167df9eec9b450682ad377b5ec90 and passed TerminalCmdClickUITests/testStationaryCmdClickPlainURLWithMouseReportingOpensURL: exactly 1 test, 0 failures, 3.564 seconds. The run also published its test-recording artifact.
  • The mandated tagged cloud build for ce3520ead… completed on cmux12s-mac-mini in 327 seconds with CMUX_DEV_BACKEND_MODE=off and produced the tagged archive. The wrapper then failed during post-build run-state confirmation with No space left on device; the archive was intact, but the remote SSH session could not launch the app because macOS returned RBSRequestErrorDomain Code=5 (no GUI launch domain). The exact archive, extraction directory, tag symlink, and derived data were removed after inspection. This is a launch-confirmation limitation, not a compile failure.
  • swiftc -frontend -parse Sources/AppDelegate.swift and swiftc -frontend -parse cmuxUITests/TerminalCmdClickUITests.swift passed. These were syntax-only checks; no local build or test was run.
  • The mandated scripts/swift_file_length_budget.py command could not run because that script is absent from this current origin/main checkout; neither it nor either tracked budget TSV was created or modified.
  • No local xcodebuild, Swift build, or XCUITest run was used. The full app/test verification ran on the hosted macOS runner, and the tagged app build runs on the cloud builder as required.

Before / after evidence

  • Before the Ghostty lineage fix: mouse_event != .none skipped both link-refresh gates, leaving over_link false and sending Cmd-click to tmux.
  • After the current Ghostty lineage fix: mouseLinkRefreshAllowedState(true, …, super) is true, the click lifecycle is latched and swallowed locally, and the hosted test verifies that a plain https://github.com emits open_url while ghostty_surface_mouse_captured is true.
  • This is a terminal interaction regression rather than a layout change. The hosted recording is the reproducible real-app evidence; a before/after screenshot cannot show the pre-fix pointer/underline state in the deterministic harness. The remote pixel/CUA leg was attempted on the tagged app but could not match the app window title, while the same remote verification did produce socket and pane evidence; this limitation is stated rather than presented as visual proof.

Trade-offs

  • The test uses DECSET 1000 instead of spawning tmux so it remains hermetic and directly targets the terminal protocol state; this covers the same Ghostty mouse-reporting invariant without coupling the test to tmux installation/configuration.
  • This PR intentionally contains no runtime change because the production fix is already present in origin/main; the remaining value is executable regression coverage and issue provenance. Adding an unrelated repair for the current-main v2Error compile regression would expand scope and obscure the bug-fix provenance, so that repair remains separate in PR fix(macOS): harden mobile surface kind mapping #10330.
  • CMUX_DEV_BACKEND_MODE=off is used only for the tagged terminal build because this test does not exercise web/backend surfaces; hosted E2E still runs the complete app/test target.
  • No user-facing app strings or keyboard shortcuts changed, so localization and shortcut settings are unaffected.

Summary by CodeRabbit

  • Tests

    • Expanded terminal interaction coverage for Cmd-clicking plain URLs and OSC 8 links while mouse reporting is enabled.
    • Added verification that terminal mouse-reporting state is captured correctly and that URL-opening events are triggered as expected.
    • Added support for repeatedly displaying plain URL test content, improving coverage of stationary pointer interactions.
  • Documentation

    • Updated Cmd-click link activation documentation with an additional related issue reference.

@vercel

vercel Bot commented Sep 4, 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 7, 2026 2:30am UTC
cmux41 Ready Ready Preview Sep 7, 2026 2:30am UTC

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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

@coderabbitai

coderabbitai Bot commented Sep 4, 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: Team

Run ID: e5a13c20-46b7-4101-82c3-6ac64265b1c3

📥 Commits

Reviewing files that changed from the base of the PR and between 167bfea and ff10bbc.

📒 Files selected for processing (3)
  • Sources/AppDelegate.swift
  • cmuxUITests/TerminalCmdClickUITests.swift
  • docs/ghostty-fork.md

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


📝 Walkthrough

Walkthrough

The terminal setup supports mouse reporting and a plain-URL line format. UI tests verify stationary Cmd-click behavior with mouse reporting enabled. The fork documentation adds a reproduction issue reference.

Changes

Mouse Reporting URL Cmd-Click

Layer / File(s) Summary
Terminal command and line-format setup
Sources/AppDelegate.swift
Reads the mouse-reporting environment variable, supports the url line format, logs the state, prepends DECSET 1000 commands, and reports captured mouse state.
UI-test launch and URL validation
cmuxUITests/TerminalCmdClickUITests.swift, docs/ghostty-fork.md
Adds plain-URL test coverage, configures URL capture, and documents the additional reproduction issue reference.

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

Merge Risk: ⚪ Minimal · up to ff10b

This change adds regression coverage for Cmd-clicking plain URLs while terminal mouse reporting is active, without changing production behavior. The new fixture and assertions are ready to merge.

Sequence Diagram(s)

sequenceDiagram
  participant TerminalCmdClickUITests
  participant AppDelegate
  participant Terminal
  participant OpenURLCapture
  TerminalCmdClickUITests->>AppDelegate: Launch with mouseReporting=1 and lineFormat=url
  AppDelegate->>Terminal: Prepend DECSET 1000 and print https://github.com
  TerminalCmdClickUITests->>Terminal: Run stationary Cmd-click
  Terminal->>OpenURLCapture: Record opened URL
  OpenURLCapture-->>TerminalCmdClickUITests: Return captured https://github.com
Loading

Suggested reviewers: lawrencecchen, azooz2003-bit

🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

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 4 functions across 1 files. (2 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description clearly explains the root cause, scope, verification, limitations, and trade-offs. It omits the required Demo Video section for a UI behavior change, the Review Trigger block, and the … Add the Demo Video section with a video or attachment, include the Review Trigger block, and complete the Checklist.
✅ Passed checks (13 passed)
Check name Status Explanation
Cmux Swift Actor Isolation ✅ Passed PASS. The production Swift diff is limited to the #if DEBUG terminal UI-test harness inside @MainActor final class AppDelegate. It adds local state, shell-command text, and a writeState payload …
Cmux Swift Blocking Runtime ✅ Passed PASS. The cumulative PR diff changes only the #if DEBUG terminal Cmd-click UI-test harness in Sources/AppDelegate.swift, the UI test, and documentation. The production-file additions only configur…
Cmux Browser Automation Off-Main ✅ Passed The exact PR range was inspected from its merge base. Sources/TerminalController.swift and Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Wire/ControlCommandExecutionPolicy.swift are u…
Cmux Expensive Synchronous Load ✅ Passed PASS. The PR changes only the #if DEBUG terminal Cmd-click UI-test fixture in Sources/AppDelegate.swift, adds a UI test, and updates documentation. The additions read test environment values, gene…
Cmux Cache Substitution Correctness ✅ Passed PASS — The PR adds debug-only UI-test instrumentation and a regression test. Sources/AppDelegate.swift reads ghostty_surface_mouse_captured from the live TerminalSurface.surface handle and write…
Cmux No Hacky Sleeps ✅ Passed PASS: The pull-request diff contains only Sources/AppDelegate.swift, cmuxUITests/TerminalCmdClickUITests.swift, and docs/ghostty-fork.md. The runtime rule applies to non-Swift TypeScript, JavaSc…
Cmux Algorithmic Complexity ✅ Passed PASS. The PR adds only debug UI-test harness behavior in Sources/AppDelegate.swift under #if DEBUG, plus XCTest coverage and documentation. The fixture shell loop is explicitly fixed at 48 iterati…
Cmux Swift Concurrency ✅ Passed PASS. The PR diff adds only terminal fixture setup and XCTest coverage in Swift. The added code uses environment values, shell command strings, payload reporting, and existing synchronous test helpers…
Cmux Swift @Concurrent ✅ Passed PASS. The PR diff adds only synchronous setup logic in @MainActor final class AppDelegate and a synchronous throws UI test. It adds no async, nonisolated async, @concurrent, or new async cal…
Cmux Swift Package Boundaries ✅ Passed PASS — The PR does not introduce independently reusable domain logic in the app target. The only production-file changes are inside AppDelegate's #if DEBUG private `setupTerminalCmdClickUITestIfNeed…
Linked Issues check ✅ Passed The pull request explicitly links issue #2896 and preserves the existing reference to issue #5128.
Out of Scope Changes check ✅ Passed The changes stay within the stated scope of regression coverage, test harness updates, and issue documentation. No unrelated runtime changes are included.
Title check ✅ Passed The title clearly identifies the main change: testing Cmd-click URL handling while terminal mouse reporting is active.
Full details: Docstring Coverage

Explanation

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 4 functions across 1 files. (2 skipped: 1 unsupported, 1 too large.)

Full details: Description check

Explanation

The description clearly explains the root cause, scope, verification, limitations, and trade-offs. It omits the required Demo Video section for a UI behavior change, the Review Trigger block, and the Checklist.

  • 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 issue-2896-tmux-cmd-click

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.

@austinywang
austinywang force-pushed the issue-2896-tmux-cmd-click branch from 59ab23c to b8ec83b Compare September 4, 2026 12:11
@coderabbitai

coderabbitai Bot commented Sep 4, 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.

@austinywang
austinywang force-pushed the issue-2896-tmux-cmd-click branch from b8ec83b to 8edb883 Compare September 4, 2026 12:30
@austinywang

Copy link
Copy Markdown
Contributor Author

CodeRabbit review follow-up: the Docstring Coverage warning is acknowledged and intentionally left unchanged. The touched Swift is an existing #if DEBUG private UI-test harness; the added XCTest method and local fixture branches are test-only, not public package API. Adding API-style doc comments to private/local test helpers would add noise without changing the contract, so no code change is warranted.

@cursor

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

@austinywang

austinywang commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Review audit (re-checked against HEAD ce3520ead2d3167df9eec9b450682ad377b5ec90)

Comment ID Author File:line Ask Disposition Commit SHA
5540198746 coderabbitai[bot] Sources/AppDelegate.swift:2621, cmuxUITests/TerminalCmdClickUITests.swift:223 Review the test/harness changes; the generated pre-merge report noted docstring coverage for private/debug/test helpers. disagree ce3520ead2d3167df9eec9b450682ad377b5ec90
5540267519 coderabbitai[bot] full diff Full-review processing notice; the completed review produced no actionable comments. already-fixed ce3520ead2d3167df9eec9b450682ad377b5ec90
5540726053 cursor[bot] — Bugbot was paused by the on-demand spend limit; no finding was issued. already-fixed ce3520ead2d3167df9eec9b450682ad377b5ec90
5558596582 cursor[bot] — Bugbot was paused by the on-demand spend limit; no finding was issued. already-fixed ce3520ead2d3167df9eec9b450682ad377b5ec90
5558597200 coderabbitai[bot] full diff Full-review fallback processing notice; no actionable finding was issued. already-fixed ce3520ead2d3167df9eec9b450682ad377b5ec90
5540186807 vercel[bot] — Preview deployment status only; both deployments are now complete. already-fixed ce3520ead2d3167df9eec9b450682ad377b5ec90
5540187886 github-actions[bot] — CLA acknowledgment only. already-fixed ce3520ead2d3167df9eec9b450682ad377b5ec90

The docstring warning in 5540198746 applies to private #if DEBUG/XCTest helpers rather than public package API; the rationale remains recorded in comment 5540639998. There are no unresolved inline review threads, no CHANGES_REQUESTED reviews, and no Codex/Greptile/Cubic review body requiring a code response. The final hosted regression run is 34073087822, which checked out this exact SHA and passed the selected test (1 test, 0 failures).

@cursor

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

@austinywang
austinywang merged commit 2bde087 into main Sep 8, 2026
22 checks passed
rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 8, 2026
2bde087 Test Cmd-click URLs while mouse reporting is active (manaflow-ai#11949)
aerickson pushed a commit to aerickson/cmux that referenced this pull request Sep 13, 2026
* test: cover cmd-click URLs under mouse reporting

* docs: link tmux Cmd-click fix to issue 2896

* test: assert mouse reporting fixture is active

This branch was successfully deployed

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