Update pkg/channels/weixin/weixin.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Hua Audio 2026-03-22 06:09:59 +01:00 committed by GitHub
parent 7be39689f2
commit 7b65f1ca7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -286,6 +286,14 @@ func (c *WeixinChannel) Send(ctx context.Context, msg bus.OutboundMessage) error
contextToken, _ = ct.(string)
}
// If we don't have a context token for this user, we cannot send a valid reply.
// Treat this as a non-temporary error so the manager doesn't keep retrying.
if contextToken == "" {
logger.ErrorCF("weixin", "Missing context token, cannot send message", map[string]any{
"to_user_id": toUserID,
})
return fmt.Errorf("weixin send: missing context token for chat %s", toUserID)
}
clientID := "picoclaw-" + uuid.New().String()
req := SendMessageReq{