mom: fix [SILENT] to delete thread messages too

Track all thread message timestamps during a run. When response is
[SILENT], delete all thread messages before deleting the main message.
This prevents the 'This message was deleted' tombstone in Slack.
This commit is contained in:
Mario Zechner 2025-12-12 22:56:56 +01:00
parent 8ba6aa6627
commit f1451fd8f0
3 changed files with 18 additions and 5 deletions

View file

@ -690,11 +690,11 @@ function createRunner(sandboxConfig: SandboxConfig, channelId: string, channelDi
.map((c) => c.text)
.join("\n") || "";
// Check for [SILENT] marker - delete message instead of posting
// Check for [SILENT] marker - delete message and thread instead of posting
if (finalText.trim() === "[SILENT]" || finalText.trim().startsWith("[SILENT]")) {
try {
await ctx.deleteMessage();
log.logInfo("Silent response - deleted status message");
log.logInfo("Silent response - deleted message and thread");
} catch (err) {
const errMsg = err instanceof Error ? err.message : String(err);
log.logWarning("Failed to delete message for silent response", errMsg);