Skip to content

[tasks/init] Handle stale repo_git in augur_handle_task_failure#3724

Draft
devs6186 wants to merge 1 commit intochaoss:mainfrom
devs6186:fix/3421-failure-handler-repo-git-lookup
Draft

[tasks/init] Handle stale repo_git in augur_handle_task_failure#3724
devs6186 wants to merge 1 commit intochaoss:mainfrom
devs6186:fix/3421-failure-handler-repo-git-lookup

Conversation

@devs6186
Copy link

Changeset

  • Changed session.query(Repo).filter(...).one() to .one_or_none() in augur_handle_task_failure
  • Return early with a warning log when the repo is not found instead of raising NoResultFound

Notes

When detect_github_repo_move_core detects that a repo has moved it updates the DB's repo_git to the new URL and then raises an exception. The on_failure Celery handler then tries to look up the repo by the old URL, which no longer matches anything in the DB, so .one() raises NoResultFound. This secondary exception masked the original one and showed up as a separate error in the worker logs.

Using .one_or_none() and returning early when the repo is not found avoids the crash. It's safe to skip the status update in this case because the repo-move handler already reset the collection state before raising.

Related issues/PRs

Description

  • Switched repo lookup in failure handler to one_or_none() to avoid NoResultFound when a repo's URL has changed

This PR fixes #3421

Notes for Reviewers
The fix is in augur_handle_task_failure which is shared by both AugurCoreRepoCollectionTask and AugurSecondaryRepoCollectionTask (via inheritance), so both are covered.

Signed commits

  • Yes, I signed my commits.

When detect_github_repo_move updates the repo_git in the DB and then
raises an exception, the failure handler was looking up the repo by the
now-stale old URL, causing a NoResultFound that masked the original
error. Switched to one_or_none() and return early with a warning when
the repo is not found.

Fixes chaoss#3421

Signed-off-by: devs6186 <devyanshsomvanshi@gmail.com>
@MoralCode MoralCode added the stale Stuff that's abandoned or not making forward progress and may need taking over/reassignment/closing label Feb 19, 2026
@MoralCode
Copy link
Contributor

I like the core idea of this change, but I think the log message that is specifically related to the move detection may need some more work.

marking as draft in case someone else wants to pick it up or a maintainer is interested in it.

@MoralCode MoralCode marked this pull request as draft February 24, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stuff that's abandoned or not making forward progress and may need taking over/reassignment/closing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

celery task failure handling still looks up repositories by their git url

2 participants