fix: remove vestigial state.json files from agent directories

Agent directories (witness/, refinery/, mayor/) contained state.json files
with last_active timestamps that were never updated, making them stale and
misleading. This change removes:

- initAgentStates function that created vestigial state.json files
- AgentState type and related Load/Save functions from config package
- MayorStateValidCheck from doctor checks
- requesting_* lifecycle verification (dead code - flags were never set)
- FileStateJSON constant and MayorStatePath function

Kept intact:
- daemon/state.json (actively used for daemon runtime state)
- crew/<name>/state.json (operational CrewWorker metadata)
- Agent state tracking via beads (the ZFC-compliant approach)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
splendid
2026-01-03 21:20:11 -08:00
committed by Steve Yegge
parent 60ecf1ff76
commit acd2565a5b
13 changed files with 23 additions and 576 deletions

View File

@@ -80,36 +80,6 @@ func TestRigsConfigRoundTrip(t *testing.T) {
}
}
func TestAgentStateRoundTrip(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "state.json")
original := &AgentState{
Role: "mayor",
LastActive: time.Now().Truncate(time.Second),
Session: "abc123",
Extra: map[string]any{
"custom": "value",
},
}
if err := SaveAgentState(path, original); err != nil {
t.Fatalf("SaveAgentState: %v", err)
}
loaded, err := LoadAgentState(path)
if err != nil {
t.Fatalf("LoadAgentState: %v", err)
}
if loaded.Role != original.Role {
t.Errorf("Role = %q, want %q", loaded.Role, original.Role)
}
if loaded.Session != original.Session {
t.Errorf("Session = %q, want %q", loaded.Session, original.Session)
}
}
func TestLoadTownConfigNotFound(t *testing.T) {
_, err := LoadTownConfig("/nonexistent/path.json")
if err == nil {
@@ -129,12 +99,6 @@ func TestValidationErrors(t *testing.T) {
if err := validateTownConfig(tc); err == nil {
t.Error("expected error for wrong type")
}
// Missing role
as := &AgentState{}
if err := validateAgentState(as); err == nil {
t.Error("expected error for missing role")
}
}
func TestRigConfigRoundTrip(t *testing.T) {