responses replay cleanup: tool-media guard provenance, contract docstring, signature NOTE (follow-up from #11684)
Deferred from the #11684 review (rounds R1/R3/R4) so they do not get lost. That PR landed only its Critical fixes; these four Suggestions remain open.
Tool-media guard is adjacency-fragile (R3-1).
justDroppedUnitis a one-shot flag cleared by the next kept item, so a parallel-call turn that interleaves thought episodes and calls puts a survivingfunction_call_outputbetween the dropped unit and the captioned media message, and the guard never fires. Probe witness in the thread.Tool-media predicate matches by shape, not provenance (R3-2).
isToolMediaFollowUpwould delete a genuine user message whose text happens to equal the caption placeholder while carrying an image. Nothing exercises the predicate negatively: weakening any of its three conditions keeps the suite green.The contract docstring of
downgradeRejectedReasoningItemsunderstates what the body removes (R1-3). It enumerates the call group and its outputs, but the body also removes the captioned tool-media message and rewrites or removes kept reasoning items via the bare-episode sweep. Both classes should be named.The NOTE on Responses signature handling states the inverse of
llm-chat.tsbehavior (R1-7). Each complete Responses signature closes its own episode (llm-chat.ts:407-410says so in terms); nothing concatenates across items. The multi-episode adjacency premise of #11684 depends on this, so the NOTE should be rewritten.
Source: QwenLM/qwen-code