Repository navigation
fix(durable): record an actor stopped in the step that spawns it, or before it respawns, as ended - #272
Merged
Conversation
Contributor
Author
Review findingsThe AI reviewers' pass over this change checked every review label. They found one real regression, which is fixed in the second commit:
Two candidates were refuted:
|
Contributor
Author
Decisions for Temple to ratifyI made these calls in this PR. Each is a suggestion for you to confirm or change.
|
This was referenced Nov 18, 2026
reka18
force-pushed
the
fix/durable-actor-driven-effects
branch
from
November 24, 2026 19:40
685a0a4 to
1e2f238
Compare
…before it respawns, as ended An explicit stopActor while the actor's declaring state stays active - one a step's own effects hold later than the spawn, as the OnDone of a compound the step completes, or one a parent Fire an earlier spawn drove - skipped the spawn but noted nothing, not even an attempt, so the journal recorded the actor unstarted and a Recover spawned it fresh, running its behavior a second time. The same held for a stop a parent Fire noted while Recover respawned a batch of running actors, before its target respawned: the stop found nothing running and did nothing, though the journal held it, so both the recovering Handle and a later Recover ran the actor the live run had ended. And an explicit StopActor counted as the actor's state being left, so a stop followed by a re-entry of the same state later in the same step skipped the new activation's spawn too, and the actor never ran though its state was active. - durable: absorbActors notes every spawn it skips as attempted and stopped, so actorSets counts the actor ended and the journal records it ended rather than unstarted, and a Recover spawns none of them. An actor that is explicitly stopped in the step that spawns it, while its state stays active, never runs its behavior. - durable: a parent Fire's stops are noted by actor on the collector, and left now reports the states a Fire's trace says it exited, so an explicit StopActor no longer lefts the state. A StopActor the step absorbs supersedes the Fire's mark, so a stop followed by a re-entry of the same state later in the same step doesn't skip the new activation's spawn. - durable: respawn applies the stops a batch's Fires noted, before their target's respawn, to the actors the batch respawned, so the recovering Handle ends them and the journal records them ended, and a later Recover ends them too. Closes #261. Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
reka18
force-pushed
the
fix/durable-stopactor-actor-sets
branch
from
November 25, 2026 20:42
78bcfe1 to
7cd223c
Compare
reka18
marked this pull request as ready for review
November 25, 2026 20:55
joshua-temple
approved these changes
Nov 25, 2026
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.
What this does
#235 made durable skip spawning an actor whose state was already left in the same step. Two gaps remained. Both involve an explicit
stopActorwhile the declaring state stays active, and both left the journal's actor sets out of step with the live Handle:Recoverspawned it fresh and ran its behavior, while the live Handle had no such actor. It's now recorded as ended. This covers a stop later in the step's own effects, and a stop from a parent Fire that an earlier spawn drove. It holds forFire,Tick,RunServiceandStart.Recover's respawn, a failed respawn's onError could stop another actor before that actor respawned. The stop did nothing, and the actor kept running. Stops noted during the respawn batch now apply to the actors the batch respawned.The fix also separates an explicit stop from a state being left.
left()now reads the states a parent Fire's trace exited, rather than everyStopActor. So an explicit stop followed by re-entering the same state later in one step still spawns the new activation. Only a Fire that succeeded counts its exits: a Fire that failed partway, such as in an exit action, left its states active.All of it is in
durable/runner.go, with no new API and no journal format change.Tests
durable/actor_stop_sets_test.go:TestRecover_ASpawnTheSameStepStops_IsEndedNotUnstarted, forFire,TickandRunService;TestRecover_ASpawnAParentFireStops_IsEndedNotUnstarted, forFireandStart;TestRecover_AStopBeforeItsTargetRespawns_EndsIt, with a control row where a live Fire stops the actor while it runs;TestTick_AnExplicitStopThenAReentry_SpawnsTheNewActivation;TestRecover_ASpawnAStateAFailedFireTriedToExit_Runs.Every row compares the live Handle's actors with a recovered Handle's, with and without checkpoints. Each touch point is mutation-checked and fails its own rows.
Checks
mage checkpasses in every module (go1.27.4)Closes #261