Skip to content

verify connect flow before returning success & use custom invite deeplink#366

Open
yashkhare0 wants to merge 828 commits intostickerdaniel:mainfrom
yashkhare0:feature-365-verify-connect-flow
Open

verify connect flow before returning success & use custom invite deeplink#366
yashkhare0 wants to merge 828 commits intostickerdaniel:mainfrom
yashkhare0:feature-365-verify-connect-flow

Conversation

@yashkhare0
Copy link
Copy Markdown

Summary

This fixes connect_with_person false positives by making the tool verify the final LinkedIn relationship state before returning success.

What changed

  • routes connectable and follow-only profiles through LinkedIn's preload/custom-invite deeplink
  • prefers the explicit Send without note action when no note is provided
  • re-reads the profile and only returns connected when the page verifies Pending
  • re-reads the profile after accepting an incoming request and only returns accepted when the page verifies a 1st connection
  • adds test coverage for verified success and verification failure paths
  • ignores local /.serena workspace artifacts in git

Why

The previous flow inferred the pre-click state from profile text, clicked the UI, and could return success without proving that LinkedIn had actually transitioned to the expected final state. That made the connect tool flaky and could produce false-positive success responses.

Validation

  • uv run pytest tests/test_scraping.py -k TestConnectWithPerson
  • uv run ruff check linkedin_mcp_server/scraping/extractor.py tests/test_scraping.py
  • Live check on drowsy returned pending without sending a new invite
  • Live check on stanimirovicuros sent an invite and verified the profile transitioned to Pending

Closes #365.

Synthetic prompt

Replace the optimistic connect_with_person flow with a verified sequence: short-circuit on already-connected or pending states, send invites through LinkedIn's preload/custom-invite deeplink, and only return success after re-reading the profile and confirming Pending (or 1st after accepting an incoming request). Update the tests to enforce verification and ignore the local .serena workspace artifacts.

Generated with Codex (GPT-5)

stickerdaniel and others added 30 commits March 8, 2026 16:19
…raping_add_compact_references

feat(scraping): add compact references
…r-all-major-dependencies

chore(deps): update all major dependencies (major)
…ependencies

chore(deps): update ci dependencies
Updated the prerequisites section to include a link for installing uv.
…-patch-1

docs(README): installation link for uv in README
stickerdaniel and others added 22 commits April 13, 2026 22:16
…raping_add_skills_and_projects_sections_to_get_person_profile

feat(scraping): Add skills and projects sections to get_person_profile
…ump_version_to_4.9.0

chore: Bump version to 4.9.0
…i_simplify_release_download_link

style(ci): Simplify release download link
- Match on field name instead of Pydantic error code for stability
Detail pages (experience, certifications, skills, etc.) paginate with
a "Show more" button inside <main>, not scroll-to-bottom. Click it in
a loop (bounded by max_scrolls) until the button disappears.

Resolves: stickerdaniel#360
- Configure mock_locator.filter in fixture so Show more loop exits cleanly
  without hitting the exception handler in detail-page tests
…raping_add_max_scrolls_parameter_to_get_person_profile

feat(scraping): Add max_scrolls parameter to get_person_profile
…ump_version_to_4.9.1

chore: Bump version to 4.9.1
- Drop Spanish-only aria-label from compose focus selector; generic
  contenteditable fallback already covers all locales
- Patch asyncio.sleep in TestSendMessageComposerInteraction helper so
  tests no longer burn 1.4s of real wall time per run
- Set wait_for mocks before the call in test_returns_locator_when_count_positive
  and assert_not_called() after, so the early-return invariant is actually verified
…-compose-box-actionability

Fix/344 bypass patchright compose box actionability in send_message
@yashkhare0 yashkhare0 changed the title [codex] verify connect flow before returning success verify connect flow before returning success & use custom invite deeplink Apr 16, 2026
…readability

- Consolidated button text retrieval for 'incoming_request' state.
- Streamlined the unpacking of verified state and profile connection state.
- Enhanced formatting for better readability in the extractor logic.
@stickerdaniel
Copy link
Copy Markdown
Owner

Thanks for the PR. The verify-after-action layer is exactly what #365 needs and I'd like to land it.

I'm on board with the deeplink approach. Looking at how LinkedIn actually emits /preload/custom-invite/ as the Connect anchor's href in its own HTML, navigating to it directly drops the whole button-click + modal-index dance that #304, #319, #348 and #368 all orbited, and makes the Connect flow locale-independent by default.

Before we merge:

  1. Rebase on main, fix: handle invitation modal in connect_with_person using structural selectors #368 rewrote the block you're editing.
  2. Drop _click_send_without_note_button. Use _click_dialog_primary_button() (positional, from fix: handle invitation modal in connect_with_person using structural selectors #368). The regex on "Send without a note" is English-only and LinkedIn localizes the label, which defeats the locale advantage the deeplink gives us.
  3. Drop the on-profile click fallback. If the deeplink doesn't render a dialog, return connect_unavailable. One reliable path is easier to reason about than two.
  4. Keep Accept as on-profile click for incoming_request. It's not the fragile path, no modal involved.
  5. Move .serena to your global gitignore, not the project one.

Happy to re-review after the rebase.

@yashkhare0 yashkhare0 marked this pull request as ready for review April 17, 2026 16:19
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 17, 2026

Too many files changed for review. (122 files found, 100 file limit)

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 can return false-positive success

8 participants