fix: do not discard a cloned course when discussion migration fails - #664
Merged
Syed-Ali-Abbas-568 merged 2 commits intoAug 11, 2026
Merged
Conversation
update_unit_discussion_state_from_discussion_blocks runs after the course has already been cloned successfully. Anything it raises reaches the catch-all in rerun_course, which marks the rerun failed and deletes the destination course, losing a complete clone over an optional migration. Log and continue instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Syed-Ali-Abbas-568
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A rerun of
course-v1:Wikimedia-UK+TT001+2025on prod failed and deleted its own destination course. The clone itself had succeeded, with all 161 blocks written correctly, but the step immediately after it raisedAttributeError: 'ErrorBlockWithMixins' object has no attribute 'discussions_settings', that reached the catch-all inrerun_course, and the handler both marked the rerun failed and calleddelete_courseon the destination. Studio then 404s and the authoring MFE reports the course as still being prepared.update_unit_discussion_state_from_discussion_blocksruns afterclone_coursehas returned. By that point the course exists and is complete, so a failure there should not be able to take it down. Migrating unit discussion state is worth doing and worth knowing about when it fails, but it is not worth a course.The underlying trigger was ours, a plugin receiver writing a content-scoped field inside the still-open bulk operation so that the clone read its own course root back as an
ErrorBlock, and that is fixed separately in wikimedia/openedx-wikilearn-features#37. This guard is still worth carrying: it is the difference between a rerun that silently destroys a course and one that succeeds with a logged, recoverable gap, and it holds for any future receiver of the same shape.Kept to the smallest possible change in core, log and continue, no behaviour change on the success path. On a legacy-provider course the migration does real work, so if it does start failing the log line is the thing to watch, and the migration can be rerun on its own afterwards.
🤖 Generated with Claude Code