Fix gastown mail routing for rig-specific agent beads
All checks were successful
CI / check (push) Successful in 3m18s

- Add title-based lookup for hq- prefixed beads (uses title as address if contains "/")
- Add rig-specific prefix handling to parse IDs like j-java-crew-americano → java/crew/americano
- Handles crew, polecat, witness, refinery role patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-28 17:20:03 -08:00
committed by John Ogle
parent 7df68ba8c8
commit 94fb5a3e64

View File

@@ -41,11 +41,45 @@ let
'if AddressToIdentity(agentBeadToAddress(agent)) == AddressToIdentity(identity) {'
# Fix agentBeadToAddress to use title field for hq- prefixed beads
# Title should contain the address (e.g., "java/crew/americano")
substituteInPlace internal/mail/router.go \
--replace-fail \
'return parseAgentAddressFromDescription(bead.Description)' \
'if bead.Title != "" && strings.Contains(bead.Title, "/") { return bead.Title }; return parseAgentAddressFromDescription(bead.Description)'
# Fix agentBeadToAddress to handle rig-specific prefixes (j-, sc-, etc.)
# Bead IDs like j-java-crew-americano should map to java/crew/americano
substituteInPlace internal/mail/router.go \
--replace-fail \
'// Handle gt- prefixed IDs (legacy format)
if !strings.HasPrefix(id, "gt-") {
return "" // Not a valid agent bead ID
}' \
'// Handle rig-specific prefixes: <prefix>-<rig>-<role>-<name>
// Examples: j-java-crew-americano -> java/crew/americano
idParts := strings.Split(id, "-")
if len(idParts) >= 3 {
for i, part := range idParts {
if part == "crew" || part == "polecat" || part == "polecats" {
if i >= 1 && i < len(idParts)-1 {
rig := idParts[i-1]
name := strings.Join(idParts[i+1:], "-")
return rig + "/" + part + "/" + name
}
}
if part == "witness" || part == "refinery" {
if i >= 1 {
return idParts[i-1] + "/" + part
}
}
}
}
// Handle gt- prefixed IDs (legacy format)
if !strings.HasPrefix(id, "gt-") {
return "" // Not a valid agent bead ID
}'
# Fix crew/polecat home paths: remove incorrect /rig suffix
substituteInPlace internal/cmd/role.go \
--replace-fail \