feat: implement ephemeral polecat model
This implements the ephemeral polecat model where polecats are spawned fresh for each task and deleted upon completion. Key changes: **Spawn (internal/cmd/spawn.go):** - Always create fresh worktree from main branch - Run bd init in new worktree to initialize beads - Remove --create flag (now implicit) - Replace stale polecats with fresh worktrees **Handoff (internal/cmd/handoff.go):** - Add rig/polecat detection from environment and tmux session - Send shutdown requests to correct witness (rig/witness) - Include polecat name in lifecycle request body **Witness (internal/witness/manager.go):** - Add mail checking in monitoring loop - Process LIFECYCLE shutdown requests - Implement full cleanup sequence: - Kill tmux session - Remove git worktree - Delete polecat branch **Polecat state machine (internal/polecat/types.go):** - Primary states: working, done, stuck - Deprecate idle/active (kept for backward compatibility) - New polecats start in working state - ClearIssue transitions to done (not idle) **Polecat commands (internal/cmd/polecat.go):** - Update list to show "Active Polecats" - Normalize legacy states for display - Add deprecation warnings to wake/sleep commands Closes gt-7ik 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,21 +9,22 @@ import (
|
||||
"github.com/steveyegge/gastown/internal/rig"
|
||||
)
|
||||
|
||||
func TestStateIsAvailable(t *testing.T) {
|
||||
func TestStateIsActive(t *testing.T) {
|
||||
tests := []struct {
|
||||
state State
|
||||
available bool
|
||||
state State
|
||||
active bool
|
||||
}{
|
||||
{StateIdle, true},
|
||||
{StateActive, true},
|
||||
{StateWorking, false},
|
||||
{StateWorking, true},
|
||||
{StateDone, false},
|
||||
{StateStuck, false},
|
||||
// Legacy states are treated as active
|
||||
{StateIdle, true},
|
||||
{StateActive, true},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
if got := tt.state.IsAvailable(); got != tt.available {
|
||||
t.Errorf("%s.IsAvailable() = %v, want %v", tt.state, got, tt.available)
|
||||
if got := tt.state.IsActive(); got != tt.active {
|
||||
t.Errorf("%s.IsActive() = %v, want %v", tt.state, got, tt.active)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,7 +300,7 @@ func TestClearIssue(t *testing.T) {
|
||||
t.Fatalf("ClearIssue: %v", err)
|
||||
}
|
||||
|
||||
// Verify
|
||||
// Verify - in ephemeral model, ClearIssue transitions to Done
|
||||
polecat, err := m.Get("Test")
|
||||
if err != nil {
|
||||
t.Fatalf("Get: %v", err)
|
||||
@@ -307,7 +308,7 @@ func TestClearIssue(t *testing.T) {
|
||||
if polecat.Issue != "" {
|
||||
t.Errorf("Issue = %q, want empty", polecat.Issue)
|
||||
}
|
||||
if polecat.State != StateIdle {
|
||||
t.Errorf("State = %v, want StateIdle", polecat.State)
|
||||
if polecat.State != StateDone {
|
||||
t.Errorf("State = %v, want StateDone", polecat.State)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user