feat(conversations): expose disconnect method for clean process exit#340
feat(conversations): expose disconnect method for clean process exit#340dsuresh-ap wants to merge 1 commit intomainfrom
Conversation
The SessionManager already has a disconnect() method but it was not exposed through the public ConversationService API. CLI consumers that use startSession/endSession had no way to close the underlying WebSocket, causing the process to hang indefinitely due to socket.io reconnection timers keeping the event loop alive. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
| * conversationalAgent.conversations.disconnect(); | ||
| * ``` | ||
| */ | ||
| disconnect(): void { |
There was a problem hiding this comment.
- Please add this method in the
ConversationServiceModelas well.
- Add a test case here -
| { | ||
| "name": "@uipath/uipath-typescript", | ||
| "version": "1.2.1", | ||
| "version": "1.3.0", |
There was a problem hiding this comment.
Let's not bump up the version with this change. We might have a few other changes we want to ship with the next version. We'll raise a separate PR for the version change.
| * Disconnects the WebSocket and releases all session resources. | ||
| * | ||
| * Immediately closes the WebSocket connection and clears all per-conversation | ||
| * socket tracking. Call this after ending all sessions to allow the process to exit. |
There was a problem hiding this comment.
"Call this after ending all sessions" implies endSession() is a required prerequisite. It isn't,disconnect closes all sockets directly without needing prior endSession calls.
better add: "Call this to shut down the WebSocket connection entirely."
There was a problem hiding this comment.
have the same description in models as well when you add, because in public docs, comments from models get picked up.
| * Disconnects the WebSocket and releases all session resources. | ||
| * | ||
| * Immediately closes the WebSocket connection and clears all per-conversation | ||
| * socket tracking. Call this after ending all sessions to allow the process to exit. |
There was a problem hiding this comment.
also add a line somehting like this: "In Node.js, the WebSocket keeps the event loop alive until disconnected, call this to allow the process to exit cleanly." because In a browser, the runtime handles socket cleanup on page unload, so this is a no-op there.



Summary
disconnect()onConversationService, delegating to the existingSessionManager.disconnect()methodstartSession/endSessionhave no way to close the underlying WebSocket, causing the process to hang indefinitely due to socket.io reconnection timers keeping the event loop aliveTest plan
cas chatsingle-message mode exits cleanly (exit code 0) against the built binary/quitexits cleanly (exit code 0)🤖 Generated with Claude Code