fix(rig): check witness/state.json instead of witness/rig (gm-2ej)

Witnesses don't have git clones like other agents. The detection was
checking for witness/rig which doesn't exist. Now correctly checks for
witness/state.json which is created by AddRig.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 20:23:18 -08:00
parent 3e77fadb49
commit 52194a5496
3 changed files with 11 additions and 4 deletions

View File

@@ -128,9 +128,9 @@ func (m *Manager) loadRig(name string, entry config.RigEntry) (*Rig, error) {
} }
} }
// Check for witness // Check for witness (witnesses don't have clones, just state.json)
witnessPath := filepath.Join(rigPath, "witness", "rig") witnessStatePath := filepath.Join(rigPath, "witness", "state.json")
if _, err := os.Stat(witnessPath); err == nil { if _, err := os.Stat(witnessStatePath); err == nil {
rig.HasWitness = true rig.HasWitness = true
} }

View File

@@ -37,6 +37,12 @@ func createTestRig(t *testing.T, root, name string) {
} }
} }
// Create witness state.json (witnesses don't have clones, just state)
witnessState := filepath.Join(rigPath, "witness", "state.json")
if err := os.WriteFile(witnessState, []byte(`{"role":"witness"}`), 0644); err != nil {
t.Fatalf("write witness state: %v", err)
}
// Create some polecats // Create some polecats
polecatsDir := filepath.Join(rigPath, "polecats") polecatsDir := filepath.Join(rigPath, "polecats")
for _, polecat := range []string{"Toast", "Cheedo"} { for _, polecat := range []string{"Toast", "Cheedo"} {

View File

@@ -37,11 +37,12 @@ type Rig struct {
} }
// AgentDirs are the standard agent directories in a rig. // AgentDirs are the standard agent directories in a rig.
// Note: witness doesn't have a /rig subdirectory (no clone needed).
var AgentDirs = []string{ var AgentDirs = []string{
"polecats", "polecats",
"crew", "crew",
"refinery/rig", "refinery/rig",
"witness/rig", "witness",
"mayor/rig", "mayor/rig",
} }