Repository navigation
fix: handle dead challenge container removal failures - #584
Open
Yeagerist0 wants to merge 1 commit into
Open
Yeagerist0 wants to merge 1 commit into
Yeagerist0 wants to merge 1 commit into
Conversation
Signed-off-by: Yeagerist0 <180412661+Yeagerist0@users.noreply.github.com>
This branch has not been deployed
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.
Summary
Return a controlled error when Docker cannot remove a dead challenge container before replacement. Do not start another container or overwrite the existing
UserChallengestate in that case.Problem / Motivation
DoItFast.post()calledcontainer.remove(force=True)outside its Docker error handler. An API failure raised an unhandled exception, so the request crashed without a stable response and the user could not tell why the challenge did not restart. I reproduced this with a failing Docker removal mock before applying the fix.Solution / Approach
Catch Docker errors at the replacement boundary and return HTTP 500 with the existing challenge state preserved. A regression test verifies the response, confirms that no replacement container is started, and checks that the stored container ID/live flag remain available for retry.
Files Changed
challenge/views.pychallenge/tests.pyType of Change
Impact
Challenge restart failures now produce a clear response and avoid creating a second container when deletion of the old one fails. No behavior change on the successful path.
Verification
python manage.py test challenge --noinput— 24 passedpython manage.py test --noinput— 55 passedgit diff --check— cleanAI Tool Disclosure
Codex assisted with code analysis, the regression test, and the patch. Test commands above were run in the local repository. No physical Docker daemon was needed for this mocked failure case.