mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-08 06:54:24 +00:00
fix(subagents): restore isInternalMessageChannel guard in resolveAnnounceOrigin
Restores the narrower internal-channel guard from PR #22223 (fe57bea08) that was inadvertently reverted byf555835b0. The original !isDeliverableMessageChannel() check strips the requester's channel whenever it is not in the registered deliverable set. This causes delivery failures for plugin channels whose adapter ID differs from their plugin ID (e.g. "gmail" vs "openclaw-gmail"): the requester origin is discarded and the announce falls back to stale session routes — typically WhatsApp — resulting in a timeout followed by an E.164 format error. Replacing with isInternalMessageChannel() limits stripping to explicitly internal channels (webchat), preserving the requester origin for all external channels regardless of whether they are currently in the deliverable list. Fixes: #22223 regression introduced inf555835b0Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ import {
|
||||
mergeDeliveryContext,
|
||||
normalizeDeliveryContext,
|
||||
} from "../utils/delivery-context.js";
|
||||
import { isDeliverableMessageChannel } from "../utils/message-channel.js";
|
||||
import { isDeliverableMessageChannel, isInternalMessageChannel } from "../utils/message-channel.js";
|
||||
import {
|
||||
buildAnnounceIdFromChildRun,
|
||||
buildAnnounceIdempotencyKey,
|
||||
@@ -350,9 +350,12 @@ function resolveAnnounceOrigin(
|
||||
): DeliveryContext | undefined {
|
||||
const normalizedRequester = normalizeDeliveryContext(requesterOrigin);
|
||||
const normalizedEntry = deliveryContextFromSession(entry);
|
||||
if (normalizedRequester?.channel && !isDeliverableMessageChannel(normalizedRequester.channel)) {
|
||||
// Ignore internal/non-deliverable channel hints (for example webchat)
|
||||
// so a valid persisted route can still be used for outbound delivery.
|
||||
if (normalizedRequester?.channel && isInternalMessageChannel(normalizedRequester.channel)) {
|
||||
// Ignore internal channel hints (webchat) so a valid persisted route
|
||||
// can still be used for outbound delivery. Non-standard channels that
|
||||
// are not in the deliverable list should NOT be stripped here — doing
|
||||
// so causes the session entry's stale lastChannel (often WhatsApp) to
|
||||
// override the actual requester origin, leading to delivery failures.
|
||||
return mergeDeliveryContext(
|
||||
{
|
||||
accountId: normalizedRequester.accountId,
|
||||
|
||||
Reference in New Issue
Block a user