#8742: fix(webchat): hide internal system messages from UI (#7440)
app: web-ui
stale
Cluster:
Webchat NO_REPLY Handling
Filter out internal system messages that should not be visible to users in the WebChat interface. These include:
- Memory flush prompts ("Pre-compaction memory flush...")
- Session reset/new greeting prompts ("A new session was started via /new or /reset...")
- Silent reply responses (messages starting with NO_REPLY)
These housekeeping messages are injected by the Gateway for internal operations and should only exist in the agent's transcript, not in the user-facing chat display.
Fixes #7440
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds an `isInternalSystemMessage` helper to detect gateway-injected housekeeping messages (pre-compaction memory flush prompts, session reset prompts, and `NO_REPLY` silent responses) and filters them out during WebChat message list construction (`buildChatItems`). It also adds targeted unit tests for the new detection logic in `message-normalizer.test.ts`.
Overall, the change fits cleanly into the existing chat rendering pipeline: messages are normalized/grouped for display, and this new check prevents specific internal transcript artifacts from ever becoming user-facing.
<h3>Confidence Score: 4/5</h3>
- This PR is reasonably safe to merge; changes are localized and covered by unit tests.
- The UI behavior change is a simple filter with explicit regexes and a dedicated test suite. The main remaining risk is false negatives due to message shape/type casing differences between raw gateway payloads and what the UI ultimately renders (the helper re-parses raw message structures instead of using the already-normalized representation).
- ui/src/ui/chat/message-normalizer.ts; ui/src/ui/views/chat.ts
<!-- greptile_other_comments_section -->
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#8334: fix(webchat): Filter NO_REPLY messages from chat history
by vishaltandale00 · 2026-02-03
84.6%
#7127: fix(webchat): add regenerate flag to prevent context leak on response…
by craihub · 2026-02-02
81.5%
#3721: fix(ui): webchat not displaying chat responses
by maxmaxrouge-rgb · 2026-01-29
81.0%
#15564: fix: webchat messages disappear during concurrent session activity
by Automatedcapitalist · 2026-02-13
80.9%
#14966: fix(webchat): preserve user message visibility after chat.send
by BenediktSchackenberg · 2026-02-12
80.5%
#14309: fix(ui): resolve chat event session key mismatch
by justonlyforyou · 2026-02-11
79.8%
#16361: Gateway: suppress NO_REPLY in webchat
by shadril238 · 2026-02-14
79.0%
#11647: fix(webchat): filter HEARTBEAT_OK messages from chat.history response
by liuxiaopai-ai · 2026-02-08
79.0%
#23370: fix: strip [[reply_to_current]] tags from WebChat + validate invoke...
by alexmelges · 2026-02-22
78.9%
#12974: fix: intermittent (no output) reported by users
by vincentkoc · 2026-02-10
78.5%