diff --git a/gui/ollie9pclient.cpp b/gui/ollie9pclient.cpp index ff657e0..a43819a 100644 --- a/gui/ollie9pclient.cpp +++ b/gui/ollie9pclient.cpp @@ -45,7 +45,14 @@ Ollie9pClient::Ollie9pClient(QObject *parent) if (!data.isEmpty()) emit chatReceived(QString::fromUtf8(data)); }); - connect(m_chat, &StreamFsm::died, this, &Ollie9pClient::streamingDone); + connect(m_chat, &StreamFsm::died, this, [this]() { + // The chat stream closes when the selected session ends. Treat that + // existing signal as an immediate disconnect for connection tracking; + // the periodic connection probe will confirm or recover it later. + if (!m_activeSessionId.isEmpty() && !m_agentId.isEmpty()) + setAgentConnected(agentKey(m_activeSessionId, m_agentId), false); + emit streamingDone(); + }); // State stream — guarded, reads agent statewait. Auto-restarts until // session/agent is deselected (guard returns false).