fix(cliproxy): register session on dashboard start and add port-based stop fallback

Dashboard Stop/Update buttons failed with contradictory errors:
- Stop: "No active CLIProxy session found"
- Update: "CLIProxy was already running"

Root cause: service-manager spawned proxy but never called registerSession(),
so stopProxy() couldn't find the lock file.

Changes:
- service-manager.ts: Add registerSession() after spawn
- session-tracker.ts: Make stopProxy() async with port-based fallback
- routes.ts: Update proxy-stop endpoint to async
- cliproxy-command.ts: Update handleStop() to await async stopProxy()
- port-utils.ts: Fix double-escaped regex for Windows port detection
- session-tracker.test.js: Update tests for async stopProxy()
This commit is contained in:
kaitranntt committed 2025-12-19 03:57:06 -05:00
1 parent f1dfd69a4a
commit a3b172cc43
6 files changed
+47 -12

No files matched your search

+1 -1
View File
@@ -1069,7 +1069,7 @@ async function handleStop(): Promise<void> {
console.log(header('Stop CLIProxy'));
console.log('');
const result = stopProxy();
const result = await stopProxy();
if (result.stopped) {
console.log(ok(`CLIProxy stopped (PID ${result.pid})`));