fix: prevent interrupt mode from replaying previous assistant reply#1026
Open
BingqingLyu wants to merge 1 commit into
Open
fix: prevent interrupt mode from replaying previous assistant reply#1026BingqingLyu wants to merge 1 commit into
BingqingLyu wants to merge 1 commit into
Conversation
When messages.queue.mode is 'interrupt', aborting an active run causes the previous turn's assistant reply to be re-sent to the user. Root cause: buildEmbeddedRunPayloads falls back to extractAssistantText(lastAssistant) when assistantTexts is empty. After an abort, assistantTexts is empty but lastAssistant still references the previous turn's message from session history. Fix: 1. Guard lastAssistant fallback: pass undefined when aborted and no new assistant text was generated (run.ts) 2. Skip blockReplyPipeline flush and payload delivery entirely when the run was aborted (agent-runner.ts) Fixes openclaw#50145
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes openclaw#50145
Problem
When
messages.queue.modeis set to"interrupt", incoming messages that abort an active run cause the previous turn's assistant reply to be re-sent to the user before the new (correct) reply is delivered.Root Cause
buildEmbeddedRunPayloadsfalls back toextractAssistantText(lastAssistant)whenassistantTextsis empty. After an abort,assistantTextsis empty (model never generated new text), butlastAssistantstill references the previous turn's message frommessagesSnapshot(full session history). This stale text gets packaged as the current run's output and delivered to the user.Fix
Two changes (defense in depth):
1. Guard
lastAssistantfallback (run.ts)When the run was aborted and produced no new assistant text, pass
undefinedinstead of the stalelastAssistant:2. Early exit for aborted runs (
agent-runner.ts)blockReplyPipeline.flush()when aborted (buffer may contain stale content)wasAbortedis trueTesting
messages.queue.mode: "interrupt"