mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-11-07 06:19:43 -10:00
* feat(mods): run prompt.submit hooks in headless runs Mods' prompt.submit hooks can rewrite, add context to, or drop each headless prompt before UserPromptSubmit, @ processing and the transcript see it. Terminals keep skipping these hooks until they raise the event. Includes the design document for the four steps. * test(mods): update bundled worker load response expectation * fix(mods): preserve downstream prompt submit outcomes * fix(mods): isolate prompt fallback from host continuations * fix(mods): preserve latest local prompt outcome in recovery * fix(mods): hear only a message's text and take any answer after next A stream-json message with an image block reached the prompt.submit hooks as its serialized blocks, so they were skipped as too long or saw JSON noise, and a rewrite carried that JSON into humanInput and turn.start. The hooks now hear its text blocks; a rewrite replaces them and the other blocks follow it. A hook's answer after its next changes nothing, but it was still validated, so a hook that only watches and returns nothing, or spreads the event back, failed and logged a skip on every prompt. Only a drop there is now checked. * fix(mods): keep prompt.submit to typed text and drop empty rewrites - Show only the rewritten text in the transcript and UserPromptSubmit, not the serialized non-text blocks of a stream-json message. - Skip prompt.submit for SDK messages that answer a tool call or carry tool blocks, and for messages without text. - Drop a prompt the hooks rewrote to nothing instead of sending the model an empty prompt. * fix(mods): send each prompt context once on its own The Mods' prompt.submit context and UserPromptSubmit's additionalContext share one hidden block, and the block was only skipped when the conversation already held it whole. A Mod whose context changes every turn made every block new, so an unchanged UserPromptSubmit context went to the model again each turn. The injected part now records the contexts it joins, and a context counts as delivered when an earlier block holds it, so only the contexts the conversation lacks are sent. A block without that record, as after resume, still counts as one context. * fix(mods): keep a message's blocks in the transcript after a rewrite A stream-json message with blocks other than text is recorded with those blocks serialized after its text. A prompt.submit rewrite recorded the rewritten text alone, so the same kind of message showed two shapes in the transcript. The rewritten prompt is now recorded with the blocks after it. Adds the headless E2E test plan and its results. --------- Co-authored-by: Shaojin Wen <[email protected]>