From 91e7b9f93787e5b2d45bffdaed75e75c151281e4 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Fri, 26 Dec 2025 12:51:09 -0500 Subject: [PATCH] fix(health): use prefix matching for Linux process name truncation Linux kernel truncates process names to 15 chars, causing 'cli-proxy-api-plus' to appear as 'cli-proxy-api-p' in lsof output. Switch from exact whitelist to prefix matching for robust detection. --- src/utils/port-utils.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/utils/port-utils.ts b/src/utils/port-utils.ts index 8416e97e..2359f1ab 100644 --- a/src/utils/port-utils.ts +++ b/src/utils/port-utils.ts @@ -111,26 +111,17 @@ async function getPortProcessWindows(port: number): Promise /** * Check if process is CLIProxy + * Uses prefix matching to handle Linux kernel's 15-char process name truncation + * (e.g., 'cli-proxy-api-plus' becomes 'cli-proxy-api-p' in lsof/ps output) */ export function isCLIProxyProcess(process: PortProcess | null): boolean { if (!process) { return false; } - // Match various CLIProxy binary names const name = process.processName.toLowerCase(); - return [ - 'cli-proxy', - 'cli-proxy.exe', - 'cliproxy', - 'cliproxy.exe', - 'cli-proxy-api', - 'cli-proxy-api.exe', - 'cliproxyapi', - 'cliproxyapi.exe', - 'cli-proxy-api-plus', - 'cli-proxy-api-plus.exe', - ].includes(name); + // All CLIProxy variants start with 'cli-proxy' or 'cliproxy' + return name.startsWith('cli-proxy') || name.startsWith('cliproxy'); } /**