Repository navigation
fix(execution): catch BaseException from task code - #934
Merged
Merged
Conversation
tobiasraabe
marked this pull request as ready for review
August 2, 2026 18:45
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
BaseExceptionat the user-task execution boundaryKeyboardInterruptbranch and existing pytask control-flow handlingSystemExit, includingSystemExit(0), into an ordinary failed task reportRoot cause
The task protocol caught
Exception, butSystemExitinherits directly fromBaseException. A task callingsys.exit(0)therefore escaped report creation and cleanup and could terminate pytask with a successful process status.Impact
Raw
SystemExitfrom task code now follows normal task failure semantics. Its exit code remains available on the reported exception, unrelated tasks continue, descendants skip, and the build returns pytask's failed-build exit code.Validation
uv run --group test pytest --snapshot-warn-unused: 935 passed, 39 skipped, 4 xfaileduv run --group test pytest tests/test_execute.py -q: 57 passed, 1 xfaileduv run --group typing --group test --isolated ty check --python-platform linux: passeduv run ruff check .: passedruff format --checkfor changed files: passedThe repository's
justrecipes cannot locate their configured shell on this Windows checkout. The pre-commit Ruff 0.16 hook also reports new baseline rules across untouchedmain, while the project lock provides Ruff 0.15.16. This PR was checked with the project-locked Ruff version and does not alter lint configuration.