fix(hook): normalize agent ID trailing slash in agentIDToBeadID (gt-az3jjb)

resolveSelfTarget returns "mayor/" with trailing slash per addressToIdentity
normalization, but agentIDToBeadID only checked for "mayor" without slash.

This caused `gt hook --clear` to fail with:
  Error: could not convert agent ID mayor/ to bead ID

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
mayor
2026-01-21 19:49:01 -08:00
committed by Steve Yegge
parent 2119841d57
commit c42b5db7ab

View File

@@ -345,6 +345,9 @@ func detectActor() string {
// Rig-level agents use the rig's configured prefix (default "gt-").
// townRoot is needed to look up the rig's configured prefix.
func agentIDToBeadID(agentID, townRoot string) string {
// Normalize: strip trailing slash (resolveSelfTarget returns "mayor/" not "mayor")
agentID = strings.TrimSuffix(agentID, "/")
// Handle simple cases (town-level agents with hq- prefix)
if agentID == "mayor" {
return beads.MayorBeadIDTown()