Use rig prefix for agent bead IDs instead of hardcoded gt- (gt-w0fqg)

The getCleanupStatus function in witness/handlers.go and crew removal
in cmd/crew_lifecycle.go were constructing agent bead IDs with hardcoded
"gt-" prefix. This failed for rigs that use a different prefix like "bd-".

Now uses beads.GetPrefixForRig to look up the correct prefix from
routes.jsonl, enabling support for the beads rig and any future rigs
with custom prefixes.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/polecats/furiosa
2025-12-30 23:05:55 -08:00
committed by Steve Yegge
parent 1cbe638e4f
commit 0da29050dd
2 changed files with 19 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ import (
"strings"
"time"
"github.com/steveyegge/gastown/internal/beads"
"github.com/steveyegge/gastown/internal/git"
"github.com/steveyegge/gastown/internal/mail"
"github.com/steveyegge/gastown/internal/workspace"
@@ -386,8 +387,15 @@ type agentBeadResponse struct {
// ZFC #10: This enables the Witness to verify it's safe to nuke before proceeding.
// The polecat self-reports its git state when running `gt done`, and we trust that report.
func getCleanupStatus(workDir, rigName, polecatName string) string {
// Construct agent bead ID: gt-<rigName>-polecat-<polecatName>
agentBeadID := fmt.Sprintf("gt-%s-polecat-%s", rigName, polecatName)
// Construct agent bead ID using the rig's configured prefix
// This supports non-gt prefixes like "bd-" for the beads rig
townRoot, err := workspace.Find(workDir)
if err != nil || townRoot == "" {
// Fall back to default prefix
townRoot = workDir
}
prefix := beads.GetPrefixForRig(townRoot, rigName)
agentBeadID := beads.PolecatBeadIDWithPrefix(prefix, rigName, polecatName)
cmd := exec.Command("bd", "show", agentBeadID, "--json")
cmd.Dir = workDir