Summary / Problem Statement
The Telegram channel daemon (`telegram-ingress-spool.ts`) checks for lock ownership liveness using:
function processExists(pid: number): boolean {
try {
process.kill(pid, 0);
return true;
} catch (e) {
return e.code === "EPERM";
}
}
On Windows platforms, sending signal `0` via `process.kill(pid, 0)` is not supported by Node.js and throws a system error (usually `EINVAL`). As a result, `processExists(pid)` always returns `false` on Windows, even if the process is alive. Unrelated instances will assume the active claim is dead and attempt to hijack the claim lock, resulting in duplicate updates processing.
Detailed Technical Context
- Process Probe: In `extensions/telegram/src/telegram-ingress-spool.ts`:
export function checkSpoolLiveness(claim: TelegramClaimRecord): boolean {
if (!claim.ownerPid) return false;
return processExists(claim.ownerPid);
}
- Under Unix, `process.kill(pid, 0)` is a standard way to verify a PID exists.
- Under Windows, Node.js throws `EINVAL` or `ENOSYS` for signal `0` because Windows has no native concept of POSIX signals.
Impact Analysis
- Lock collisions and double message deliveries when running OpenClaw gateway on Windows.
- Multiple Telegram client pollers hijacking the same spool folder concurrently.
Proposed Solution / Implementation Plan
- Platform-Specific Check: Implement a robust cross-platform liveness checker using Windows-specific API checks or process query tools:
import { platform } from "node:os";
function processExists(pid: number): boolean {
try {
if (platform() === "win32") {
// Query tasks using tasklist or try opening the process handle
execSync(`tasklist /FI "PID eq \${pid}"`, { stdio: "ignore" });
return true;
}
process.kill(pid, 0);
return true;
} catch {
return false;
}
}
Affected File References
Summary / Problem Statement
The Telegram channel daemon (`telegram-ingress-spool.ts`) checks for lock ownership liveness using:
On Windows platforms, sending signal `0` via `process.kill(pid, 0)` is not supported by Node.js and throws a system error (usually `EINVAL`). As a result, `processExists(pid)` always returns `false` on Windows, even if the process is alive. Unrelated instances will assume the active claim is dead and attempt to hijack the claim lock, resulting in duplicate updates processing.
Detailed Technical Context
Impact Analysis
Proposed Solution / Implementation Plan
Affected File References