← Back to PRs

#22798: feat(webchat): ChatGPT-style multi-chat threads with generated titles

by opnsec open 2026-02-21 17:41 View on GitHub →
app: web-ui size: S
## Summary Implements an initial vertical slice of ChatGPT-style multi-chat behavior in Control UI WebChat: - New chat creates a fresh isolated session key (`agent:<agentId>:webchat:thread:<uuid>`). - Chat tab navigation no longer silently resets active session to `main`. - Webchat thread sessions get a friendly fallback display name ("New Chat"). - First successful message in a webchat thread auto-sets session label via heuristic title generation (trimmed first message). ## Details ### Functional changes - Added `createWebchatThreadSessionKey()` helper and wired New chat button in chat controls. - Preserved active session when switching to Chat from sidebar nav. - Added webchat-thread key parsing/fallback naming in session display resolution. - Added `maybeAutoTitleWebchatThread()` in chat send flow (uses `sessions.patch`). ### Tests - Added/updated parser + key-generation tests in `app-render.helpers.node.test.ts`. - Updated navigation browser test expectation to match new preserved-session behavior. - Stabilized browser test mount helper by importing app registration side-effect. - Full UI Playwright-backed test suite passes locally: - `pnpm -C ui test` - Result: **31 passed files, 279 passed tests** ## Related - Feature request: https://github.com/openclaw/openclaw/issues/22761 --- **AI-generated contribution:** This PR was primarily generated with AI assistance and then validated with local tests. Tracking: Ref #22761 <!-- greptile_comment --> <h3>Greptile Summary</h3> Implements ChatGPT-style multi-chat threading for the webchat UI. New chat button creates isolated session keys using `agent:<agentId>:webchat:thread:<uuid>` format. Navigation no longer resets active session to main when switching tabs, preserving user context. First message in a thread auto-generates a friendly title (trimmed to 60 chars) via heuristic. **Key improvements:** - Session isolation prevents accidental context mixing between chats - Preserved navigation state improves UX by maintaining active session context - Auto-titling provides friendly fallback display names for new threads **Test coverage:** - Added unit tests for key parsing and thread session creation - Updated navigation browser test to match new preserved-session behavior - Fixed test expectations for `TAB_GROUPS` labels (lowercase, not capitalized) - Stabilized mount helper by importing app registration side-effect <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - Clean implementation following established patterns. Auto-title generation is non-destructive (only applies when label is empty). Session key parsing uses existing regex patterns. All changes are additive and maintain backward compatibility. Test coverage is comprehensive with both unit and browser tests passing. - No files require special attention <sub>Last reviewed commit: 4b29c8f</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs