Fix agent bead prefix mismatch for rigs with custom prefixes (bd-otyh)

When spawning polecats in rigs with custom prefixes (e.g., beads uses bd-
instead of gt-), agent beads were being created with hardcoded gt- prefix,
causing warnings like issue ID gt-beads-polecat-obsidian does not match
configured prefix bd.

Changes:
- polecat/manager.go: agentBeadID() now looks up the rigs configured prefix
  from routes.jsonl via beads.GetPrefixForRig()
- prime.go: getAgentBeadID() now uses prefix lookup for rig-level agents
  (witness, refinery, polecat, crew)

Town-level agents (mayor, deacon) continue to use gt- prefix as expected.
This commit is contained in:
Steve Yegge
2025-12-30 16:56:10 -08:00
parent 8754acff7e
commit 05b1f30381
2 changed files with 24 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ import (
"github.com/steveyegge/gastown/internal/config"
"github.com/steveyegge/gastown/internal/git"
"github.com/steveyegge/gastown/internal/rig"
"github.com/steveyegge/gastown/internal/workspace"
)
// Common errors
@@ -84,9 +85,17 @@ func (m *Manager) assigneeID(name string) string {
}
// agentBeadID returns the agent bead ID for a polecat.
// Format: "gt-<rig>-polecat-<name>" (e.g., "gt-gastown-polecat-Toast")
// Format: "<prefix>-<rig>-polecat-<name>" (e.g., "gt-gastown-polecat-Toast", "bd-beads-polecat-obsidian")
// The prefix is looked up from routes.jsonl to support rigs with custom prefixes.
func (m *Manager) agentBeadID(name string) string {
return beads.PolecatBeadID(m.rig.Name, name)
// Find town root to lookup prefix from routes.jsonl
townRoot, err := workspace.Find(m.rig.Path)
if err != nil || townRoot == "" {
// Fall back to default prefix
return beads.PolecatBeadID(m.rig.Name, name)
}
prefix := beads.GetPrefixForRig(townRoot, m.rig.Name)
return beads.PolecatBeadIDWithPrefix(prefix, m.rig.Name, name)
}
// getCleanupStatusFromBead reads the cleanup_status from the polecat's agent bead.