fix(handoff): normalize identity in sendHandoffMail (#780)

The handoff mail bead was created with un-normalized assignee
(e.g., gastown/crew/holden) but mailbox queries use normalized identity
(gastown/holden), causing self-mail to be invisible to the inbox.

Export addressToIdentity as AddressToIdentity and call it in
sendHandoffMail() to normalize the agent identity before storing,
matching the normalization performed in Router.sendToSingle().

Fix handoff mail delivery (hq-snp8)
This commit is contained in:
aleiby
2026-01-20 14:09:54 -08:00
committed by GitHub
parent 2fe23b7be5
commit 08cee416a4
5 changed files with 15 additions and 11 deletions

View File

@@ -569,7 +569,7 @@ func (r *Router) sendToGroup(msg *Message) error {
// sendToSingle sends a message to a single recipient.
func (r *Router) sendToSingle(msg *Message) error {
// Convert addresses to beads identities
toIdentity := addressToIdentity(msg.To)
toIdentity := AddressToIdentity(msg.To)
// Build labels for from/thread/reply-to/cc
var labels []string
@@ -582,7 +582,7 @@ func (r *Router) sendToSingle(msg *Message) error {
}
// Add CC labels (one per recipient)
for _, cc := range msg.CC {
ccIdentity := addressToIdentity(cc)
ccIdentity := AddressToIdentity(cc)
labels = append(labels, "cc:"+ccIdentity)
}
@@ -692,7 +692,7 @@ func (r *Router) sendToQueue(msg *Message) error {
labels = append(labels, "reply-to:"+msg.ReplyTo)
}
for _, cc := range msg.CC {
ccIdentity := addressToIdentity(cc)
ccIdentity := AddressToIdentity(cc)
labels = append(labels, "cc:"+ccIdentity)
}
@@ -763,7 +763,7 @@ func (r *Router) sendToAnnounce(msg *Message) error {
labels = append(labels, "reply-to:"+msg.ReplyTo)
}
for _, cc := range msg.CC {
ccIdentity := addressToIdentity(cc)
ccIdentity := AddressToIdentity(cc)
labels = append(labels, "cc:"+ccIdentity)
}
@@ -836,7 +836,7 @@ func (r *Router) sendToChannel(msg *Message) error {
labels = append(labels, "reply-to:"+msg.ReplyTo)
}
for _, cc := range msg.CC {
ccIdentity := addressToIdentity(cc)
ccIdentity := AddressToIdentity(cc)
labels = append(labels, "cc:"+ccIdentity)
}