refactor(gastown): combine router.go patches into single file
All checks were successful
CI / check (push) Successful in 3m41s

Merge three separate patches that all modify internal/mail/router.go
into one combined patch to avoid patch ordering conflicts.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 12:47:52 -08:00
parent 56097aefa4
commit 6394d69478
4 changed files with 24 additions and 37 deletions

View File

@@ -43,12 +43,8 @@ let
# Bug fixes not yet merged upstream
# Each patch is stored in a separate file for clarity and maintainability
patches = [
# Fix validateRecipient bug: normalize addresses before comparison
./gastown-fix-validate-recipient.patch
# Fix agentBeadToAddress to use title field for hq- prefixed beads
./gastown-fix-agent-bead-address-title.patch
# Fix agentBeadToAddress to handle rig-specific prefixes (j-, sc-, etc.)
./gastown-fix-agent-bead-rig-prefix.patch
# Combined mail router fixes: validateRecipient normalization, title field for hq- beads, rig prefixes
./gastown-mail-router-fixes.patch
# Fix crew/polecat home paths: remove incorrect /rig suffix
./gastown-fix-role-home-paths.patch
# Fix town root detection: don't map to Mayor (causes spurious mismatch warnings)

View File

@@ -1,16 +0,0 @@
diff --git a/internal/mail/router.go b/internal/mail/router.go
index 0000000..1111111 100644
--- a/internal/mail/router.go
+++ b/internal/mail/router.go
@@ -326,7 +326,11 @@ func agentBeadToAddress(bead *agentBead) string {
}
// Fall back to parsing description for role_type and rig
- return parseAgentAddressFromDescription(bead.Description)
+ if bead.Title != "" && strings.Contains(bead.Title, "/") {
+ return bead.Title
+ }
+ return parseAgentAddressFromDescription(bead.Description)
}
// Handle gt- prefixed IDs (legacy format)

View File

@@ -1,13 +0,0 @@
diff --git a/internal/mail/router.go b/internal/mail/router.go
index b864c069..4b6a045b 100644
--- a/internal/mail/router.go
+++ b/internal/mail/router.go
@@ -646,7 +646,7 @@ func (r *Router) validateRecipient(identity string) error {
}
for _, agent := range agents {
- if agentBeadToAddress(agent) == identity {
+ if AddressToIdentity(agentBeadToAddress(agent)) == AddressToIdentity(identity) {
return nil // Found matching agent
}
}

View File

@@ -1,8 +1,19 @@
diff --git a/internal/mail/router.go b/internal/mail/router.go
index 0000000..1111111 100644
--- a/internal/mail/router.go
+++ b/internal/mail/router.go
@@ -330,8 +330,28 @@ func agentBeadToAddress(bead *agentBead) string {
@@ -326,7 +326,11 @@ func agentBeadToAddress(bead *agentBead) string {
}
// Fall back to parsing description for role_type and rig
- return parseAgentAddressFromDescription(bead.Description)
+ if bead.Title != "" && strings.Contains(bead.Title, "/") {
+ return bead.Title
+ }
+ return parseAgentAddressFromDescription(bead.Description)
}
// Handle gt- prefixed IDs (legacy format)
@@ -330,8 +334,28 @@ func agentBeadToAddress(bead *agentBead) string {
}
// Handle gt- prefixed IDs (legacy format)
@@ -34,3 +45,12 @@ index 0000000..1111111 100644
}
// Strip prefix
@@ -646,7 +670,7 @@ func (r *Router) validateRecipient(identity string) error {
}
for _, agent := range agents {
- if agentBeadToAddress(agent) == identity {
+ if AddressToIdentity(agentBeadToAddress(agent)) == AddressToIdentity(identity) {
return nil // Found matching agent
}
}