Remove StateIdle and idle polecat concept

The transient polecat model says: "Polecats exist only while working."
This removes the deprecated StateIdle and updates the codebase:

- Remove StateIdle from polecat/types.go (keep StateActive for legacy data)
- Update manager.go: Get() returns StateDone (not StateIdle) when no work
- Update manager.go: Add/Recreate return StateWorking (not StateIdle)
- Remove zombie scan logic from deacon.go (no idle polecats to scan for)
- Update tests to reflect new behavior

The correct lifecycle is now:
- Spawn: polecat created with work (StateWorking)
- Work: sessions cycle, sandbox persists
- Done: polecat signals completion (StateDone)
- Nuke: Witness destroys sandbox

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
prime
2026-01-04 14:36:23 -08:00
committed by Steve Yegge
parent 871410f157
commit af95b7b7f4
4 changed files with 29 additions and 324 deletions

View File

@@ -17,8 +17,7 @@ func TestStateIsActive(t *testing.T) {
{StateWorking, true},
{StateDone, false},
{StateStuck, false},
// Legacy states are treated as active
{StateIdle, true},
// Legacy active state is treated as active
{StateActive, true},
}
@@ -34,7 +33,6 @@ func TestStateIsWorking(t *testing.T) {
state State
working bool
}{
{StateIdle, false},
{StateActive, false},
{StateWorking, true},
{StateDone, false},
@@ -143,8 +141,9 @@ func TestAssigneeID(t *testing.T) {
// Note: State persistence tests removed - state is now derived from beads assignee field.
// Integration tests should verify beads-based state management.
func TestGetReturnsIdleWithoutBeads(t *testing.T) {
// When beads is not available, Get should return StateIdle
func TestGetReturnsWorkingWithoutBeads(t *testing.T) {
// When beads is not available, Get should return StateWorking
// (assume the polecat is doing something if it exists)
root := t.TempDir()
polecatDir := filepath.Join(root, "polecats", "Test")
if err := os.MkdirAll(polecatDir, 0755); err != nil {
@@ -163,7 +162,7 @@ func TestGetReturnsIdleWithoutBeads(t *testing.T) {
}
m := NewManager(r, git.NewGit(root))
// Get should return polecat with StateIdle (no beads = no assignment)
// Get should return polecat with StateWorking (assume active if beads unavailable)
polecat, err := m.Get("Test")
if err != nil {
t.Fatalf("Get: %v", err)
@@ -172,8 +171,8 @@ func TestGetReturnsIdleWithoutBeads(t *testing.T) {
if polecat.Name != "Test" {
t.Errorf("Name = %q, want Test", polecat.Name)
}
if polecat.State != StateIdle {
t.Errorf("State = %v, want StateIdle (beads not available)", polecat.State)
if polecat.State != StateWorking {
t.Errorf("State = %v, want StateWorking (beads not available)", polecat.State)
}
}