fix(hooks): preserve observers after inbound claim
This commit is contained in:
parent
eb0e41e6ff
commit
94a0da0c08
@ -193,6 +193,7 @@ export async function dispatchReplyFromConfig(params: {
|
||||
const hookContext = deriveInboundMessageHookContext(ctx, { messageId: messageIdForHook });
|
||||
const { isGroup, groupId } = hookContext;
|
||||
|
||||
let pluginClaimedInbound = false;
|
||||
if (hookRunner?.hasHooks("inbound_claim")) {
|
||||
const inboundClaim = await hookRunner.runInboundClaim(
|
||||
toPluginInboundClaimEvent(hookContext, {
|
||||
@ -202,11 +203,7 @@ export async function dispatchReplyFromConfig(params: {
|
||||
}),
|
||||
toPluginInboundClaimContext(hookContext),
|
||||
);
|
||||
if (inboundClaim?.handled) {
|
||||
markIdle("plugin_claim");
|
||||
recordProcessed("completed", { reason: "plugin-claimed" });
|
||||
return { queuedFinal: false, counts: dispatcher.getQueuedCounts() };
|
||||
}
|
||||
pluginClaimedInbound = inboundClaim?.handled === true;
|
||||
}
|
||||
|
||||
// Trigger plugin hooks (fire-and-forget)
|
||||
@ -233,6 +230,12 @@ export async function dispatchReplyFromConfig(params: {
|
||||
);
|
||||
}
|
||||
|
||||
if (pluginClaimedInbound) {
|
||||
markIdle("plugin_claim");
|
||||
recordProcessed("completed", { reason: "plugin-claimed" });
|
||||
return { queuedFinal: false, counts: dispatcher.getQueuedCounts() };
|
||||
}
|
||||
|
||||
// Check if we should route replies to originating channel instead of dispatcher.
|
||||
// Only route when the originating channel is DIFFERENT from the current surface.
|
||||
// This handles cross-provider routing (e.g., message from Telegram being processed
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user