Skip to content

fix: do not discard a cloned course when discussion migration fails - #664

Merged
Syed-Ali-Abbas-568 merged 2 commits into
developfrom
ahmed-arb/rerun-survive-discussion-migration-failure
Aug 11, 2026
Merged

fix: do not discard a cloned course when discussion migration fails#664
Syed-Ali-Abbas-568 merged 2 commits into
developfrom
ahmed-arb/rerun-survive-discussion-migration-failure

Conversation

@ahmed-arb

Copy link
Copy Markdown
Collaborator

A rerun of course-v1:Wikimedia-UK+TT001+2025 on 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 raised AttributeError: 'ErrorBlockWithMixins' object has no attribute 'discussions_settings', that reached the catch-all in rerun_course, and the handler both marked the rerun failed and called delete_course on the destination. Studio then 404s and the authoring MFE reports the course as still being prepared.

update_unit_discussion_state_from_discussion_blocks runs after clone_course has 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

ahmed-arb and others added 2 commits August 10, 2026 21:20
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
Syed-Ali-Abbas-568 merged commit 0014bf3 into develop Aug 11, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants