fix: send appVersion in probe client hello and update it on session resume

buildClientConfig in test-daemon-connection.ts never set appVersion, so
probe clients (which become the live client) sent hello without it. The
daemon's version gate then hid Pi/Copilot from all these sessions.

Also update appVersion on the Session when a client reconnects with a
newer version, so stale sessions don't stay gated forever.
This commit is contained in:
Mohamed Boudra
2026-04-04 21:12:34 +07:00
parent 3110bae209
commit 744ca7a2bc
3 changed files with 14 additions and 1 deletions

View File

@@ -529,7 +529,7 @@ function toAgentPersistenceHandle(
*/
export class Session {
private readonly clientId: string;
private readonly appVersion: string | null;
private appVersion: string | null;
private readonly sessionId: string;
private readonly onMessage: (msg: SessionOutboundMessage) => void;
private readonly onBinaryMessage: ((frame: Uint8Array) => void) | null;
@@ -714,6 +714,12 @@ export class Session {
this.sessionLogger.trace("Session created");
}
updateAppVersion(appVersion: string | null): void {
if (appVersion && appVersion !== this.appVersion) {
this.appVersion = appVersion;
}
}
/**
* Get the client's current activity state
*/

View File

@@ -745,6 +745,11 @@ export class VoiceAssistantWebSocketServer {
clearTimeout(existing.externalDisconnectCleanupTimeout);
existing.externalDisconnectCleanupTimeout = null;
}
const newAppVersion = message.appVersion ?? null;
if (newAppVersion && newAppVersion !== existing.appVersion) {
existing.appVersion = newAppVersion;
existing.session.updateAppVersion(newAppVersion);
}
existing.sockets.add(ws);
this.sessions.set(ws, existing);
this.sendToClient(ws, this.createServerInfoMessage());