fix: use rig prefixes for agent bead IDs
Align rig-scoped agent beads with route prefixes so crew add/prime/status resolve the same IDs across rigs. Add tests that assert rig-prefixed agent IDs in prime and status. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1195,9 +1195,7 @@ func getAgentFields(ctx RoleContext, state string) *beads.AgentFields {
|
||||
}
|
||||
|
||||
// getAgentBeadID returns the agent bead ID for the current role.
|
||||
// Uses canonical naming: gt-rig-role-name
|
||||
// Agent beads always use "gt-" prefix (required by beads validation).
|
||||
// Only issue beads use rig-specific prefixes.
|
||||
// Rig-scoped agents use the rig's configured prefix; town agents remain gt-.
|
||||
// Returns empty string for unknown roles.
|
||||
func getAgentBeadID(ctx RoleContext) string {
|
||||
switch ctx.Role {
|
||||
@@ -1207,22 +1205,26 @@ func getAgentBeadID(ctx RoleContext) string {
|
||||
return beads.DeaconBeadID()
|
||||
case RoleWitness:
|
||||
if ctx.Rig != "" {
|
||||
return beads.WitnessBeadID(ctx.Rig)
|
||||
prefix := beads.GetPrefixForRig(ctx.TownRoot, ctx.Rig)
|
||||
return beads.WitnessBeadIDWithPrefix(prefix, ctx.Rig)
|
||||
}
|
||||
return ""
|
||||
case RoleRefinery:
|
||||
if ctx.Rig != "" {
|
||||
return beads.RefineryBeadID(ctx.Rig)
|
||||
prefix := beads.GetPrefixForRig(ctx.TownRoot, ctx.Rig)
|
||||
return beads.RefineryBeadIDWithPrefix(prefix, ctx.Rig)
|
||||
}
|
||||
return ""
|
||||
case RolePolecat:
|
||||
if ctx.Rig != "" && ctx.Polecat != "" {
|
||||
return beads.PolecatBeadID(ctx.Rig, ctx.Polecat)
|
||||
prefix := beads.GetPrefixForRig(ctx.TownRoot, ctx.Rig)
|
||||
return beads.PolecatBeadIDWithPrefix(prefix, ctx.Rig, ctx.Polecat)
|
||||
}
|
||||
return ""
|
||||
case RoleCrew:
|
||||
if ctx.Rig != "" && ctx.Polecat != "" {
|
||||
return beads.CrewBeadID(ctx.Rig, ctx.Polecat)
|
||||
prefix := beads.GetPrefixForRig(ctx.TownRoot, ctx.Rig)
|
||||
return beads.CrewBeadIDWithPrefix(prefix, ctx.Rig, ctx.Polecat)
|
||||
}
|
||||
return ""
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user