Walk exception cause chain to filter benign signals wrapped by finalizer errors#534
Merged
GoodForOneFare merged 1 commit intomainfrom Mar 17, 2026
Merged
Conversation
e9a48da to
9c6ff9a
Compare
a94eda4 to
123a62a
Compare
Rylan12
approved these changes
Mar 17, 2026
Member
Rylan12
left a comment
There was a problem hiding this comment.
Not entirely sure how to test this since I've not looked at this repo before much, but this makes sense to me
…zer errors When a process receives SIGTERM/SIGHUP/SIGINT, an ensure block (e.g. Dev::Finalize.deliver!) can raise a secondary exception such as Errno::EPIPE or Errno::EBADF when it tries to write to a closed stderr. This secondary exception replaces the original SignalException as the top-level error, but keeps it accessible via Exception#cause. Previously, exception_for_submission only checked the top-level exception for SignalException, so these wrapped signals fell through to the else branch and were incorrectly reported as bugs. Add caused_by_benign_signal? which walks the entire cause chain, so SIGTERM/SIGHUP/SIGINT are still filtered even when buried as a cause. Co-authored-by: Claude <noreply@anthropic.com>
123a62a to
e88ed31
Compare
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.
When a process receives SIGTERM/SIGHUP/SIGINT, an ensure block (e.g. Dev::Finalize.deliver!) can raise a secondary exception such as Errno::EPIPE or Errno::EBADF when it tries to write to a closed stderr. This secondary exception replaces the original SignalException as the top-level error, but keeps it accessible via Exception#cause.
Previously, exception_for_submission only checked the top-level exception for SignalException, so these wrapped signals fell through to the else branch and were incorrectly reported as bugs.
Add caused_by_benign_signal? which walks the entire cause chain, so SIGTERM/SIGHUP/SIGINT are still filtered even when buried as a cause.
Co-authored-by: Claude noreply@anthropic.com