Skip to content

Sweep: decide a worker's double end from the log (seed 625) - #494

Merged
el-bri-ga merged 1 commit into
mainfrom
fix/sweep-seed-625-ended-twice
Nov 21, 2026
Merged

el-bri-ga merged 1 commit into
mainfrom
fix/sweep-seed-625-ended-twice

Conversation

@el-bri-ga

Copy link
Copy Markdown
Contributor

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. append drops 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 read worker_by_token before 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()), and replay re-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_before comes from replay(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 one WorkerStopped, 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, and KBL_SWEEP_SEEDS=700 all pass. check-threat-model --fix, scripts/lint.mjs, clippy and fmt are clean.

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
el-bri-ga enabled auto-merge (squash) November 21, 2026 19:37
@sonarqubecloud

Copy link
Copy Markdown

@el-bri-ga
el-bri-ga merged commit 3cd1dbd into main Nov 21, 2026
10 checks passed
@el-bri-ga
el-bri-ga deleted the fix/sweep-seed-625-ended-twice branch November 21, 2026 19:51
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.

1 participant