Skip to content

Don't call -JobAbortCleanup for a job whose -JobFinalize threw - #48

Merged
HalRiveria-Bot merged 1 commit into
mainfrom
fix/abort-cleanup-finished-job
Nov 17, 2026
Merged

HalRiveria-Bot merged 1 commit into
mainfrom
fix/abort-cleanup-finished-job

Conversation

@HalRiveria-Bot

Copy link
Copy Markdown
Collaborator

What was wrong: when -JobFinalize threw, the job it was finalizing was still in the running list, so the teardown treated it like a job it had killed and called -JobAbortCleanup on it. That callback is documented for a job an abort killed or kept from starting ("remove its partial output"), so a cleanup that deletes output files could delete a finished job's real output.

What changed: the dispatcher remembers which job -JobFinalize is working on (in all three finalize passes). If the callback throws, the teardown skips -JobAbortCleanup for that job but still gives back its slot and disposes its process. Jobs the teardown kills get the cleanup as before.

Tested: new harness assertion, failing before the fix on 5.1 and 7. A finished job's -JobFinalize throws while a cmd /c ping job runs, with a shared 2-slot budget. Before the fix the cleanup ran for both jobs (run,done); after, only for the killed one (run). Nothing was left running and both slots came back. Full harness passes on Windows PowerShell 5.1 and PowerShell 7.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HalRiveria-Bot
HalRiveria-Bot merged commit a5f4d0a into main Nov 17, 2026
2 checks passed
@HalRiveria-Bot
HalRiveria-Bot deleted the fix/abort-cleanup-finished-job branch November 17, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants