From a0f28f8807dff5036f94183e8f12cd0cd36505af Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Sat, 28 Mar 2026 17:55:51 -0400 Subject: [PATCH] fix(docker): register session lock from bootstrap for proxy discovery Docker bootstrap spawns CLIProxy but never registered a session lock, so the dashboard's fallback detection found nothing. Now registers on spawn and unregisters on close. --- src/docker/docker-bootstrap.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/docker/docker-bootstrap.ts b/src/docker/docker-bootstrap.ts index 5b381239..96629391 100644 --- a/src/docker/docker-bootstrap.ts +++ b/src/docker/docker-bootstrap.ts @@ -9,6 +9,8 @@ import { } from '../cliproxy/config-generator'; import { CLIPROXY_DEFAULT_PORT } from '../cliproxy/config/port-manager'; import { getCliproxyConfigPath } from '../cliproxy/config/path-resolver'; +import { registerSession, unregisterSession } from '../cliproxy/session-tracker'; +import { getInstalledCliproxyVersion } from '../cliproxy/binary-manager'; async function prepareIntegratedRuntime(): Promise<{ binaryPath: string; configPath: string }> { const binaryPath = await ensureCLIProxyBinary(false); @@ -32,8 +34,18 @@ async function runCliproxy(): Promise { }, }); + // Register session lock so dashboard can detect the running proxy + let sessionId: string | undefined; + child.on('spawn', () => { + const version = getInstalledCliproxyVersion() ?? undefined; + sessionId = registerSession(CLIPROXY_DEFAULT_PORT, child.pid ?? 0, version, 'plus'); + }); + child.on('error', reject); child.on('close', (code) => { + if (sessionId) { + unregisterSession(sessionId, CLIPROXY_DEFAULT_PORT); + } resolve(code ?? 1); }); });