[Bug] Fully-async callback admits nested ABORTED agent results to the completed queue
Bug description
At 5bae5bb7928d65906e24e99f5b5d3f99a4daaf93, generate_and_rm_group() explicitly supports list[list[Sample]] when a custom generate function emits several training segments for one agent rollout. However, AsyncRolloutWorker._make_done_cb() checks ABORTED status only on the outer list's elements:
if any(getattr(s, "status", None) == Sample.Status.ABORTED for s in result):For [[aborted_sample], [completed_sample]], both inspected objects are lists, so the condition is false. The group enters the completed queue despite containing an ABORTED trajectory, contrary to the worker's stated retry contract.
Minimal reproduction
In a slime environment (no model/Ray startup needed):
import queue
from types import SimpleNamespace
from slime.rollout.fully_async_rollout import AsyncRolloutWorker
from slime.utils.types import Sample
requeued = []
worker = object.__new__(AsyncRolloutWorker)
worker.output_queue = queue.Queue()
worker.data_buffer = SimpleNamespace(add_samples=lambda groups: requeued.extend(groups))
result = [
[Sample(index=0, status=Sample.Status.ABORTED)],
[Sample(index=1, reward=1.0, status=Sample.Status.COMPLETED)],
]
worker._make_done_cb(7)(SimpleNamespace(result=lambda: result))
print(worker.queue_size(), len(requeued)) # actual: 1, 0Expected: an ABORTED leaf must prevent the entire prompt group from being admitted as completed; retry must receive valid original per-rollout Sample inputs.
Scope and related work
#2345 fixes sorting of nested groups in _generate_rollout_async; it does not change the callback's ABORTED handling. This report concerns the earlier admission/retry boundary. I am not claiming that unmodified main successfully trains these nested groups: the separate sorting bug can fail first.
Recursively checking leaves alone is insufficient for a complete fix. Requeuing the nested output directly makes generate_and_rm_group() receive lists where it expects Sample objects (it accesses sample.session_id). A fix needs to retain the original input group or otherwise map aborted segment outputs back to valid generation inputs, while preserving successful siblings and existing partial-rollout semantics.
Verified with a CPU reproduction against the current callback: 1 completed group, 0 requeued groups, ABORTED leaf present in the completed queue. Python 3.12.13, PyTorch 2.14.0, macOS arm64; existing CPU import stubs were used, with no GPU/server or live agent run. CONTRIBUTING.md and existing nested/aborted issues and PRs were checked.
Source: THUDM/slime