feat: route cron output via reviewer bot in paired rooms
In paired rooms, cron output was posted by the owner bot. Since the owner can't respond to its own messages, the cron report just sat there with no follow-up action. Now cron output in paired rooms is posted via the reviewer bot. The owner picks it up as a peer request, analyzes the report, and acts on it (e.g., fixing Sentry errors). The normal paired review loop then kicks in to verify the fix.
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
deleteTask,
|
||||
getDueTasks,
|
||||
getTaskById,
|
||||
isPairedRoomJid,
|
||||
logTaskRun,
|
||||
updateTask,
|
||||
updateTaskAfterRun,
|
||||
@@ -161,6 +162,8 @@ export interface SchedulerDependencies {
|
||||
ipcDir: string,
|
||||
) => void;
|
||||
sendMessage: (jid: string, text: string) => Promise<void>;
|
||||
/** Send a message via the reviewer bot identity so the owner treats it as a peer request. */
|
||||
sendMessageViaReviewerBot?: (jid: string, text: string) => Promise<void>;
|
||||
sendTrackedMessage?: (jid: string, text: string) => Promise<string | null>;
|
||||
editTrackedMessage?: (
|
||||
jid: string,
|
||||
@@ -402,7 +405,13 @@ async function runTask(
|
||||
const outputText = getAgentOutputText(streamedOutput);
|
||||
if (outputText) {
|
||||
attemptResult = outputText;
|
||||
await deps.sendMessage(task.chat_jid, outputText);
|
||||
// In paired rooms, post cron output via reviewer bot so the
|
||||
// owner treats it as a peer request and acts on it.
|
||||
const send =
|
||||
isPairedRoomJid(task.chat_jid) && deps.sendMessageViaReviewerBot
|
||||
? deps.sendMessageViaReviewerBot
|
||||
: deps.sendMessage;
|
||||
await send(task.chat_jid, outputText);
|
||||
}
|
||||
|
||||
if (streamedOutput.status === 'error') {
|
||||
|
||||
Reference in New Issue
Block a user