fix(core): terminalize orphaned child claims through events - #46943
Open
kitlangton wants to merge 2 commits into
Open
fix(core): terminalize orphaned child claims through events#46943kitlangton wants to merge 2 commits into
kitlangton wants to merge 2 commits into
Conversation
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
Restart recovery clears unrecoverable child execution claims with a direct SQL update, without publishing a terminal event. The claim disappears, but the child's projected idle outcome and stale retry state do not reflect that its execution ended, and event consumers never receive that transition.
What Changes
session.execution.interruptedwith reasonsuperseded; release its claim and reset resume accounting in the event commit.The existing terminal projector records the interrupted idle outcome and clears stale retry state without changing Session recency. Existing event consumers can now observe the child as interrupted/cancelled. Claim cleanup does not resume foreground orphans; existing background-notification wake-ups remain unchanged.
Session Recovery
Replace the mutating
SessionStore.releaseChildClaimsoperation with a read-onlylistChildClaimsquery using the same eligibility filter. Recovery publishes one existing terminal event per selected child, withstore.releasein the commit hook so event projection and local claim release are atomic. Event replay still does not manage process-local execution claims.Scope
This PR owns only child-claim terminalization and focused recovery tests. It does not rename
time_suspended, add a migration, change public event schemas, or extract the background-job recovery flow.Verification
Using Bun 1.4.0:
consistent-returnwarnings in unchanged test bodies.