gui: re-discover agent ID on state stream start to pick up renames

This commit is contained in:
Levi Neely 2026-08-01 18:14:29 +02:00
parent 79d031ff04
commit 74d346418d
1 changed files with 11 additions and 0 deletions

View File

@ -364,6 +364,17 @@ void Ollie9pClient::startChatStream()
void Ollie9pClient::startStateStream()
{
if (m_stateProc) return;
// Re-discover agent ID — directory may have been renamed
QByteArray out = run9p({"ls", "session/" + m_activeSessionId + "/agent"});
QString agents = QString::fromUtf8(out).trimmed();
if (!agents.isEmpty()) {
QString newId = agents.split('\n').first().trimmed();
if (newId != m_agentId) {
m_agentId = newId;
emit activeAgentIdChanged();
}
}
m_stateProc = new QProcess(this);
connect(m_stateProc, &QProcess::readyReadStandardOutput, this, &Ollie9pClient::onStateReadyRead);
connect(m_stateProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),