#16361: Gateway: suppress NO_REPLY in webchat
app: web-ui
gateway
stale
size: S
trusted-contributor
Cluster:
Webchat NO_REPLY Handling
- Filter NO_REPLY silent tokens from webchat chat deltas and final payloads so they never render in the UI.
- Exclude NO_REPLY-only assistant messages from chat history responses.
- Add gateway test coverage for silent-token suppression.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Filtered `NO_REPLY` silent tokens from webchat responses to prevent them from rendering in the UI. Added helper functions `extractChatTextContent` and `isSilentChatMessage` to detect and filter assistant messages containing only the silent token. Updated streaming logic in `server-chat.ts` to suppress `NO_REPLY` deltas, and modified chat history endpoint to exclude silent messages. Test updated to use `SILENT_REPLY_TOKEN` constant for consistency.
Key implementation details:
- `isSilentChatMessage` only filters assistant-role messages with text-only content (preserves messages with images/tools)
- Falls back to `record.text` field if content array doesn't contain text
- Uses existing `isSilentReplyText` utility for token matching with proper regex handling
- Chat history filtering happens after sanitization but before byte-capping for efficiency
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no identified issues
- The implementation is clean, well-tested, and follows existing patterns. The logic correctly handles edge cases (non-text content, role filtering, whitespace trimming). The filtering happens at appropriate points in the request flow. Tests verify both streaming suppression and final message filtering. No breaking changes or security concerns identified.
- No files require special attention
<sub>Last reviewed commit: f1dee85</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#8334: fix(webchat): Filter NO_REPLY messages from chat history
by vishaltandale00 · 2026-02-03
85.4%
#8493: fix(tui): filter NO_REPLY token from chat display
by gavinbmoore · 2026-02-04
83.7%
#23761: fix: suppress partial NO_REPLY tokens at lifecycle boundary
by kami-saia · 2026-02-22
80.9%
#8742: fix(webchat): hide internal system messages from UI (#7440)
by revenuestack · 2026-02-04
79.0%
#15118: Fix webchat ghost bubble when model replies with NO_REPLY
by jwchmodx · 2026-02-13
78.6%
#11647: fix(webchat): filter HEARTBEAT_OK messages from chat.history response
by liuxiaopai-ai · 2026-02-08
78.4%
#19648: fix: suppress silent-reply partial tokens during streaming
by bradleypriest · 2026-02-18
77.9%
#11889: fix(chat): filter HEARTBEAT_OK messages in chat.history when showOk...
by bendyclaw · 2026-02-08
77.4%
#19576: fix: tighten isSilentReplyText to match whole-text only
by aldoeliacim · 2026-02-18
76.7%
#21462: fix(agents): hold back partial NO_REPLY token in pi-embedded streaming
by algal · 2026-02-20
76.6%