From 738a18d6ff47be822cfd2e81ace56b3287814dd4 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Tue, 24 Mar 2026 11:46:29 -0700 Subject: [PATCH] Fix owner-PID false positive when owner runs as different user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ownerAlive() treated EPERM (permission denied) the same as ESRCH (process not found), causing the server to self-terminate within 60s whenever the owner process ran as a different user. This affected WSL (owner is a Windows process), Tailscale SSH, and any cross-user scenario. The fix: `return e.code === 'EPERM'` — if we get permission denied, the process is alive; we just can't signal it. Tested on Linux via Tailscale SSH with a root-owned grandparent PID: - Server survives past the 60s lifecycle check (EPERM = alive) - Server still shuts down when owner genuinely dies (ESRCH = dead) Fixes #879 --- RELEASE-NOTES.md | 1 + skills/brainstorming/scripts/server.cjs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index ee30ff77..2abd1463 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -17,6 +17,7 @@ The subagent review loop (dispatching a fresh agent to review plans/specs) doubl ### Bug Fixes +- **Owner-PID false positives** — the brainstorm server's `ownerAlive()` check treated EPERM (permission denied) the same as ESRCH (process not found), causing the server to self-terminate within 60 seconds whenever the owner process ran as a different user. This affected WSL (owner is a Windows process), Tailscale SSH, and any cross-user scenario. Fixed by treating EPERM as "alive". (#879) - **writing-skills** — corrected false claim that SKILL.md frontmatter supports "only two fields"; now says "two required fields" and links to the agentskills.io specification for all supported fields (PR #882 by @arittr) ### Codex App Compatibility diff --git a/skills/brainstorming/scripts/server.cjs b/skills/brainstorming/scripts/server.cjs index e139c13f..14b8197c 100644 --- a/skills/brainstorming/scripts/server.cjs +++ b/skills/brainstorming/scripts/server.cjs @@ -313,7 +313,7 @@ function startServer() { function ownerAlive() { if (!OWNER_PID) return true; - try { process.kill(OWNER_PID, 0); return true; } catch (e) { return false; } + try { process.kill(OWNER_PID, 0); return true; } catch (e) { return e.code === 'EPERM'; } } // Check every 60s: exit if owner process died or idle for 30 minutes