fix(hook): Use consistent 3-part polecat identity format (gt-6zzvi)

buildAgentIdentity was returning 2-part format (rig/name) while
sling.go sets assignee using 3-part format (rig/polecats/name) from
session.AgentIdentity.Address(). This mismatch caused gt hook to
fail when querying for hooked beads by assignee.

Changes:
- buildAgentIdentity: Return rig/polecats/name for polecats
- buildAgentBeadID: Handle both 2-part and 3-part formats

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
angharad
2026-01-02 01:25:14 -08:00
committed by Steve Yegge
parent c7e5bc08c4
commit 87d79c40ee

View File

@@ -71,6 +71,10 @@ func buildAgentBeadID(identity string, role Role) string {
}
return ""
case RolePolecat:
// Handle both 2-part (rig/name) and 3-part (rig/polecats/name) formats
if len(parts) == 3 && parts[1] == "polecats" {
return beads.PolecatBeadID(parts[0], parts[2])
}
if len(parts) >= 2 {
return beads.PolecatBeadID(parts[0], parts[1])
}
@@ -423,6 +427,7 @@ func runMoleculeStatus(cmd *cobra.Command, args []string) error {
}
// buildAgentIdentity constructs the agent identity string from role context.
// Format matches session.AgentIdentity.Address() for consistency.
func buildAgentIdentity(ctx RoleContext) string {
switch ctx.Role {
case RoleMayor:
@@ -434,7 +439,7 @@ func buildAgentIdentity(ctx RoleContext) string {
case RoleRefinery:
return ctx.Rig + "/refinery"
case RolePolecat:
return ctx.Rig + "/" + ctx.Polecat
return ctx.Rig + "/polecats/" + ctx.Polecat
case RoleCrew:
return ctx.Rig + "/crew/" + ctx.Polecat
default: