← Back to PRs

#10898: fix(mac): adopt canonical session key and add reset triggers

by Nachx639 open 2026-02-07 04:56 View on GitHub →
app: macos stale
## Summary - **Bug fix**: The Mac app chat was silently dropping all gateway push events because the ViewModel kept the short session key alias (`"main"`) while the gateway emits events with the canonical key (`"agent:main:main"`). After loading history we now adopt the canonical key returned by `chat.history` so event filtering matches correctly. - **Feature**: Adds `/new`, `/reset`, `/clear` trigger support to the native Mac chat UI — the same reset triggers already available on messaging channels (WhatsApp, Telegram, etc.) — by intercepting them in `performSend()` and calling `sessions.reset` on the gateway. ## Changes - `ChatViewModel.swift`: Adopt canonical session key from gateway response in `bootstrap()`; intercept reset triggers in `performSend()`; add `performReset()` method - `ChatTransport.swift`: Add `resetSession(sessionKey:)` to the `OpenClawChatTransport` protocol with a default throwing implementation - `WebChatSwiftUI.swift`: Implement `resetSession` in `MacGatewayChatTransport` using the `sessions.reset` gateway RPC ## Test plan - [x] Built and launched Mac app — verified chat events now display correctly (session key match) - [x] Tested `/new` in Mac app chat — session resets and history clears - [ ] Verify no regression on iOS (default protocol extension throws, same as before) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> - Updates the macOS chat ViewModel to adopt the gateway’s canonical session key from `chat.history`, aiming to prevent push events from being filtered out when aliases like `"main"` are used. - Adds `/new`, `/reset`, and `/clear` trigger handling in the native macOS chat UI by resetting the session via the transport instead of sending the command as a message. - Extends `OpenClawChatTransport` with a `resetSession(sessionKey:)` API and implements it for the macOS gateway transport using the `sessions.reset` RPC. <h3>Confidence Score: 3/5</h3> - This PR is close to safe to merge, but has a functional gap that can still leave macOS push events filtered out after canonicalization. - The change to adopt the canonical session key is sensible, but the current code sets the active session key before canonicalization and never re-applies it, so the intended fix may not take effect depending on how the transport/gateway filters events. Reset-trigger handling and the transport extension look straightforward otherwise. - apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs