Skip to content

fix: keep the lfx member as primary when merging orgs with llm - #5042

Merged
skwowet merged 1 commit into
mainfrom
fix/llm-org-merge-lfx-primary
Oct 20, 2026
Merged

skwowet merged 1 commit into
mainfrom
fix/llm-org-merge-lfx-primary

Conversation

@skwowet

@skwowet skwowet commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The LLM organization merge workflow fails when the secondary org in a pair is an LFX member, because the merge API never merges an LFX member away.

Pair order is fixed when a pair is first queued, but LFX memberships can change later. The worker only corrected the order when onlyLFXMembers was set, which the scheduled run doesn't pass.

Changes

  • Always put the LFX member first in getRawOrganizationMergeSuggestions, regardless of onlyLFXMembers.
  • Fetch memberships for the whole batch in one query instead of one per pair.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Performance improvement
  • Chore / dependency update
  • Documentation

Related issue

None.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 10:02

Copilot AI 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.

🟢 Approval recommended

The focused change matches backend merge constraints and preserves downstream pair handling, with no identified blocking issues.

No open issues 🎉

What changed in this PR

Fixes LLM-driven organization merges by keeping the LFX member as primary, regardless of the onlyLFXMembers flag.

Changes:

  • Checks current memberships for every nonempty suggestion batch.
  • Replaces per-pair membership queries with one batch lookup.
  • Swaps pairs only when the secondary alone is an LFX member.
File Description
services/​apps/​merge_suggestions_worker/​src/​activities/​organizationMergeSuggestions.ts Normalizes pair order using batched LFX membership data.

Review effort: Balanced

@skwowet
skwowet merged commit 5d812ad into main Oct 20, 2026
14 checks passed
@skwowet
skwowet deleted the fix/llm-org-merge-lfx-primary branch October 20, 2026 11:53
@skwowet skwowet self-assigned this Oct 20, 2026
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.

2 participants