mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-09 22:48:57 +02:00
Re-derive of PR #2414 (SYKhayyat) onto current main. Most of the PR already landed in earlier waves: the tick-derived RESPAWN_GUARD_WINDOW_MS, the spawnTerminalAgent windowsHide flag, the process-liveness regression tests, and the browse/test import.meta.path sweep are all on main. Two pieces remained: 1. isProcessAlive EPERM semantics (error-handling.ts): on the signal-0 path, EPERM means the process EXISTS but we lack rights to signal it — that is ALIVE. Returning false made callers that validate liveness before killing (killAgentByRecord, the terminal-agent watchdog) skip the kill and respawn around a survivor — the self-reinforcing one-leak-per-tick chain from #2414/#2295. Matters for cross-user PID checks. 2. Six test/ files ADDED SINCE the PR reintroduced the exact Windows bug its second commit fixed: `new URL(import.meta.url).pathname` yields `/C:/Users/...` on Windows, so path.resolve prepends the cwd drive and every tripwire ENOENTs instead of asserting anything (egress-receipt, egress-lib, egress-receipt-wiring, gstack-egress-cli, pty-skill-seeding-wiring, skill-census). All six now use import.meta.path — Bun's absolute native path, identical arity. The remaining #2414 piece — replacing the Windows tasklist probe with signal-0 — lands as its own commit (#1952) on top of this shape. Tests: the 6 touched test files 47 pass; process-liveness-windows + error-handling 13 pass. Re-derived from PR #2414 by @SYKhayyat. Fixes the residual of #2295. Co-authored-by: SYKhayyat <shaulyoelkhayyat@gmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>