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:
@@ -2,6 +2,7 @@ import { DaemonClient } from "@server/client/daemon-client";
|
|||||||
import type { DaemonClientConfig } from "@server/client/daemon-client";
|
import type { DaemonClientConfig } from "@server/client/daemon-client";
|
||||||
import type { HostConnection } from "@/types/host-connection";
|
import type { HostConnection } from "@/types/host-connection";
|
||||||
import { getOrCreateClientId } from "./client-id";
|
import { getOrCreateClientId } from "./client-id";
|
||||||
|
import { resolveAppVersion } from "./app-version";
|
||||||
import { buildDaemonWebSocketUrl, buildRelayWebSocketUrl } from "./daemon-endpoints";
|
import { buildDaemonWebSocketUrl, buildRelayWebSocketUrl } from "./daemon-endpoints";
|
||||||
import {
|
import {
|
||||||
buildLocalDaemonTransportUrl,
|
buildLocalDaemonTransportUrl,
|
||||||
@@ -53,6 +54,7 @@ export async function buildClientConfig(
|
|||||||
const base = {
|
const base = {
|
||||||
clientId,
|
clientId,
|
||||||
clientType: "mobile" as const,
|
clientType: "mobile" as const,
|
||||||
|
appVersion: resolveAppVersion() ?? undefined,
|
||||||
suppressSendErrors: true,
|
suppressSendErrors: true,
|
||||||
reconnect: { enabled: false },
|
reconnect: { enabled: false },
|
||||||
...(connection.type === "directSocket" || connection.type === "directPipe"
|
...(connection.type === "directSocket" || connection.type === "directPipe"
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ function toAgentPersistenceHandle(
|
|||||||
*/
|
*/
|
||||||
export class Session {
|
export class Session {
|
||||||
private readonly clientId: string;
|
private readonly clientId: string;
|
||||||
private readonly appVersion: string | null;
|
private appVersion: string | null;
|
||||||
private readonly sessionId: string;
|
private readonly sessionId: string;
|
||||||
private readonly onMessage: (msg: SessionOutboundMessage) => void;
|
private readonly onMessage: (msg: SessionOutboundMessage) => void;
|
||||||
private readonly onBinaryMessage: ((frame: Uint8Array) => void) | null;
|
private readonly onBinaryMessage: ((frame: Uint8Array) => void) | null;
|
||||||
@@ -714,6 +714,12 @@ export class Session {
|
|||||||
this.sessionLogger.trace("Session created");
|
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
|
* Get the client's current activity state
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -745,6 +745,11 @@ export class VoiceAssistantWebSocketServer {
|
|||||||
clearTimeout(existing.externalDisconnectCleanupTimeout);
|
clearTimeout(existing.externalDisconnectCleanupTimeout);
|
||||||
existing.externalDisconnectCleanupTimeout = null;
|
existing.externalDisconnectCleanupTimeout = null;
|
||||||
}
|
}
|
||||||
|
const newAppVersion = message.appVersion ?? null;
|
||||||
|
if (newAppVersion && newAppVersion !== existing.appVersion) {
|
||||||
|
existing.appVersion = newAppVersion;
|
||||||
|
existing.session.updateAppVersion(newAppVersion);
|
||||||
|
}
|
||||||
existing.sockets.add(ws);
|
existing.sockets.add(ws);
|
||||||
this.sessions.set(ws, existing);
|
this.sessions.set(ws, existing);
|
||||||
this.sendToClient(ws, this.createServerInfoMessage());
|
this.sendToClient(ws, this.createServerInfoMessage());
|
||||||
|
|||||||
Reference in New Issue
Block a user