fix(gateway): filter NO_REPLY messages from chat history endpoint#27258
Closed
Sid-Qin wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(gateway): filter NO_REPLY messages from chat history endpoint#27258Sid-Qin wants to merge 1 commit intoopenclaw:mainfrom
Sid-Qin wants to merge 1 commit intoopenclaw:mainfrom
Conversation
The streaming path (emitChatDelta/emitChatFinal) already suppresses assistant messages containing NO_REPLY tokens, but the chat.history endpoint returned them unfiltered. When users refresh webchat or open a new connection, historical NO_REPLY messages appeared in the UI. Add extractAssistantText() to pull text from various message formats and filter out matching messages in sanitizeChatHistoryMessages(), bringing the history path in line with the streaming path. Closes openclaw#27238
Contributor
Greptile SummaryFilters
Confidence Score: 5/5
Last reviewed commit: 70d0f85 |
5 tasks
|
This pull request has been automatically marked as stale due to inactivity. |
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.
Summary
NO_REPLY/[NO_REPLY]sentinel tokens leak into chat history when the non-streaming path stores them as regular assistant messages, causing the model to parrot them back to users.[NO_REPLY]text in bot responses, which is confusing and breaks the conversation flow.isSilentReplyText()filtering insanitizeChatHistoryMessages()to strip silent-reply messages from history before they reach the model, matching the streaming path's existing behavior.isSilentReplyText()detection are unaffected. Only the history sanitization was missing the filter.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
NO_REPLY/[NO_REPLY]sentinel tokens no longer appear in bot responses. Silent replies are now consistently filtered from chat history across both streaming and non-streaming paths.Security Impact (required)
Testing
npx vitest run src/agents/pi-embedded-runner.sanitize-session-history— 18 tests ✓npx vitest run src/auto-reply/reply/— 479 tests ✓Rollback Plan
Revert the single commit. No migration or data changes involved.