You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: Resume fails for good when a dataset has an exact duplicate row and the first run sampled only one copy #4157
If a dataset has the same seed row twice and the first run's sampling (max_per_dataset or max_total) picked only one of the copies, resuming that run always fails:
ValueError: Scenario result id '...' cannot resume: 2 planned atomic group(s) are no longer reconstructable.
The same scenario without the duplicate row resumes and completes normally.
What happens: both copies have the same logical_id, since it's a hash of the seed contents. On resume, Scenario.initialize_async resolves the datasets without sampling and keeps every group whose logical_id is in the stored plan (scenario.py around line 1212), so both copies come back. MatrixAtomicAttackBuilder.build and build_baseline_atomic_attacks then see a repeated objective and switch to one atomic attack per seed group, named like baseline__ and a_ds_a__, instead of the batched baseline and a_ds_a the first run created. _apply_persisted_run_plan can't find those planned group ids and raises.
Repro: a matrix scenario over two datasets with max_per_dataset=2, where ds_a holds "dup objective" twice. The first run's target fails every send so everything stays pending, then resume with a healthy target:
run 1 sampled: ['dup objective', 'a2', 'b0', 'b1']; atomic groups: ['baseline', 'a_ds_a', 'a_ds_b']
run 1 ended: ScenarioPartialFailureException
RESUME FAILED: ValueError - Scenario result id '...' cannot resume: 2 planned atomic group(s) are no longer reconstructable.
control (no duplicate row):
RESUME OK: COMPLETED
There's no simple fix in the resume filter, because duplicates are a supported case: _unique_group_name exists so behaviorally identical groups run as repeats. The plan stores each logical_id once per atomic group (ScenarioRunPlan rejects repeats), so on resume there's no way to tell whether the first run had one copy or two.
Two options I can see. The first is to record how many copies of each logical_id the planned population had per dataset, as a new optional field on the run plan, and have resume keep that many. Older plans without the field would keep today's behaviour. The second is to infer the count from the planned atomic group names (batched versus ), which needs no schema change but depends on the naming staying the same.
I'd go with the first. Happy to send a PR once you're fine with adding a plan field.
Activity