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:
Eyejoker
2026-03-30 01:32:06 +09:00
parent d024b763f0
commit ab2680ba11
2 changed files with 27 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import {
DATA_DIR,
IDLE_TIMEOUT,
POLL_INTERVAL,
REVIEWER_AGENT_TYPE,
SERVICE_ID,
SERVICE_AGENT_TYPE,
isSessionCommandSenderAllowed,
@@ -46,6 +47,7 @@ import { resolveGroupFolderPath, resolveGroupIpcPath } from './group-folder.js';
import { startIpcWatcher } from './ipc.js';
import {
findChannel,
findChannelByName,
formatOutbound,
normalizeMessageForDedupe,
} from './router.js';
@@ -437,6 +439,15 @@ async function main(): Promise<void> {
}
// Start subsystems (independently of connection handler)
// Resolve the reviewer channel so cron output in paired rooms is posted
// via the reviewer bot — the owner then treats it as a peer request.
const reviewerChannelName =
REVIEWER_AGENT_TYPE === 'claude-code' ? 'discord' : 'discord-review';
const reviewerChannelForCron = findChannelByName(
channels,
reviewerChannelName,
);
startSchedulerLoop({
registeredGroups: () => registeredGroups,
getSessions: () => sessions,
@@ -445,6 +456,12 @@ async function main(): Promise<void> {
queue.registerProcess(groupJid, proc, processName, ipcDir),
sendMessage: (jid, rawText) =>
sendFormattedChannelMessage(channels, jid, rawText),
sendMessageViaReviewerBot: reviewerChannelForCron
? async (jid, rawText) => {
const text = formatOutbound(rawText);
if (text) await reviewerChannelForCron.sendMessage(jid, text);
}
: undefined,
sendTrackedMessage: (jid, rawText) =>
sendFormattedTrackedChannelMessage(channels, jid, rawText),
editTrackedMessage: (jid, messageId, rawText) =>