Skip to content

feat: delay auto onboarding to weekend and prevent them during weekdays [CM-1011]#3886

Merged
mbani01 merged 3 commits intomainfrom
feat/delay_automatic_git_reonbording_until_weekend
Mar 3, 2026
Merged

feat: delay auto onboarding to weekend and prevent them during weekdays [CM-1011]#3886
mbani01 merged 3 commits intomainfrom
feat/delay_automatic_git_reonbording_until_weekend

Conversation

@mbani01
Copy link
Contributor

@mbani01 mbani01 commented Mar 2, 2026

This pull request introduces support for deferred re-onboarding of repositories by adding a new PENDING_REONBOARD state and updating the repository acquisition logic to prioritize these repos only on weekends. This helps manage system load by postponing re-onboarding tasks to less busy periods.

Deferred re-onboarding support:

  • Added a new PENDING_REONBOARD state to the RepositoryState enum to represent repositories waiting for re-onboarding on weekends.
  • Updated the repository acquisition logic in acquire_repo_for_processing to check for PENDING_REONBOARD repos on weekends and process them with lowest priority. [1] [2]
  • Implemented the acquire_pending_reonboard_repo function to select and lock a pending re-onboard repository for processing.

Worker logic changes:

  • Changed the handling of ReOnboardingRequiredError in the repository worker to set the repository state to PENDING_REONBOARD and defer processing, instead of immediately resetting and re-queueing for onboarding.
  • Removed the unused increase_re_onboarding_count import from the repository worker.

Other:

  • Ensured timezone-aware datetime usage for weekend detection.

Note

Medium Risk
Changes repository state transitions and selection/locking logic in the processing pipeline, which could delay re-onboarding or affect scheduling/throughput if the new PENDING_REONBOARD handling is incorrect.

Overview
Adds a new RepositoryState.PENDING_REONBOARD to represent repositories that require re-onboarding but should be deferred until the weekend.

Updates repo acquisition so PENDING_REONBOARD items are excluded from normal recurrent processing and are only picked up on weekends via a new acquire_pending_reonboard_repo() path that also resets commit/branch and increments reOnboardingCount.

Adjusts the worker’s ReOnboardingRequiredError handling to mark repos as PENDING_REONBOARD instead of immediately resetting and re-queueing for onboarding, and removes the now-unneeded increase_re_onboarding_count helper.

Written by Cursor Bugbot for commit deaa2f1. This will update automatically on new commits. Configure here.

@mbani01 mbani01 requested a review from epipav March 2, 2026 16:43
@mbani01 mbani01 self-assigned this Mar 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

2 similar comments
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@mbani01 mbani01 changed the title feat: delay auto onboarding to weekend and prevent them during weekdays feat: delay auto onboarding to weekend and prevent them during weekdays [CM-1011] Mar 2, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

"updatedAt" = NOW()
WHERE "repositoryId" = $1
"""
return await execute(sql_query, (repo_id,))
Copy link

Choose a reason for hiding this comment

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

Pending reonboard repos prioritized above recurrent repos

High Severity

The acquire_pending_reonboard_repo call is placed before acquire_recurrent_repo, giving re-onboarding repos higher priority than recurrent repos on weekends. This contradicts both the docstring (which lists them as priority 3, "lowest priority") and the PR description ("process them with lowest priority"). The weekend reonboard check and the recurrent repo check need to be swapped so recurrent repos are tried first.

Fix in Cursor Fix in Web

@mbani01 mbani01 merged commit 1ed9927 into main Mar 3, 2026
20 checks passed
@mbani01 mbani01 deleted the feat/delay_automatic_git_reonbording_until_weekend branch March 3, 2026 17:04
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