From a5e7f82a696c0072cb73724ae906b8b1355569d1 Mon Sep 17 00:00:00 2001 From: matevip Date: Sun, 3 May 2026 17:15:25 +0800 Subject: [PATCH] fix(cron): self-heal missing tasks_ conversation row before saving messages --- .../vip/mate/cron/service/CronJobLifecycleService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mateclaw-server/src/main/java/vip/mate/cron/service/CronJobLifecycleService.java b/mateclaw-server/src/main/java/vip/mate/cron/service/CronJobLifecycleService.java index a9ccba69..d15378e9 100644 --- a/mateclaw-server/src/main/java/vip/mate/cron/service/CronJobLifecycleService.java +++ b/mateclaw-server/src/main/java/vip/mate/cron/service/CronJobLifecycleService.java @@ -70,6 +70,15 @@ public class CronJobLifecycleService { run.setDeliveryStatus("NONE"); runMapper.insert(run); + // Self-heal the parent conversation row before saving messages. + // saveMessage only inserts message rows; if the conversation row is + // missing (e.g. tasks_ seed never ran on this DB, or was + // deleted manually) the messages become orphans the sidebar cannot + // surface. getOrCreateSharedConversation makes the row land with + // username=system so every workspace member sees it. + conversationService.getOrCreateSharedConversation( + conversationId, job.getAgentId(), job.getWorkspaceId()); + // Cron-run header (system role) so users browsing the unified // tasks_ conversation can tell which job's run starts here. // Renderable as a divider card on the frontend; LLM history reads