mirror of https://github.com/openclaw/openclaw.git
fix(hooks): preserve observers after inbound claim
This commit is contained in:
parent
99759acc98
commit
ad1fedd6ba
|
|
@ -186,6 +186,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, {
|
||||
|
|
@ -195,11 +196,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)
|
||||
|
|
@ -226,6 +223,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…
Reference in New Issue