← Back to PRs

#3721: fix(ui): webchat not displaying chat responses

by maxmaxrouge-rgb open 2026-01-29 03:12 View on GitHub →
channel: telegram app: web-ui gateway
## Summary - Fix webchat Control UI not displaying assistant responses (messages were going to TUI but not appearing in webchat) - Add final message from chat event payload directly to chatMessages instead of relying on loadChatHistory (which returns 0 messages when session transcript file doesn't exist) - Add configurable debug logging controlled by settings/environment variables ## Changes - **UI**: Add `debug()` utility controlled by `debugLogs` setting, localStorage, or `window.MOLTBOT_UI_DEBUG` - **Server**: Add `debugChat()` utility controlled by `CLAWDBOT_DEBUG_CHAT` env var - **Fix**: Handle final chat event by adding message directly to chatMessages array ## Test plan - [ ] Send message in webchat, verify response appears - [ ] Enable debug logging (`localStorage.setItem('moltbot-ui-debug', 'true')`) and verify logs appear in browser console - [ ] Set `CLAWDBOT_DEBUG_CHAT=1` and verify server-side debug logs appear 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR fixes webchat assistant responses not appearing by appending the final chat event payload directly into the UI `chatMessages` list and avoiding reliance on `chat.history` when no transcript exists. It also adds optional debug logging (UI + server) and a few related adjustments (e.g., applying URL settings earlier, better token mismatch hints, restart-sentinel wiring to register chat runs). Main issue found: a debug log executes inside the chat render path, which can cause heavy console spam and degrade responsiveness when debug logging is enabled. <h3>Confidence Score: 4/5</h3> - This PR is generally safe to merge; the main risk is debug logging placement causing noisy/slow renders when enabled. - Most changes are additive and scoped to chat event handling and debug instrumentation. I found one performance/UX footgun (debug logging executed during render) but no clear correctness regressions from the diff review. - ui/src/ui/app-render.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs