#13125·qwen-code

responses replay cleanup: tool-media guard provenance, contract docstring, signature NOTE (follow-up from #11684)

Author: he-yufengCreated Sep 30, 2026Updated Sep 30, 2026
Labelspriority/P2type/bugcategory/corescope/content-generationneed-discussionscope/core

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.

  1. Tool-media guard is adjacency-fragile (R3-1). justDroppedUnit is a one-shot flag cleared by the next kept item, so a parallel-call turn that interleaves thought episodes and calls puts a surviving function_call_output between the dropped unit and the captioned media message, and the guard never fires. Probe witness in the thread.

  2. Tool-media predicate matches by shape, not provenance (R3-2). isToolMediaFollowUp would 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.

  3. The contract docstring of downgradeRejectedReasoningItems understates 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.

  4. The NOTE on Responses signature handling states the inverse of llm-chat.ts behavior (R1-7). Each complete Responses signature closes its own episode (llm-chat.ts:407-410 says so in terms); nothing concatenates across items. The multi-episode adjacency premise of #11684 depends on this, so the NOTE should be rewritten.

Threads: R3-1, R3-2, R1-3, R1-7.