Skip to content

fix(person): dismiss composer overlay to prevent dialog collision#464

Open
devag7 wants to merge 2 commits into
stickerdaniel:mainfrom
devag7:fix/432-dialog-composer-collision
Open

fix(person): dismiss composer overlay to prevent dialog collision#464
devag7 wants to merge 2 commits into
stickerdaniel:mainfrom
devag7:fix/432-dialog-composer-collision

Conversation

@devag7
Copy link
Copy Markdown

@devag7 devag7 commented May 26, 2026

Fixes #432. Calls _dismiss_message_ui before navigating to the connect deeplink to prevent the composer overlay from intercepting the dialog.

Copilot AI review requested due to automatic review settings May 26, 2026 20:52
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 26, 2026

Greptile Summary

This PR updates the LinkedIn connect flow to clear message UI before opening the invite dialog. It changes:

  • Adds a pre-invite call to _dismiss_message_ui(fast=True).
  • Scopes message dismissal selectors to aside elements.
  • Adds a fast-path option for message UI dismissal.
  • Updates connect-flow tests to assert dismissal happens before invite navigation.

Confidence Score: 3/5

This should be fixed before merging.

  • The new fast dismissal path can block before invite navigation.

  • The affected flow is the main connection request path this PR is trying to repair.

  • The tests assert the helper is called, but they do not exercise the helper against hidden or stale matching controls.

  • linkedin_mcp_server/scraping/extractor.py

Important Files Changed

Filename Overview
linkedin_mcp_server/scraping/extractor.py Adds pre-invite composer dismissal and changes the dismissal helper behavior.
tests/test_scraping.py Updates coverage for the connect dismissal call order and arguments.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
linkedin_mcp_server/scraping/extractor.py:2255-2257
**Fast dismissal can hang**

`fast=True` sets `timeout` to `0`, but Playwright-style `wait_for(..., timeout=0)` disables the timeout instead of doing a quick visibility check. If an `aside` close/dismiss button exists in the DOM but the first match is hidden or minimized, `_locator_is_visible` can wait forever before `connect_with_person` navigates to the invite deeplink. That leaves the connection flow stuck before the invite dialog opens.

Reviews (2): Last reviewed commit: "fix(person): restrict dismissal to messa..." | Re-trigger Greptile

Comment thread linkedin_mcp_server/scraping/extractor.py
Comment thread linkedin_mcp_server/scraping/extractor.py
Comment thread linkedin_mcp_server/scraping/extractor.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR hardens the connection-request flow against LinkedIn’s messaging composer overlay interfering with the invite dialog detection and navigation.

Changes:

  • Update _dialog_is_open to ignore messaging composer overlays that match [role="dialog"].
  • Dismiss the messaging composer overlay before navigating to the custom-invite deeplink.
  • Add an async test asserting the dismiss happens before navigation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
tests/test_scraping.py Adds a regression test that asserts overlay dismissal occurs before invite navigation.
linkedin_mcp_server/scraping/extractor.py Filters composer overlays out of dialog detection and proactively dismisses messaging UI before invite navigation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +739 to +751
count = await locator.count()
if count == 0:
return False
await locator.first.wait_for(state="visible", timeout=timeout)
return True

# Filter out composer overlays (they have [role="dialog"] but shouldn't count as modal dialogs)
for i in range(count):
el = locator.nth(i)
if await el.is_visible(timeout=timeout):
# Check if it contains the messaging close button
if await el.locator(_MESSAGING_CLOSE_SELECTOR).count() > 0:
continue
return True
return False
Comment on lines +1760 to 1762
# Issue 432: Clear any message composer overlay which might overlap the invite dialog
await self._dismiss_message_ui()
await self._navigate_to_page(invite_url)
Comment thread tests/test_scraping.py Outdated
Comment on lines +1008 to +1011
async def mock_nav(*args, **kwargs):
calls.append("nav")

async def mock_dismiss(*args, **kwargs):
Comment thread tests/test_scraping.py
Comment on lines +1032 to +1037
patch.object(
extractor,
"_navigate_to_page",
new_callable=AsyncMock,
side_effect=mock_nav,
),
Comment thread tests/test_scraping.py Outdated
Comment on lines +1050 to +1051
assert calls[0] == "dismiss"
assert calls[1] == "nav"
Comment on lines +2255 to 2257
timeout = 0 if fast else 750
if not await self._locator_is_visible(selector, timeout=timeout):
return
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.

P1 Fast dismissal can hang

fast=True sets timeout to 0, but Playwright-style wait_for(..., timeout=0) disables the timeout instead of doing a quick visibility check. If an aside close/dismiss button exists in the DOM but the first match is hidden or minimized, _locator_is_visible can wait forever before connect_with_person navigates to the invite deeplink. That leaves the connection flow stuck before the invite dialog opens.

Prompt To Fix With AI
This is a comment left during a code review.
Path: linkedin_mcp_server/scraping/extractor.py
Line: 2255-2257

Comment:
**Fast dismissal can hang**

`fast=True` sets `timeout` to `0`, but Playwright-style `wait_for(..., timeout=0)` disables the timeout instead of doing a quick visibility check. If an `aside` close/dismiss button exists in the DOM but the first match is hidden or minimized, `_locator_is_visible` can wait forever before `connect_with_person` navigates to the invite deeplink. That leaves the connection flow stuck before the invite dialog opens.

How can I resolve this? If you propose a fix, please make it concise.

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.

[BUG] connect_with_person with note: dialog locator collides with message composer overlay (Emoji button)

2 participants