fix(webchat): suppress partial NO_REPLY tokens during streaming#32052
fix(webchat): suppress partial NO_REPLY tokens during streaming#32052ningding97 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
During streaming, the webchat delta handler only checked for the full NO_REPLY token. Partial tokens like "NO" or "NO_RE" were sent to the UI before the complete token arrived, causing a visible "NO" bubble. Add isSilentReplyPrefixText check to suppress partial silent tokens in the streaming delta path. Closes openclaw#32015
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14de324e2d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return; | ||
| } | ||
| // Suppress partial NO_REPLY tokens during streaming (e.g. "NO" before full "NO_REPLY" arrives) | ||
| if (isSilentReplyPrefixText(cleaned, SILENT_REPLY_TOKEN)) { |
There was a problem hiding this comment.
Suppress pre-underscore silent token chunks
The new isSilentReplyPrefixText gate does not catch the first streamed chunks like "N"/"NO", because that helper only returns true once an underscore is present (it explicitly rejects these cases in src/auto-reply/tokens.ts and src/auto-reply/tokens.test.ts). In streams that tokenize as "NO" then "NO_REPLY", this still emits a visible NO delta before suppression, so the partial-token leak this commit targets remains reproducible.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR adds a check for partial Key changes:
Implementation correctness:
Testing:
Confidence Score: 5/5
Last reviewed commit: 14de324 |
Closes #32015
Problem
During streaming in webchat, the delta handler only checks for the full
NO_REPLYtoken viaisSilentReplyText. When tokens arrive incrementally (e.g."NO"→"NO_R"→"NO_REPLY"), the partial text passes the check and gets rendered as a visible "NO" bubble.Fix
Add
isSilentReplyPrefixTextcheck inemitChatDeltato suppress partial silent token prefixes during streaming. The existingisSilentReplyPrefixTextfunction already handles this exact case (checks if text looks like a prefix of the silent token).Tests
pnpm test -- src/gateway/server-chat(15 tests pass)