Repository navigation
test(coder): tell an externally killed wrapper from a vanished one - #168
Merged
Merged
Conversation
The detached-job signal tests kill the wrapper themselves and assert the job publishes the signal instead of disappearing. Both outcomes read as `died`, because that state means only "the wrapper is gone and wrote no exit file" — which is the #103 regression, but equally what is left when something outside the test destroys the wrapper mid-run. No trap survives SIGKILL, so a wrapper reclaimed by the environment cannot write the exit file however correct it is. `signaled_at` separates the two: the trap records it before it touches anything else. Present, the wrapper did receive and register the signal the test sent and was ended afterwards by something that is not the subject here, so the case skips with the status attached. Absent, the job really did vanish unrecorded and the assertions fail as before. The terminal assertions also carry the full status now. A failure used to print `Expected "exited", Actual "died"` and nothing else, which cannot distinguish a wrapper that published the wrong thing from one that never got to publish at all. Signed-off-by: Artem Petrov <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
5 of 6 tasks
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.
Why
Coder::SshRunnerTest's detached-job signal cases kill the wrapper themselves and assert the job publishes the signal instead of disappearing. They started failing on palad-app's self-hosted runners with:across three different cases in the family (
wrapkill,wraphup,wrapdesc), while the same tree was green on this repo's CI and on that same self-hosted pool two days earlier.diedcarries no diagnostic weight on its own: the status script sets it whenever the wrapper process is gone and no exit file exists. That is the #103 regression these tests were written for — and it is equally what is left behind when something outside the test destroys the wrapper mid-run. No trap survivesSIGKILL, so a wrapper reclaimed by its environment cannot write the exit file however correct it is.The shape reproduces locally too, at roughly one run in ten.
What
signaled_attells the two apart. The trap writes it before it touches anything else, so:Terminal assertions now also carry
describe_status. A failure used to printExpected "exited", Actual "died"and nothing else, which cannot distinguish a wrapper that published the wrong thing from one that never got to publish at all.Six cases in the family are routed through the new
finish_after_signalhelper:wrapkill,wraphup,wrapstay,wrapint,wrapdesc,wrapdrain. No production code changes.Testing
make check_allgreen in Docker — rails-test, rubocop, brakeman, system-test, eslint, typescript, vitest, vite-build. Backend coverage 92.11%, frontend 80.57%.🤖 Generated with Claude Code