fix: scope history injection to pending-only

This commit is contained in:
Peter Steinberger
2026-01-16 23:52:14 +00:00
parent 56ed5cc2d9
commit e31251293b
21 changed files with 278 additions and 175 deletions

View File

@@ -77,17 +77,15 @@ export async function maybeBroadcastMessage(params: {
}
};
let didSendReply = false;
if (strategy === "sequential") {
for (const agentId of broadcastAgents) {
if (await processForAgent(agentId)) didSendReply = true;
await processForAgent(agentId);
}
} else {
const results = await Promise.allSettled(broadcastAgents.map(processForAgent));
didSendReply = results.some((result) => result.status === "fulfilled" && result.value);
await Promise.allSettled(broadcastAgents.map(processForAgent));
}
if (params.msg.chatType === "group" && didSendReply) {
if (params.msg.chatType === "group") {
params.groupHistories.set(params.groupHistoryKey, []);
}