From 4f1c1f7222487da6eb633c1b857e67728bfb2f22 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 31 Jul 2026 20:30:17 +0200 Subject: [PATCH] =?UTF-8?q?gui:=20fix=20session=20switch=20=E2=80=94=20emi?= =?UTF-8?q?t=20signals=20after=20agent=20ID=20discovery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signals were emitted before m_agentId was set, causing QML's onActiveSessionIdChanged handler to call readLog() with an empty agent path. Now: discover agent → emit signals → start streams. --- gui/ollie9pclient.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gui/ollie9pclient.cpp b/gui/ollie9pclient.cpp index c354a35..a5870b2 100644 --- a/gui/ollie9pclient.cpp +++ b/gui/ollie9pclient.cpp @@ -45,12 +45,14 @@ void Ollie9pClient::setActiveSessionId(const QString &id) m_activeSessionId = id; m_agentId.clear(); m_activeState = "idle"; - emit activeSessionIdChanged(); - emit activeStateChanged(); - if (id.isEmpty()) return; + if (id.isEmpty()) { + emit activeSessionIdChanged(); + emit activeStateChanged(); + return; + } - // Discover agent ID + // Discover agent ID BEFORE emitting signals QByteArray out = run9p({"ls", "session/" + id + "/agent"}); QString agents = QString::fromUtf8(out).trimmed(); if (!agents.isEmpty()) { @@ -59,6 +61,9 @@ void Ollie9pClient::setActiveSessionId(const QString &id) m_agentId = "0"; } + emit activeSessionIdChanged(); + emit activeStateChanged(); + startChatStream(); startStateStream(); }