Skip to content

Dismiss tooltips when owner windows change lifecycle#564

Open
0xNino wants to merge 1 commit into
repoprompt:mainfrom
0xNino:fix/mcp-tooltip-owner-lifecycle
Open

Dismiss tooltips when owner windows change lifecycle#564
0xNino wants to merge 1 commit into
repoprompt:mainfrom
0xNino:fix/mcp-tooltip-owner-lifecycle

Conversation

@0xNino

@0xNino 0xNino commented Jul 16, 2026

Copy link
Copy Markdown

Summary

  • dismiss a hover tooltip when its owning window closes, moves, or resigns key-window status
  • clean up all owner-lifecycle notification observers through the existing hide() path
  • keep tooltip presentation independent of MCP call sites and preserve the existing non-child-window hierarchy

Closes #563.

Root cause

The shared tooltip overlay is a standalone borderless NSWindow at .floating level. It previously observed only NSWindow.willCloseNotification.

SwiftUI popovers may be ordered out or resign key-window status without closing their backing window. The tooltip could therefore outlive the MCP Server popover, remain at its previous screen coordinates, and float above unrelated windows.

Scope

This is intentionally a one-file lifecycle fix in TooltipOverlayController.

It supersedes the broader approach from #227, which added a global dismiss coordinator, MCP-specific calls, invalid-anchor handling, and a new test suite. This change does not alter MCP behavior, add a parallel tooltip authority, or reintroduce child-window hierarchy behavior.

Validation

  • make guardrails — passed
  • scoped SwiftFormat lint on TooltipOverlayController.swift — passed; 0/1 files require formatting
  • scoped strict SwiftLint on TooltipOverlayController.swift — passed; 0 violations
  • make dev-swift-build PRODUCT=RepoPrompt — passed
  • make dev-build — passed; patched debug app built, signed, and packaged
  • live UI validation — reproduced with release v1.0.29 (30), then confirmed fixed in the patched debug app while the release app remained running
  • contribution commit and push preflights — passed, including staged/outgoing secret scans and guardrails

The computed-outgoing-range pr-ready lane reached the repository-wide SwiftFormat baseline mismatch and stopped on thousands of findings in untouched files. The changed file passes both scoped SwiftFormat and strict SwiftLint.

No new XCTest is included because reposting AppKit notifications would test the observer implementation rather than the SwiftUI popover/order-out lifecycle that produces the visual defect. The real UI lifecycle was exercised directly.

Screenshot

The current before screenshot will be attached to #563. No after screenshot is included because the corrected behavior is the absence of the detached tooltip.

@0xNino

0xNino commented Jul 16, 2026

Copy link
Copy Markdown
Author

CI appears to have hit two unrelated CodeMap test flakes:

  • Initial run: shard 2 failed in CodeMapArtifactBuildCoordinatorTests.testHookOverflowDropsNewestPreservesAcceptedFIFOAndDrainsWithoutLeak. The exact test passed locally, and shard 2 passed on the fresh CI run.
  • Fresh run: shard 4 failed in CodemapGraphFreezeQueryTests.testPresentationRenderFailsClosedAfterDemandCancellationCatalogAdvanceAndUnload with expectedReady. The exact test also passed locally on the unchanged branch.

All other checks pass. This PR changes only TooltipOverlayController.swift and does not touch CodeMap runtime or tests, so I have not broadened the patch with unrelated test changes.

Could a maintainer rerun the failed shard 4 job?

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.

MCP connection tooltip remains floating after opening the status window

1 participant