Skip to content

fix: prevent duplicate merge suggestion workflow runs (CM-1217)#4173

Merged
skwowet merged 1 commit into
mainfrom
fix/merge-suggestions-schedule
Jun 5, 2026
Merged

fix: prevent duplicate merge suggestion workflow runs (CM-1217)#4173
skwowet merged 1 commit into
mainfrom
fix/merge-suggestions-schedule

Conversation

@skwowet

@skwowet skwowet commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes duplicate merge suggestion generation runs by scheduling the actual generation workflows directly instead of scheduling short-lived spawner workflows that launched abandoned child workflows.

Previously, the schedule overlap policy only applied to the spawner workflow. Since the spawner completed quickly and its child workflows continued independently, later schedule ticks could start additional generation workflows for the same work. This caused multiple member/org merge suggestion workflows to run in parallel and potentially reprocess the same items.

Changes

  • Schedule generateMemberMergeSuggestions directly with DEFAULT_TENANT_ID.
  • Schedule generateOrganizationMergeSuggestions directly with DEFAULT_TENANT_ID.
  • Keep BUFFER_ONE overlap policy so only one generation run is active, with at most one buffered run.
  • Switch both schedules to a consistent every-2-hours cron expression.
  • Remove the all-tenants spawner workflows, since production only uses the default tenant.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Jun 5, 2026
Copilot AI review requested due to automatic review settings June 5, 2026 09:20

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.

Pull request overview

This PR updates the Temporal scheduling strategy in merge_suggestions_worker to prevent duplicate merge-suggestion generation by scheduling the actual generation workflows directly (for DEFAULT_TENANT_ID) instead of using short-lived spawner workflows whose abandoned child workflows could overlap across ticks.

Changes:

  • Removed the “spawn for all tenants” workflows for member/org merge suggestions.
  • Updated both schedules to start generateMemberMergeSuggestions / generateOrganizationMergeSuggestions directly with DEFAULT_TENANT_ID and BUFFER_ONE overlap policy.
  • Standardized both schedules to an every-2-hours cron expression.

Reviewed changes

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

Show a summary per file
File Description
services/apps/merge_suggestions_worker/src/workflows/spawnOrganizationMergeSuggestionsForAllTenants.ts Removes the all-tenants spawner workflow for organization suggestions.
services/apps/merge_suggestions_worker/src/workflows/spawnMemberMergeSuggestionsForAllTenants.ts Removes the all-tenants spawner workflow for member suggestions.
services/apps/merge_suggestions_worker/src/workflows.ts Stops exporting the removed spawner workflows.
services/apps/merge_suggestions_worker/src/schedules/organizationMergeSuggestions.ts Schedules generateOrganizationMergeSuggestions directly with DEFAULT_TENANT_ID on a 2-hour cron.
services/apps/merge_suggestions_worker/src/schedules/memberMergeSuggestions.ts Schedules generateMemberMergeSuggestions directly with DEFAULT_TENANT_ID on a 2-hour cron.

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

@skwowet
skwowet merged commit 17d1bfd into main Jun 5, 2026
14 checks passed
@skwowet
skwowet deleted the fix/merge-suggestions-schedule branch June 5, 2026 09:27
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