fix: ZFC improvements - query tmux directly instead of marker TTL
Two ZFC fixes: 1. Boot marker file (hq-zee5n): Changed IsRunning() to query tmux.HasSession() directly instead of checking marker file freshness with TTL. Removed stale marker check from doctor. 2. Branch pattern matching (hq-zwuh6): Replaced hardcoded "polecat/" strings with constants.BranchPolecatPrefix for consistency. Also removed 60-second WaitForCommand blocking from crew Start() which was causing gt crew start to hang. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
e0858096f6
commit
c94d59dca7
@@ -23,15 +23,12 @@ import (
|
||||
// to return true when only Boot is running.
|
||||
const SessionName = "gt-boot"
|
||||
|
||||
// MarkerFileName is the file that indicates Boot is currently running.
|
||||
// MarkerFileName is the lock file for Boot startup coordination.
|
||||
const MarkerFileName = ".boot-running"
|
||||
|
||||
// StatusFileName stores Boot's last execution status.
|
||||
const StatusFileName = ".boot-status.json"
|
||||
|
||||
// DefaultMarkerTTL is how long a marker is considered valid before it's stale.
|
||||
const DefaultMarkerTTL = 5 * time.Minute
|
||||
|
||||
// Status represents Boot's execution status.
|
||||
type Status struct {
|
||||
Running bool `json:"running"`
|
||||
@@ -78,22 +75,9 @@ func (b *Boot) statusPath() string {
|
||||
}
|
||||
|
||||
// IsRunning checks if Boot is currently running.
|
||||
// Returns true if marker exists and isn't stale, false otherwise.
|
||||
// Queries tmux directly for observable reality (ZFC principle).
|
||||
func (b *Boot) IsRunning() bool {
|
||||
info, err := os.Stat(b.markerPath())
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// Check if marker is stale (older than TTL)
|
||||
age := time.Since(info.ModTime())
|
||||
if age > DefaultMarkerTTL {
|
||||
// Stale marker - clean it up
|
||||
_ = os.Remove(b.markerPath())
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
return b.IsSessionAlive()
|
||||
}
|
||||
|
||||
// IsSessionAlive checks if the Boot tmux session exists.
|
||||
@@ -106,7 +90,7 @@ func (b *Boot) IsSessionAlive() bool {
|
||||
// Returns error if Boot is already running.
|
||||
func (b *Boot) AcquireLock() error {
|
||||
if b.IsRunning() {
|
||||
return fmt.Errorf("boot is already running (marker exists)")
|
||||
return fmt.Errorf("boot is already running (session exists)")
|
||||
}
|
||||
|
||||
if err := b.EnsureDir(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user