fix: scope messaging tool final reply dedupe

Co-authored-by: HCL <chenglunhu@gmail.com>
This commit is contained in:
Peter Steinberger
2026-05-04 01:35:14 +01:00
parent 5d09b4b92c
commit eb66def656
20 changed files with 502 additions and 84 deletions

View File

@@ -179,6 +179,8 @@ describe("createCodexDynamicToolBridge", () => {
provider: "telegram",
to: "chat-1",
threadId: "thread-ts-1",
text: "hello from Codex",
mediaUrls: ["/tmp/reply.png"],
},
],
});

View File

@@ -231,13 +231,16 @@ function collectToolTelemetry(params: {
if (text) {
params.telemetry.messagingToolSentTexts.push(text);
}
params.telemetry.messagingToolSentMediaUrls.push(...collectMediaUrls(params.args));
const mediaUrls = collectMediaUrls(params.args);
params.telemetry.messagingToolSentMediaUrls.push(...mediaUrls);
params.telemetry.messagingToolSentTargets.push({
tool: params.toolName,
provider: readFirstString(params.args, ["provider", "channel"]) ?? params.toolName,
accountId: readFirstString(params.args, ["accountId", "account_id"]),
to: readFirstString(params.args, ["to", "target", "recipient"]),
threadId: readFirstString(params.args, ["threadId", "thread_id", "messageThreadId"]),
...(text ? { text } : {}),
...(mediaUrls.length > 0 ? { mediaUrls } : {}),
});
}

View File

@@ -308,6 +308,8 @@ describe("OpenClaw-owned tool runtime contract — Codex app-server adapter", ()
provider: "telegram",
to: "chat-1",
threadId: "thread-ts-1",
text: "hello from Codex",
mediaUrls: ["/tmp/codex-reply.png"],
},
],
});