feat: let the owner skip review for change-free explanation answers

The owner may end a TASK_DONE answer with "리뷰 불필요: <reason>". The
host treats it as a request and honors it only when every guard holds:

- workspace content equals the task base (hasCodeChangesSinceRef), the
  working tree is clean, and HEAD did not move during the owner run
- the run used no file-mutating tool (Edit/Write/MultiEdit/NotebookEdit),
  no subagent (Agent/Task) and no state-changing or unknown MCP tool
- every Bash command is classified read-only by a conservative
  quote-aware classifier (src/bash-command-classifier.ts); anything
  unknown counts as mutating
- tool usage was reported and not truncated (agent-runner now reports
  tool names and Bash commands as toolUsage on its terminal output)
- the user did not ask for a review in this task

When honored the task completes as review_skipped with no reviewer or
finalize turn; the answer is delivered with the marker line removed and a
small "-# 검토 생략 …" note. Otherwise the marker is stripped and the
normal review runs. A bare "검토해줘"-style message right after a
review-skipped answer reopens that task for the reviewer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-10-01 20:36:53 +09:00
parent c858b6e446
commit 7f54c47e64
22 changed files with 2323 additions and 14 deletions

View File

@@ -37,6 +37,7 @@ import {
} from './token-refresh.js';
import { findChannel, formatMessages } from './router.js';
import { stopRoomWorkIfRequested, type RoomStopResult } from './room-stop.js';
import { reopenReviewSkippedTaskForReview } from './review-request-gate.js';
import { createScopedLogger, logger } from './logger.js';
import type { GroupQueue, GroupRunContext } from './group-queue.js';
import type {
@@ -293,6 +294,15 @@ async function processMissedMessages(
return true;
}
const reviewRequestOutcome = await runReviewRequestGate(
args,
runtime,
missedMessages,
);
if (reviewRequestOutcome !== null) {
return reviewRequestOutcome;
}
const reloginOutcome = await runReloginRequiredGate(
args,
runtime,
@@ -447,6 +457,50 @@ async function runReloginRequiredGate(
return true;
}
/**
* "검토해줘" right after an answer whose review was skipped: run the reviewer
* on that answer (the task is reopened) instead of starting a new owner turn.
* Returns null when the message is not such a request.
*/
async function runReviewRequestGate(
args: ProcessGroupMessagesDeps,
runtime: RuntimeContext,
missedMessages: NewMessage[],
): Promise<boolean | null> {
const task = reopenReviewSkippedTaskForReview({
chatJid: runtime.chatJid,
messages: missedMessages,
});
if (!task) return null;
const lastMessage = missedMessages[missedMessages.length - 1];
if (lastMessage?.seq != null) {
advanceLastAgentCursor(
args.getLastAgentTimestamps(),
args.saveState,
runtime.chatJid,
lastMessage.seq,
);
}
const outcome = await runPendingPairedTurnIfNeeded({
chatJid: runtime.chatJid,
group: runtime.group,
runId: runtime.runId,
log: runtime.log,
timezone: args.timezone,
task,
rawMissedMessages: [],
saveState: args.saveState,
lastAgentTimestamps: args.getLastAgentTimestamps(),
executeTurn: args.executeTurn,
getFixedRoleChannelName,
roleToChannel: runtime.roleToChannel,
labelPairedSenders: args.labelPairedSenders,
mode: 'idle',
});
return outcome ?? true;
}
/**
* A stop request that reaches a queued run without having been handled by the
* message loop (e.g. it was pending across a restart) still stops the room's