← Back to PRs

#10828: Filter out bare reset/new session prompts from chat UI

by ByteBotAI open 2026-02-07 02:21 View on GitHub →
app: web-ui stale size: S
## Summary Filters out bare reset/new session system messages that leak into the chat UI by using exact matching on the full prompt text. ## Problem When creating a new session via /new or /reset, the system message was visible in the chat interface, creating unnecessary UI clutter. ## Solution - Created `@openclaw/shared-constants` package to define the reset prompt in a single location - Updated filter to use exact role + content matching (`===`) instead of substring matching - Both backend and frontend now import from the shared package, eliminating data duplication ## Addresses Code Review Feedback - **Greptile:** Fixed overbroad substring filtering that could hide legitimate messages - **HenryLoenwind:** Eliminated data duplication by referencing the prompt through a shared package instead of copying the text ## Changes - `packages/shared-constants/` - New shared package with prompt constants - `ui/src/ui/views/chat.ts` - Updated to use exact matching and import from shared package - `src/auto-reply/reply/get-reply-run.ts` - Updated to import from shared package ## Testing Verified in dev environment that only bare reset messages are filtered, not legitimate system messages. <!-- greptile_comment --> ## Greptile Overview ### Greptile Summary - Adds a `BARE_SESSION_RESET_PROMPT` constant in a shared package and filters chat history items in `ui/src/ui/views/chat.ts` so reset/new-session system messages don't render in the chat thread. - Uses exact matching (`===`) on both role and trimmed content to avoid filtering legitimate messages. - Both backend and frontend import from the shared constants package, eliminating data duplication. ### Confidence Score: 4/5 - The filtering is now precise and only targets bare reset messages. - Shared constants package properly addresses DRY concerns. - Small, localized change with clear separation of concerns. <!-- /greptile_comment -->

Most Similar PRs