fix(zfc): remove PID-based agent liveness detection

Replace ProcessExists() checks in witness and refinery managers with
tmux session detection. Agent liveness should be derived from tmux
session state, not PID probing (per ZFC tracking principles).

- Remove util.ProcessExists() from witness/manager.go and refinery/manager.go
- Delete internal/util/process.go and process_test.go (now unused)
- Foreground mode and Stop() now rely solely on tmux HasSession/KillSession

Closes: hq-yxkdr (recentDeaths already removed)
Closes: hq-1sd4o (ProcessExists removed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
dennis
2026-01-09 22:02:34 -08:00
committed by Steve Yegge
parent 593185873d
commit 0f633be4b1
4 changed files with 12 additions and 78 deletions

View File

@@ -1,24 +0,0 @@
// Package util provides utility functions for Gas Town.
// This file was created as part of an E2E polecat workflow test.
package util
import (
"os"
"syscall"
)
// ProcessExists checks if a process with the given PID exists.
// It sends signal 0 to the process, which doesn't actually send a signal
// but does perform error checking to see if the process exists.
func ProcessExists(pid int) bool {
if pid <= 0 {
return false
}
process, err := os.FindProcess(pid)
if err != nil {
return false
}
// Signal 0 checks if process exists without sending a real signal
err = process.Signal(syscall.Signal(0))
return err == nil
}

View File

@@ -1,25 +0,0 @@
package util
import (
"testing"
)
func TestProcessExistsNonExistent(t *testing.T) {
// Using a very high PID that's unlikely to exist
pid := 999999999
if ProcessExists(pid) {
t.Errorf("ProcessExists(%d) = true, want false for non-existent process", pid)
}
}
func TestProcessExistsNegativePID(t *testing.T) {
// Negative PIDs are invalid and should return false or may cause errors
// depending on the platform, so just test that it doesn't panic
_ = ProcessExists(-1)
}
func TestProcessExistsZero(t *testing.T) {
// PID 0 is special (kernel process on Unix)
// Test that we can call it without panicking
_ = ProcessExists(0)
}