mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-20 14:30:57 +00:00
Matrix: stop queuing inbound previews
This commit is contained in:
@@ -234,6 +234,30 @@ describe("matrix monitor handler pairing account scope", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("does not enqueue delivered text messages into system events", async () => {
|
||||
const dispatchReplyFromConfig = vi.fn(async () => ({
|
||||
queuedFinal: true,
|
||||
counts: { final: 1, block: 0, tool: 0 },
|
||||
}));
|
||||
const { handler, enqueueSystemEvent } = createMatrixHandlerTestHarness({
|
||||
dispatchReplyFromConfig,
|
||||
isDirectMessage: true,
|
||||
getMemberDisplayName: async () => "sender",
|
||||
});
|
||||
|
||||
await handler(
|
||||
"!room:example.org",
|
||||
createMatrixTextMessageEvent({
|
||||
eventId: "$event-system-preview",
|
||||
body: "hello from matrix",
|
||||
mentions: { room: true },
|
||||
}),
|
||||
);
|
||||
|
||||
expect(dispatchReplyFromConfig).toHaveBeenCalled();
|
||||
expect(enqueueSystemEvent).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("drops forged metadata-only mentions before agent routing", async () => {
|
||||
const { handler, recordInboundSession, resolveAgentRoute } = createMatrixHandlerTestHarness({
|
||||
isDirectMessage: false,
|
||||
|
||||
@@ -758,7 +758,6 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
||||
});
|
||||
}
|
||||
|
||||
let didSendReply = false;
|
||||
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
||||
cfg,
|
||||
channel: "matrix",
|
||||
@@ -811,7 +810,6 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
||||
mediaLocalRoots,
|
||||
tableMode,
|
||||
});
|
||||
didSendReply = true;
|
||||
},
|
||||
onError: (err: unknown, info: { kind: "tool" | "block" | "final" }) => {
|
||||
runtime.error?.(`matrix ${info.kind} reply failed: ${String(err)}`);
|
||||
@@ -834,7 +832,6 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
||||
if (!queuedFinal) {
|
||||
return;
|
||||
}
|
||||
didSendReply = true;
|
||||
const finalCount = counts.final;
|
||||
logVerboseMessage(
|
||||
`matrix: delivered ${finalCount} reply${finalCount === 1 ? "" : "ies"} to ${replyTarget}`,
|
||||
|
||||
Reference in New Issue
Block a user