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:
committed by
Steve Yegge
parent
1cbe638e4f
commit
0da29050dd
@@ -9,12 +9,14 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/gastown/internal/beads"
|
||||
"github.com/steveyegge/gastown/internal/constants"
|
||||
"github.com/steveyegge/gastown/internal/crew"
|
||||
"github.com/steveyegge/gastown/internal/mail"
|
||||
"github.com/steveyegge/gastown/internal/session"
|
||||
"github.com/steveyegge/gastown/internal/style"
|
||||
"github.com/steveyegge/gastown/internal/tmux"
|
||||
"github.com/steveyegge/gastown/internal/workspace"
|
||||
)
|
||||
|
||||
func runCrewRemove(cmd *cobra.Command, args []string) error {
|
||||
@@ -80,8 +82,13 @@ func runCrewRemove(cmd *cobra.Command, args []string) error {
|
||||
style.Bold.Render("✓"), r.Name, name)
|
||||
|
||||
// Close the agent bead if it exists
|
||||
// Format: gt-<rig>-crew-<name> (matches session name format)
|
||||
agentBeadID := fmt.Sprintf("gt-%s-crew-%s", r.Name, name)
|
||||
// Use the rig's configured prefix (e.g., "gt" for gastown, "bd" for beads)
|
||||
townRoot, _ := workspace.Find(r.Path)
|
||||
if townRoot == "" {
|
||||
townRoot = r.Path
|
||||
}
|
||||
prefix := beads.GetPrefixForRig(townRoot, r.Name)
|
||||
agentBeadID := beads.CrewBeadIDWithPrefix(prefix, r.Name, name)
|
||||
closeCmd := exec.Command("bd", "close", agentBeadID, "--reason=Crew workspace removed")
|
||||
closeCmd.Dir = r.Path // Run from rig directory for proper beads resolution
|
||||
if output, err := closeCmd.CombinedOutput(); err != nil {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user