fix: harden message aborts + bluebubbles dm create (#1751) (thanks @tyler6204)

This commit is contained in:
Peter Steinberger
2026-01-25 10:19:56 +00:00
parent 6cc1f5abb8
commit 98cecc9c56
5 changed files with 98 additions and 2 deletions

View File

@@ -526,6 +526,7 @@ async function handleBroadcastAction(
input: RunMessageActionParams,
params: Record<string, unknown>,
): Promise<MessageActionRunResult> {
throwIfAborted(input.abortSignal);
const broadcastEnabled = input.cfg.tools?.message?.broadcast?.enabled !== false;
if (!broadcastEnabled) {
throw new Error("Broadcast is disabled. Set tools.message.broadcast.enabled to true.");
@@ -550,8 +551,11 @@ async function handleBroadcastAction(
error?: string;
result?: MessageSendResult;
}> = [];
const isAbortError = (err: unknown): boolean => err instanceof Error && err.name === "AbortError";
for (const targetChannel of targetChannels) {
throwIfAborted(input.abortSignal);
for (const target of rawTargets) {
throwIfAborted(input.abortSignal);
try {
const resolved = await resolveChannelTarget({
cfg: input.cfg,
@@ -575,6 +579,7 @@ async function handleBroadcastAction(
result: sendResult.kind === "send" ? sendResult.sendResult : undefined,
});
} catch (err) {
if (isAbortError(err)) throw err;
results.push({
channel: targetChannel,
to: target,