Hello Michael,
I think I can see the problem. The issue appears to be related to session handling and websocket connection management. Even though the clear conversation and conversation disconnect is set to display status and disconnect you might be hitting a race condition in the session handling.
I got this from looking at a couple of things. The websocket connection is properly closed from your widget side, no new messages originate from the widget after the interaction ends, the "echo" method confirms no active connections, messages show 'delivery-failed' status with yellow triangle in the UI and previous chat messages appearing in new sessions despite clear conversation being enabled.
Specifically to the error message, it looks like the app instance coordination issue in the agent workspace. The error message also indicates a mismatch between the conversation state and the app instance management. The system is showing active conversations that might not be properly terminated.
I have some recommendations that may help.
First lets double check the implementation. Verify that your widget is properly implementing the session clean up on disconnect. Next ensure you're handling the disconnect event properly in your custom widget. Finally implementing proper session state management on your end could help.
Next lets check up on how you are monitoring. My recommendation is to add logging for websocket connection states. This can be found here. Then monitor the delivery status of messages more closely. Finally track session ids and their lifecycles.
Since you have a case with the interaction id, I recommend implementing additional logging around the session termination, capture the full sequence of events leading to the ghost interaction. Verify that your implementation properly handles the "closed" response from the server. Ensure your widget waits for the proper closed message without timeout handling before completely terminating the session.
If all the above doesn't help, my next suggestion would be to open a support case so they can look into the logging on our end as well as the console logs you can provide.
I would also like to mention that posting in the dev community might be helpful as well.
Cheers,
------------------------------
Cameron
Online Community Manager/Moderator
------------------------------