Repository navigation
Sweep: decide a worker's double end from the log (seed 625) - #494
Merged
Merged
Conversation
The model read the worker's token map before the call to decide whether the worker was already ended. A stop that did not land drops the token until the next rebuild while the worker is still live on the log, so a retried stop looked like a second end. The log is now the check.
el-bri-ga
enabled auto-merge (squash)
November 21, 2026 19:37
|
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.



Fixes the nightly Fault sweep failure on seed 625 ("sup-a ended twice", sweep.rs worker_end_step).
Culprit: #483 (76dd811). It added a policy step to the sweep, which shifted the random stream so seed 625 now reaches a path the sweep model already got wrong. Bisected from cfafab7 to 229983f. Seed 625 is outside the default 100 seeds, so only the nightly run sees it.
Cause: the tracker does not end a worker twice.
appenddrops the worker's token from the live map before the write ("a stop that did not land comes back with the rebuild"). After such a failed stop, the token is gone and the state is stale, but the log has no stop for the worker. The model readworker_by_tokenbefore the retry, saw "dead", and treated the retry's first real stop as a second one. Debug output on seed 625:stopped=None stale=true, token map empty, stop returns Ok.Reading: neither of the two proposed readings changes tracker code. The fold already refuses a second stop or finish with
BadWorker(stopped_ms.is_some()), andreplayre-folds the log after every step, so a duplicate stop or free event would fail the sweep there. The model's "ended twice" check was wrong, so it now asks the log:ended_beforecomes fromreplay(fake).Tests:
ending_a_dead_worker_again_is_refused_and_writes_nothing: second stop and a finish after a stop are refused and append nothing.a_stop_that_did_not_land_can_be_retried_once: a failed stop drops the token, the retry lands exactly oneWorkerStopped, and a third is refused. These two pass before and after; the regression test for the model fix is seed 625 itself, which fails on main and passes here.KBL_SWEEP_SEED=625, seeds 1..20, andKBL_SWEEP_SEEDS=700all pass.check-threat-model --fix,scripts/lint.mjs, clippy and fmt are clean.