fix: reject orphan checkpoint race - #690
Open
warren830 wants to merge 1 commit into
Open
Conversation
Recheck parent completion while holding the queue insertion locks so an already-known branch cannot enqueue after becoming orphaned. Add a deterministic event-coordinated regression test.
warren830
marked this pull request as ready for review
August 31, 2026 02:09
warren830
requested a deployment
to
ai-pr-review
August 31, 2026 02:09 — with
GitHub Actions
Waiting
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.
Issue
Fixes #640
Description
A child checkpoint could pass the initial parent-done validation, pause while plugin hooks ran, then enqueue after its parent completed and marked it orphaned. The final enqueue path rechecked execution completion and checkpoint failure, but not the child's
_parent_donestate.This change:
_reject_if_parent_done();_completion_lockand then_parent_done_lockthrough queue insertion, establishing a single linearization point;_completion_lock→_parent_done_lockorder;Scope
This PR fixes only the already-known-child race in #640. It deliberately does not reject late-created descendants whose parent was already orphaned; that separate behavior remains tracked by #641.
Red → green
DID NOT RAISE OrphanedChildException.The regression uses two
threading.Eventbarriers and no sleeps: the child pauses in the plugin hook after initial validation, the parent completes and marks it orphaned, and the child then resumes into the final enqueue attempt.Testing
git diff --check: passed.All validation used the repository-pinned Hatch 1.16.5 and Python 3.12. No AWS call or cloud resource was used.
Fork CI note
Some repository cloud/conformance workflows require AWS secrets, SAM, and live CloudFormation resources that are unavailable to fork PRs. The authoritative local unit, integration, coverage, type-check, and formatting gates above are green; any credential-gated non-required fork check should be treated as an infrastructure limitation rather than a product regression.
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.