Skip to content

fix(terminal): restore link hover after mouseleave - #10903

Merged
nwparker merged 3 commits into
stablyai:mainfrom
nwparker:nwparker/link-click
Jul 27, 2026
Merged

nwparker merged 3 commits into
stablyai:mainfrom
nwparker:nwparker/link-click

Conversation

@nwparker

@nwparker nwparker commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Reproduces the intermittent Claude Code case where a colored URL remains non-clickable after the pointer leaves and returns to the same terminal cell.
  • Resets xterm's stale linkifier hover cache on the non-bubbling terminal-screen mouseleave event and disposes the listener with its pane.
  • Adds focused unit coverage plus URL and file-path E2E regressions.

Screenshots

After the pointer leaves the terminal and returns to the same Claude Code URL cell, the URL hover strip and pointer affordance now recover immediately without clicking, selecting, scrolling, or changing worktrees.

issue-001-fixed-first-hover.png

Testing

  • pnpm lint (targeted Oxlint and formatting checks passed)
  • pnpm typecheck (pnpm run typecheck:web passed)
  • pnpm test (63 focused tests passed)
  • pnpm build (E2E-mode Electron build passed)
  • Added or updated high-quality tests that would catch regressions

Focused verification:

  • pnpm exec vitest run src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-mouseleave.test.ts src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset.test.ts src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-write.test.ts src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts src/renderer/src/components/terminal-pane/terminal-visibility-resume.test.ts --config config/vitest.config.ts — 63 passed
  • pnpm run typecheck:web
  • pnpm run check:max-lines-ratchet
  • pnpm exec electron-vite build --mode e2e --logLevel error
  • SKIP_BUILD=1 pnpm exec playwright test tests/e2e/terminal-link-hover-after-worktree-return.spec.ts --reporter=line — 3 passed
  • Manual Electron verification against Claude Code output confirmed first-hover recovery after leaving and returning to the same URL cell.

Performance Audit

The handler is an O(1) pair of terminal-local cache assignments and runs only on .xterm-screen mouseleave, not terminal output, typing, render, resize, polling, or visibility hot paths. A local stress measurement completed 1,000,000 handler calls in 2.3 ms and 100,000 install/dispose pairs in 29.4 ms; every one of 100,001 installed listeners was removed and zero listeners remained. The lifecycle regression now asserts the exact listener added during openTerminal is removed by disposePane.

AI Review Report

No findings remained. The review traced listener ownership from terminal creation through pane disposal, verified no-op behavior when the xterm screen or private linkifier fields are unavailable, checked synchronous stale-state recovery and event ordering, and confirmed the E2E test targets the same cell without a visibility transition or scroll. A review nit that the lifecycle test initially exercised a no-op disposable was fixed by supplying a real screen-capable harness and asserting the exact add/remove listener pairing. Cross-platform review found no macOS-, Linux-, Windows-, WSL-, SSH-, or folder-workspace-specific assumptions: the change is renderer-local DOM behavior and introduces no shortcuts, labels, filesystem paths, shell commands, or provider-specific logic.

Security Audit

No new IPC, network, authentication, secret, command-execution, filesystem-path, dependency, or untrusted-input surface is introduced. The handler only invalidates terminal-local xterm hover-cache fields, those private accesses remain guarded, and the DOM listener is explicitly removed during pane disposal.

Notes

The reset continues to rely on guarded xterm linkifier internals because xterm exposes no public hover-cache invalidation API. If those fields change in a future xterm release, the behavior safely degrades to the prior cell-change recovery path rather than throwing.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 71074bf0-3453-4aa8-b6a0-c6aaff909f26

📥 Commits

Reviewing files that changed from the base of the PR and between c2a644c and 356a74a.

📒 Files selected for processing (2)
  • src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
  • src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-mouseleave.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-mouseleave.test.ts

📝 Walkthrough

Walkthrough

Adds mouseleave handling for xterm linkifier hover state. The new disposable listener resets cached hover data when leaving the terminal screen and removes itself during pane disposal. Managed pane initialization and lifecycle teardown now track this disposable. Unit tests cover reset behavior, disposal, missing DOM surfaces, and missing internals. End-to-end coverage verifies URL links deactivate after mouseleave and reactivate on subsequent hover.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: restoring terminal link hover after mouseleave.
Description check ✅ Passed The description covers the required sections, includes testing evidence, screenshots, security, notes, and an explicit cross-platform AI review.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts (1)

626-637: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a screen-capable harness for this lifecycle test.

createOpenTerminalHarness returns null from querySelector at Line 486, so this test receives the installer’s no-op disposable. It verifies only field assignment and invocation, not removal of the active screen listener. Add a fake .xterm-screen, then assert its listener is removed after disposePane.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 41ed1366-cceb-4d57-94d7-c799178f48e4

📥 Commits

Reviewing files that changed from the base of the PR and between 165e4e0 and 2701402.

📒 Files selected for processing (7)
  • src/renderer/src/lib/pane-manager/pane-dom-creation.ts
  • src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
  • src/renderer/src/lib/pane-manager/pane-lifecycle.ts
  • src/renderer/src/lib/pane-manager/pane-manager-types.ts
  • src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-mouseleave.test.ts
  • src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-mouseleave.ts
  • tests/e2e/terminal-link-hover-after-worktree-return.spec.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f179f6d8-18aa-42c5-892d-8c6c55fdfce0

📥 Commits

Reviewing files that changed from the base of the PR and between 2701402 and c2a644c.

📒 Files selected for processing (1)
  • src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts

@nwparker
nwparker merged commit 0e11ec3 into stablyai:main Jul 27, 2026
5 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(terminal): restore link hover after mouseleave

* test(terminal): verify mouseleave listener cleanup

* test(terminal): assert link hover listener wiring
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